diff --git a/Engine/lib/collada/src/dae/daeRawResolver.cpp b/Engine/lib/collada/src/dae/daeRawResolver.cpp index f297a36f4..b1ee18577 100644 --- a/Engine/lib/collada/src/dae/daeRawResolver.cpp +++ b/Engine/lib/collada/src/dae/daeRawResolver.cpp @@ -57,8 +57,11 @@ daeElement* daeRawResolver::resolveElement(const daeURI& uri) { daeElement *accessor; accessor = uri.getContainer(); - if ( accessor == NULL ) - return NULL; + if (accessor == NULL) + { + fclose(rawFile); + return NULL; + } src = accessor->getParentElement()->getParentElement(); daeElementRefArray children; accessor->getChildren( children ); diff --git a/Engine/lib/lmng/CHANGES b/Engine/lib/lmng/CHANGES deleted file mode 100644 index eeacf3324..000000000 --- a/Engine/lib/lmng/CHANGES +++ /dev/null @@ -1,1447 +0,0 @@ ------------------------------------------------------------ - -1.0.10 (Jul 13th 2007) ----------------------- - -in short: - -intermediate CVS - -------------------- - -bugfixes: - -core: -- fixed some compiler-warnings -- fixed display routines called twice for FULL_MNG support in mozlibmngconf.h -- standard windows dll upgraded to zlib 1.2.3 -- fixed problem with CLON object during readdisplay() (thanks Winfried!) -- added typecast to appease the compiler (G R-P) -- added more SKIPCHUNK conditionals (G R-P) -- added MORE MNG_NO_1_2_4BIT_SUPPORT (G R-P) -- added provisional support for anIM(mpNG) proposal -- added provisional support for ANG proposal - -samples: -- xmngview upgraded to 0.6 (thanks Winfried!) - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.9 (jan 30th 2005) ---------------------- - -in short: - -New optimizations save over 20KB on footprint. -Also a few bugfixes and several patches. - -Thanks to those sending in their additions and for testing! - -To turn on the optimizations do: - -#DEFINE MNG_OPTIMIZE_CHUNKINITFREE -#DEFINE MNG_OPTIMIZE_OBJCLEANUP -#DEFINE MNG_OPTIMIZE_CHUNKASSIGN -#DEFINE MNG_OPTIMIZE_CHUNKREADER - -(eg. they're not on by default (yet) !) - -------------------- - -bugfixes: -- fixed chunk pushing mechanism -- fixed bug in writing sBIT for indexed color -- fixed PPLT getchunk/putchunk routines -- fixed MNG_NO_1_2_4BIT_SUPPORT for TBBN1G04.PNG -- cleaned up macro-invocations (thanks to D. Airlie) - -core: -- added more SKIPCHUNK conditionals -- replaced MNG_TWEAK_LARGE_FILES with permanent solution -- improved handling of cheap transparency when 16-bit support is disabled -- added some MNG_SUPPORT_WRITE conditionals -- added function to retrieve current FRAM delay -- added MNG_NO_1_2_4BIT_SUPPORT -- added bgr565_a8 canvas-style (thanks to J. Elvander) -- standard windows dll upgraded to zlib 1.2.2 -- added LITTLEENDIAN/BIGENDIAN fixtures (thanks J.Stiles) -- inclusion of zlib/lcms/ijgsrc6b with <> instead of "" -- added conditional MNG_OPTIMIZE_CHUNKINITFREE -- added conditional MNG_OPTIMIZE_OBJCLEANUP -- added conditional MNG_OPTIMIZE_CHUNKASSIGN -- added conditional MNG_OPTIMIZE_CHUNKREADER -- fixed problem with global PLTE/tRNS - -samples: - -contrib: - -doc: -- patched jng & mng manual pages (Thanks Peter Breitenlohner) - -makefiles: - -autoconf: -- patched makefile.am & configure.in (Thanks Peter Breitenlohner) - ------------------------------------------------------------ - -1.0.8 (aug 5th 2004) --------------------- - -in short: - -added special data-pushing mechanisms and a few other tid-bits - -------------------- - -bugfixes: -- fixed problem with PAST usage where source > dest - -core: -- added missing get-/put-chunk-jdaa -- added CRC existence & checking flags -- added data-push mechanisms for specialized decoders -- some speed optimizations (thanks to John Stiles) -- defend against using undefined closestream function -- defend against using undefined openstream function -- added check for extreme chunk-lengths -- change worst-case iAlphadepth to 1 for standalone PNGs -- added support for 3+byte pixelsize for JPEG's -- added conditional to allow easier writing of large MNG's - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.7 (March 21st 2004) ------------------------ - -in short: - -A bunch of new canvas-styles, some bug-fixes, upgraded to latest zlib/lcms -and yet more work to please the Mozilla crowd. -Releasing beta's doesn't seem very responsive, and this one's hardly changed -much anyway. I just wanted to bump to a regular version for Mozilla -re-integration. - -------------------- - -bugfixes: -- fixed inclusion of IJNG chunk for non-JNG use (J.S) -- fixed bug in chunk-storage of SHOW chunk (where from == to) -- fixed bug in promote_g8_g8 with 16bit support off - -core: -- added CANVAS_RGB565 and CANVAS_BGR565 (big thanx to Raphael Assenat!!) -- added CANVAS_RGBA565 and CANVAS_BGRA565 ( -- ditto -- ) -- upgraded to zlib 1.2.1 -- upgraded to lcms 1.11 -- added premultiplied alpha canvas' for RGBA, ARGB, ABGR (thx to John Stiles) -- more optimizations with 16bit support off -- put conditionals around openstream/closestream callbacks. -- fixed typo (MNG_SKIPCHUNK_SAVE -> MNG_SKIPCHUNK_nEED) -- fixed some 64-bit platform compiler warnings - -samples: - -contrib: -- fixed mngtree sample (Raphael) -- added 5-6-5 canvas to SDL sample (Raphael) - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.6 (oct 19th 2003) ---------------------- - -in short: - -Final release from beta1. No feedback is good feedback I presume, -so here's 1.0.6-final! - - -------------------- - -bugfixes: - -core: - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.6-beta1 (sep 14th 2003) ---------------------------- - -in short: - -further footprint-reductions -removing email-addresses - -1.0.6 (final) will be out shortly - -------------------- - -bugfixes: - -core: -- added support for reducing the footprint of libmng by macros that optionally - skip unused chunks, remove 16-bit sample support, remove Delta support, and - remove JNG support, to accomodate Mozilla/Firebird. -- further optional removal of unused functions -- added MNG_NO_SUPPORT_FUNCQUERY conditional -- added iPNGdepth member to pData structure -- added conditionals around MAGN chunk support -- added conditionals around non-VLC chunk support -- added conditionals around "mng_display_go*" and other unused functions -- added more conditionals around "promote" functions -- removed email references as appropriate - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.6-alpha1 (aug 2nd 2003) ---------------------------- - -in short: - -This is mostly in the light of footprint-reduction to please the Mozilla -crew with a leaner and meaner libmng. See bug 18574 if you're interested: -http://bugzilla.mozilla.org/show_bug.cgi?id=18574 - -------------------- - -bugfixes: -- B719420 - fixed several MNG_APP_CMS problems - -core: -- removed some compiler-warnings -- hiding 12-bit JPEG stuff -- fixed problem with infinite loops during readdisplay() -- added size-optimiation COMPOSE routine usage -- added conditionals around canvas update routines -- added MNG_SKIPCHUNK_cHNK footprint optimizations -- added conditionals around some JNG-supporting code -- added conditionals around 16-bit supporting code -- combined init functions into one function -- replaced nested switches with simple init setup function -- added conditionals zlib and jpeg property accessors -- added size-optimization DIV255B8 routine usage -- added conditionals around 8-bit magn routines -- removed conditionals around 8-bit magn routines -- added MNG_NO_16BIT_SUPPORT and MNG_NO_DELTA_PNG conditionals -- reversed many loops to use decrementing counter -- converted some switches to array references -- removed some redundant checks for iRawlen==0 -- optionally use zlib's crc32 function instead of local mng_update_crc -- bugfix empty "if" statement when 16-bit code is enabled -- restored two misplaced #else/#endif blocks -- added conditionals around "mng_display_go*" and other unused functions -- added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional -- fixed duplicate for-loop -- fixed invalid test in promote_imageobject -- added conditionals around PAST chunk support -- fixed "FOOTPRINT_COMPOSEIV" typo (now "FOOTPRINT_DIV") - -samples: - -contrib: -- updated xmngview -- added MSVC project for creating delta-MNGs: makemng (thanks Alex!) -- added MSVC lib-file for use with the standard libmng.dll (again thanks Alex) - -doc: -- updated readme.contrib - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5 (mar 1st 2003) --------------------- - -in short: - -Only a small fix for progressive jpeg suspension problem. - -This is the long-awaited final release containing the new 'dynamic MNG' feature -and bringing MNG compliance to near 100%! - -------------------- - -bugfixes: -- B683152 - libjpeg suspension not always honored correctly - -core: - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-rc3 (jan 20th 2003) -------------------------- - -in short: - -Third release-candidate for the upcoming 1.0.5 version. - -Minor bug-fixes and finalizing the accepted proposal (by official vote) for -the TERM/frame_delay changes on mng-list (nov-dec/2002). - -------------------- - -bugfixes: -- B654627 - fixed SEGV when no gettickcount callback (thanks Adam!) -- B664383 - fixed typo (thanks Dimitri) -- B664911 - fixed buffer overflow during init (thanks Alex!) - -core: -- finalized changes in TERM/final_delay to elected proposal (positive vote) - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-rc2 (dec 9th 2002) ------------------------- - -in short: - -Second release-candidate for the upcoming 1.0.5 version. -This contains fixes for a few minor details reported by the loyal testers. -It fixes some issues with the goframe/golayer/gotime processing and related -stuff. And it adds a way to disable playback-caching from within the MNG, -which is very useful for streaming-MNG encoders (such as gserver!). - -------------------- - -bugfixes: - -core: -- fixed layer- & frame-counting during read() -- changed FRAMECOUNT/LAYERCOUNT/PLAYTIME error to warning -- fixed goframe/golayer/gotime processing -- added support for nEED "MNG 1.1" -- added support for nEED "CACHEOFF"; turn playback caching off for streaming MNG -- fixed magnification bug with object 0 -- added support to get totals for frames/layers/playtime after mng_read() -- fixed some issues in init_app_cms() -- fixed goxxxxx() support for zero values - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-rc1 (nov 1st 2002) ------------------------- - -in short: - -First release-candidate for the upcoming 1.0.5 version. -This fixes a few small problems and brings the TERM/MEND processing, with -respect to interframe_delay as per the current discussion on MNG-list, -up-to-date with the latest proposal. - -------------------- - -bugfixes: - -core: -- fixed initialization of pIds in dISC read routine (Thanks Winfried!) -- fixed issue in freeing evNT chunk (Thanks Winfried!) -- fixed clipping-problem with BACK tiling (Thanks Sakura!) -- fixed processing for multiple objects in MAGN (Thanks Sakura!) -- fixed display of visible target of PAST operation (Thanks Sakura!) -- modified TERM/MEND processing for max(1, TERM_delay, interframe_delay) - -samples: - -contrib: -- fixed typo in Makefile for gtk-mng-view sample - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-b3 (oct 15th 2002) ------------------------- - -in short: - -Fairly quick after beta2, since that introduced a couple of unfortunate -booboo's and wasn't very workable. It also changes the standard configure -script to build a standard shared object similar to what I intended. - -------------------- - -bugfixes: - -core: -- fixed support for condition=2 in TERM chunk -- fixed trace-constants for PAST chunk -- added mng_status_dynamic to supports function - -samples: - -contrib: - -doc: -- small cosmetic changes in man/libmng.3 - -makefiles: - -autoconf: -- fixed configure.in to build a 'standard' SO primarily - ------------------------------------------------------------ - -1.0.5-b2 (oct 9th 2002) ------------------------- - -in short: - -Second beta for next 1.0.5 release. This addresses some minor problems -detected during testing. It adds the proposed change to the MNG spec as -discussed on the "mng-list" recently; eg. Adam's option 4. -And it adds a little function to check at run-time if the lib is a beta or not. - -------------------- - -bugfixes: - -core: -- fixed chunk-storage for evNT chunk -- fixed dropping mix of frozen/unfrozen objects -- fixed problem with cloned objects marked as invalid -- fixed problem cloning frozen object_buffers -- fixed DISC support -- added proposed change in handling of TERM- & interframe-delay -- added another fix for misplaced TERM chunk -- added check for TERM placement during create/write -- completed support for condition=2 in TERM chunk -- added beta version function & constant - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-b1 (sep 24th 2002) ------------------------- - -in short: - -First beta of a large maintenance release. This completes support of the MNG -specification to nearly 100% (PAST, PROM, delta-images, BACK image+tile). -It adds "dynamic" MNG and a few other neat routines as well as fixes several -bugs reported through SourceForge or to me directly. - -------------------- - -bugfixes: -- B575832 - library has wrong patch version number -- B578572 - remove in 1.0.0! -- B578940 - some functions not implemented -- B581625 - large chunks fail with suspension reads -- B597134 - libmng pollutes the linker namespace - -core: -- added sanity check for improbable chunklengths -- removed eMNGma hack (thanks Dimitri!) -- unimplemented functions return an errorcode now -- added test-option for PNG filter method 192 (= levelling) -- added test-option for PNG filter method 193 (= no filtering) - (both are conditional and only for testing purposes!!!) -- completed PROM support -- completed delta-image support -- completed MAGN support (16-bit functions) -- added HLAPI function to copy a chunk from a read MNG to a newly created MNG -- added option for soft-handling of errors (only for repair software!!!) -- fixed some routine inclusion/exclusion for undefined conditionals -- pre-fixed all internal routines with mng_ -- added symbol MNG_LOCAL (= static) to really local functions -- fixed reading of FRAM with just frame_mode and name -- fixed read/write of MAGN chunk -- added event handling for dynamic MNG -- added 'supports' call to check function availability -- fixed copyright notice in the headers of all libmng modules -- fixed LOOP iteration=0 special case -- re-compiled standard Windows dll with lcms-1.0.9 -- added warning for too much IDAT data -- warnings are ignored by default now -- misplaced TERM is now treated as warning -- fixed color-correction for restore-background handling -- optimized restore-background for bKGD cases -- cleaned up some old stuff -- completed support for BACK image & tiling -- completed support for PAST -- added bgrx8 canvas (filler byte) -- fixed reset_object_detail to clear old buffer -- added in-memory color-correction of abstract images -- added compose over/under routines for PAST processing -- added flip & tile routines for PAST processing - -samples: -- Added new BCB sample for fixing invalid JASC Animation Shop files - (shows new copy_chunks function; use of MNG_SOFTERRORS & static linking) - -contrib: -- added xmngview by Winfried Szukalski (Vielen dank!) -- Updated the Delphi mngview sample to handle dynamic MNGs -- Added Kylix example (simplified port of the Delphi mngview sample) - -doc: -- added diff to add MNG&JNG to a systems 'magic' file (Thanks Winfried) -- fixed docs about using mng_display_resume after display_reset - (should read to use mng_display!) - -makefiles: -- added makefile to build a libmng.dll for MingW - (makefile.mingwdll - thanks to Frank Richter!) - -autoconf: -- fixing libtool version-number to be in line with what it should be - ------------------------------------------------------------ - -1.0.4 (Jun 23rd 2002) ---------------------- - -in short: - -Just some small fixes -Standard dll now compiled with zlib 1.1.4 and lcms 1.0.8 - -------------------- - -bugfixes: -- B495442 - invalid returnvalue in mng_get_suspensionmode -- B495443 - incorrect suspend check in read_databuffer -- B526138 - returned IJGSRC6B calling convention to default for MSVC -- B558212 - off by one error -- B557677 - can't find lcms.h - -core: -- fixed possible compile-problem in cleanup_rowproc -- MNG subimage alpha composite wrong for rgba8 images - -samples: - -contrib: - -doc: - -makefiles: -- fixed check for lcms.h in configure.in - -autoconf: - ------------------------------------------------------------ - -1.0.3 (Sep 18th 2001) ---------------------- - -in short: - -Small cosmetic changes. Cleaning up the contributions. -New makefile for mingw32, and new fbcon example. -Major thanks to Greg for helping out with the *nix stuff! -Note that there's also a separate download for ASM programmers now. -Check http://www.libmng.com for details (download/ports&packages page). - -It may be a while for the next release. I'm "off duty" for the next 8 or -so months... - -Gerard - -------------------- - -bugfixes: -- B459058 - wrong include for lcms headers - -core: -- changed inclusion of lcms.h header for Linux platforms (suggested by Greg) -- added get function for last processed BACK chunk - -samples: -- replaced the gtk & sdl viewer apps with updates by Greg Roelofs - -contrib: - -doc: - -makefiles: -- changed makefile.linux & makefile.unix as suggested by Greg Roelofs - (makefile.linux now compiles with lcms by default) -- added makefile.mingw for mingw32 by Benoit Blanchon (thanks Mate!) - -autoconf: - ------------------------------------------------------------ - -1.0.2 (Jul 7th 2001) --------------------- - -in short: - -Another maintenance release with a few added extra's. - -------------------- - -bugfixes: -- B421427 - writes wrong format in bKGD and tRNS -- B434583 - compiler-warning if MNG_STORE_CHUNKS undefined - -core: -- added optimization option for MNG-video playback -- added processterm callback -- added late binding errorcode (not used internally) -- fixed memory-leak with delta-images (Thanks Michael!) -- added option to turn off progressive refresh for large images - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.1 (May 2nd 2001) --------------------- - -in short: - -Maintenance release. -Fixed several memory-leaks with the help of Gregg Kelly, added/fixed some CMS -handling, exported JPEG functions from standard DLL, and some other minor fixes. - -The CMS fix now makes libmng automagically work in MNG_FULL_CMS mode as a -sRGB compliant system. YOU WILL NEED TO CHANGE THIS IF YOU ARE NOT ON AN sRGB -COMPLIANT SYSTEM AND WANT TO USE CMS!!!! -(look in libmng.h for the proper function-calls) - -------------------- - -bugfixes: - -core: -- added MEND processing callback -- fixed first FRAM_MODE=4 timing problem -- added handle status-copy function (use with care) -- exported JPEG functions from standard DLL -- added BGRA8 canvas with premultiplied alpha (contrib by Gregg Kelly) -- fixed problem with display_reset/display_resume (Thanks Gregg!) -- fixed several memory-leaks (Thanks Gregg!) -- fixed reset_rundata to drop all objects (Thanks again, Gregg!) -- fixed problem with cms profile being created multiple times when both - iCCP & cHRM/gAMA are present (And again... Gregg) -- moved mng_clear_cms to libmng_cms -- added "default" sRGB generation (Thanks Marti!) - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.0 (Feb 6th 2001) --------------------- - -in short: - -First public release. Finally(!) - -This is the 0.9.5 CVS version, which will never be released, because I feel it -is now ready for a public release. So apart from the version-numbers here and -there, all other changes are listed under 0.9.5. - -This library will work with every MNG/JNG known and available to me. Note that -there are still parts that need to be coded, and that MNG support is around -90-95% (JNG at 100%). It is however compliant with the latest and greatest -MNG 1.0 specification. - -I hope to dedicate a bit more time this year to finish up full support and fill -in the remaining blanks. But this is coming out of my spare time. And extra -help is always appreciated. - -Please enjoy! - -Gerard - ------------------------------------------------------------ - -0.9.5 (no release) ------------------- - -in short: - -intermediate CVS - -------------------- - -bugfixes: -B129681 - fixed compiler warnings SGI/Irix (thanks Dimitri) - -core: -- fixed compiler-warnings Mozilla (thanks Tim) -- fixed timing-problem with switching framing_modes -- fixed some small compiler warnings (thanks Nikki) - -samples: - -contrib: -- fixed library-paths for MSVC DLL project (thanks Chad) - -doc: - -makefiles: -- added makefile for DJGPP (thanks Silvio) - -autoconf: - ------------------------------------------------------------ - -0.9.4 (Jan 19th 2001) ----------------------- - -in short: - -Now that the MNG spec is at 1.0, this should be the last beta. There's a few -small changes to make it inline with the spec, and a couple of bug-fixes. -This is a serious release-candidate for libmng-1.0!! -Please... test test test test!! - -------------------- - -bugfixes: -B123314 - fixed number of TERM related problems -B123322 - fixed unwanted repetition in mng_readdisplay() -B123443 - fixed by Ralph -B124910 - fixed definition for WIN32_LEAN_AND_MEAN (thanks Chad) -B125750 - fixed by Ralph -B125756 - fixed mixup of data- & function-pointers (thanks Dimitri) -B127517 - changed inclusion of the lcms header file for non-windows platforms - -core: -- version numbers -- fixed possible loop in display_resume() (Thanks Vova!) -- fixed unwanted repetition in mng_readdisplay() -- changed inclusion of the lcms header file for non-windows platforms -- changed IHDR filter_method check for PNGs -- moved restore of object 0 to libmng_display -- added restore of object 0 to TERM processing (B123314) -- fixed TERM delay processing (B123314) -- fixed TERM end processing when count = 0 (B123314) -- changed callback convention for MSVC (Thanks Chad) -- fixed mixup of data- & function-pointers (thanks Dimitri) -- added support for "nEED MNG-1.0" -- added errorcode for MAGN methods -- added errorchecking for MAGN methods -- removed "old" MAGN methods 3 & 4 -- added "new" MAGN methods 3, 4 & 5 -- removed test filter-methods 1 & 65 -- set default level-set for filtertype=64 to all zeroes - -samples: - -contrib: -- added GTK mng-view example by Vova Babin -- added MSVC MNGview sample by Nikolaus Brennig -- updated Jason Summer's mngplg to version 0.9.2 - (that's mngplg-0.9.2 based on libmng-0.9.3 !!!) -- rearranged contrib directory slightly -- added MSVC project to build libmng.dll by Chad Austin - -doc: -- added README.dll -- added README.config - -makefiles: -- added a makefile for MS Visual C++ (Thanks to Atsushi Matsuda) - -autoconf: -- fixed configure.in for lcms (FreeBSD port by Mikhail Teterin) -- by default configure includes CMS support if lcms is present - ------------------------------------------------------------ - -0.9.3 (October 29th 2000) -------------------------- - -in short: - -Another beta release. The number of changes in the MNG specification have -resulted in a lot of new code and some changed code. At the same time I saw -no need to withhold some new functionality as it was pretty clear there was -going to be another beta-round. If things go well, I'm going to try to release -libmng 1.0.0 very shortly after this one. - -Many thanks to a lot of people for helping out, sending contributions, making -suggestions and testing this little baby. This would get nowhere without YOU!!! - -- fixed bug 111300/117103 -- added workaround for faulty PhotoShop iCCP chunk -- added MAGN/JDAA chunks -- added support for new filter_types -- added PNG/MNG spec version indicators -- added BCB mngview contribution by Andy Protano -- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano) -- implemented support for nEED "draft nn" -- implemented app-defined support for bKGD for PNG images -- removed trace-options from default SO/DLL builds (!!!) -- raised initial maximum canvas size to 10000x10000 (!!!) - (an App that wants to protect from overly large images should call - mng_set_maxcanvassize() with appropriate values) -- fixed other assorted stuff - -------------------- - -bugfixes: -B111300 - fixup for improved portability -B117103 - fixed compilation errors on *nix with lcms (thanks Ralph!) - -core: -- fixed compiler-warnings from Mozilla -- added check for simplicity-bits in MHDR -- added workaround for faulty PhotoShop iCCP chunk -- fixed app-supplied background restore -- fixed TERM processing delay of 0 msecs -- fixed write-code for zTXt & iTXt -- fixed read-code for iTXt -- added MAGN chunk -- fixed sRGB precedence for gamma_only corection -- added support for new filter_types -- fixed problem with no refresh after TERM -- fixed DEFI behavior -- fixed inclusion parameters to make the external libs work together -- added export of zlib functions from windows dll -- fixed timing & refresh behavior for single PNG/JNG -- removed trace-options from default SO/DLL builds (!!!) -- fixed MAGN rounding errors (thanks Matthias!) -- fixed small timing problem when FRAM delay = 0 -- fixed simplicity-check in compliance with draft 81/0.98a -- fixed alpha-blending for all alpha-canvasstyles -- added support for alpha-depth prediction -- fixed processing of unknown critical chunks -- removed test-MaGN -- added PNG/MNG spec version indicators -- implemented support for nEED -- added support for JDAA -- added functions to retrieve PNG/JNG specific header-info -- added optional support for bKGD for PNG images -- raised initial maximum canvas size to 10000x10000 -- added support for delta-JNG -- added callback to process non-critical unknown chunks -- fixed support for delta-images during read() / display() -- added closestream() processing for mng_cleanup() -- fixed delta-processing behavior -- added storage for pixel-/alpha-sampledepth for delta's -- implemented delayed delta-processing -- fixed putchunk_plte() to set bEmpty parameter (thanks Ben!) -- added errorcode for delayed delta-processing -- added get/set for bKGD preference setting -- added get function for interlace/progressive display -- fixed bug in empty PLTE handling -- fixed seperate read() & display() processing -- fixed tRNS processing for gray-image < 8-bits - -samples: -- added BCB mngview contribution by Andy Protano - -contrib: -- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano) - -doc: -- updated RPM spec-file by MATSUURA Takanori -- updated README.contrib - -makefiles: -- fixed some stuff in automake/autoconf/libtool -- fixed auto* for bug B117103 - ------------------------------------------------------------ - -0.9.2 (August 7th 2000) ------------------------ - -in short: - -Third beta release! Last one??? - -!!IMPORTANT!! All file-names are now prefixed with "libmng_" !!IMPORTANT!! - -Many thanks to Albert Chin-A-Young for his contribution of the -autoconf/automake/libtool stuff and to Ralph Giles for helping me -put it in the right places. - -There's a special README.autoconf so please read it! - -- fixed bug 110320/110546/110547/111096 -- added several status retrieval functions -- fixed other small bugs in display processing -- fixed number of small problems and documentation typos -- added autoconf/automake/libtool -- added latest MNG plugin (0.9.0) by Jason Summers - -------------------- - -bugfixes: -B110320 - fixed GCC warning about mix-sized pointer math -B110546 - fixed for improperly returning UNEXPECTEDEOF -B110547 - fixed bug in interlace code -B111096 - fixed large-buffer read-suspension - -core: -- version numbers -- fixed small bugs in display processing -- removed Nextbackxxx fields (no longer used) -- fixed problem with trace-functions improperly wrapped -- put specific code in add_chunk() inside MNG_SUPPORT_WRITE wrapper -- fixed documentation typos -- fixed wrapping of suspension parameters -- added status_xxxx functions -- added trace-codes/-strings for status_xxxxx functions -- changed file-prefixes -- added function to set simplicity field -- added trace-code/-string for updatemngsimplicity -- fixed putchunk_unknown() function - -samples: - -contrib: -- added latest MNG plugin (0.9.0) by Jason Summers - -doc: -- version numbers -- added autoconf readme -- version numbers in RPM stuff - -makefiles: -- fixed for new file-prefix -- added autoconf/automake/libtool - ------------------------------------------------------------ - -0.9.1 (July 26th 2000) ----------------------- - -in short: - -Second beta release. - -Given the enormous amount of bug-reports (not ;-), this will most likely -be one of the last betas. If things remain upright, the first public release -(1.0.0) is fairly eminent in the weeks to come... - -- added SDL mng player by Ralph Giles to contributions -- fixed timing and added internal buffering for I/O-suspension scenarios -- added get routines for internal display-state variables (frame/layer/playtime) -- changed read-processing for improved I/O-suspension (internal buffering) -- fixed several problems with create- & write-support -- added a load of documentation -- lots of small stuff - -------------------- - -bugfixes: - -core: -- fixed mandatory BACK color to be opaque -- changed mng_display_resume to allow to be called after a suspension - return with MNG_NEEDMOREDATA -- changed comments to indicate modified behavior for timer & suspension breaks -- added variables for go_xxxx processing -- implemented support for freeze/reset/resume & go_xxxx -- added trace-codes/-strings for special display processing -- added variables for improved timing support -- added support for improved timing -- added get routines for internal display variables -- added get/set routines for suspensionmode variable -- added trace-code/-string for get/set suspensionmode -- added trace-codes/-strings for get/set display variables -- added support for improved I/O-suspension -- changed read-processing for improved I/O-suspension -- added trace-code/-string for read_databuffer (I/O-suspension) -- added suspendbuffer constants -- changed EOF processing behavior -- fixed TERM delay processing -- changed pre-draft48 frame_mode=3 to frame_mode=1 -- added callbacks for SAVE/SEEK processing -- added trace-codes/-strings for SAVE/SEEK callbacks -- added variable for NEEDSECTIONWAIT breaks -- added trace-codes/-strings for get/set sectionbreaks -- added NEEDSECTIONWAIT error-code/-string -- added macro + routine to set returncode without calling error callback -- added trace-code/-string for special error routine -- changed default readbuffer size from 1024 to 4200 -- added variable for freeze & reset processing -- fixed storage of images during mng_read() -- fixed support for mng_display() after mng_read() -- added error cleanup processing -- fixed support for mng_display_reset() -- fixed suspension-buffering for 32K+ chunks -- added function to set frame-/layer-count & playtime -- added trace-code/-string for updatemngheader -- added error-code/-string for updatemngheader if not a MNG -- fixed creation-code -- fixed writing of signature -- fixed several chunk-writing routines - -samples: -- fixed the libmng.pas module in line with libmng.h - -contrib: -- added the SDL based mngplay viewer by Ralph Giles - -doc: -- extended the RPM contribution by MATSUURA Takanori -- added libmng.txt, a full description of the library and its usage -- added man-pages for mng(5), jng(5) and libmng(3) - -makefiles: - ------------------------------------------------------------ - -0.9.0 (June 30th 2000) ----------------------- - -in short: - -This is the first beta!!! Yippee!!! - -Thanks to all the people who helped to guide me in the right direction. -You know who you are! - -A special thanks to the guys with early implementations, who stood by and -put up with my whims :-) - -changes over 0.5.3: - -- updated mngplg to 0.4.1 (the latest & greatest) -- changed refresh parameters to 'x,y,width,height' - ------------------------------------------------------------ - -0.5.3 (never released) ----------------------- - -in short: - -This is a working version only; the next release will be 0.9.0 (first Beta!) - -There are a few incompatible changes with previous versions. The userdata -variable has been changed from mng_uint32 to mng_ptr to accomodate 64-bit -systems. For the same reason memory allocation size parameters have been -changed to a mng_size_t type which is a typedef of size_t. - -Thanks to Aleks Jakulin for helping to iron out some 64-bit platform issues! - -- implemented the update-region parameters of the refresh callback -- added support for most common delta-image options -- added an animation-speed modifier -- added an image-level parameter for the processtext callback -- updated mngplg to 0.4.0 (supports JNG, full CMS, and other enhancements!) -- fixed a lot of small things -- added support for PPLT chunk -- fixed to support 64-bit platforms - -------------------- - -bugfixes: - -core: -- added processing of color-info on delta-image -- fixed handling of empty SAVE chunk -- fixed display of stored JNG images -- fixed problem with BASI-IEND as object 0 -- changed the version parameters (obviously) -- added update-region parms for refresh calback -- added Needrefresh parameter -- added initialization of update-region for refresh -- added initialization of Needrefresh parameter -- changed progressive-display processing -- added tracecodes for tracing JPEG progression -- added tracing of JPEG calls -- added Deltaimmediate parm for faster delta-processing -- added extra checks for delta-images -- many changes to support delta-images -- optimized some store_xxx routines -- fixed some small things (as precaution) -- fixed possible trouble if IEND display-processing got broken up -- fixed nasty bug with embedded PNG after delta-image -- added processing of PLTE & tRNS for delta-images -- added processing of PLTE/tRNS & color-info for delta-images in the - ani_objects chain -- fixed problem with color-correction for stored images -- added get/set for speedtype to facilitate testing -- added trace-codes & -strings for get/set speedtype -- added speed-modifier to timing routine -- added get-routine of imagelevel for processtext callback -- added trace-code & -string for get imagelevel -- added administration of imagelevel parameter -- added support for PPLT chunk -- added trace-codes & -strings for PPLT chunk processing -- fixed problem with incorrect gamma-correction -- fixed inclusion of IJG read/write code -- fixed problem with 16-bit GA format -- fixed problem with cheap transparency for 4-bit gray -- fixed display_xxxx routines for interlaced images -- added precaution against faulty iCCP chunks from PS -- changed userdata variable to mng_ptr -- added typedef for mng_size_t -- changed size parameter for memory allocation to mng_size_t -- fixed compiler-warning for non-initialized iB variable -- changed definition for 32-bit ints (64-bit platforms) -- changed definition for mng_handle (64-bit platforms) -- swapped refresh parameters -- fixed initialization routine for new mng_handle type -- added inclusion of stdlib.h for abs() -- fixed some 64-bit warnings -- fixed incompatible return-types - -samples: - -contrib: -- updated mngplg to 0.3.0 (supports JNG & full color-correction!) -- updated mngplg to 0.4.0 (Jason is picking up the pace ;-) - -doc: -- added rpm directory with rpm spec-file (contributed by MATSUURA Takanori) - -makefiles: -- changed makefile.linux to reflect versionnr for shared-lib -- changed makefile.linux to depend on mng_conf.h & mng_types.h - ------------------------------------------------------------ - -0.5.2 (June 10th 2000) ----------------------- - -in short: - -This is the third release for developers -Another milestone since JNG is now fully supported -The next release will most likely be numbered 0.9.0 as the first Beta!! - -Fixed bug 106017 & 106019 -Added many constants regarding chunk-property values -Implemented full JNG support -Added all the error- & trace-strings -Added get/set routines for default ZLIB/IJG parameters -Added a generic makefile for Unix platforms (contributed by Tim Rowley) -Added canvasstyle for separate RGB + A canvas (eg. mozilla-style) -Separated configuration-options into a separate file: "mng_conf.h" -Fixed stuff for generic Unix compilation (contributed by Tim Rowley) -Upgraded to lcms1.0.6 (now supports 16-bit endian-peculiarities) -Added a makefile for Linux ELF & fixed some code-issues to go along with gcc -Added support for suspended input-buffer processing -Implemented the display-routines for RGBA/ARGB/BGRA/ABGR canvasstyles -Implemented the application background-restore functionality -Fixed & tested the mngtree Unix-sample (runs on Linux-RH6.2 with libmng.so) -Upgraded mngplg to v0.2.2 (based on the latest code including JNG) -Fixed a lot of other assorted stuff - -------------------- - -bugfixes: -B003(106017) - fixed problem with being proprietary to BCB -B004(106019) - fixed problem when MNG_SUPPORT_WRITE not defined - -core: -- bumped version-numbers up to 0.5.2 (yeah, really) -- fixed support for IJGSRC6B -- cleaned up some code regarding mixed support-options -- complemented constants for chunk-property values -- fixed MNG_UINT_pHYg value -- implemented JNG support -- fixed problem with DEFI clipping -- added error telltale strings & support -- added trace telltale strings & support -- added support for global color-chunks inside TERM/LOOP -- added support for global PLTE,tRNS,bKGD inside TERM/LOOP -- added default IJG compression parameters and such -- moved init of default zlib parms to "mng_hlapi.c" -- added init of default IJG parms -- added support for get/set of zlib/IJG default parms -- added tracestrings for global animation color-chunks -- added tracestrings for get/set of default ZLIB/IJG parms -- added tracestrings for global PLTE,tRNS,bKGD -- added framenr/layernr/playtime to object header -- added initialization of framenr/layernr/playtime -- changed ani_create calls not returning object pointer -- create ani objects always (not just inside TERM/LOOP) -- fixed inconsistancy with freeing global iCCP profile -- fixed minor bugs 16-bit pixel-handling -- added object promotion routine (PROM handling) -- added trace-codes & -strings for image-object promotion -- added trace-codes & -strings for delta-image processing -- added error-codes & -strings for delta-image processing -- added support for delta-image processing -- added ani-object routines for delta-image processing -- added delta-image fields -- added compression/filter/interlace fields to object-buffer for - delta-image processing -- added delta-image row-processing routines -- fixed up punctuation in several files (contributed by Tim Rowley) -- removed useless definition in "mng_chunks.h" (contributed by Tim Rowley) -- fixed pointer confusion in "mng_display.c" (contributed by Tim Rowley) -- fixed inclusion for memcpy (contributed by Tim Rowley) -- added mng_int32p (contributed by Tim Rowley) -- added internal delta-image processing callbacks -- separated configuration-options into "mng_conf.h" -- changed to most likely configuration -- added RGB8_A8 canvasstyle -- added getalphaline callback for RGB8_A8 canvasstyle -- fixed some makeup for Linux gcc compile -- implemented app bkgd restore routines -- implemented RGBA8, ARGB8, BGRA8 & ABGR8 display routines -- added support for RGB8_A8 canvasstyle -- added support for suspended input-buffer processing -- added mng_read_resume HLAPI function to support read-suspension -- fixed timer-handling to run with Mozilla (Tim Rowley) -- fixed alpha-handling for alpha canvasstyles -- fixed some compilation-warnings (contrib Jason Morris) - -samples: -- fixed mngview(delphi) to work with the new core -- synchronized libmng.pas(delphi) with the new libmng.h header -- removed the error- & trace-strings from libmng.pas(delphi) -- fixed mngtree(Unix) to compile on Linux (runs with libmng.so) -- added makefile.linux for mngtree(Unix) (tested on RedHat6.2) - -contrib: -- updated mngplg to 0.2.2 (based on latest code; supports JNG!) - -doc: -- this file obviously -- added Tim Rowley as contributing author -- changed the examples.readme doc -- updated the design-schematics in line with the current code - -makefiles: -- changed the directory to "makefiles" to avoid name-conflicts -- added generic Unix makefile (thanks to Tim Rowley) -- added Linux ELF makefile (tested on RedHat6.2) - ------------------------------------------------------------ - -0.5.1 May 16th 2000 -------------------- - -in short: - -This is the second release for developers -It's a bit of a milestone since all the chunk functionality is in place and -functioning (read, examine, create & write) -This version is incompatible with 0.5.0 since some of the callback prototypes -have changed (should be the last time that happens!) -There are a few more samples and even a real contribution! - -Fixed bug 105795 & 105797 -Fixed a mis-alignment in animation-timing -Added chunk-access functions -Finished all chunk-storage routine-bits -Finished all chunk-write routines -Changed the callback prototypes to allow error-reporting back to the library -Fixed some routines to allow for callback error-reporting -Added version-control functions & constants -Added two functions to set display- & sRGB-profile from memory -Moved CRC table to dynamic structure (for improved thread-safety) -Added SAVE & SEEK save&restore functionality -Finished the application-based CMS-callbacks -Fixed a few BCB specifics -Changed the Win32 DLL and samples to use __stdcall -Did some more assorted little changes -Added 2 BCB samples -Added 1 Unix sample -Added the MNG plugin by Jason Summers in the contrib section -Changed some documents to reflect these changes - -------------------- - -bugfixes: -B001(105795) - fixed wrong lcms call & memory-leak for gammatables -B002(105797) - fixed problem with missing sRGB profile - -core: -- changed chunk iteration function -- added chunk access functions -- added version control constants & functions -- changed strict-ANSI stuff -- added set_outputprofile2 & set_srgbprofile2 -- added empty-chunk put-routines -- added version_dll & VERSION_DLL (for consistency) -- added version control explanatory text & samples -- added iteratechunk callback definition -- improved definitions for DLL support -- added 8-bit palette definition -- added general array definitions -- added MNG_NULL definition -- changed most callback prototypes to allow the app - to report errors during callback processing -- added CRC table to main structure (for thread-safety) -- added iPLTEentries for checking hIST-length -- changed palette definition to exported palette-type -- removed frozen indicator -- added create/write indicators -- added eMNGma hack (will be removed in 1.0.0 !!!) -- added TERM animation object pointer (easier reference) -- added saved-data structure for SAVE/SEEK processing -- added some errorcodes -- added application errorcodes (used with callbacks) -- moved chunk-access errorcodes to severity 5 -- added chunk-access function trace-codes -- changed trace to macro for callback error-reporting -- added save_state & restore_state trace-codes -- put in some extra comments -- fixed layout for sBIT, PPLT -- changed write callback definition -- fixed layout for PPLT again (missed deltatype ?!?) -- cleaned up left-over teststuff in the BACK chunk routine -- changed CRC initialization to use dynamic structure - (wasn't thread-safe the old way !) -- filled in many missing sequence&length checks -- filled in many missing chunk-store snippets -- added checks for running animations -- filled remaining write routines -- fixed read_pplt with regard to deltatype -- added callback error-reporting support -- added pre-draft48 support (short MHDR, frame_mode, LOOP) -- fixed chunk-storage bit in several routines -- supplemented the SAVE & SEEK display processing -- added init of iPLTEcount -- changed calling-convention definition -- changed status-handling of display-routines -- added versioning-control routines -- filled the write routine -- fixed frame_delay misalignment -- added sanity check for frozen status -- changed display_mend to reset state to initial or SAVE -- added save_state and restore_state for SAVE/SEEK/TERM - processing -- added process_save & process_seek routines -- changed and filled iterate-chunk function -- added getchunk functions -- added putchunk functions -- added empty-chunk put-routines -- filled application-based color-management routines -- added creatememprofile -- filled the deflatedata routine -- added cleanup of saved-data (SAVE/SEEK processing) -- moved the actual write_graphic functionality from mng_hlapi.c - to it's appropriate function in the mng_write.c module -- moved standard header includes into mng_types.h - (stdlib/mem for mem-mngmt & math for fp gamma-calc) -- added getimgdata & putimgdata functions - -samples: -- fixed mngview(delphi) to work with the new core -- synchronized libmng.pas(delphi) with the new libmng.h header -- added mngtree(bcb) sample -- added bogus(bcb) sample -- added mngtree(unix) sample - -contrib: -- added mngplg 0.1.0 / a MNG plugin for Win32 by Jason Summers - -doc: -- added this changes.readme file -- changed the samples.readme doc accordingly -- changed the contrib.readme doc accordingly - ------------------------------------------------------------ - -0.5.0 May 1st 2000 ------------------- - -in short: - -This is the first developers release. -It's roughly about 60% done. diff --git a/Engine/lib/lmng/LICENSE b/Engine/lib/lmng/LICENSE deleted file mode 100644 index 2b624c00a..000000000 --- a/Engine/lib/lmng/LICENSE +++ /dev/null @@ -1,57 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2007 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * Glenn Randers-Pehrson * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * Parts of this software have been adapted from the libpng package. * */ -/* * Although this library supports all features from the PNG specification * */ -/* * (as MNG descends from it) it does not require the libpng package. * */ -/* * It does require the zlib library and optionally the IJG jpeg library, * */ -/* * and/or the "little-cms" library by Marti Maria (depending on the * */ -/* * inclusion of support for JNG and Full-Color-Management respectively. * */ -/* * * */ -/* * This library's function is primarily to read and display MNG * */ -/* * animations. It is not meant as a full-featured image-editing * */ -/* * component! It does however offer creation and editing functionality * */ -/* * at the chunk level. * */ -/* * (future modifications may include some more support for creation * */ -/* * and or editing) * */ -/* * * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/README b/Engine/lib/lmng/README deleted file mode 100644 index a8e67cad5..000000000 --- a/Engine/lib/lmng/README +++ /dev/null @@ -1,36 +0,0 @@ -libmng 1.0.10 -------------- - -Added provisional ANG and anIM support, and made some minor bugfixes. - -libmng 1.0.9 ------------- - -A number of optimizations in the chunk handling and reader/writer code. -This saves over 20KB on binary footprint! - -Also several bugfixes and a couple of patches bring it another step -closer to perfection.... :-) - -See CHANGELOG for details. - - -Y.T. - -Gerard - - -For more information please visit: - -The official libmng web-site: - http://www.libmng.com/ - -Libmng's community on SourceForge: - https://sourceforge.net/project/?group_id=5635 - -The official MNG homepage: - http://www.libpng.org/pub/mng/ - -The official PNG homepage: - http://www.libpng.org/pub/png/ - diff --git a/Engine/lib/lmng/README.autoconf b/Engine/lib/lmng/README.autoconf deleted file mode 100644 index 753f7b4fd..000000000 --- a/Engine/lib/lmng/README.autoconf +++ /dev/null @@ -1,213 +0,0 @@ -********************************************************************** -********************************************************************** - - ***** this is unmaintained ***** - -If you happen to find problems with autoconfiguration and building, -I simply cannot help you. I'm looking for a maintainer that doesn't mind -spending a few minutes every now and then on the next release to make sure -things are still in working order. - -For the moment all autoconf stuff ahs been moved into unmaintained!! - -********************************************************************** -********************************************************************** - - - - -Configuration from CVS -====================== - -If you're using source checked out from CVS, rather than a source -distribution tarball, please be aware that you can use ./autogen.sh in -place of ./configure below. - -Because this is a cross-platform project, the source templates for -the autoconf scripts are sequestered in the 'makefiles' directory. -Running './autogen.sh' will copy them into their conventional places at -the lop level. If you already see the files there, you don't need to -worry about this step. - -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/Engine/lib/lmng/README.config b/Engine/lib/lmng/README.config deleted file mode 100644 index d5cd4541d..000000000 --- a/Engine/lib/lmng/README.config +++ /dev/null @@ -1,104 +0,0 @@ -Configuration options in libmng -=============================== - -The library is fairly configurable through the use of a number of defines. -Please note however that certain defines are for internal use only. -The following list gives a summary of options that can be used externally to -define the functionality of the library: - -======================================== - -#define MNG_BUILD_DLL - -This is used to indicate that a "standard" DLL should result from compiling -the library. Please note the remarks in README.dll if you intend to work -with the library as a DLL. The purpose of this option is to ensure that -DLL builds have the same set of functions. - -#define MNG_BUILD_SO - -This is used to indicate that a "standard" shared library (SO) should result -from a compilation. The purpose of this option is to ensure that all -shared libraries generated this way will have the same set of functions. - -#define MNG_USE_DLL / #define MNG_USE_SO - -These should be used when including the library header in the compilation -of an application to indicate that the compiler/linker must take the -necessary steps to make the binary executable to use the standard DLL -or shared library (SO). - -#define MNG_SKIP_ZLIB / #define MNG_SKIP_LCMS / #define MNG_SKIP_IJG6B - -Use these in conjunction with MNG_USE_DLL / MNG_USE_SO. This is useful if -you only need the external definitions of the MNG library and not the others, -which will speed up the compilation process. - -#define MNG_SUPPORT_FULL / #define MNG_SUPPORT_LC / #define MNG_SUPPORT_VLC - -These can be used to indicate the level of MNG spec compliance required. -Currently only full MNG compliance is supported. - -#define MNG_SUPPORT_IJG6B - -This can be used to indicate if JNG support is required. This option will -include the IJG JPEG-library. Note that MNG_SUPPORT_FULL will automatically -set this option. Use this only if you need JNG support with MNG-(V)LC. - -#define MNG_FULL_CMS / #define MNG_GAMMA_ONLY / #define MNG_NO_CMS / -#define MNG_APP_CMS - -These indicate the color-correction support level of the library. -If you are on a platform that supports lcms (Little CMS by Marti Maria Saguar) -then it is highly recommended to define MNG_FULL_CMS. -If your platform has it's own CMS then select MNG_APP_CMS and be sure to -include the appropriate callbacks in your app. -In all other cases it is recommended to define MNG_GAMMA_ONLY. - -#define MNG_SUPPORT_READ / #define MNG_SUPPORT_WRITE / -#define MNG_SUPPORT_DISPLAY - -These indicate the high-level support for reading, writing and/or -displaying files. Note that in order to display a file, you'll need to read -it first. (yes, really!) - -#define MNG_STORE_CHUNKS - -This indicates that the library should store chunk-information when reading -a file. This information can then be processed through the -MNG_ITERATE_CHUNKS() function. Note that you must specify this option if -you want to create and write a new file. - -#define MNG_ACCESS_CHUNKS - -This is used to indicate that the app may need access to internally stored -chunk information. MNG_STORE_CHUNKS must be defined as well for this option -to function properly. - -#define MNG_INTERNAL_MEMMNGMT - -You can use this to have the library handle it's own memory allocation and -deallocation through the "standard" memory functions. This option is turned -off by default, which means your app must define the memory callbacks. - -#define MNG_ERROR_TELLTALE - -Set this on to allow human-readable error-messages to be included in the -library and the error function and callback. - -#define MNG_BIGENDIAN_SUPPORTED - -This option should be used to indicate the hardware is based on big endian -integers. - -#define MNG_SUPPORT_TRACE / #define MNG_TRACE_TELLTALE - -These two can be used when debugging an app. You'll need to have the trace -callback setup also. This allows for a rather thorough investigation of the -libraries function paths. - -======================================== - -Any other optional defines you may encounter are for internal use only. -please do not specify them externally. In case of doubt, consult the -support email lists. More info can be found on http://www.libmng.com diff --git a/Engine/lib/lmng/README.contrib b/Engine/lib/lmng/README.contrib deleted file mode 100644 index 9b287532a..000000000 --- a/Engine/lib/lmng/README.contrib +++ /dev/null @@ -1,95 +0,0 @@ -The contrib directory contains contributions made by fellow -enthousiasts. (Check respective web-sites for the latest version) - ----------------------------------------------------------------------- - -mngplg - A Netscape plugin for MNG - by Jason Summers - -http://pobox.com/~jason1/imaging/mngplg/ - -The very first contribution, and what a start! -GIF look out, MNG is on the prowl and ready to swat you like a fly! - ----------------------------------------------------------------------- - -mngplay - An SDL based MNG viewer - by Ralph Giles - -http://snow.ashlu.bc.ca/~giles/mng/ - -Another nice contribution. View MNG files on practically any platform -with this standalone viewer. -Source-code only; Requires SDL library and libmng.so - -(Modified by Greg Roelofs) - ----------------------------------------------------------------------- - -mngview - A BCB port of the Delphi sample - by Andy Protano - -I have added this nice little port to the BCB samples directory. -It adds a nifty progressbar while reading a file. Excellent work! -Requires libmng.dll -(note: this is in the BCB samples directory) - ----------------------------------------------------------------------- - -mngdump - A BCB GUI-based dump utility - by Andy Protano - -Andy has sent me this fully functional MNG dump utility, that gives -detailed information of the contents of any MNG file. -Requires libmng.dll - ----------------------------------------------------------------------- - -mng-view - A GTK-based MNG viewer - by Vova Babin - -Vova has been hacking away with the libmng code and has come up with -this nice little sample how to write a MNG viewer using GTK. -Thanks mate! -Source-code only -Requires GTK+ (1.2 or higher) and libmng (0.9.2 or higher) - -(Modified by Greg Roelofs) - ----------------------------------------------------------------------- - -mngview - Another MNG viewer; this one for MSVC - by Nicholaus Brennig - -A welcome contribution from Nicholaus. Author of SlowView. A very nice -image-handling utility for Windows. A welcome contribution since there -have been numerous questions about linking libmng with MSVC. -Well, look no further. Here it is! - ----------------------------------------------------------------------- - -MSVC libmng project - An MSVC project to build libmng.dll - - by Chad Austin - -Chad has contributed some project-files that you could use to build -libmng.dll with MSVC. Please be sure to read the README file included. - ----------------------------------------------------------------------- - -fbmngplay - A simple fbcon based mng player - by Stefan Reinauer - -Stefan has contributed this little example, based on Ralph's -SDL player. It uses the kernel framebuffer device to display mng -animations through the libmng interface. -(currently for 16-bit buffers only) - ----------------------------------------------------------------------- - -xmngview - Lesstif/Motif standalone player for MNG files - - by Winfried Szukalski - -Winfried contributed this MNG player for X-based systems. -(recently updated) - ----------------------------------------------------------------------- - -makemng - A delta-MNG creation utility for MSVC - by Alex Volkov - -Alex sent me this nice utility that will allow you to create highly -optmized MNGs using the delta-PNG capabilities of MNG. - ----------------------------------------------------------------------- diff --git a/Engine/lib/lmng/README.dll b/Engine/lib/lmng/README.dll deleted file mode 100644 index 2f779e81a..000000000 --- a/Engine/lib/lmng/README.dll +++ /dev/null @@ -1,41 +0,0 @@ -Standard Windows DLL -==================== - -The DLL provided in the BCB/win32dll directory is meant as the sole candidate -for distributions, based on libmng.dll, that install the DLL into the public -Windows system-directory. The outline herein defines the requirements to -which such a distribution must comply. If you cannot comply with these -requirements please install the dll in the same directory as your application -and NOT in the Windows system-directory!!! - - -1) Only the DLL already assembled in the libmng distribution may be used for - other distributions! - -2) Only stable public releases are eligible for distribution! A public release - is one where the y-value of the x.y.z version-code is an even number. - Eg. 1.0.0, 1.2.1, 2.4.7, etc. - -3) The installation program MUST store the DLL in the Windows system-directory! - Eg. C:\WinNT\System32, C:\Windows98\System - (Note: InstallShield users can use the variable) - -3) The installation program MUST flag the file as a shared library! - -4) The installation program MUST NOT install the DLL if a newer version - already exists in the Windows system-directory! The standard DLL provided - contains the Windows-default version-numbering system. PLEASE USE IT!! - DO NOT rely on the date or size of the files. - -5) An uninstall procedure MAY NOT remove the DLL if other applications are - still linked to it! Proper handling as a shared library is imperitive. - -6) TEST IT, TEST IT, TEST IT!!! (I just can't stress this enough) - If you don't have enough time, let someone else test it BEFORE you - distribute! - - -The penalty for violating these rules is inclusion of your name in the list -of endangered but useless species (just below the GIF entry!), and on my -blacklist. YOU HAVE BEEN FOREWARNED! - diff --git a/Engine/lib/lmng/README.examples b/Engine/lib/lmng/README.examples deleted file mode 100644 index 1ba94c140..000000000 --- a/Engine/lib/lmng/README.examples +++ /dev/null @@ -1,48 +0,0 @@ -The samples are in platform-specific directories. - -!!! contributions are very welcome !!! - - -bcb - Borland C++ Builder (3.0) (found under bcb/xxx) ------------------------------------------------------ - -win32dll - sample project to create a Windows dll. Requires zlib1.2.1, - IJG jpgsrc6b and lcms1.0.14. The directories containing these - libraries must be at the same level as the libmng directory. - So if you're in the directory with this file and the libmng - sources, they should be in ..\zlib , ..\jpgsrc6b and ..\lcms - respectively. - -!!! To run the other Win32 samples you need to copy the libmng.dll - file from here into the sample's directory !!! - -mngtree - sample project to create a little command-line tool that dumps - the chunk-structure of a given file onto stdout. - -bogus - a completely bogus example on how to create a perfectly valid - (though slightly biased) MNG. - -mngview - port of the Delphi mngview sample. contributed by Andy Protano. - see also README.contrib - -mngrepair- an example on how to fix invalid MNG files - uses the new mng_copy_chunks() function and MNG_SOFTERRORS to - 'ignore' certain input-errors. This conditional *MUST* only be used - for exactly this kind of software; eg. repair utilities. - - -delphi - Borland Delphi (3.0+) (found under contrib/delphi/xxx) ---------------------------------------------------------------- - -mngview - sample project for a simple mng-viewer. The general unit in - the delphi directory was translated from libmng.h It can be - used in other projects to access libmng.dll created with the - win32dll example above. - - -unix - Unix (found under contrib/gcc/xxx) ------------------------------------------ - -mngtree - basically a copy of the BCB sample. It includes a makefile for - Linux and it's been tested on RedHat6.2 - diff --git a/Engine/lib/lmng/README.footprint b/Engine/lib/lmng/README.footprint deleted file mode 100644 index 34dba7f18..000000000 --- a/Engine/lib/lmng/README.footprint +++ /dev/null @@ -1,46 +0,0 @@ -/* - You can use one or more of the following defines to - reduce the size of the compiled library. Define the - SKIPCANVAS macros for any canvas configurations that - your application doesn't use. Define the SKIPCHUNK - macros for any chunks that your application doesn't - process. Define MNG_OPTIMIZE_FOOTPRINT to choose - smaller code size over faster execution and less memory - usage. These macros became available in version 1.0.6. -*/ - -/* eliminate unused features from libmng */ -#define MNG_OPTIMIZE_FOOTPRINT -#define MNG_OPTIMIZE_OBJCLEANUP -#define MNG_OPTIMIZE_CHUNKINITFREE -#define MNG_OPTIMIZE_CHUNKASSIGN -#define MNG_OPTIMIZE_CHUNKREADER - -#define MNG_SKIPCANVAS_ABGR8 -#define MNG_SKIPCANVAS_ARGB8 -#define MNG_SKIPCANVAS_BGR8 -#define MNG_SKIPCANVAS_BGRA8 -#define MNG_SKIPCANVAS_BGRA8_PM -#define MNG_SKIPCANVAS_BGRX8 -#define MNG_SKIPCANVAS_RGBA8 -#define MNG_SKIPCANVAS_BGR565 -#define MNG_SKIPCANVAS_RGB565 -#define MNG_SKIPCANVAS_BGRA565 -#define MNG_SKIPCANVAS_RGBA565 - -#define MNG_SKIPCHUNK_iCCP -#define MNG_SKIPCHUNK_tEXt -#define MNG_SKIPCHUNK_zTXt -#define MNG_SKIPCHUNK_iTXt -#define MNG_SKIPCHUNK_bKGD -#define MNG_SKIPCHUNK_pHYs -#define MNG_SKIPCHUNK_sBIT -#define MNG_SKIPCHUNK_sPLT -#define MNG_SKIPCHUNK_hIST -#define MNG_SKIPCHUNK_tIME -#define MNG_SKIPCHUNK_eXPI -#define MNG_SKIPCHUNK_fPRI -#define MNG_SKIPCHUNK_nEED -#define MNG_SKIPCHUNK_pHYg - - diff --git a/Engine/lib/lmng/README.packaging b/Engine/lib/lmng/README.packaging deleted file mode 100644 index da0db3e7b..000000000 --- a/Engine/lib/lmng/README.packaging +++ /dev/null @@ -1,24 +0,0 @@ -Packaging Libmng for distribution ---------------------------------- - -These are some notes for those building binaries for distribution. - -We're interested to hear about anywhere libmng is helpful, so let us -know if you're including it with your application or OS. Also, if your -build is publicly accessible, we'd be happy to link to it from -the libmng site. - -However, We respectfully request that you *not* distribute binaries as a -shared library (DLL) with any of the major features disabled. While -there is support for this in terms of #ifdef directives (in -libmng_conf.h) and autoconf switches they are intended for embedded -application and testing. The default compilation options support the -full MNG specification, and we wish to avoid the confusion among -general users that partial support would engender. - - -Platform specific notes: - -We have a basic .spec file for generating rpms. Send us a note if you'd -like to clean it up. - diff --git a/Engine/lib/lmng/bcb/bogus/bogus.bpr b/Engine/lib/lmng/bcb/bogus/bogus.bpr deleted file mode 100644 index 50a7a8094..000000000 --- a/Engine/lib/lmng/bcb/bogus/bogus.bpr +++ /dev/null @@ -1,184 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = bogus.exe -OBJFILES = bogus.obj -RESFILES = bogus.res -RESDEPEN = $(RESFILES) -LIBFILES = ..\win32dll\libmng.lib -LIBRARIES = -SPARELIBS = -PACKAGES = vclx35.bpi VCL35.bpi vcldb35.bpi vcldbx35.bpi bcbsmp35.bpi dclocx35.bpi \ - Qrpt35.bpi -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .; -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -w -r- -k -y -v -vi- -c -tWC -CFLAG2 = -D_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -I..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -CFLAG3 = -Tkh30000 -PFLAGS = -D_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -U..\win32dll;$(BCB)\lib;$(DEBUGLIBPATH) \ - -I..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include \ - -$Y -$W -$O- -v -JPHN -M -RFLAGS = -D_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -i..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -AFLAGS = /i..\win32dll /i..\..\..\libmng-devel /i..\..\..\zlib /i..\..\..\jpgsrc6b \ - /i..\..\..\lcms /i$(BCB)\include /d_NO_VCL /dMNG_SUPPORT_WRITE \ - /dMNG_ACCESS_CHUNKS /dMNG_STORE_CHUNKS /dMNG_NO_CMS /dMNG_USE_DLL /mx /w2 /zd -LFLAGS = -L..\win32dll;$(BCB)\lib;$(DEBUGLIBPATH) -ap -Tpe -x -Gn -v -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) import32.lib cw32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=1 -MinorVer=0 -Release=1 -Build=9 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription=Executable (Console) -FileVersion=1.0.1.9 -InternalName=bogus -LegalCopyright=copyright (c) 2000,2002 G. Juyn -LegalTrademarks= -OriginalFilename=bogus.exe -ProductName=bogus -ProductVersion=1.0.1 -Comments= - -[Excluded Packages] -C:\Program Files\Borland\CBuilder3\Bin\DbX35.bpl=(untitled) - -[HistoryLists\hlIncludePath] -Count=3 -Item0=..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item1=..\..\..\libmng-devel;..\..\..\zlib;$(BCB)\include -Item2=..\..\..\libmng;..\..\..\zlib;$(BCB)\include - -[HistoryLists\hlLibraryPath] -Count=2 -Item0=..\win32dll;$(BCB)\lib -Item1=$(BCB)\lib - -[HistoryLists\hlConditionals] -Count=2 -Item0=_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item1=_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_USE_DLL - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/bogus/bogus.cpp b/Engine/lib/lmng/bcb/bogus/bogus.cpp deleted file mode 100644 index 626d0d73c..000000000 --- a/Engine/lib/lmng/bcb/bogus/bogus.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000,2002 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : bogus * */ -/* * file : bogus.cpp copyright (c) 2000,2002 G.Juyn * */ -/* * version : 1.0.1 * */ -/* * * */ -/* * purpose : main project file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : bogus is (quite literally) a bogus sample which creates and* */ -/* * writes a totally valid, be it somewhat trivial, MNG-file * */ -/* * * */ -/* * changes : 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - changed memory allocation size parameters to mng_size_t * */ -/* * * */ -/* * 1.0.1 - 10/07/2002 - G.Juyn * */ -/* * - fixed copyright notice * */ -/* * - updated MHDR simplicity flag * */ -/* * * */ -/* ************************************************************************** */ - -#pragma hdrstop -#include -#include -#include -#include - -#include "libmng.h" - -/* ************************************************************************** */ - -USERES("bogus.res"); -USELIB("..\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- -typedef struct user_struct { - - FILE *hFile; /* file handle */ - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -#define MY_DECL __stdcall /* get the right callback convention */ - -/* ************************************************************************** */ - -mng_ptr MY_DECL myalloc (mng_size_t iSize) -{ - return (mng_ptr)calloc (1, iSize); /* duh! */ -} - -/* ************************************************************************** */ - -#pragma argsused -void MY_DECL myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool MY_DECL mywritedata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iWritten) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* write it */ - *iWritten = fwrite (pBuf, 1, iSize, pMydata->hFile); - /* iWritten will indicate errors */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -int makeimage (char * zFilename) -{ - userdatap pMydata; - mng_handle hMNG; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - /* can we open the file ? */ - if ((pMydata->hFile = fopen (zFilename, "wb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open output file %s.\n", zFilename); - return 1; - } - /* let's initialize the library */ - hMNG = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!hMNG) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (hMNG, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (hMNG, myclosestream)) != 0) || - ((iRC = mng_setcb_writedata (hMNG, mywritedata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* create the file in memory */ - if ( ((iRC = mng_create (hMNG) ) != 0) || - ((iRC = mng_putchunk_mhdr (hMNG, 640, 480, 1000, 3, 1, 3, 0x0047) ) != 0) || - ((iRC = mng_putchunk_basi (hMNG, 640, 160, 8, 2, 0, 0, 0, 0xFF, 0x00, 0x00, 0xFF, 1)) != 0) || - ((iRC = mng_putchunk_iend (hMNG) ) != 0) || - ((iRC = mng_putchunk_defi (hMNG, 0, 0, 0, MNG_TRUE, 0, 160, MNG_FALSE, 0, 0, 0, 0 )) != 0) || - ((iRC = mng_putchunk_basi (hMNG, 640, 160, 8, 2, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 1)) != 0) || - ((iRC = mng_putchunk_iend (hMNG) ) != 0) || - ((iRC = mng_putchunk_defi (hMNG, 0, 0, 0, MNG_TRUE, 0, 320, MNG_FALSE, 0, 0, 0, 0 )) != 0) || - ((iRC = mng_putchunk_basi (hMNG, 640, 160, 8, 2, 0, 0, 0, 0x00, 0x00, 0xFF, 0xFF, 1)) != 0) || - ((iRC = mng_putchunk_iend (hMNG) ) != 0) || - ((iRC = mng_putchunk_mend (hMNG) ) != 0) ) - fprintf (stderr, "Cannot create the chunks for the image.\n"); - else - { - if ((iRC = mng_write (hMNG)) != 0) - fprintf (stderr, "Cannot write the image.\n"); - - } - } - - mng_cleanup (&hMNG); /* cleanup the library */ - } - - fclose (pMydata->hFile); /* cleanup */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -#pragma argsused -int main (int argc, char *argv[]) -{ - return makeimage ("dutch.mng"); -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr b/Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr deleted file mode 100644 index 386da9021..000000000 --- a/Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr +++ /dev/null @@ -1,235 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = mngrepair.exe -OBJFILES = obj\mngrepair.obj obj\libmng_hlapi.obj obj\libmng_callback_xs.obj \ - obj\libmng_prop_xs.obj obj\libmng_chunk_xs.obj obj\libmng_object_prc.obj \ - obj\libmng_chunk_prc.obj obj\libmng_chunk_io.obj obj\libmng_read.obj \ - obj\libmng_write.obj obj\libmng_display.obj obj\libmng_dither.obj \ - obj\libmng_pixels.obj obj\libmng_filter.obj obj\libmng_error.obj \ - obj\libmng_trace.obj obj\libmng_cms.obj obj\libmng_zlib.obj obj\libmng_jpeg.obj \ - obj\adler32.obj obj\compress.obj obj\crc32.obj obj\deflate.obj obj\infblock.obj \ - obj\infcodes.obj obj\inffast.obj obj\inflate.obj obj\inftrees.obj \ - obj\infutil.obj obj\trees.obj obj\uncompr.obj obj\zutil.obj -RESFILES = mngrepair.res -RESDEPEN = $(RESFILES) -LIBFILES = -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = vclx35.bpi VCL35.bpi vcldb35.bpi vcldbx35.bpi bcbsmp35.bpi dclocx35.bpi \ - Qrpt35.bpi -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\..;..\..\..\zlib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -Od -Hc -w -r- -d -k -y -v -vi- -w-par -c -tWC -CFLAG2 = -D_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS \ - -I..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include \ - -H=$(BCB)\lib\vcl35.csm -CFLAG3 = -Tkh30000 -ff -5 -wuse -wucp -wstv -wstu -wsig -wpin -wnod -wnak -wdef -wcln \ - -wbbf -wasm -wamp -wamb -PFLAGS = -D_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS \ - -N2.\obj -N0.\obj \ - -U..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(RELEASELIBPATH) \ - -I..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -H -W \ - -$Y -$W -$O- -v -JPHN -M -RFLAGS = -D_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS \ - -i..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -AFLAGS = /i..\..\..\libmng-devel /i..\..\..\zlib /i..\..\..\jpgsrc6b /i$(BCB)\include \ - /d_NO_VCL /dMNG_SUPPORT_FULL /dMNG_SUPPORT_READ /dMNG_SUPPORT_WRITE \ - /dMNG_ACCESS_CHUNKS /dMNG_STORE_CHUNKS /dMNG_INCLUDE_ZLIB /dMNG_NO_CMS \ - /dMNG_SOFTERRORS /mx /w2 /zd -LFLAGS = -L..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(RELEASELIBPATH) \ - -ap -Tpe -x -Gn -wdef -wdpl -v -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) import32.lib cw32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=1 -MinorVer=0 -Release=0 -Build=27 -Debug=1 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription=Executable (Console) -FileVersion=1.0.0.27 -InternalName=mngrepair -LegalCopyright=copyright (c) 2002 G.Juyn -LegalTrademarks= -OriginalFilename=mngrepair.exe -ProductName=mngrepair -ProductVersion=1.0 -Comments= - -[Excluded Packages] -C:\Program Files\Borland\CBuilder3\Bin\DbX35.bpl=(untitled) - -[HistoryLists\hlIncludePath] -Count=9 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -Item1=..\..\..\libmng-devel;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -Item2=..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -Item3=..\..\..\libmng-devel;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item4=..\..;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item5=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item6=..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item7=..\..\..\libmng;..\..\..\zlib;$(BCB)\include -Item8=..\..\..\libmng;$(BCB)\include - -[HistoryLists\hlLibraryPath] -Count=7 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib -Item1=..\..\..\libmng-devel;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib -Item2=..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib -Item3=..\..\..\jpgsrc6b;..\..\..\zlib;..\..\..\libmng-devel;..\win32dll;$(BCB)\lib -Item4=..\win32dll;$(BCB)\lib -Item5=..\..\..\libmng\bcb\win32dll;$(BCB)\lib -Item6=..\..\..\libmng;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b - -[HistoryLists\hlConditionals] -Count=13 -Item0=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS -Item1=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG6B;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL;MNG_SOFTERRORS -Item2=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG6B;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL;MNG_SOFTERROR -Item3=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG6B;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item4=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item5=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item6=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL;MNG_SUPPORT_IJG6B -Item7=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item8=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS -Item9=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS -Item10=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item11=_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item12=_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS - -[HistoryLists\hlIntOutputDir] -Count=2 -Item0=.\obj -Item1=..\..\..\obj - -[HistoryLists\hlRunParameters] -Count=4 -Item0=roilion02.mng roilion02-fixed.mng -Item1=roilion.mng roilion-fixed.mng -Item2=dutch.mng -Item3=usflag-lc-d63.mng - -[Debugging] -DebugSourceDirs=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b - -[Parameters] -RunParams=roilion02.mng roilion02-fixed.mng -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp b/Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp deleted file mode 100644 index 5f7c6ec19..000000000 --- a/Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2002 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : mngrepair * */ -/* * file : mngrepair.cpp copyright (c) 2002 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : main project file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : mngrepair iterates tries to fix a couple of 'common' * */ -/* * MNG encoding errors (such as in JASC Animation Shop) * */ -/* * * */ -/* * changes : * */ -/* * * */ -/* ************************************************************************** */ - -#define HAVE_BOOLEAN - -#include -#pragma hdrstop -#include - -#include "libmng.h" - -/* ************************************************************************** */ - -USERES("mngrepair.res"); -USEUNIT("..\..\libmng_hlapi.c"); -USEUNIT("..\..\libmng_callback_xs.c"); -USEUNIT("..\..\libmng_prop_xs.c"); -USEUNIT("..\..\libmng_chunk_xs.c"); -USEUNIT("..\..\libmng_object_prc.c"); -USEUNIT("..\..\libmng_chunk_prc.c"); -USEUNIT("..\..\libmng_chunk_io.c"); -USEUNIT("..\..\libmng_read.c"); -USEUNIT("..\..\libmng_write.c"); -USEUNIT("..\..\libmng_display.c"); -USEUNIT("..\..\libmng_dither.c"); -USEUNIT("..\..\libmng_pixels.c"); -USEUNIT("..\..\libmng_filter.c"); -USEUNIT("..\..\libmng_error.c"); -USEUNIT("..\..\libmng_trace.c"); -USEUNIT("..\..\libmng_cms.c"); -USEUNIT("..\..\libmng_zlib.c"); -USEUNIT("..\..\libmng_jpeg.c"); -USEUNIT("..\..\..\zlib\adler32.c"); -USEUNIT("..\..\..\zlib\compress.c"); -USEUNIT("..\..\..\zlib\crc32.c"); -USEUNIT("..\..\..\zlib\deflate.c"); -USEUNIT("..\..\..\zlib\infblock.c"); -USEUNIT("..\..\..\zlib\infcodes.c"); -USEUNIT("..\..\..\zlib\inffast.c"); -USEUNIT("..\..\..\zlib\inflate.c"); -USEUNIT("..\..\..\zlib\inftrees.c"); -USEUNIT("..\..\..\zlib\infutil.c"); -USEUNIT("..\..\..\zlib\trees.c"); -USEUNIT("..\..\..\zlib\uncompr.c"); -USEUNIT("..\..\..\zlib\zutil.c"); -//--------------------------------------------------------------------------- -typedef struct user_struct { - - FILE *hFileI; /* input file handle */ - FILE *hFileO; /* output file handle */ - mng_handle hHandleI; /* input mng handle */ - mng_handle hHandleO; /* output mng handle */ - mng_bool bHasSAVE; /* indicates a SAVE in the input */ - mng_bool bHasTERM; /* indicates we saved the TERM */ - mng_bool bIsJASC; /* indicates if this is an AS file */ - mng_chunkid iLastchunk; /* last processed chunk */ - mng_retcode iError; /* errorcode from function in callback */ - mng_uint8 iTermaction; /* saved TERM parameters */ - mng_uint8 iIteraction; - mng_uint32 iDelay; - mng_uint32 iItermax; - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -#define MY_DECL /* get the right callback convention */ - -/* ************************************************************************** */ - -mng_ptr MY_DECL myalloc (mng_size_t iSize) -{ /* duh! */ - return (mng_ptr)calloc (1, (size_t)iSize); -} - -/* ************************************************************************** */ - -#pragma argsused -void MY_DECL myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool MY_DECL myreaddata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* read it */ - *iRead = fread (pBuf, 1, iSize, pMydata->hFileI); - /* iRead will indicate EOF */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool MY_DECL mywritedata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iWritten) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* write it */ - *iWritten = fwrite (pBuf, 1, iSize, pMydata->hFileO); - /* iWritten will indicate errors */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool MY_DECL myprocesserror (mng_handle hMNG, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext) -{ /* sequence error for TERM we ignore ! */ - if ((iErrorcode == MNG_SEQUENCEERROR) && (iChunkname == MNG_UINT_TERM)) - return MNG_TRUE; - - return MNG_FALSE; /* all others get dumped ! */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myiterchunk (mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq) -{ - mng_uint32 iWidth; /* temps for IHDR processing */ - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - - mng_bool bEmpty; /* temps for FRAM processing */ - mng_uint8 iMode; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iChangedelay; - mng_uint8 iChangetimeout; - mng_uint8 iChangeclipping; - mng_uint8 iChangesyncid; - mng_uint32 iDelay; - mng_uint32 iTimeout; - mng_uint8 iBoundarytype; - mng_int32 iBoundaryl; - mng_int32 iBoundaryr; - mng_int32 iBoundaryt; - mng_int32 iBoundaryb; - mng_uint32 iCount; - mng_uint32p pSyncids; - /* get to my userdata */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - - if (pMydata->hFileO) /* are we writing this time ? */ - { /* do we need to 'forget' the TERM ? */ - if ((iChunktype == MNG_UINT_TERM) && (pMydata->bHasTERM)) - ; - else - { /* fix JASC AS frame_type ? */ - if ((iChunktype == MNG_UINT_FRAM) && (pMydata->bIsJASC)) - { - if ((pMydata->iError = mng_getchunk_fram (hMNG, hChunk, - &bEmpty, &iMode, &iNamesize, &zName, - &iChangedelay, &iChangetimeout, - &iChangeclipping, &iChangesyncid, - &iDelay, &iTimeout, &iBoundarytype, - &iBoundaryl, &iBoundaryr, - &iBoundaryt, &iBoundaryb, - &iCount, &pSyncids)) != 0) - { - fprintf (stderr, "Cannot get FRAM fields.\n"); - return MNG_FALSE; /* stop the process ! */ - } - - if (iMode == 1) /* really ? */ - iMode = 3; - - if ((pMydata->iError = mng_putchunk_fram (pMydata->hHandleO, - bEmpty, iMode, iNamesize, zName, - iChangedelay, iChangetimeout, - iChangeclipping, iChangesyncid, - iDelay, iTimeout, iBoundarytype, - iBoundaryl, iBoundaryr, - iBoundaryt, iBoundaryb, - iCount, pSyncids)) != 0) - { - fprintf (stderr, "Cannot write FRAM chunk.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - else - { - if ((pMydata->iError = mng_copy_chunk (hMNG, hChunk, pMydata->hHandleO)) != 0) - { - fprintf (stderr, "Cannot copy the chunk.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - } - /* need to insert TERM in the proper place ? */ - if ((iChunktype == MNG_UINT_MHDR) && (pMydata->bHasTERM)) - { - if ((pMydata->iError = mng_putchunk_term (pMydata->hHandleO, - pMydata->iTermaction, - pMydata->iIteraction, - pMydata->iDelay, - pMydata->iItermax)) != 0) - { - fprintf (stderr, "Cannot write TERM chunk.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - } - else /* first iteration; just checking stuff */ - { - if (iChunktype == MNG_UINT_SAVE) /* SAVE ? */ - { - pMydata->bHasSAVE = MNG_TRUE; /* we got a SAVE ! */ - pMydata->bIsJASC = MNG_FALSE; /* so it's definitely not an invalid AS file */ - } - else - { /* TERM ? */ - if (iChunktype == MNG_UINT_TERM) - { /* is it in the wrong place ? */ - if ((pMydata->iLastchunk != MNG_UINT_MHDR) || - (pMydata->iLastchunk != MNG_UINT_SAVE) ) - { - pMydata->bHasTERM = MNG_TRUE; - - if ((pMydata->iError = mng_getchunk_term (hMNG, hChunk, - &pMydata->iTermaction, - &pMydata->iIteraction, - &pMydata->iDelay, - &pMydata->iItermax)) != 0) - { - fprintf (stderr, "Cannot get TERM fields.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - } - else - { /* IHDR ? */ - if (iChunktype == MNG_UINT_IHDR) - { - if ((pMydata->iError = mng_getchunk_ihdr (hMNG, hChunk, - &iWidth, &iHeight, &iBitdepth, - &iColortype, &iCompression, - &iFilter, &iInterlace)) != 0) - { - fprintf (stderr, "Cannot get IHDR fields.\n"); - return MNG_FALSE; /* stop the process ! */ - } - /* is it not a typical JASC AS file */ - if ((iBitdepth != 8) || (iColortype != 6)) - pMydata->bIsJASC = MNG_FALSE; - } - } - } - - pMydata->iLastchunk = iChunktype; - } - - return MNG_TRUE; /* keep'm coming... */ -} - -/* ************************************************************************** */ - -int fixit (char * zFilenameI, - char * zFilenameO) -{ - userdatap pMydata; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - - pMydata->hFileO = 0; /* initialize some stuff! */ - pMydata->hHandleI = MNG_NULL; - pMydata->hHandleO = MNG_NULL; - pMydata->bHasSAVE = MNG_FALSE; - pMydata->bHasTERM = MNG_FALSE; - pMydata->bIsJASC = MNG_TRUE; - pMydata->iLastchunk = MNG_UINT_HUH; - pMydata->iTermaction = 0; - pMydata->iIteraction = 0; - pMydata->iDelay = 0; - pMydata->iItermax = 0; - /* can we open the input file ? */ - if ((pMydata->hFileI = fopen (zFilenameI, "rb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open input file %s.\n", zFilenameI); - return 1; - } - /* let's initialize the library */ - pMydata->hHandleI = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!pMydata->hHandleI) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* some informatory messages */ - fprintf (stderr, "Compiled with libmng %s.\n", MNG_VERSION_TEXT); - fprintf (stderr, "Running with libmng %s.\n", mng_version_text()); - /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (pMydata->hHandleI, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (pMydata->hHandleI, myclosestream )) != 0) || - ((iRC = mng_setcb_readdata (pMydata->hHandleI, myreaddata )) != 0) || - ((iRC = mng_setcb_errorproc (pMydata->hHandleI, myprocesserror)) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* reaad the file into memory */ - if ((iRC = mng_read (pMydata->hHandleI)) != 0) - fprintf (stderr, "Cannot read the input file.\n"); - else - { /* run through the chunk list to get TERM */ - if ((iRC = mng_iterate_chunks (pMydata->hHandleI, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - else - { - if (pMydata->iError) /* did the iteration fail somehow ? */ - iRC = pMydata->iError; - else - { /* can we open the output file ? */ - if ((pMydata->hFileO = fopen (zFilenameO, "wb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open output file %s.\n", zFilenameO); - iRC = 1; - } - else - { /* let's initialize the library */ - pMydata->hHandleO = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!pMydata->hHandleO) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (pMydata->hHandleO, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (pMydata->hHandleO, myclosestream)) != 0) || - ((iRC = mng_setcb_writedata (pMydata->hHandleO, mywritedata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { - if ((iRC = mng_create (pMydata->hHandleO)) != 0) - fprintf (stderr, "Cannot create a new MNG.\n"); - else - { /* run through the chunk again and create the new file */ - if ((iRC = mng_iterate_chunks (pMydata->hHandleI, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - else - { /* did the iteration fail somehow ? */ - if (pMydata->iError) - iRC = pMydata->iError; - else - { /* now write the created new file !! */ - if ((iRC = mng_write (pMydata->hHandleO)) != 0) - fprintf (stderr, "Cannot write the output file.\n"); - } - } - } - } - /* cleanup the library */ - mng_cleanup (&pMydata->hHandleO); - } - /* cleanup output file */ - fclose (pMydata->hFileO); - } - } - } - } - } - - mng_cleanup (&pMydata->hHandleI); /* cleanup the library */ - } - - fclose (pMydata->hFileI); /* cleanup input file and userdata */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -int main(int argc, char *argv[]) -{ - if (argc > 2) /* need two (2) parameters ! */ - return fixit (argv[1], argv[2]); - else - fprintf (stdout, "\nUsage: mngrepair \n\n"); - - return 0; -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/bcb/mngrepair/mngrepair.res b/Engine/lib/lmng/bcb/mngrepair/mngrepair.res deleted file mode 100644 index 12530c34f..000000000 Binary files a/Engine/lib/lmng/bcb/mngrepair/mngrepair.res and /dev/null differ diff --git a/Engine/lib/lmng/bcb/mngtree/mngtree.bpr b/Engine/lib/lmng/bcb/mngtree/mngtree.bpr deleted file mode 100644 index 656a04130..000000000 --- a/Engine/lib/lmng/bcb/mngtree/mngtree.bpr +++ /dev/null @@ -1,188 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = mngtree.exe -OBJFILES = mngtree.obj -RESFILES = mngtree.res -RESDEPEN = $(RESFILES) -LIBFILES = ..\win32dll\libmng.lib -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = vclx35.bpi VCL35.bpi vcldb35.bpi vcldbx35.bpi bcbsmp35.bpi dclocx35.bpi \ - Qrpt35.bpi -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .; -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -Od -w -r- -k -y -v -vi- -c -tWC -CFLAG2 = -D_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -I..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -CFLAG3 = -Tkh30000 -PFLAGS = -D_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -U..\win32dll;$(BCB)\lib;$(DEBUGLIBPATH) \ - -I..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include \ - -$Y -$W -$O- -v -JPHN -M -RFLAGS = -D_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -i..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -AFLAGS = /i..\..\..\libmng-devel /i..\..\..\zlib /i..\..\..\jpgsrc6b /i..\..\..\lcms \ - /i$(BCB)\include /d_NO_VCL /dMNG_SUPPORT_READ /dMNG_ACCESS_CHUNKS \ - /dMNG_STORE_CHUNKS /dMNG_NO_CMS /dMNG_USE_DLL /mx /w2 /zd -LFLAGS = -L..\win32dll;$(BCB)\lib;$(DEBUGLIBPATH) -ap -Tpe -x -Gn -v -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) import32.lib cw32mt.lib libmng.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=0 -MinorVer=9 -Release=0 -Build=13 -Debug=1 -PreRelease=1 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription=Executable (Console) -FileVersion=0.9.0.13 -InternalName=mngtree -LegalCopyright=copyright (c) 2000 G.Juyn -LegalTrademarks= -OriginalFilename=mngtree.exe -ProductName=mngtree -ProductVersion=0.9.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item1=..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item2=..\..\..\libmng;..\..\..\zlib;$(BCB)\include -Item3=..\..\..\libmng;$(BCB)\include - -[HistoryLists\hlLibraryPath] -Count=3 -Item0=..\win32dll;$(BCB)\lib -Item1=..\..\..\libmng\bcb\win32dll;$(BCB)\lib -Item2=..\..\..\libmng;$(BCB)\lib - -[HistoryLists\hlConditionals] -Count=2 -Item0=_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item1=_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS - -[HistoryLists\hlRunParameters] -Count=2 -Item0=dutch.mng -Item1=usflag-lc-d63.mng - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams=dutch.mng -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/mngtree/mngtree.cpp b/Engine/lib/lmng/bcb/mngtree/mngtree.cpp deleted file mode 100644 index d16c68e9c..000000000 --- a/Engine/lib/lmng/bcb/mngtree/mngtree.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : mngtree * */ -/* * file : mngtree.cpp copyright (c) 2000 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : main project file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : mngtree simply dumps the chunk-structure of the supplied * */ -/* * first parameter to stdout (should be a xNG-file) * */ -/* * * */ -/* * changes : 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - changed memory allocation size parameters to mng_size_t * */ -/* * * */ -/* ************************************************************************** */ - -#pragma hdrstop -#include -#include -#include -#include - -#include "libmng.h" - -/* ************************************************************************** */ - -USERES("mngtree.res"); -USELIB("..\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- - -/* ************************************************************************** */ - -typedef struct user_struct { - - FILE *hFile; /* file handle */ - int iIndent; /* for nice indented formatting */ - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -#define MY_DECL __stdcall /* get the right callback convention */ - -/* ************************************************************************** */ - -mng_ptr MY_DECL myalloc (mng_size_t iSize) -{ /* duh! */ - return (mng_ptr)calloc (1, (size_t)iSize); -} - -/* ************************************************************************** */ - -#pragma argsused -void MY_DECL myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool MY_DECL myreaddata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* read it */ - *iRead = fread (pBuf, 1, iSize, pMydata->hFile); - /* iRead will indicate EOF */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myiterchunk (mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - char aCh[4]; - char zIndent[80]; - int iX; - /* decode the chunkname */ - aCh[0] = (char)((iChunktype >> 24) & 0xFF); - aCh[1] = (char)((iChunktype >> 16) & 0xFF); - aCh[2] = (char)((iChunktype >> 8) & 0xFF); - aCh[3] = (char)((iChunktype ) & 0xFF); - /* indent less ? */ - if ( (iChunktype == MNG_UINT_MEND) || (iChunktype == MNG_UINT_IEND) || - (iChunktype == MNG_UINT_ENDL) ) - pMydata->iIndent -= 2; - /* this looks ugly; but I haven't - figured out how to do it prettier */ - for (iX = 0; iX < pMydata->iIndent; iX++) - zIndent[iX] = ' '; - zIndent[pMydata->iIndent] = '\0'; - /* print a nicely indented line */ - printf ("%s%c%c%c%c\n", &zIndent, aCh[0], aCh[1], aCh[2], aCh[3]); - /* indent more ? */ - if ( (iChunktype == MNG_UINT_MHDR) || (iChunktype == MNG_UINT_IHDR) || - (iChunktype == MNG_UINT_JHDR) || (iChunktype == MNG_UINT_DHDR) || - (iChunktype == MNG_UINT_BASI) || (iChunktype == MNG_UINT_LOOP) ) - pMydata->iIndent += 2; - - return MNG_TRUE; /* keep'm coming... */ -} - -/* ************************************************************************** */ - -int dumptree (char * zFilename) -{ - userdatap pMydata; - mng_handle hMNG; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - /* can we open the file ? */ - if ((pMydata->hFile = fopen (zFilename, "rb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open input file %s.\n", zFilename); - return 1; - } - /* let's initialize the library */ - hMNG = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!hMNG) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (hMNG, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (hMNG, myclosestream)) != 0) || - ((iRC = mng_setcb_readdata (hMNG, myreaddata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* reaad the file into memory */ - if ((iRC = mng_read (hMNG)) != 0) - fprintf (stderr, "Cannot read the file.\n"); - else - { - pMydata->iIndent = 2; /* start of the indenting at a nice level */ - - printf ("Starting dump of %s.\n\n", zFilename); - /* run through the chunk list */ - if ((iRC = mng_iterate_chunks (hMNG, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - - printf ("\nDone.\n"); - } - } - - mng_cleanup (&hMNG); /* cleanup the library */ - } - - fclose (pMydata->hFile); /* cleanup */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -#pragma argsused -int main(int argc, char *argv[]) -{ - if (argc > 1) /* need that first parameter ! */ - return dumptree (argv[1]); - else - fprintf (stdout, "\nUsage: mngtree \n\n"); - - return 0; -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/bcb/mngview/MNGI.ICO b/Engine/lib/lmng/bcb/mngview/MNGI.ICO deleted file mode 100644 index 1556e5899..000000000 Binary files a/Engine/lib/lmng/bcb/mngview/MNGI.ICO and /dev/null differ diff --git a/Engine/lib/lmng/bcb/mngview/Main.cpp b/Engine/lib/lmng/bcb/mngview/Main.cpp deleted file mode 100644 index 2bc3b5409..000000000 --- a/Engine/lib/lmng/bcb/mngview/Main.cpp +++ /dev/null @@ -1,573 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -#include // for : malloc & free -#include "Main.h" - -/****************************************************************************} -{* For conditions of distribution and use, *} -{* see copyright notice in libmng.pas *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : main.pas copyright (c) 2000 G.Juyn *} -{* version : 1.0.1 *} -{* *} -{* purpose : Main form for mngview application *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info@3-t.com *} -{* *} -{* comment : this is the heart of the mngview applciation *} -{* *} -{* changes : This project is a converted version of "mngview" - AP *} -{* - AP - 15/9/2000 - revisions ... *} -{* - made the callbacks calling convention explicit *} -(* - Moved the defines from "project options" to "main.h" *} -{* - Added Readme.txt to the project - Please READ IT ! *} -(* *} -{* 0.5.1 - 05/02/2000 - G.Juyn *} -{* - added this version block *} -{* - made the initialization part more robust *} -{* eg. program aborts on initialization errors *} -{* - B002(105797) - added check for existence of default sRGB *} -{* profile (now included in distribution) *} -{* - added mng_cleanup to program exit *} -{* 0.5.1 - 05/08/2000 - G.Juyn *} -{* - changed to stdcall convention *} -{* 0.5.1 - 05/11/2000 - G.Juyn *} -{* - changed callback function declarations *} -{* *} -{* 0.5.3 - 06/16/2000 - G.Juyn *} -{* - removed processmessages call from refresh callback *} -{* 0.5.3 - 06/17/2000 - G.Juyn *} -{* - switched "storechunks" off *} -{* 0.5.3 - 06/26/2000 - G.Juyn *} -{* - changed definition of userdata to mng_ptr *} -{* 0.5.3 - 06/28/2000 - G.Juyn *} -{* - changed the default icon to something more appropriate *} -{* - changed definition of memory alloc size to mng_size_t *} -{* 0.5.3 - 06/29/2000 - G.Juyn *} -{* - changed order of refresh parameters *} -{* *} -{* 0.9.0 - 06/30/2000 - G.Juyn *} -{* - changed refresh parameters to 'x,y,width,height' *} -{* *} -{* 0.9.1 - 07/08/2000 - G.Juyn *} -{* - fixed to use returncode constants *} -{* - changed to accomodate MNG_NEEDTIMERWAIT returncode *} -{* 0.9.1 - 07/10/2000 - G.Juyn *} -{* - changed to use suspension-mode *} -{* *} -{* 1.0.1 - 05/02/2000 - G.Juyn *} -{* - removed loading of default sRGB profile (auto in libmng) *} -{* *} -{****************************************************************************/ - -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -TMainForm *MainForm; - -# define _OR_ | -# define _AND_ & -# define _DIV_ / -# define _NOT_ ! -# define _NIL_ 0 -# define _SHR_ >> -# define _SHL_ << - -// Prototypes for static functions - the LibMng Callbacks. -static mng_ptr __stdcall Memalloc( mng_uint32 iLen ); -static void __stdcall Memfree( mng_ptr iPtr, mng_size_t iLen ); -static mng_bool __stdcall Openstream( mng_handle hHandle ); -static mng_bool __stdcall Closestream( mng_handle hHandle ); -static mng_bool __stdcall Readdata ( mng_handle hHandle, mng_ptr pBuf, - mng_uint32 iBuflen, mng_uint32 *pRead ); -static mng_bool __stdcall ProcessHeader ( mng_handle hHandle, - mng_uint32 iWidth, mng_uint32 iHeight ); -static mng_ptr __stdcall GetCanvasLine ( mng_handle hHandle, - mng_uint32 iLinenr ); -static mng_ptr __stdcall GetAlphaLine( mng_handle hHandle, mng_uint32 iLinenr ); -static mng_bool __stdcall ImageRefresh ( mng_handle hHandle, - mng_uint32 iX, mng_uint32 iY, mng_uint32 iWidth, mng_uint32 iHeight ); -static mng_uint32 __stdcall GetTickCount( mng_handle hHandle ); -static mng_bool __stdcall SetTimer( mng_handle hHandle, mng_uint32 iMsecs ); - -//--------------------------------------------------------------------------- -__fastcall TMainForm::TMainForm(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -static mng_ptr __stdcall Memalloc( mng_uint32 iLen ) -{ -mng_ptr pResult = - - malloc( iLen ); /* get memory from the heap */ - - if( pResult ) /* Added - condition */ - memset( pResult, 0, iLen ); - - return pResult; -} -//--------------------------------------------------------------------------- -static void __stdcall Memfree( mng_ptr iPtr, mng_size_t iLen ) -{ - free( iPtr ); /* free the memory */ - (void)iLen; // Kill compiler warning -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall Openstream( mng_handle hHandle ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - if( OHForm->OFFile != _NIL_ ) /* free previous stream (if any) */ - OHForm->OFFile->Free(); - - /* open a new stream */ - OHForm->OFFile = new TFileStream( - OHForm->SFFileName, fmOpenRead _OR_ fmShareDenyWrite); - - OHForm->ProgressBar1->Position = 0; /* Added */ - OHForm->ProgressBar1->Min =0; /* Added */ - OHForm->ProgressBar1->Max = OHForm->OFFile->Size; /* Added */ - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall Closestream( mng_handle hHandle ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - OHForm->OFFile->Free(); /* cleanup the stream */ - OHForm->OFFile = 0; /* don't use it again ! */ - - OHForm->ProgressBar1->Position = 0; /* Added */ - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall Readdata ( mng_handle hHandle, mng_ptr pBuf, - mng_uint32 iBuflen, mng_uint32 *pRead ) -{ -TMainForm *OHForm; -unsigned int IHTicks; -unsigned int IHByte1; -unsigned int IHByte2; -unsigned int IHBytesPerSec ; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* are we at EOF ? */ - if( OHForm->OFFile->Position >= OHForm->OFFile->Size ) - { - *pRead = 0; /* indicate so */ - } - else - { - IHBytesPerSec = OHForm->IFBytesPerSec; /* fake a slow connection */ - - if( IHBytesPerSec > 0 ) - { - IHTicks = (unsigned int)GetTickCount(); - IHByte1 = (IHTicks - OHForm->IFTicks) * IHBytesPerSec; - IHByte2 = (OHForm->IFBytes + iBuflen) * 1000; - - if( IHByte2 > IHByte1 ) /* Added - condition */ - if( ((IHByte2 - IHByte1) _DIV_ IHBytesPerSec) > 10 ) - { - Sleep( (DWORD)((IHByte2 - IHByte1) _DIV_ IHBytesPerSec) ); - } - }; - - /* read the requested data */ - *pRead = OHForm->OFFile->Read( pBuf, iBuflen); - OHForm->IFBytes = OHForm->IFBytes + *pRead; - - OHForm->ProgressBar1->Position = (int)OHForm->IFBytes; /* Added */ - } // end else; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall ProcessHeader ( mng_handle hHandle, - mng_uint32 iWidth, mng_uint32 iHeight ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* Added */ - OHForm->Caption = ExtractFileName( OHForm->SFFileName ) + - " [" + - String( iWidth ) + - "x" + - String( iHeight ) + - "]"; - - OHForm->OFBitmap->Width = iWidth; /* store the new dimensions */ - OHForm->OFBitmap->Height = iHeight; - OHForm->OFImage->Left = 0; /* adjust the visible component */ - OHForm->OFImage->Top = 0; - OHForm->OFImage->Width = iWidth; - OHForm->OFImage->Height = iHeight; - - OHForm->FormResize (OHForm); /* force re-centering the image*/ - /* clear the canvas & draw an outline */ - OHForm->OFBitmap->Canvas->Brush->Color = clGray; - OHForm->OFBitmap->Canvas->Brush->Style = bsSolid; - OHForm->OFBitmap->Canvas->FillRect( OHForm->OFBitmap->Canvas->ClipRect ); - OHForm->OFBitmap->Canvas->Brush->Color = clRed; - OHForm->OFBitmap->Canvas->Brush->Style = bsSolid; - OHForm->OFBitmap->Canvas->Pen->Color = clRed; - OHForm->OFBitmap->Canvas->Pen->Style = psSolid; - OHForm->OFBitmap->Canvas->FrameRect( OHForm->OFBitmap->Canvas->ClipRect); - - /* make sure it gets out there */ - OHForm->OFImage->Picture->Assign( OHForm->OFBitmap ); - - /* tell the library we want funny windows-bgr*/ - if( mng_set_canvasstyle( hHandle, MNG_CANVAS_BGR8 ) ) - OHForm->MNGerror( "libmng reported an error setting the canvas style" ); - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_ptr __stdcall GetCanvasLine ( mng_handle hHandle, - mng_uint32 iLinenr ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* easy with these bitmap objects ! */ - return OHForm->OFBitmap->ScanLine[ iLinenr ]; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall ImageRefresh ( mng_handle hHandle, - mng_uint32 iX, mng_uint32 iY, mng_uint32 iWidth, mng_uint32 iHeight ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* force redraw */ - OHForm->OFImage->Picture->Assign( OHForm->OFBitmap ); - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_uint32 __stdcall GetTickCount( mng_handle hHandle ) -{ - return GetTickCount(); /* windows knows that */ -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall SetTimer( mng_handle hHandle, mng_uint32 iMsecs ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - OHForm->OFTimer->Interval = iMsecs; /* and set the timer */ - OHForm->OFTimer->Enabled = true; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormCreate(TObject *Sender) -{ -String SHProfileName; -mng_uint16 IHRed, IHGreen, IHBlue; /* word */ - - OFBitmap = new Graphics::TBitmap(); /* initialize */ - IFBytesPerSec = 10000000; - OFFile = 0; - - OFOpenDialog->InitialDir = ""; - OFBitmap->HandleType = bmDIB; /* make it a 24-bit DIB */ - OFBitmap->PixelFormat = pf24bit; - - /* now initialize the library */ - IFHandle = mng_initialize( mng_ptr(this), Memalloc, Memfree, _NIL_ ); - - if( IFHandle == _NIL_ ) - { - MNGerror ("libmng initializiation error"\ - "\n"\ - "Program aborted" - ); - PostMessage( Handle, WM_CLOSE, 0, 0); - return; // was Exit - }; - - /* no need to store chunk-info ! */ - mng_set_storechunks( IFHandle, MNG_FALSE ); - - /* use suspension-buffer */ - mng_set_suspensionmode( IFHandle, MNG_TRUE ); - - /* set all the callbacks */ - if( - (mng_setcb_openstream (IFHandle, Openstream ) != MNG_NOERROR) _OR_ - (mng_setcb_closestream (IFHandle, Closestream ) != MNG_NOERROR) _OR_ - (mng_setcb_readdata (IFHandle, Readdata ) != MNG_NOERROR) _OR_ - (mng_setcb_processheader(IFHandle, ProcessHeader) != MNG_NOERROR) _OR_ - (mng_setcb_getcanvasline(IFHandle, GetCanvasLine) != MNG_NOERROR) _OR_ - (mng_setcb_refresh (IFHandle, ImageRefresh ) != MNG_NOERROR) _OR_ - (mng_setcb_gettickcount (IFHandle, GetTickCount ) != MNG_NOERROR) _OR_ - (mng_setcb_settimer (IFHandle, SetTimer ) != MNG_NOERROR) - ) - { - MNGerror ("libmng reported an error setting a callback function!"\ - "\n"\ - "Program aborted" - ); - PostMessage( Handle, WM_CLOSE, 0, 0 ); - return; // was Exit - }; - - /* supply our own bg-color */ - IHRed = (mng_uint16)((Color ) _AND_ 0xFF); - IHGreen = (mng_uint16)((Color _SHR_ 8) _AND_ 0xFF); - IHBlue = (mng_uint16)((Color _SHR_ 16) _AND_ 0xFF); - - IHRed = (mng_uint16)((IHRed _SHL_ 8) + IHRed); - IHGreen = (mng_uint16)((IHGreen _SHL_ 8) + IHGreen); - IHBlue = (mng_uint16)((IHBlue _SHL_ 8) + IHBlue); - - if( mng_set_bgcolor (IFHandle, IHRed, IHGreen, IHBlue) != MNG_NOERROR ) - MNGerror( "libmng reported an error setting the background color!"); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormCloseQuery(TObject *Sender, - bool &CanClose) -{ - BFCancelled = true; - - /* if we're still animating then stop it */ - if( OFTimer->Enabled ) - { - if( mng_display_freeze (IFHandle) != MNG_NOERROR ) - MNGerror ("libmng reported an error during display_freeze!" ); - } - - OFTimer->Enabled = false; - - mng_cleanup( &IFHandle ); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormShow(TObject *Sender) -{ - FormResize( this ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormResize(TObject *Sender) -{ - /* center the image in the window */ - - if( ClientWidth < OFImage->Width ) - OFImage->Left = 0; - else - OFImage->Left = (ClientWidth - OFImage->Width ) _DIV_ 2; - - if( ClientHeight < OFImage->Height ) - OFImage->Top = 0; - else - OFImage->Top = (ClientHeight - OFImage->Height) _DIV_ 2; - - ProgressBar1->Width = Panel1->Width - 8; /* Added */ - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormKeyDown(TObject *Sender, WORD &Key, - TShiftState Shift) -{ - /* pressing will freeze an animation */ - if( Key == VK_ESCAPE ) - { - if( OFTimer->Enabled ) - { - if( mng_display_freeze( IFHandle) != MNG_NOERROR ) - MNGerror( "libmng reported an error during display_freeze!" ); - } - - OFTimer->Enabled = false; /* don't let that timer go off then ! */ - BFCancelled = true; - } - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFTimerTimer(TObject *Sender) -{ -mng_retcode IHRslt; - - OFTimer->Enabled = false; /* only once ! */ - - if( _NOT_ BFCancelled ) - { - /* and inform the library */ - IHRslt = mng_display_resume( IFHandle ); - - if( (IHRslt != MNG_NOERROR) _AND_ (IHRslt != MNG_NEEDTIMERWAIT) ) - MNGerror( "libmng reported an error during display_resume!" ); - - }; - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuFileOpenClick(TObject *Sender) -{ -mng_retcode IHRslt; - - OFOpenDialog->InitialDir = ""; -OFOpenDialog->InitialDir = GetCurrentDir(); //@@ - OFOpenDialog->FileName = SFFileName; - - if( OFOpenDialog->Execute() ) /* get the filename */ - { - if( OFTimer->Enabled ) /* if the lib was active; stop it */ - { - OFTimer->Enabled = false; - - Application->ProcessMessages(); /* process any timer requests (for safety) */ - /* now freeze the animation */ - if( mng_display_freeze( IFHandle ) != MNG_NOERROR ) - MNGerror( "libmng reported an error during display_freeze!" ); - }; - - /* save interesting fields */ - SFFileName = OFOpenDialog->FileName; - IFTicks = GetTickCount(); - IFBytes = 0; - BFCancelled = false; - - /* always reset (just in case) */ - if( mng_reset( IFHandle ) != MNG_NOERROR ) - { - MNGerror( "libmng reported an error during reset!" ); - } - else - { - /* and let the lib do it's job ! */ - IHRslt = mng_readdisplay (IFHandle); - - if( (IHRslt != MNG_NOERROR) _AND_ (IHRslt != MNG_NEEDTIMERWAIT) ) - MNGerror( "libmng reported an error reading the input file!" ); - - }; - }; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuFileProfileClick(TObject *Sender) -{ -char SHProfileDir[ MAX_PATH ]; - - GetSystemDirectory( SHProfileDir, MAX_PATH ); - strcat( SHProfileDir, "\\Color" ); - - OFOpenDialogProfile->InitialDir = String( SHProfileDir ); - - if( OFOpenDialogProfile->Execute() ) - { - if( mng_set_outputprofile( IFHandle, OFOpenDialogProfile->FileName.c_str()) != 0 ) - MNGerror( "libmng reported an error setting the output-profile!" ); - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuFileExitClick(TObject *Sender) -{ - if( mng_cleanup( &IFHandle ) != MNG_NOERROR ) - MNGerror( "libmng cleanup error" ); - - Close(); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuOptionsModemSpeedClick(TObject *Sender) -{ - - OFMenuOptionsModem28k8->Checked = false; - OFMenuOptionsModem33k6->Checked = false; - OFMenuOptionsModem56k->Checked = false; - OFMenuOptionsModemISDN64->Checked = false; - OFMenuOptionsModemISDN128->Checked = false; - OFMenuOptionsModemCable512->Checked = false; - OFMenuOptionsModemUnlimited->Checked = false; - - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModem28k8->Tag _DIV_ 10 ) - OFMenuOptionsModem28k8->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModem33k6->Tag _DIV_ 10 ) - OFMenuOptionsModem33k6->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModem56k->Tag _DIV_ 10 ) - OFMenuOptionsModem56k->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemISDN64->Tag _DIV_ 10 ) - OFMenuOptionsModemISDN64->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemISDN128->Tag _DIV_ 10 ) - OFMenuOptionsModemISDN128->Checked = true; - else - /* Added - changedit was the line below ! */ -// if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemUnlimited->Tag _DIV_ 10 ) - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemCable512->Tag _DIV_ 10 ) - OFMenuOptionsModemCable512->Checked = true; - else - OFMenuOptionsModemUnlimited->Checked = true; - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuOptionsModemXClick(TObject *Sender) -{ - IFBytesPerSec = ((TMenuItem*)Sender)->Tag _DIV_ 10; -} -//--------------------------------------------------------------------------- -void TMainForm::MNGerror( String SHMsg ) -{ -/* get extended info */ -mng_uint32 iErrorcode; -mng_uint8 iSeverity; -mng_chunkid iChunkname; -mng_uint32 iChunkseq; -mng_int32 iExtra1; -mng_int32 iExtra2; -mng_pchar zErrortext; -char szFormatStr[ 256 ]; - - iErrorcode = mng_getlasterror (IFHandle, &iSeverity, - &iChunkname, &iChunkseq, &iExtra1, &iExtra2, - (mng_pchar*)&zErrortext); - - wsprintf( szFormatStr, - "Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d", - (int)iErrorcode, (int)iSeverity, (int)iChunkseq, (int)iExtra1 - ); - - MessageDlg( SHMsg + - "\n\n" + - String(zErrortext) + - "\n\n" + - szFormatStr, /* see wsprintf above */ - mtError, - TMsgDlgButtons() << mbOK, - 0 - ); - -} -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/bcb/mngview/Main.dfm b/Engine/lib/lmng/bcb/mngview/Main.dfm deleted file mode 100644 index ae72e95c1..000000000 Binary files a/Engine/lib/lmng/bcb/mngview/Main.dfm and /dev/null differ diff --git a/Engine/lib/lmng/bcb/mngview/Main.h b/Engine/lib/lmng/bcb/mngview/Main.h deleted file mode 100644 index 94dac0191..000000000 --- a/Engine/lib/lmng/bcb/mngview/Main.h +++ /dev/null @@ -1,84 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef MainH -#define MainH -//--------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -//--------------------------------------------------------------------------- -// These MUST be defined before we include "Libmng.h -# define MNG_SUPPORT_READ -# define MNG_ACCESS_CHUNKS -# define MNG_STORE_CHUNKS -# define MNG_NO_CMS -# define MNG_USE_DLL -# define MNG_SUPPORT_DISPLAY -# define MNG_SKIP_ZLIB // we don't need the zlib definitions here -# define MNG_SKIP_IJG6B // we don't need the IJG definitions here -#include "libmng.h" -//--------------------------------------------------------------------------- -class TMainForm : public TForm -{ -__published: // IDE-managed Components - TMainMenu *OFMainMenu; - TMenuItem *OFMenuFile; - TMenuItem *OFMenuFileOpen; - TMenuItem *OFMenuFileProfile; - TMenuItem *OFMenuFileN1; - TMenuItem *OFMenuFileExit; - TMenuItem *OFMenuOptions; - TMenuItem *OFMenuOptionsModemSpeed; - TMenuItem *OFMenuOptionsModem28k8; - TMenuItem *OFMenuOptionsModem33k6; - TMenuItem *OFMenuOptionsModem56k; - TMenuItem *OFMenuOptionsModemISDN64; - TMenuItem *OFMenuOptionsModemISDN128; - TMenuItem *OFMenuOptionsModemCable512; - TMenuItem *OFMenuOptionsModemUnlimited; - TOpenDialog *OFOpenDialog; - TTimer *OFTimer; - TOpenDialog *OFOpenDialogProfile; - TImage *OFImage; - TPanel *Panel1; - TProgressBar *ProgressBar1; - void __fastcall FormCreate(TObject *Sender); - void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose); - void __fastcall FormShow(TObject *Sender); - void __fastcall FormResize(TObject *Sender); - void __fastcall FormKeyDown(TObject *Sender, WORD &Key, - TShiftState Shift); - void __fastcall OFTimerTimer(TObject *Sender); - void __fastcall OFMenuFileOpenClick(TObject *Sender); - void __fastcall OFMenuFileProfileClick(TObject *Sender); - void __fastcall OFMenuFileExitClick(TObject *Sender); - void __fastcall OFMenuOptionsModemSpeedClick(TObject *Sender); - void __fastcall OFMenuOptionsModemXClick(TObject *Sender); -private: // User declarations -public : - // Data - was private in the pascal version - String SFFileName; /* filename of the input stream */ - TFileStream *OFFile; /* input stream */ - mng_handle IFHandle; /* the libray handle */ - Graphics::TBitmap *OFBitmap; /* drawing canvas */ -# ifdef TEST_RGB8_A8 - void *OFAlpha; -# endif - bool BFCancelled; /* or app-exit */ - unsigned int IFTicks; /* used to fake slow connections */ - unsigned int IFBytes; - unsigned int IFBytesPerSec; - // Methods - void MNGerror( String SHMsg ); -public: // User declarations - __fastcall TMainForm(TComponent* Owner); -}; -//--------------------------------------------------------------------------- -extern PACKAGE TMainForm *MainForm; -//--------------------------------------------------------------------------- -#endif - diff --git a/Engine/lib/lmng/bcb/mngview/MngView.bpr b/Engine/lib/lmng/bcb/mngview/MngView.bpr deleted file mode 100644 index f80283bb1..000000000 --- a/Engine/lib/lmng/bcb/mngview/MngView.bpr +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = MngView.exe -OBJFILES = MngView.obj Main.obj -RESFILES = MngView.res -DEFFILE = -RESDEPEN = $(RESFILES) Main.dfm -LIBFILES = ..\win32dll\libmng.lib -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi bcbsmp35.bpi dclocx35.bpi \ - QRPT35.bpi -# --------------------------------------------------------------------------- -PATHCPP = .; -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -Od -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx -tW -CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -CFLAG3 = -Tkh30000 -6 -PFLAGS = -U$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ - -I$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -$Y \ - -$W -$O- -v -JPHN -M -RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /i..\.. /i..\..\..\zlib \ - /i..\..\..\jpgsrc6b /mx /w2 /zd /dMNG_USE_DLL -LFLAGS = -L$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpe -x -Gn -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=2057 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=8 -Item0=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -Item1=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;..\win32dll -Item2=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\ijgsrc6b -Item3=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\libjpeg -Item4=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\zlib -Item5=$(BCB)\include;$(BCB)\include\vcl;..\.. -Item6=$(BCB)\include;$(BCB)\include\vcl -Item7=..\..\delphi;$(BCB)\include;$(BCB)\include\vcl - -[HistoryLists\hlLibraryPath] -Count=2 -Item0=$(BCB)\lib\obj;$(BCB)\lib -Item1=..\..\delphi;$(BCB)\lib\obj;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=3 -Item0=MNG_USE_DLL -Item1=_RTLDLL -Item2=_RTLDLL;USEPACKAGES - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -[Parameters] -RunParams= -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/mngview/MngView.cpp b/Engine/lib/lmng/bcb/mngview/MngView.cpp deleted file mode 100644 index bc4624bc0..000000000 --- a/Engine/lib/lmng/bcb/mngview/MngView.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -USERES("MngView.res"); -USEFORM("Main.cpp", MainForm); -USEFILE("README.txt"); -USELIB("..\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- -WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) -{ - try - { - Application->Initialize(); - Application->CreateForm(__classid(TMainForm), &MainForm); - Application->Run(); - } - catch (Exception &exception) - { - Application->ShowException(&exception); - } - return 0; -} -//--------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/mngview/MngView.res b/Engine/lib/lmng/bcb/mngview/MngView.res deleted file mode 100644 index a596e0985..000000000 Binary files a/Engine/lib/lmng/bcb/mngview/MngView.res and /dev/null differ diff --git a/Engine/lib/lmng/bcb/mngview/README.TXT b/Engine/lib/lmng/bcb/mngview/README.TXT deleted file mode 100644 index 28a54321a..000000000 --- a/Engine/lib/lmng/bcb/mngview/README.TXT +++ /dev/null @@ -1,22 +0,0 @@ - -Please note : - - If your project includes the header file "Rpcndr.h", then -you will then have to define "HAVE_BOOLEAN" before "libmng.h" -is included. Why ? ... - -"jmorecfg.h" has -#ifndef HAVE_BOOLEAN -typedef int boolean; -#endif - - and "Rpcndr.h" has -typedef unsigned char boolean - - This >>MAY<< affect other libraries used in the same project -that depend on the jpeg source - especially as "boolean" is -used in structures (possible alignment problems). For example -"Sam leffler's" LibTiff can be built with the Jpeg codec. - - Just a little something to be aware of !. AP - 15/9/2000. - diff --git a/Engine/lib/lmng/bcb/win32dll/libmng.bpr b/Engine/lib/lmng/bcb/win32dll/libmng.bpr deleted file mode 100644 index c02c4a645..000000000 --- a/Engine/lib/lmng/bcb/win32dll/libmng.bpr +++ /dev/null @@ -1,315 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = libmng.dll -OBJFILES = ..\..\..\obj\libmng.obj ..\..\..\obj\libmng_hlapi.obj \ - ..\..\..\obj\libmng_callback_xs.obj ..\..\..\obj\libmng_prop_xs.obj \ - ..\..\..\obj\libmng_chunk_xs.obj ..\..\..\obj\libmng_object_prc.obj \ - ..\..\..\obj\libmng_chunk_descr.obj ..\..\..\obj\libmng_chunk_prc.obj \ - ..\..\..\obj\libmng_chunk_io.obj ..\..\..\obj\libmng_read.obj \ - ..\..\..\obj\libmng_write.obj ..\..\..\obj\libmng_display.obj \ - ..\..\..\obj\libmng_dither.obj ..\..\..\obj\libmng_pixels.obj \ - ..\..\..\obj\libmng_filter.obj ..\..\..\obj\libmng_error.obj \ - ..\..\..\obj\libmng_trace.obj ..\..\..\obj\libmng_cms.obj \ - ..\..\..\obj\libmng_zlib.obj ..\..\..\obj\libmng_jpeg.obj \ - ..\..\..\obj\adler32.obj ..\..\..\obj\compress.obj ..\..\..\obj\crc32.obj \ - ..\..\..\obj\deflate.obj ..\..\..\obj\inffast.obj ..\..\..\obj\inflate.obj \ - ..\..\..\obj\inftrees.obj ..\..\..\obj\trees.obj ..\..\..\obj\uncompr.obj \ - ..\..\..\obj\zutil.obj ..\..\..\obj\jquant2.obj ..\..\..\obj\jcapistd.obj \ - ..\..\..\obj\jccoefct.obj ..\..\..\obj\jccolor.obj ..\..\..\obj\jcdctmgr.obj \ - ..\..\..\obj\jchuff.obj ..\..\..\obj\jcinit.obj ..\..\..\obj\jcmainct.obj \ - ..\..\..\obj\jcmarker.obj ..\..\..\obj\jcmaster.obj ..\..\..\obj\jcomapi.obj \ - ..\..\..\obj\jcparam.obj ..\..\..\obj\jcphuff.obj ..\..\..\obj\jcprepct.obj \ - ..\..\..\obj\jcsample.obj ..\..\..\obj\jctrans.obj ..\..\..\obj\jdapistd.obj \ - ..\..\..\obj\jdatadst.obj ..\..\..\obj\jdatasrc.obj ..\..\..\obj\jdcoefct.obj \ - ..\..\..\obj\jdcolor.obj ..\..\..\obj\jddctmgr.obj ..\..\..\obj\jdhuff.obj \ - ..\..\..\obj\jdinput.obj ..\..\..\obj\jdmainct.obj ..\..\..\obj\jdmarker.obj \ - ..\..\..\obj\jdmaster.obj ..\..\..\obj\jdmerge.obj ..\..\..\obj\jdphuff.obj \ - ..\..\..\obj\jdpostct.obj ..\..\..\obj\jdsample.obj ..\..\..\obj\jdtrans.obj \ - ..\..\..\obj\jerror.obj ..\..\..\obj\jfdctflt.obj ..\..\..\obj\jfdctfst.obj \ - ..\..\..\obj\jfdctint.obj ..\..\..\obj\jidctflt.obj ..\..\..\obj\jidctfst.obj \ - ..\..\..\obj\jidctint.obj ..\..\..\obj\jidctred.obj ..\..\..\obj\jmemmgr.obj \ - ..\..\..\obj\jmemnobs.obj ..\..\..\obj\jquant1.obj ..\..\..\obj\jcapimin.obj \ - ..\..\..\obj\jutils.obj ..\..\..\obj\jdapimin.obj -RESFILES = libmng.res -RESDEPEN = $(RESFILES) -LIBFILES = ..\..\..\lcms\Projects\Bcc-5.5-static\lcmsstat.lib -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = vclx35.bpi VCL35.bpi vcldb35.bpi vcldbx35.bpi bcbsmp35.bpi dclocx35.bpi \ - Qrpt35.bpi -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -WD -O2 -Hc -w- -d -k- -vi -w-par -c -tWD -CFLAG2 = -D_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL \ - -I"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin \ - -H=$(BCB)\lib\vcl35.csm -CFLAG3 = -Tkh30000 -ff -pr -wuse -wucp -wstv -wstu -wsig -wpin -wnod -wnak -wdef -wcln \ - -wbbf -wasm -wamp -wamb -PFLAGS = -D_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL \ - -N2..\..\..\obj -N0..\..\..\obj \ - -U"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin;$(RELEASELIBPATH) \ - -I"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin \ - -H -W -$L- -$D- -v -JPHN -M -RFLAGS = -D_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL \ - -i"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -AFLAGS = /i"c:\program files\borland\cbuilder3\projects" /i..\..\..\libmng-devel \ - /i..\..\..\zlib /i..\..\..\jpgsrc6b /i..\..\..\lcms\include /i..\..\..\lcms\src \ - /i$(BCB)\include /i$(BCB)\bin /d_NO_VCL /dMNG_BUILD_DLL /dMNG_FULL_CMS \ - /dMNG_STRICT_ANSI /dMNG_CHECK_BAD_ICCP /dZLIB_DLL /dZLIB_WINAPI \ - /dMNG_OPTIMIZE_FOOTPRINT_COMPOSE /dMNG_OPTIMIZE_FOOTPRINT_DIV \ - /dMNG_OPTIMIZE_FOOTPRINT_SWITCH /dXMNG_DECREMENT_LOOPS \ - /dMNG_OPTIMIZE_FOOTPRINT_INIT /dXMNG_OPTIMIZE_FOOTPRINT_MAGN \ - /dMNG_OPTIMIZE_OBJCLEANUP /dMNG_OPTIMIZE_CHUNKINITFREE \ - /dMNG_OPTIMIZE_CHUNKASSIGN /dMNG_OPTIMIZE_CHUNKREADER \ - /dXMNG_OPTIMIZE_DISPLAYCALLS /dXMNG_INCLUDE_MPNG_PROPOSAL \ - /dXMNG_INCLUDE_ANG_PROPOSAL /mx /w2 /zd -LFLAGS = -L"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin;$(RELEASELIBPATH) \ - -H:0x1000000 -Hc:0x10000 -B:0x60000000 -aa -Tpd -s -Gn -Gi -M -wdpl -d -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0d32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) import32.lib cw32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=1 -MinorVer=0 -Release=10 -Build=1440 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=1 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName=PNG/MNG Group -FileDescription=libmng - THE MNG library -FileVersion=1.0.10.1440 -InternalName=libmng -LegalCopyright=Copyright © 2000-2007 G. Juyn, 2007 G.Randers-Pherson -LegalTrademarks= -OriginalFilename=libmng.dll -ProductName=libmng -ProductVersion=1.0.10 -Comments= - -[HistoryLists\hlIncludePath] -Count=12 -Item0=c:\program files\borland\cbuilder3\projects;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item1=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item2=c:\program files\borland\cbuilder3\projects;..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item3=..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item4=..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;$(BCB)\include;$(BCB)\bin -Item5=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;$(BCB)\include;$(BCB)\bin -Item6=..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;$(BCB)\include;$(BCB)\bin -Item7=..\..\..\..\jpgsrc6b;..\..\..\..\lcms\include;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\include;$(BCB)\bin -Item8=..\..\..\..\lcms\include;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\include;$(BCB)\bin -Item9=..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\include;$(BCB)\bin -Item10=..\..\libmng;$(BCB)\include;$(BCB)\bin -Item11=..\..\libmng;$(BCB)\include - -[HistoryLists\hlLibraryPath] -Count=12 -Item0=c:\program files\borland\cbuilder3\projects;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin -Item1=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin -Item2=c:\program files\borland\cbuilder3\projects;..\..\..\lcms\src;..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item3=..\..\..\lcms\src;..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item4=..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item5=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item6=..\..\..\libmng;..\..\..\jpgsrc6b;..\..\..\zlib;$(BCB)\lib;$(BCB)\bin -Item7=..\..\..\..\jpgsrc6b;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item8=..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item9=..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item10=..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item11=..\..\libmng;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=7 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\src -Item1=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\source;..\..\..\lcms\src -Item2=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\source -Item3=..\..\..\jpgsrc6b;..\..\..\lcms\source;..\..\..\zlib;..\..\..\libmng -Item4=..\..\..\..\jpgsrc6b;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng -Item5=..\..\..\..\libmng -Item6=..\..\libmng - -[HistoryLists\hlConditionals] -Count=30 -Item0=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL -Item1=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;MNG_INCLUDE_MPNG_PROPOSAL;MNG_INCLUDE_ANG_PROPOSAL -Item2=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;MNG_INCLUDE_ANG_PROPOSAL -Item3=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;MNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL -Item4=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;MNG_INCLUDE_MPNG_PROPOSAL;MNG_INCLUDE_ANG6_PROPOSAL -Item5=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;MNG_INCLUDE_MPNG_PROPOSAL -Item6=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL -Item7=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;XMNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;MNG_INCLUDE_MPNG_PROPOSAL -Item8=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;MNG_SUPPORT_MPNG_PROPOSAL -Item9=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS -Item10=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;MNG_OPTIMIZE_DISPLAYCALLS -Item11=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS -Item12=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS -Item13=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS -Item14=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;MNG_NO_OLD_VERSIONS -Item15=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;MNG_OPTIMIZE_DISPLAYCALLS -Item16=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER -Item17=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_OBJCLEANUP;XMNG_OPTIMIZE_CHUNKINITFREE;XMNG_OPTIMIZE_CHUNKASSIGN;XMNG_OPTIMIZE_CHUNKREADER -Item18=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;XMNG_OPTIMIZE_CHUNKREADER -Item19=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER -Item20=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKASSIGN;XMNG_OPTIMIZE_CHUNKREADER -Item21=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKASSIGN -Item22=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_OBJCLEANUP -Item23=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_OPTIMIZE_CHUNKINITFREE -Item24=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_CHUNKINITFREE -Item25=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT -Item26=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;XMNG_OPTIMIZE_FOOTPRINT_COMPOSE;XMNG_OPTIMIZE_FOOTPRINT_DIV;XMNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_OPTIMIZE_FOOTPRINT_INIT -Item27=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_SUPPORT_TRACE -Item28=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;x_MNG_NO_16BIT_SUPPORT -Item29=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;MNG_OPTIMIZE_FOOTPRINT_INIT;MNG_NO_16BIT_SUPPORT - -[HistoryLists\hlIntOutputDir] -Count=2 -Item0=..\..\..\obj -Item1=..\..\..\..\obj - -[HistoryLists\hlHostApplication] -Count=23 -Item0=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngview.exe -Item1=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\MNGJNGportal.exe -Item2=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\gif2mng.exe -Item3=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngview_push.exe -Item4=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngtree.exe -Item5=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngdump.exe -Item6=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\lm_diag.exe -Item7=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\eMNGma.exe -Item8=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\bogus.exe -Item9=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\TestNGImage.exe -Item10=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngrepair.exe -Item11=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\Test_lz.exe -Item12=D:\Triple-T\Software\LossyPNG\Bin\Test_lz.exe -Item13=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\SlowView.exe -Item14=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\Bin\eMNGma.exe -Item15=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngpromo.exe -Item16=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\mngdump.exe -Item17=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\mngview.exe -Item18=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\bogus.exe -Item19=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\mngtree.exe -Item20=D:\Triple-T\Software\mnglib3t\libmng\samples\bcb\win32dll\mngview.exe -Item21=D:\Triple-T\Software\mnglib3t\libmng\samples\bcb\win32dll\mngdump.exe -Item22=D:\Triple-T\Software\mnglib3t\libmng\samples\Delphi3\mngdump\mngdump.exe - -[HistoryLists\hlRunParameters] -Count=3 -Item0=sample.mng -Item1=roilion02.mng roilion02-fixed.mng -Item2=usflag-lc-d63.mng - -[Debugging] -DebugSourceDirs=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\src - -[Parameters] -RunParams= -HostApplication=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngview.exe - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/win32dll/libmng.cpp b/Engine/lib/lmng/bcb/win32dll/libmng.cpp deleted file mode 100644 index 5ba4a8a89..000000000 --- a/Engine/lib/lmng/bcb/win32dll/libmng.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2007 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng.cpp copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : generic dll project assembly file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : Autogenerated file with the libmng.dll BCB project * */ -/* * * */ -/* * changes : 0.5.1 - 05/14/2000 - G.Juyn * */ -/* * - added this block * */ -/* * * */ -/* * 1.0.5 - 08/20/2000 - G.Juyn * */ -/* * - version-number & copyright * */ -/* * * */ -/* ************************************************************************** */ - -#include -#pragma hdrstop -#include - -/* ************************************************************************** */ - -USERES("libmng.res"); -USEUNIT("..\..\libmng_hlapi.c"); -USEUNIT("..\..\libmng_callback_xs.c"); -USEUNIT("..\..\libmng_prop_xs.c"); -USEUNIT("..\..\libmng_chunk_xs.c"); -USEUNIT("..\..\libmng_object_prc.c"); -USEUNIT("..\..\libmng_chunk_descr.c"); -USEUNIT("..\..\libmng_chunk_prc.c"); -USEUNIT("..\..\libmng_chunk_io.c"); -USEUNIT("..\..\libmng_read.c"); -USEUNIT("..\..\libmng_write.c"); -USEUNIT("..\..\libmng_display.c"); -USEUNIT("..\..\libmng_dither.c"); -USEUNIT("..\..\libmng_pixels.c"); -USEUNIT("..\..\libmng_filter.c"); -USEUNIT("..\..\libmng_error.c"); -USEUNIT("..\..\libmng_trace.c"); -USEUNIT("..\..\libmng_cms.c"); -USEUNIT("..\..\libmng_zlib.c"); -USEUNIT("..\..\libmng_jpeg.c"); -USEUNIT("..\..\..\zlib\adler32.c"); -USEUNIT("..\..\..\zlib\compress.c"); -USEUNIT("..\..\..\zlib\crc32.c"); -USEUNIT("..\..\..\zlib\deflate.c"); -USEUNIT("..\..\..\zlib\inffast.c"); -USEUNIT("..\..\..\zlib\inflate.c"); -USEUNIT("..\..\..\zlib\inftrees.c"); -USEUNIT("..\..\..\zlib\trees.c"); -USEUNIT("..\..\..\zlib\uncompr.c"); -USEUNIT("..\..\..\zlib\zutil.c"); -USEUNIT("..\..\..\jpgsrc6b\jquant2.c"); -USEUNIT("..\..\..\jpgsrc6b\jcapistd.c"); -USEUNIT("..\..\..\jpgsrc6b\jccoefct.c"); -USEUNIT("..\..\..\jpgsrc6b\jccolor.c"); -USEUNIT("..\..\..\jpgsrc6b\jcdctmgr.c"); -USEUNIT("..\..\..\jpgsrc6b\jchuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jcinit.c"); -USEUNIT("..\..\..\jpgsrc6b\jcmainct.c"); -USEUNIT("..\..\..\jpgsrc6b\jcmarker.c"); -USEUNIT("..\..\..\jpgsrc6b\jcmaster.c"); -USEUNIT("..\..\..\jpgsrc6b\jcomapi.c"); -USEUNIT("..\..\..\jpgsrc6b\jcparam.c"); -USEUNIT("..\..\..\jpgsrc6b\jcphuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jcprepct.c"); -USEUNIT("..\..\..\jpgsrc6b\jcsample.c"); -USEUNIT("..\..\..\jpgsrc6b\jctrans.c"); -USEUNIT("..\..\..\jpgsrc6b\jdapistd.c"); -USEUNIT("..\..\..\jpgsrc6b\jdatadst.c"); -USEUNIT("..\..\..\jpgsrc6b\jdatasrc.c"); -USEUNIT("..\..\..\jpgsrc6b\jdcoefct.c"); -USEUNIT("..\..\..\jpgsrc6b\jdcolor.c"); -USEUNIT("..\..\..\jpgsrc6b\jddctmgr.c"); -USEUNIT("..\..\..\jpgsrc6b\jdhuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jdinput.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmainct.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmarker.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmaster.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmerge.c"); -USEUNIT("..\..\..\jpgsrc6b\jdphuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jdpostct.c"); -USEUNIT("..\..\..\jpgsrc6b\jdsample.c"); -USEUNIT("..\..\..\jpgsrc6b\jdtrans.c"); -USEUNIT("..\..\..\jpgsrc6b\jerror.c"); -USEUNIT("..\..\..\jpgsrc6b\jfdctflt.c"); -USEUNIT("..\..\..\jpgsrc6b\jfdctfst.c"); -USEUNIT("..\..\..\jpgsrc6b\jfdctint.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctflt.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctfst.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctint.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctred.c"); -USEUNIT("..\..\..\jpgsrc6b\jmemmgr.c"); -USEUNIT("..\..\..\jpgsrc6b\jmemnobs.c"); -USEUNIT("..\..\..\jpgsrc6b\jquant1.c"); -USEUNIT("..\..\..\jpgsrc6b\jcapimin.c"); -USEUNIT("..\..\..\jpgsrc6b\jutils.c"); -USEUNIT("..\..\..\jpgsrc6b\jdapimin.c"); -USELIB("..\..\..\lcms\Projects\Bcc-5.5-static\lcmsstat.lib"); -//--------------------------------------------------------------------------- -#pragma argsused -int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) -{ - return 1; -} -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/bcb/win32dll/libmng.dll b/Engine/lib/lmng/bcb/win32dll/libmng.dll deleted file mode 100644 index 50c4e8250..000000000 Binary files a/Engine/lib/lmng/bcb/win32dll/libmng.dll and /dev/null differ diff --git a/Engine/lib/lmng/contrib/README b/Engine/lib/lmng/contrib/README deleted file mode 100644 index 08d01e9a0..000000000 --- a/Engine/lib/lmng/contrib/README +++ /dev/null @@ -1 +0,0 @@ -For details check the README.contrib file in the parent directory! diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/About.cpp b/Engine/lib/lmng/contrib/bcb/mngdump/About.cpp deleted file mode 100644 index dce6ea8eb..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/About.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//--------------------------------------------------------------------------- -// About.cpp : About pane text -//--------------------------------------------------------------------------- -#include "About.h" - -// NB : If more text is to go in here don't forget to enlarge min/max -extern char *_szAbout = { -"\nCopyright (c) 2000 Andy Protano (a.a.protano@care4free.net)"\ -"\n Gerard Juyn (gerard@libmng.com)"\ -"\n"\ -"\nLibmng website - www.libmng.com" -"\nMNG Homepage - www.libpng.org/pub/mng" -"\nPNG Homepage - www.libpng.org/pub/png" -"\n" -"\nThis program is based upon the orignal \'MngTree\' by Gerard Juyn"\ -"\nAuthor & current maintainer : Andy Protano (a.a.protano@care4free.net)"\ -"\n"\ -"\nThis software is based on libmng which in its turn is based on software by :"\ -"\n"\ -"\nIndependant JPEG Group - http://www.ijg.org"\ -"\nLcms (little CMS) library by Marti Maria Saguar - http://www.lcms.colorid.de"\ -"\nZlib - http://www.info-zip.org/pub/infozip/zlib"\ -}; -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/About.h b/Engine/lib/lmng/contrib/bcb/mngdump/About.h deleted file mode 100644 index fd36c637c..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/About.h +++ /dev/null @@ -1,7 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef AboutH -#define AboutH -//--------------------------------------------------------------------------- -extern char *_szAbout; -#endif - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.CPP b/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.CPP deleted file mode 100644 index c2378fed4..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.CPP +++ /dev/null @@ -1,96 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -# include - -#include "Main.h" - -//--------------------------------------------------------------------------- -mng_ptr __stdcall TMainForm::Alloc( mng_size_t iSize ) -{ - return (mng_ptr)calloc( 1, (size_t)iSize ); -} -//--------------------------------------------------------------------------- -void __stdcall TMainForm::Free( mng_ptr pPtr, mng_size_t iSize ) -{ - free( pPtr ); - return; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::FileReadData( mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead ) -{ -TMainForm *MainForm = (TMainForm *)mng_get_userdata( hMNG ); - - *iRead = fread( pBuf, 1, iSize, MainForm->GetFd() ); - - // iRead will indicate EOF - - MainForm->ProgressBar1->Position += (int)iRead; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::ProcessHeader( mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight ) -{ -TMainForm *MainForm = (TMainForm *)mng_get_userdata( hHandle ); - - MainForm->Caption = ExtractFileName( MainForm->OpenDialog1->FileName ) + - " [" + - String( iWidth ) + - "x" + - String( iHeight ) + - "]"; - - Application->Title = MainForm->asAppName + " " + MainForm->Caption; - - MainForm->ProgressBar1->Max = iWidth * iHeight; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::OpenStream( mng_handle hMNG ) -{ - // nothing to do ! - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::CloseStream( mng_handle hMNG ) -{ - MainForm->ProgressBar1->Position = 0; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::IterateChunks( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq ) -{ -TMainForm *MainForm = (TMainForm *)mng_get_userdata( hMNG ); -char aCh[5]; - - // decode the chunkname - aCh[0] = (char)((iChunktype >> 24) & 0xFF); - aCh[1] = (char)((iChunktype >> 16) & 0xFF); - aCh[2] = (char)((iChunktype >> 8) & 0xFF); - aCh[3] = (char)((iChunktype ) & 0xFF); - aCh[4] = (char)0; // zero terminate - used as a "C" string below - - MainForm->RichEditReport->Lines->Add( "" ); - - MainForm->RichEditReport->Lines->Add( - "Chunk " + String( iChunkseq + 1 ) + " : " + String( aCh ) ); - - // Add Chunk text to listbox - MainForm->ListBoxChunks->Items->Add( aCh ); - - // keep'm coming ... unless we encounter an error - return MainForm->ShowChunk( hMNG, hChunk, iChunktype ); -} -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.H b/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.H deleted file mode 100644 index 224a3130c..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.H +++ /dev/null @@ -1,39 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#include "Main.h" -#include "libmng.h" -#pragma hdrstop - -#ifndef CallbackH -#define CallbackH - -//--------------------------------------------------------------------------- -extern mng_ptr __stdcall myalloc( mng_size_t iSize ); -//--------------------------------------------------------------------------- -extern void __stdcall myfree( mng_ptr pPtr, mng_size_t iSize ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myreaddata( mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall ProcessHeader( mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myopenstream( mng_handle hMNG ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myclosestream( mng_handle hMNG ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myiterchunk ( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall mytraceproc( mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname ); -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -#endif diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP b/Engine/lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP deleted file mode 100644 index 16a7f1a07..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP +++ /dev/null @@ -1,1689 +0,0 @@ -// -// Chunks.cpp -// -// The following functions are to assemble a string for each chunk -// The function name "Info_????" denote which chunk it handles -// -// Comments marked @todo@ may, or maynot, be filled in at a later date ! -// -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -#include "Main.h" - -# define xUSE_UNKNOWN // remove "x" to report of "UNKNOWN" - else "" - -# define FFACTOR ((float)100000.0) - -// NB We must use Octal for RichEdit's newlines - MicroSoft love Octal ! -# define nl "\015\012" -# define TAB asTab - -// Ps : If anyone reading this knows how to do this using token -// pasting please let me know ! (AP) - -// ConCat newline to string -# define NL as = as + nl - -// Integer ARGuement -# define IARG( _str_, _int_ )\ - as = as + TAB + (_str_) + " " + String( _int_ ) - -// Bool ARGuement -# define BARG( _str_, _bool_ )\ - if( WantsBool() )\ - as = as + TAB + (_str_) + " " + ((_bool_) ? "true" : "false");\ - else\ - as = as + TAB + (_str_) + " " + IntToStr( _bool_ ); - -// Float ARGuement -# define FARG( _str_, _float_ )\ - as = as + TAB + (_str_) + " " + String( _float_ ) - -// szText ARGuement -# define ZARG( _str_, _sz_ )\ - as = as + TAB + (_str_) + " \"" + String( _sz_ ) + "\"" - -// Concat general strings -# define STR( _str_ ) as = as + _str_ - -// Concat Hex string -# define HEXSTR( _str_ ) as = as + IntToHex(_str_,2) - -// Concat Macro Identifier to ARG -#define MI( _str_ ) as = as + TAB + _str_; - -// Concat "(" Comment ")" to ARG -#define PCOM( _str_ )\ - if( WantsComments() ) as = as + TAB + "(" + _str_ + ")"; - -// Concat "float(" Comment ")" to ARG -#define FPCOM( _str_ )\ - if( WantsComments() ) as = as + TAB + "float(" + _str_ + ")"; - -//--------------------------------------------------------------------------- -// Macro Identifiers - these, below, are used several times -// NB those used once have local #define's and #undef's -//--------------------------------------------------------------------------- - -# ifdef USE_UNKNOWN -# define UNKNOWN "UNKNOWN" -# else -# define UNKNOWN "" -# endif -// Does this need two to be more visible ? -# define ILLEGAL_VALUE ">> ILLEGAL VALUE << " - -// IHDR, BASI, JHDR, PROM, sPLT -# define MI_BITDEPTH( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_BITDEPTH_1 : MI( "MNG_BITDEPTH_1" ); break;\ - case MNG_BITDEPTH_2 : MI( "MNG_BITDEPTH_2" ); break;\ - case MNG_BITDEPTH_4 : MI( "MNG_BITDEPTH_4" ); break;\ - case MNG_BITDEPTH_8 : MI( "MNG_BITDEPTH_8" ); break;\ - case MNG_BITDEPTH_16 : MI( "MNG_BITDEPTH_16" ); break;\ - default : MI(ILLEGAL_VALUE);\ - } - -// IHDR, BASI, PROM -# define MI_COLORTYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_COLORTYPE_GRAY : MI( "MNG_COLORTYPE_GRAY" ); break;\ - case MNG_COLORTYPE_RGB : MI( "MNG_COLORTYPE_RGB" ); break;\ - case MNG_COLORTYPE_INDEXED : MI( "MNG_COLORTYPE_INDEXED" ); break;\ - case MNG_COLORTYPE_GRAYA : MI( "MNG_COLORTYPE_GRAYA" ); break;\ - case MNG_COLORTYPE_RGBA : MI( "MNG_COLORTYPE_RGBA" ); break;\ - default : MI(ILLEGAL_VALUE);\ - } - -// IHDR, zTXt, iTXt, iCCP, BASI, JHDR -# define MI_COMPRESSION_DEFLATE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_COMPRESSION_DEFLATE ) {\ - MI( "MNG_COMPRESSION_DEFLATE" );\ - } else {\ - MI( ILLEGAL_VALUE );\ - }\ - } - -// IHDR, BASI, JHDR -# define MI_FILTER( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_FILTER_ADAPTIVE : MI( "MNG_FILTER_ADAPTIVE" ); break;\ - case MNG_FILTER_NO_ADAPTIVE : MI( "MNG_FILTER_NO_ADAPTIVE" ); break;\ - case MNG_FILTER_DIFFERING : MI( "MNG_FILTER_DIFFERING" ); break;\ - case MNG_FILTER_MASK : MI( "MNG_FILTER_MASK" ); break;\ - default : MI(UNKNOWN);\ - } - //NB MNG_FILTER_NO_DIFFERING == MNG_FILTER_ADAPTIVE - -// IHDR, BASI, JHDR -#define MI_INTERLACE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_INTERLACE_NONE ) {\ - MI( "MNG_INTERLACE_NONE" )\ - } else if( (_i_) == MNG_INTERLACE_ADAM7 ) {\ - MI( "MNG_INTERLACE_ADAM7" );\ - } else { MI(ILLEGAL_VALUE);} \ - } - -// pHYs, pHYg -#define MI_UNITS( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_UNIT_UNKNOWN ) {\ - MI( "MNG_UNIT_UNKNOWN" )\ - } else if( (_i_) == MNG_UNIT_METER ) {\ - MI( "MNG_UNIT_METER" );\ - } else { MI(UNKNOWN);} \ - } - -// CLON & MOVE -#define MI_LOCATION( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_LOCATION_ABSOLUTE ) {\ - MI( "MNG_LOCATION_ABSOLUTE" )\ - } else if( (_i_) == MNG_LOCATION_RELATIVE ) {\ - MI( "MNG_LOCATION_RELATIVE" );\ - } else { MI(ILLEGAL_VALUE);} \ - } - -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_BACK( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -// NB for BACKGROUND other values are only advisory -#define MI_BACKGROUND( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_BACKGROUNDCOLOR_MANDATORY ) {\ - MI( "MNG_BACKGROUNDCOLOR_MANDATORY" )\ - } else if( (_i_) == MNG_BACKGROUNDIMAGE_MANDATORY ) {\ - MI( "MNG_BACKGROUNDIMAGE_MANDATORY" );\ - } \ - } - -# define MI_BACKGROUND_TILE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_BACKGROUNDIMAGE_NOTILE : MI( "MNG_BACKGROUNDIMAGE_NOTILE" ); break;\ - case MNG_BACKGROUNDIMAGE_TILE : MI( "MNG_BACKGROUNDIMAGE_TILE" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; -mng_uint8 iMandatory; -mng_uint16 iImageid; -mng_uint8 iTile; - - if( mng_getchunk_back( hMNG, hChunk, - &iRed, &iGreen, &iBlue, - &iMandatory, &iImageid, &iTile ) != 0 ) - return false; - - IARG( "iRed", iRed ); - NL; IARG( "iGreen",iGreen ); - NL; IARG( "iBlue", iBlue ); - NL; IARG( "iMandatory", iMandatory ); MI_BACKGROUND( iMandatory ); - NL; IARG( "iImageid", iImageid ); - NL; IARG( "iTile", iTile ); MI_BACKGROUND_TILE( iTile ); - - return true; -# undef MI_BACKGROUND -# undef MI_BACKGROUND_TILE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_BASI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -#define MI_VIEWABLE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_NOTVIEWABLE ) {\ - MI( "MNG_NOTVIEWABLE" )\ - } else if( (_i_) == MNG_VIEWABLE ) {\ - MI( "MNG_VIEWABLE" );\ - } else { MI(UNKNOWN);} \ - } -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint8 iBitdepth; -mng_uint8 iColortype; -mng_uint8 iCompression; -mng_uint8 iFilter; -mng_uint8 iInterlace; -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; -mng_uint16 iAlpha; -mng_uint8 iViewable; - - if( mng_getchunk_basi( hMNG, hChunk, - &iWidth, &iHeight, &iBitdepth, &iColortype, - &iCompression, &iFilter, &iInterlace, - &iRed, &iGreen, &iBlue, &iAlpha, - &iViewable ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iBitdepth", iBitdepth ); MI_BITDEPTH( iBitdepth ); - NL; IARG( "iColortype", iColortype ); MI_COLORTYPE( iColortype ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iFilter", iFilter ); MI_FILTER( iFilter ); - NL; IARG( "iInterlace", iInterlace ); MI_INTERLACE( iInterlace ); - NL; IARG( "iRed", iRed ); - NL; IARG( "iGreen", iGreen ); - NL; IARG( "iBlue", iBlue ); - NL; IARG( "iAlpha", iAlpha ); - NL; IARG( "iViewable", iViewable ); MI_VIEWABLE( iViewable ); - - return true; -# undef MI_VIEWABLE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_CLIP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_CLIPPING( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CLIPPING_ABSOLUTE : MI( "MNG_CLIPPING_ABSOLUTE" ); break;\ - case MNG_CLIPPING_RELATIVE : MI( "MNG_CLIPPING_RELATIVE" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint8 iCliptype; -mng_int32 iClipl; -mng_int32 iClipr; -mng_int32 iClipt; -mng_int32 iClipb; - - if( mng_getchunk_clip( hMNG, hChunk, - &iFirstid, &iLastid, - &iCliptype, &iClipl, &iClipr, &iClipt, &iClipb ) != 0 ) - return false; - - IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iCliptype", iCliptype ); MI_CLIPPING( iCliptype ); - NL; IARG( "iClipl", iClipl ); - NL; IARG( "iClipr", iClipr ); - NL; IARG( "iClipt", iClipt ); - NL; IARG( "iClipb", iClipb ); - - return true; -# undef MI_CLIPPING -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_CLON( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_CLONTYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_FULL_CLONE : MI( "MNG_FULL_CLONE" ); break;\ - case MNG_PARTIAL_CLONE : MI( "MNG_PARTIAL_CLONE" ); break;\ - case MNG_RENUMBER : MI( "MNG_RENUMBER" ); break;\ - default : MI(UNKNOWN);\ - } - -#define MI_CLON_CONCRETE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_CONCRETE_ASPARENT ) {\ - MI( "MNG_CONCRETE_ASPARENT" )\ - } else if( (_i_) == MNG_CONCRETE_MAKEABSTRACT ) {\ - MI( "MNG_CONCRETE_MAKEABSTRACT" );\ - } else { MI(UNKNOWN);} \ - } - -mng_uint16 iSourceid; -mng_uint16 iCloneid; -mng_uint8 iClonetype; -mng_uint8 iDonotshow; -mng_uint8 iConcrete; -mng_bool bHasloca; -mng_uint8 iLocationtype; -mng_int32 iLocationx; -mng_int32 iLocationy; - - if( mng_getchunk_clon( hMNG, hChunk, - &iSourceid, &iCloneid, &iClonetype, &iDonotshow, - &iConcrete, &bHasloca, - &iLocationtype, &iLocationx, &iLocationy ) != 0 ) - return false; - - IARG( "iSourceid", iSourceid ); - NL; IARG( "iCloneid", iCloneid ); - NL; IARG( "iClonetype", iClonetype ); MI_CLONTYPE( iClonetype ); - NL; IARG( "iDonotshow", iDonotshow ); - NL; IARG( "iConcrete", iConcrete ); MI_CLON_CONCRETE( iConcrete ); - NL; BARG( "bHasloca", bHasloca ); - NL; IARG( "iLocationtype", iLocationtype ); MI_LOCATION( iLocationtype ); - NL; IARG( "iLocationx", iLocationx ); - NL; IARG( "iLocationy", iLocationy ); - - return true; -# undef MI_CLONTYPE -# undef MI_CLON_CONCRETE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DBYK( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_POLARITY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_POLARITY_ONLY : MI( "MNG_POLARITY_ONLY" ); break;\ - case MNG_POLARITY_ALLBUT : MI( "MNG_POLARITY_ALLBUT" ); break;\ - default : MI(UNKNOWN);\ - } -mng_chunkid iChunkname; -mng_uint8 iPolarity; -mng_uint32 iKeywordssize; -mng_pchar zKeywords; - - if( mng_getchunk_dbyk( hMNG, hChunk, - &iChunkname, &iPolarity, &iKeywordssize, &zKeywords ) != 0 ) - return false; - - IARG( "iChunkname", iChunkname ); // show chunk name ? @todo@ - NL; IARG( "iPolarity", iPolarity ); MI_POLARITY( iPolarity ); - NL; IARG( "iKeywordssize", iKeywordssize ); - NL; ZARG( "zKeywords", zKeywords ); - - return true; -# undef MI_POLARITY -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DEFI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -#define MI_DONOTSHOW( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_DONOTSHOW_VISIBLE ) {\ - MI( "MNG_DONOTSHOW_VISIBLE" )\ - } else if( (_i_) == MNG_DONOTSHOW_NOTVISIBLE ) {\ - MI( "MNG_DONOTSHOW_NOTVISIBLE" );\ - }\ - } - -#define MI_DEFI_CONCRETE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_ABSTRACT ) {\ - MI( "MNG_ABSTRACT" )\ - } else if( (_i_) == MNG_CONCRETE ) {\ - MI( "MNG_CONCRETE" );\ - }\ - } -mng_uint16 iObjectid; -mng_uint8 iDonotshow; -mng_uint8 iConcrete; -mng_bool bHasloca; -mng_int32 iXlocation; -mng_int32 iYlocation; -mng_bool bHasclip; -mng_int32 iLeftcb; -mng_int32 iRightcb; -mng_int32 iTopcb; -mng_int32 iBottomcb; - - if( mng_getchunk_defi( hMNG, hChunk, - &iObjectid, &iDonotshow, &iConcrete, - &bHasloca, &iXlocation, &iYlocation, - &bHasclip, &iLeftcb, &iRightcb, &iTopcb, &iBottomcb ) != 0 ) - return false; - - IARG( "iObjectid", iObjectid ); - NL; IARG( "iDonotshow", iDonotshow ); MI_DONOTSHOW( iDonotshow ); - NL; IARG( "iConcrete", iConcrete ); MI_DEFI_CONCRETE( iConcrete ); - NL; BARG( "bHasloca", bHasloca ); - NL; IARG( "iXlocation", iXlocation ); - NL; IARG( "iYlocation", iYlocation ); - NL; BARG( "bHasclip", bHasclip ); - NL; IARG( "iLeftcb", iLeftcb ); - NL; IARG( "iRightcb", iRightcb ); - NL; IARG( "iTopcb", iTopcb ); - NL; IARG( "iBottomcb", iBottomcb ); - - return true; -# undef MI_DONOTSHOW -# undef MI_DEFI_CONCRETE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DHDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_IMAGETYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_IMAGETYPE_UNKNOWN : MI( "MNG_IMAGETYPE_UNKNOWN" ); break;\ - case MNG_IMAGETYPE_PNG : MI( "MNG_IMAGETYPE_PNG" ); break;\ - case MNG_IMAGETYPE_JNG : MI( "MNG_IMAGETYPE_JNG" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_DELTATYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_DELTATYPE_REPLACE : MI( "MNG_DELTATYPE_REPLACE" ); break;\ - case MNG_DELTATYPE_BLOCKPIXELADD : MI( "MNG_DELTATYPE_BLOCKPIXELADD" ); break;\ - case MNG_DELTATYPE_BLOCKALPHAADD : MI( "MNG_DELTATYPE_BLOCKALPHAADD" ); break;\ - case MNG_DELTATYPE_BLOCKCOLORADD : MI( "MNG_DELTATYPE_BLOCKCOLORADD" ); break;\ - case MNG_DELTATYPE_BLOCKPIXELREPLACE : MI( "MNG_DELTATYPE_BLOCKPIXELREPLACE" ); break;\ - case MNG_DELTATYPE_BLOCKALPHAREPLACE : MI( "MNG_DELTATYPE_BLOCKALPHAREPLACE" ); break;\ - case MNG_DELTATYPE_BLOCKCOLORREPLACE : MI( "MNG_DELTATYPE_BLOCKCOLORREPLACE" ); break;\ - case MNG_DELTATYPE_NOCHANGE : MI( "MNG_DELTATYPE_NOCHANGE" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_uint16 iObjectid; -mng_uint8 iImagetype; -mng_uint8 iDeltatype; -mng_uint32 iBlockwidth; -mng_uint32 iBlockheight; -mng_uint32 iBlockx; -mng_uint32 iBlocky; - - if( mng_getchunk_dhdr( hMNG, hChunk, - &iObjectid, &iImagetype, &iDeltatype, - &iBlockwidth, &iBlockheight, &iBlockx, &iBlocky ) != 0 ) - return false; - - IARG( "iObjectid", iObjectid ); - NL; IARG( "iImagetype", iImagetype ); MI_IMAGETYPE( iImagetype ); - NL; IARG( "iDeltatype", iDeltatype ); MI_DELTATYPE( iDeltatype ); - NL; IARG( "iBlockwidth", iBlockwidth ); - NL; IARG( "iBlockheight", iBlockheight ); - NL; IARG( "iBlockx", iBlockx ); - NL; IARG( "iBlocky", iBlocky ); - - return true; -# undef MI_IMAGETYPE -# undef MI_DELTATYPE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DISC( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; -mng_uint16p pObjectids; - - if( mng_getchunk_disc( hMNG, hChunk, &iCount, &pObjectids ) != 0 ) - return false; - - IARG( "iCount", iCount ); - //pObjectids pObjectids - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DROP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; -mng_chunkidp pChunknames; - - if( mng_getchunk_drop( hMNG, hChunk, &iCount, &pChunknames ) != 0 ) - return false; - - IARG( "iCount", iCount ); - // pChunknamesp Chunknames // Iterate chunk names ? @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_ENDL( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint8 iLevel; - - if( mng_getchunk_endl( hMNG, hChunk, &iLevel ) != 0 ) - return false; - - IARG( "iLevel", iLevel ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_FRAM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_BOUNDARY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_BOUNDARY_ABSOLUTE : MI( "MNG_BOUNDARY_ABSOLUTE" ); break;\ - case MNG_BOUNDARY_RELATIVE : MI( "MNG_BOUNDARY_RELATIVE" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_FRAMINGMODE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_FRAMINGMODE_NOCHANGE : MI( "MNG_FRAMINGMODE_NOCHANGE" ); break;\ - case MNG_FRAMINGMODE_1 : MI( "MNG_FRAMINGMODE_1" ); break;\ - case MNG_FRAMINGMODE_2 : MI( "MNG_FRAMINGMODE_2" ); break;\ - case MNG_FRAMINGMODE_3 : MI( "MNG_FRAMINGMODE_3" ); break;\ - case MNG_FRAMINGMODE_4 : MI( "MNG_FRAMINGMODE_4" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGEDELAY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGEDELAY_NO : MI( "MNG_CHANGEDELAY_NO" ); break;\ - case MNG_CHANGEDELAY_NEXTSUBFRAME : MI( "MNG_CHANGEDELAY_NEXTSUBFRAME" ); break;\ - case MNG_CHANGEDELAY_DEFAULT : MI( "MNG_CHANGEDELAY_DEFAULT" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGETIMOUT( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGETIMOUT_NO : MI( "MNG_CHANGETIMOUT_NO" ); break;\ - case MNG_CHANGETIMOUT_DETERMINISTIC_1 : MI( "MNG_CHANGETIMOUT_DETERMINISTIC_1" ); break;\ - case MNG_CHANGETIMOUT_DETERMINISTIC_2 : MI( "MNG_CHANGETIMOUT_DETERMINISTIC_2" ); break;\ - case MNG_CHANGETIMOUT_DECODER_1 : MI( "MNG_CHANGETIMOUT_DECODER_1" ); break;\ - case MNG_CHANGETIMOUT_DECODER_2 : MI( "MNG_CHANGETIMOUT_DECODER_2" ); break;\ - case MNG_CHANGETIMOUT_USER_1 : MI( "MNG_CHANGETIMOUT_USER_1" ); break;\ - case MNG_CHANGETIMOUT_USER_2 : MI( "MNG_CHANGETIMOUT_USER_2" ); break;\ - case MNG_CHANGETIMOUT_EXTERNAL_1 : MI( "MNG_CHANGETIMOUT_EXTERNAL_1" ); break;\ - case MNG_CHANGETIMOUT_EXTERNAL_2 : MI( " MNG_CHANGETIMOUT_EXTERNAL_2" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGECLIPPING( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGECLIPPING_NO : MI( "MNG_CHANGECLIPPING_NO" ); break;\ - case MNG_CHANGECLIPPING_NEXTSUBFRAME : MI( "MNG_CHANGECLIPPING_NEXTSUBFRAME" ); break;\ - case MNG_CHANGECLIPPING_DEFAULT : MI( "MNG_CHANGECLIPPING_DEFAULT" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGESYNCID( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGESYNCID_NO : MI( "MNG_CHANGESYNCID_NO" ); break;\ - case MNG_CHANGESYNCID_NEXTSUBFRAME : MI( "MNG_CHANGESYNCID_NEXTSUBFRAME" ); break;\ - case MNG_CHANGESYNCID_DEFAULT : MI( "MNG_CHANGESYNCID_DEFAULT" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_bool bEmpty; -mng_uint8 iMode; -mng_uint32 iNamesize; -mng_pchar zName; -mng_uint8 iChangedelay; -mng_uint8 iChangetimeout; -mng_uint8 iChangeclipping; -mng_uint8 iChangesyncid; -mng_uint32 iDelay; -mng_uint32 iTimeout; -mng_uint8 iBoundarytype; -mng_int32 iBoundaryl; -mng_int32 iBoundaryr; -mng_int32 iBoundaryt; -mng_int32 iBoundaryb; -mng_uint32 iCount; -mng_uint32p pSyncids; - - if( mng_getchunk_fram( hMNG, hChunk, - &bEmpty, &iMode, &iNamesize, &zName, - &iChangedelay, &iChangetimeout, &iChangeclipping, &iChangesyncid, - &iDelay, &iTimeout, - &iBoundarytype, &iBoundaryl, &iBoundaryr,&iBoundaryt, &iBoundaryb, - &iCount, &pSyncids ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iMode", iMode ); MI_FRAMINGMODE( iMode ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - NL; IARG( "iChangedelay", iChangedelay ); MI_CHANGEDELAY( iChangedelay ); - NL; IARG( "iChangetimeout", iChangetimeout ); MI_CHANGETIMOUT( iChangetimeout ); - NL; IARG( "iChangeclipping", iChangeclipping ); MI_CHANGECLIPPING( iChangeclipping ); - NL; IARG( "iChangesyncid", iChangesyncid ); MI_CHANGESYNCID( iChangesyncid ); - NL; IARG( "iDelay", iDelay ); - NL; IARG( "iTimeout", iTimeout ); - NL; IARG( "iBoundarytype", iBoundarytype ); MI_BOUNDARY( iBoundarytype ); - NL; IARG( "iBoundaryl", iBoundaryl ); - NL; IARG( "iBoundaryr", iBoundaryr ); - NL; IARG( "iBoundaryt", iBoundaryt ); - NL; IARG( "iBoundaryb", iBoundaryb ); - NL; IARG( "iCount", iCount ); - //pSyncids pSyncids @todo@ - - return true; -# undef MI_BOUNDARY -# undef MI_FRAMINGMODE -# undef MI_CHANGEDELAY -# undef MI_CHANGETIMOUT -# undef MI_CHANGECLIPPING -# undef MI_CHANGESYNCID -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_IDAT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iRawlen; -mng_ptr pRawdata; - - if( mng_getchunk_idat( hMNG, hChunk, &iRawlen, &pRawdata ) != 0 ) - return false; - - IARG( "iRawlen", iRawlen ); - - if( WantsRawData() ) { - Byte *bp = (Byte*)pRawdata; - - NL; STR( TAB + "Rawdata : " ); - // show the first 16 bytes, as hex - for( int n = 0; n < 16; n +=1 ) - HEXSTR( (int)bp[n] ) + " "; - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_IEND( mng_handle hMNG, mng_handle hChunk, String &as ) -{ - NL + TAB; STR( "End of Image." ); - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_IHDR( - mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint8 iBitdepth; -mng_uint8 iColortype; -mng_uint8 iCompression; -mng_uint8 iFilter; -mng_uint8 iInterlace; - - if( mng_getchunk_ihdr( hMNG, hChunk, &iWidth, &iHeight, &iBitdepth, - &iColortype, &iCompression, &iFilter, &iInterlace ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iBitdepth", iBitdepth ); MI_BITDEPTH( iBitdepth ); - NL; IARG( "iColortype", iColortype ); MI_COLORTYPE( iColortype ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iFilter", iFilter ); MI_FILTER( iFilter ); - NL; IARG( "iInterlace", iInterlace ); MI_INTERLACE( iInterlace ); - - if( WantsComments() ) - { - NL; NL + TAB; - switch( iColortype ) { - case MNG_COLORTYPE_GRAY : - switch( iBitdepth ) { - case 1 : case 2 : case 4 : case 8 : case 16 : - STR( "Each pixel value is a greyscale level -" ); - } // inner switch - break; - case MNG_COLORTYPE_RGB : - switch( iBitdepth ) { - case 8 : case 16 : - STR( "Each pixel value is an R,G,B series -" ); - } // inner switch - break; - case MNG_COLORTYPE_INDEXED : - switch( iBitdepth ) { - case 1 : case 2 : case 4 : case 8 : - STR( "Each pixel value is a palette index -" ); - } // inner switch - break; - case MNG_COLORTYPE_GRAYA : - switch( iBitdepth ) { - case 8 : case 16 : - STR( "Each pixel value is a greyscale level, "\ - "followed by an Alpha channel level -" ); - } // inner switch - break; - case MNG_COLORTYPE_RGBA : - switch( iBitdepth ){ - case 8 : case 16: - STR( "Each pixel value is an R,G,B "\ - "series, followed by an Alpha channel level -" ); - } // inner switch - break; - } - STR( " " + String(iBitdepth) + " bits per pixel." ); - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_JDAT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iRawlen; -mng_ptr pRawdata = NULL; - - if( mng_getchunk_jdat( hMNG, hChunk, &iRawlen, &pRawdata ) != 0 ) - return false; - - IARG( "iRawlen", iRawlen ); - - if( WantsRawData() ) { - Byte *bp = (Byte*)pRawdata; - - NL; STR( TAB + "Rawdata : " ); - // show the first 16 bytes, as hex - for( int n = 0; n < 16; n +=1 ) - HEXSTR( (int)bp[n] ) + " "; - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_JHDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_JPEG_COLORTYPE( _i_ )\ - if( WantsMacroIds() ) {\ - switch( _i_ ){\ - case MNG_COLORTYPE_JPEGGRAY : MI( "MNG_COLORTYPE_JPEGGRAY");break;\ - case MNG_COLORTYPE_JPEGCOLOR : MI( "MNG_COLORTYPE_JPEGCOLOR");break;\ - case MNG_COLORTYPE_JPEGGRAYA : MI( "MNG_COLORTYPE_JPEGGRAYA");break;\ - case MNG_COLORTYPE_JPEGCOLORA : MI( "MNG_COLORTYPE_JPEGCOLORA");break;\ - default : MI(UNKNOWN);\ - }\ -} - -# define MI_JPEG_BITDEPTH( _i_ )\ - if( WantsMacroIds() ) {\ - switch( _i_ ){\ - case MNG_BITDEPTH_JPEG8 : MI("MNG_BITDEPTH_JPEG8");break;\ - case MNG_BITDEPTH_JPEG12 : MI("MNG_BITDEPTH_JPEG12");break;\ - case MNG_BITDEPTH_JPEG8AND12 : MI("MNG_BITDEPTH_JPEG8AND12");break;\ - default : MI(UNKNOWN);\ - }\ - } - -# define MI_JPEGCOMPRESSION( _i_ )\ - if( WantsMacroIds() ) {\ - if( iImagecompression == MNG_COMPRESSION_BASELINEJPEG ) {\ - MI( "MNG_COMPRESSION_BASELINEJPEG" );\ - } else { MI(ILLEGAL_VALUE); };\ - } - -# define MI_JPEGINTERLACE( _i_ )\ - if( WantsMacroIds() ) {\ - if( iImageinterlace == MNG_INTERLACE_SEQUENTIAL ) {\ - MI( "MNG_INTERLACE_SEQUENTIAL");\ - } else {\ - MI( "MNG_INTERLACE_PROGRESSIVE" );\ - }\ - } - -// NB alpha bitdepth is not png bitdepth because it can be 0 (zero) -# define MI_ALPHABITDEPTH( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_BITDEPTH_1 : MI( "MNG_BITDEPTH_1" ); break;\ - case MNG_BITDEPTH_2 : MI( "MNG_BITDEPTH_2" ); break;\ - case MNG_BITDEPTH_4 : MI( "MNG_BITDEPTH_4" ); break;\ - case MNG_BITDEPTH_8 : MI( "MNG_BITDEPTH_8" ); break;\ - case MNG_BITDEPTH_16 : MI( "MNG_BITDEPTH_16" ); break;\ - case 0 : break;\ - default : MI(ILLEGAL_VALUE);\ - } - -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint8 iColortype; -mng_uint8 iImagesampledepth; -mng_uint8 iImagecompression; -mng_uint8 iImageinterlace; -mng_uint8 iAlphasampledepth; -mng_uint8 iAlphacompression; -mng_uint8 iAlphafilter; -mng_uint8 iAlphainterlace; - - if( mng_getchunk_jhdr( hMNG, hChunk, - &iWidth, &iHeight, &iColortype, &iImagesampledepth, - &iImagecompression, &iImageinterlace, - &iAlphasampledepth, &iAlphacompression, - &iAlphafilter, &iAlphainterlace ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iColortype", iColortype ); MI_JPEG_COLORTYPE( iColortype ); - NL; IARG( "iImagesampledepth", iImagesampledepth ); MI_JPEG_BITDEPTH( iImagesampledepth ); - NL; IARG( "iImagecompression", iImagecompression ); MI_JPEGCOMPRESSION( iImagecompression ); - NL; IARG( "iImageinterlace", iImageinterlace ); MI_JPEGINTERLACE( iImageinterlace ); - NL; IARG( "iAlphasampledepth", iAlphasampledepth ); MI_ALPHABITDEPTH( iAlphasampledepth ); - NL; IARG( "iAlphacompression", iAlphacompression ); MI_COMPRESSION_DEFLATE( iAlphacompression ); - NL; IARG( "iAlphafilter", iAlphafilter ); MI_FILTER( iAlphafilter ); - NL; IARG( "iAlphainterlace", iAlphainterlace ); MI_INTERLACE( iAlphainterlace ); - - return true; -# undef MI_JPEG_COLORTYPE -# undef MI_JPEG_BITDEPTH -# undef MI_JPEGCOMPRESSION -# undef MI_JPEGINTERLACE -# undef MI_ALPHABITDEPTH -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_LOOP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_TERMINATION( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_TERMINATION_DECODER_NC :\ - MI( "MNG_TERMINATION_DECODER_NC" ); break;\ - case MNG_TERMINATION_USER_NC :\ - MI( "MNG_TERMINATION_USER_NC" ); break;\ - case MNG_TERMINATION_EXTERNAL_NC :\ - MI( "MNG_TERMINATION_EXTERNAL_NC" ); break;\ - case MNG_TERMINATION_DETERMINISTIC_NC :\ - MI( "MNG_TERMINATION_DETERMINISTIC_NC" ); break;\ - case MNG_TERMINATION_DECODER_C :\ - MI( "MNG_TERMINATION_DECODER_C" ); break;\ - case MNG_TERMINATION_USER_C :\ - MI( "MNG_TERMINATION_USER_C" ); break;\ - case MNG_TERMINATION_EXTERNAL_C :\ - MI( "MNG_TERMINATION_EXTERNAL_C" ); break;\ - case MNG_TERMINATION_DETERMINISTIC_C :\ - MI( "MNG_TERMINATION_DETERMINISTIC_C" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint8 iLevel; -mng_uint32 iRepeat; -mng_uint8 iTermination; -mng_uint32 iItermin; -mng_uint32 iItermax; -mng_uint32 iCount; -mng_uint32p pSignals; - - if( mng_getchunk_loop( hMNG, hChunk, - &iLevel, &iRepeat, &iTermination, - &iItermin, &iItermax, &iCount, &pSignals ) != 0 ) - return false; - - IARG( "iLevel", iLevel ); - NL; IARG( "iRepeat", iRepeat ); - NL; IARG( "iTermination", iTermination ); MI_TERMINATION( iTermination ); - NL; IARG( "iItermin", iItermin ); - NL; IARG( "iItermax", iItermax ); - NL; IARG( "iCount", iCount ); - //pSignals pSignals //@todo@ - - return true; -# undef MI_TERMINATION -} -//--------------------------------------------------------------------------- -/* -bool __fastcall TMainForm::Info_M?GN( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint16 iMethodX; -mng_uint16 iMX; -mng_uint16 iMY; -mng_uint16 iML; -mng_uint16 iMR; -mng_uint16 iMT; -mng_uint16 iMB; -mng_uint16 iMethodY; - - if( mng_getchunk_magn( hMNG, hChunk, - &iFirstid, &iLastid, - &iMethodX, &iMX, &iMY, &iML, &iMR, &iMT, &iMB, - &iMethodY ) != 0 ) - return false; - - IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iMethodX", iMethodX ); - NL; IARG( "iMX", iMX ); - NL; IARG( "iMY", iMY ); - NL; IARG( "iML", iML ); - NL; IARG( "iMR", iMR ); - NL; IARG( "iMT", iMT ); - NL; IARG( "iMB", iMB ); - NL; IARG( "iMethodY", iMethodY ); - - return true; -} -*/ -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_MEND( mng_handle hMNG, mng_handle hChunk, String &as ) -{ - NL + TAB; STR( "End of Multiply Network Graphic." ); - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_MHDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -// NB "iSimplicity" is a bit field -# define MI_SIMPLICITY( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) & MNG_SIMPLICITY_VALID )\ - MI( "MNG_SIMPLICITY_VALID" );\ - if( (_i_) & MNG_SIMPLICITY_SIMPLEFEATURES )\ - MI( "MNG_SIMPLICITY_SIMPLEFEATURES" );\ - if( (_i_) & MNG_SIMPLICITY_COMPLEXFEATURES )\ - MI( "MNG_SIMPLICITY_COMPLEXFEATURES" );\ - if( (_i_) & MNG_SIMPLICITY_TRANSPARENCY )\ - MI( "MNG_SIMPLICITY_TRANSPARENCY" );\ - if( (_i_) & MNG_SIMPLICITY_JNG )\ - MI( "MNG_SIMPLICITY_JNG" );\ - if( (_i_) & MNG_SIMPLICITY_DELTAPNG )\ - MI( "MNG_SIMPLICITY_DELTAPNG" );\ - } - -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint32 iTicks; -mng_uint32 iLayercount; -mng_uint32 iFramecount; -mng_uint32 iPlaytime; -mng_uint32 iSimplicity; - - if( mng_getchunk_mhdr( hMNG, hChunk, - &iWidth, &iHeight, &iTicks, - &iLayercount, &iFramecount, &iPlaytime, - &iSimplicity ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iTicks", iTicks ); - NL; IARG( "iLayercount", iLayercount ); - NL; IARG( "iFramecount", iFramecount ); - NL; IARG( "iPlaytime", iPlaytime ); - NL; IARG( "iSimplicity", iSimplicity ); MI_SIMPLICITY( iSimplicity ); - - return true; -# undef MI_SIMPLICITY -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_MOVE( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint8 iMovetype; -mng_int32 iMovex; -mng_int32 iMovey; - - if( mng_getchunk_move( hMNG, hChunk, - &iFirstid, &iLastid, &iMovetype, &iMovex, &iMovey ) != 0 ) - return false; - - IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iMovetype", iMovetype ); MI_LOCATION( iMovetype ); - NL; IARG( "iMovex", iMovex ); - NL; IARG( "iMovey", iMovey ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_ORDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; - - if( mng_getchunk_ordr( hMNG, hChunk, &iCount ) != 0 ) - return false; - - IARG( "iCount", iCount ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PAST( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -// PAST -# define MI_TARGET( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_TARGET_ABSOLUTE : MI( "MNG_TARGET_ABSOLUTE" ); break;\ - case MNG_TARGET_RELATIVE_SAMEPAST : MI( "MNG_TARGET_RELATIVE_SAMEPAST" ); break;\ - case MNG_TARGET_RELATIVE_PREVPAST : MI( "MNG_TARGET_RELATIVE_PREVPAST" ); break;\ - default : MI(UNKNOWN);\ - } - -// COMPOSITE, ORIENTATION, OFFSET & BOUNDARY depend upon "iCount" -mng_uint16 iDestid; -mng_uint8 iTargettype; -mng_int32 iTargetx; -mng_int32 iTargety; -mng_uint32 iCount; - - if( mng_getchunk_past( hMNG, hChunk, - &iDestid, &iTargettype, &iTargetx, &iTargety, &iCount ) != 0 ) - return false; - - IARG( "iDestid", iDestid ); - NL; IARG( "iTargettype", iTargettype ); MI_TARGET( iTargettype ); - NL; IARG( "iTargetx", iTargetx ); - NL; IARG( "iTargety", iTargety ); - NL; IARG( "iCount", iCount ); - - return true; -# undef MI_TARGET -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PLTE( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; -mng_palette8 aPalette; -mng_uint32 iPalEntry; - - if( mng_getchunk_plte( hMNG, hChunk, &iCount, &aPalette ) != 0 ) - return false; - - IARG( "iCount", iCount ); - - if( WantsPaletteEntries() ) - { - iPalEntry = 0; - do{ - if( WantsRgbOrder() ) - { - as = as + nl + - TAB + "Palette entry [" + PadInt( iPalEntry ) + "]" + - TAB + "R(" + PadInt( aPalette[ iPalEntry ].iRed ) + ") " + - TAB + "G(" + PadInt( aPalette[ iPalEntry ].iGreen ) + ") " + - TAB + "B(" + PadInt( aPalette[ iPalEntry ].iBlue ) + ")"; - } - else - { - as = as + nl + - TAB + "Palette entry [" + PadInt( iPalEntry ) + "]" + - TAB + "B(" + PadInt( aPalette[ iPalEntry ].iBlue ) + ") " + - TAB + "G(" + PadInt( aPalette[ iPalEntry ].iGreen ) + ") " + - TAB + "R(" + PadInt( aPalette[ iPalEntry ].iRed ) + ")"; - - }; - iPalEntry += 1; - } while( iPalEntry < iCount ); - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PPLT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -/* -# define MI_DELTATYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_DELTATYPE_REPLACERGB : MI( "MNG_DELTATYPE_REPLACERGB" ); break;\ - case MNG_DELTATYPE_DELTARGB : MI( "MNG_DELTATYPE_DELTARGB" ); break;\ - case MNG_DELTATYPE_REPLACEALPHA : MI( "MNG_DELTATYPE_REPLACEALPHA" ); break;\ - case MNG_DELTATYPE_DELTAALPHA : MI( "MNG_DELTATYPE_DELTAALPHA" ); break;\ - case MNG_DELTATYPE_REPLACERGBA : MI( "MNG_DELTATYPE_REPLACERGBA" ); break;\ - case MNG_DELTATYPE_DELTARGBA : MI( "MNG_DELTATYPE_DELTARGBA" ); break;\ - default : MI(UNKNOWN);\ - } -*/ -mng_uint32 iCount; - - if( mng_getchunk_pplt( hMNG, hChunk, &iCount ) != 0 ) - return false; - - IARG( "iCount", iCount ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PROM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_FILLMETHOD( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_FILLMETHOD_LEFTBITREPLICATE : MI( "MNG_FILLMETHOD_LEFTBITREPLICATE" ); break;\ - case MNG_FILLMETHOD_ZEROFILL : MI( "MNG_FILLMETHOD_ZEROFILL" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint8 iColortype; -mng_uint8 iSampledepth; -mng_uint8 iFilltype; - - if( mng_getchunk_prom( hMNG, hChunk, - &iColortype, &iSampledepth, &iFilltype ) != 0 ) - return false; - - IARG( "iColortype", iColortype ); MI_COLORTYPE( iColortype ); - NL; IARG( "iSampledepth", iSampledepth ); MI_BITDEPTH( iSampledepth ); - NL; IARG( "iFilltype", iFilltype ); MI_FILLMETHOD( iFilltype ); - - return true; -# undef MI_FILLMETHOD -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_SAVE( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_SAVEOFFSET( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_SAVEOFFSET_4BYTE : MI( "MNG_SAVEOFFSET_4BYTE" ); break;\ - case MNG_SAVEOFFSET_8BYTE : MI( "MNG_SAVEOFFSET_8BYTE" ); break;\ - default : MI(UNKNOWN);\ - } - -/* -# define MI_SAVEENTRY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_SAVEENTRY_SEGMENTFULL : MI( "MNG_SAVEENTRY_SEGMENTFULL" ); break;\ - case MNG_SAVEENTRY_SEGMENT : MI( "MNG_SAVEENTRY_SEGMENT" ); break;\ - case MNG_SAVEENTRY_SUBFRAME : MI( "MNG_SAVEENTRY_SUBFRAME" ); break;\ - case MNG_SAVEENTRY_EXPORTEDIMAGE : MI( "MNG_SAVEENTRY_EXPORTEDIMAGE" ); break;\ - default : MI(UNKNOWN);\ - } -*/ -mng_bool bEmpty; -mng_uint8 iOffsettype; -mng_uint32 iCount; - - if( mng_getchunk_save( hMNG, hChunk, - &bEmpty, &iOffsettype, &iCount ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iOffsettype", iOffsettype ); MI_SAVEOFFSET( iOffsettype ); - NL; IARG( "iCount", iCount ); - - return true; -# undef MI_SAVEOFFSET -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_SEEK( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iNamesize; -mng_pchar zName; - - if( mng_getchunk_seek( hMNG, hChunk, &iNamesize, &zName ) != 0 ) - return false; - - IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_SHOW( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_SHOWMODE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_SHOWMODE_0 : MI( "MNG_SHOWMODE_0" ); break;\ - case MNG_SHOWMODE_1 : MI( "MNG_SHOWMODE_1" ); break;\ - case MNG_SHOWMODE_2 : MI( "MNG_SHOWMODE_2" ); break;\ - case MNG_SHOWMODE_3 : MI( "MNG_SHOWMODE_3" ); break;\ - case MNG_SHOWMODE_4 : MI( "MNG_SHOWMODE_4" ); break;\ - case MNG_SHOWMODE_5 : MI( "MNG_SHOWMODE_5" ); break;\ - case MNG_SHOWMODE_6 : MI( "MNG_SHOWMODE_6" ); break;\ - case MNG_SHOWMODE_7 : MI( "MNG_SHOWMODE_7" ); break;\ - default : MI(UNKNOWN);\ - } -mng_bool bEmpty; -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint8 iMode; - - if( mng_getchunk_show( hMNG, hChunk, - &bEmpty, &iFirstid, &iLastid, &iMode ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iMode", iMode ); MI_SHOWMODE( iMode ); - - return true; -# undef MI_SHOWMODE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_TERM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_TERMACTION( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_TERMACTION_LASTFRAME : MI( "MNG_TERMACTION_LASTFRAME" ); break;\ - case MNG_TERMACTION_CLEAR : MI( "MNG_TERMACTION_CLEAR" ); break;\ - case MNG_TERMACTION_FIRSTFRAME : MI( "MNG_TERMACTION_FIRSTFRAME" ); break;\ - case MNG_TERMACTION_REPEAT : MI( "MNG_TERMACTION_REPEAT" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_ITERACTION( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_ITERACTION_LASTFRAME : MI( "MNG_ITERACTION_LASTFRAME" ); break;\ - case MNG_ITERACTION_CLEAR : MI( "MNG_ITERACTION_CLEAR" ); break;\ - case MNG_ITERACTION_FIRSTFRAME : MI( "MNG_ITERACTION_FIRSTFRAME" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_uint8 iTermaction; -mng_uint8 iIteraction; -mng_uint32 iDelay; -mng_uint32 iItermax; - - if( mng_getchunk_term( hMNG, hChunk, - &iTermaction, &iIteraction, &iDelay, &iItermax ) != 0 ) - return false; - - IARG( "iTermaction", iTermaction ); MI_TERMACTION( iTermaction ); - NL; IARG( "iIteraction", iIteraction ); MI_ITERACTION( iIteraction ); - NL; IARG( "iDelay", iDelay ); - NL; IARG( "iItermax", iItermax ); - - return true; -# undef MI_TERMACTION -# undef MI_ITERACTION -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_bKGD( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint8 iType; -mng_uint8 iIndex; -mng_uint16 iGray; -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; - - if( mng_getchunk_bkgd( hMNG, hChunk, - &bEmpty, &iType, &iIndex, &iGray, - &iRed, &iGreen, &iBlue ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iType", iType ); - NL; IARG( "iIndex", iIndex ); - NL; IARG( "iGray", iGray ); - NL; IARG( "iRed", iRed ); - NL; IARG( "iGreen", iGreen ); - NL; IARG( "iBlue", iBlue ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_cHRM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iWhitepointx; -mng_uint32 iWhitepointy; -mng_uint32 iRedx; -mng_uint32 iRedy; -mng_uint32 iGreenx; -mng_uint32 iGreeny; -mng_uint32 iBluex; -mng_uint32 iBluey; - - if( mng_getchunk_chrm( hMNG, hChunk, - &bEmpty, &iWhitepointx, &iWhitepointy, - &iRedx, &iRedy, - &iGreenx,&iGreeny, - &iBluex, &iBluey ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; FARG( "iWhitepointx", iWhitepointx ); - FPCOM( String( (float)(iWhitepointx /FFACTOR) ) ); - NL; FARG( "iWhitepointy", iWhitepointy ); - FPCOM( String( (float)(iWhitepointy /FFACTOR) ) ); - - NL; FARG( "iRedx", iRedx ); - FPCOM( String( (float)(iRedx /FFACTOR) ) ); - NL; FARG( "iRedy", iRedy ); - FPCOM( String( (float)(iRedy /FFACTOR) ) ); - - NL; FARG( "iGreenx", iGreenx ); - FPCOM( String( (float)(iGreenx /FFACTOR) ) ); - NL; FARG( "iGreeny", iGreeny ); - FPCOM( String( (float)(iGreeny /FFACTOR) ) ); - - NL; FARG( "iBluex", iBluex ); - FPCOM( String( (float)(iBluex /FFACTOR) ) ); - NL; FARG( "iBluey", iBluey ); - FPCOM( String( (float)(iBluey /FFACTOR) ) ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_eXPI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iSnapshotid; -mng_uint32 iNamesize; -mng_pchar zName; - - if( mng_getchunk_expi( hMNG, hChunk, - &iSnapshotid, &iNamesize, &zName ) != 0 ) - return false; - - IARG( "iSnapshotid", iSnapshotid ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_fPRI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_PRIORITY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_PRIORITY_ABSOLUTE : MI( "MNG_PRIORITY_ABSOLUTE" ); break;\ - case MNG_PRIORITY_RELATIVE : MI( "MNG_PRIORITY_RELATIVE" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint8 iDeltatype; -mng_uint8 iPriority; - - if( mng_getchunk_fpri( hMNG, hChunk, &iDeltatype, &iPriority ) != 0 ) - return false; - - IARG( "iDeltatype", iDeltatype ); MI_PRIORITY( iDeltatype ); - NL; IARG( "iPriority", iPriority ); - - return true; -# undef MI_PRIORITY -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_gAMA( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iGamma; - - if( mng_getchunk_gama( hMNG, hChunk, &bEmpty, &iGamma ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; FARG( "iGamma", iGamma ); - FPCOM( String( (float)(iGamma /FFACTOR) ) ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_hIST( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iEntrycount; -mng_uint16arr aEntries; - - if( mng_getchunk_hist( hMNG, hChunk, &iEntrycount, &aEntries ) != 0 ) - return false; - - - IARG( "iEntrycount", iEntrycount ); - //aEntries aEntries @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_iCCP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iNamesize; -mng_pchar zName; -mng_uint8 iCompression; -mng_uint32 iProfilesize; -mng_ptr pProfile; - - if( mng_getchunk_iccp( hMNG, hChunk, - &bEmpty, &iNamesize, &zName, &iCompression, - &iProfilesize,&pProfile ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "Name", zName ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iProfilesize", iProfilesize ); -// "pProfile " + String( pProfile ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_iTXt( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -#define MI_ITXT_FLAG( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_FLAG_UNCOMPRESSED ) {\ - MI( "MNG_FLAG_UNCOMPRESSED" )\ - } else if( (_i_) == MNG_FLAG_COMPRESSED ) {\ - MI( "MNG_FLAG_COMPRESSED" );\ - }\ - } -mng_uint32 iKeywordsize; -mng_pchar zKeyword; -mng_uint8 iCompressionflag; -mng_uint8 iCompressionmethod; -mng_uint32 iLanguagesize; -mng_pchar zLanguage; -mng_uint32 iTranslationsize; -mng_pchar zTranslation; -mng_uint32 iTextsize; -mng_pchar zText; - - if( mng_getchunk_itxt( hMNG, hChunk, - &iKeywordsize, &zKeyword, - &iCompressionflag, &iCompressionmethod, - &iLanguagesize, &zLanguage, - &iTranslationsize, &zTranslation, - &iTextsize, &zText ) != 0 ) - return false; - - IARG( "iKeywordsize", iKeywordsize ); - NL; ZARG( "zKeyword", zKeyword ); - NL; IARG( "iCompressionflag", iCompressionflag ); MI_ITXT_FLAG( iCompressionflag ); - NL; IARG( "iCompressionmethod", iCompressionmethod ); MI_COMPRESSION_DEFLATE( iCompressionflag ); - NL; IARG( "iLanguagesize", iLanguagesize ); - NL; ZARG( "zLanguage", zLanguage ); - NL; IARG( "iTranslationsize", iTranslationsize ); - NL; ZARG( "zTranslation", zTranslation ); - NL; IARG( "iTextsize", iTextsize ); - NL; ZARG( "zText", zText ); - - return true; -# undef MI_ITXT_FLAG -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_nEED( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iKeywordssize; -mng_pchar zKeywords; - - if( mng_getchunk_need( hMNG, hChunk, &iKeywordssize, &zKeywords ) != 0) - return false; - - IARG( "iKeywordssize", iKeywordssize ); - NL; IARG( "zKeywords", zKeywords ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_pHYg( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iSizex; -mng_uint32 iSizey; -mng_uint8 iUnit; - - if( mng_getchunk_phyg( hMNG, hChunk, - &bEmpty, &iSizex, &iSizey, &iUnit ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iSizex", iSizex ); - NL; IARG( "iSizey", iSizey ); - NL; IARG( "iUnit", iUnit ); MI_UNITS( iUnit ); - - if( iUnit ) { - PCOM("X/Y pixels per unit" ); - } else { - if( iSizex == iSizey ) { - PCOM( "Square pixels" ); - } - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_pHYs( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iSizex; -mng_uint32 iSizey; -mng_uint8 iUnit; - - if( mng_getchunk_phys( hMNG, hChunk, - &bEmpty, &iSizex, &iSizey, &iUnit ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iSizex", iSizex ); - NL; IARG( "iSizey", iSizey ); - NL; IARG( "iUnit", iUnit ); MI_UNITS( iUnit ); - - if( iUnit ) { - PCOM("X/Y pixels per unit" ); - } else { - if( iSizex == iSizey ) { - PCOM( "Square pixels" ); - } - } - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_sBIT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ // tested with cs3* cs5* cs8* -mng_bool bEmpty; -mng_uint8 iType; -mng_uint8arr4 aBits; - - if( mng_getchunk_sbit( hMNG, hChunk, &bEmpty, &iType, &aBits ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iType", iType ); - //aBits aBits @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_sPLT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iNamesize; -mng_pchar zName; -mng_uint8 iSampledepth; -mng_uint32 iEntrycount; -mng_ptr pEntries; - - if( mng_getchunk_splt( hMNG, hChunk, - &bEmpty, &iNamesize, &zName, - &iSampledepth, &iEntrycount, &pEntries ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - NL; IARG( "iSampledepth", iSampledepth ); MI_BITDEPTH( iSampledepth ); - NL; IARG( "iEntrycount", iEntrycount ); - //pEntries pEntries @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_sRGB( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_RENDERINGINTENT( _i_ )\ - if( WantsMacroIds() ) {\ - switch( (_i_) ) {\ - case MNG_INTENT_PERCEPTUAL :\ - MI( "MNG_INTENT_PERCEPTUAL" ); break;\ - case MNG_INTENT_RELATIVECOLORIMETRIC :\ - MI( "MNG_INTENT_RELATIVECOLORIMETRIC" );break;\ - case MNG_INTENT_SATURATION :\ - MI( "MNG_INTENT_SATURATION" ); break;\ - case MNG_INTENT_ABSOLUTECOLORIMETRIC :\ - MI( "MNG_INTENT_ABSOLUTECOLORIMETRIC" );break;\ - }\ - } -mng_bool bEmpty; -mng_uint8 iRenderingintent; - - if( mng_getchunk_srgb( hMNG, hChunk,&bEmpty, &iRenderingintent ) != 0) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iRenderingintent", iRenderingintent ); - MI_RENDERINGINTENT( iRenderingintent ); - - return true; -# undef MI_RENDERINGINTENT -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_tEXt( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iKeywordsize; -mng_pchar zKeyword; -mng_uint32 iTextsize; -mng_pchar zText; - - if( mng_getchunk_text( hMNG, hChunk, - &iKeywordsize, &zKeyword, &iTextsize, &zText ) != 0 ) - return false; - - IARG( "iKeywordsize", iKeywordsize ); - NL; ZARG( "zKeyword", zKeyword ); - NL; IARG( "iTextsize", iTextsize ); - NL; ZARG( "zText", zText ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_tIME( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iYear; -mng_uint8 iMonth; -mng_uint8 iDay; -mng_uint8 iHour; -mng_uint8 iMinute; -mng_uint8 iSecond; - - if( mng_getchunk_time( hMNG, hChunk, - &iYear, &iMonth, &iDay, &iHour, &iMinute, &iSecond ) != 0 ) - return false; - - IARG( "iYear", iYear ); - NL; IARG( "iMonth", iMonth ); - NL; IARG( "iDay", iDay ); - NL; IARG( "iHour", iHour ); - NL; IARG( "iMinute", iMinute ); - NL; IARG( "iSecond", iSecond ); - // Do not do help line here - may confuse international readers ! - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_tRNS( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_bool bGlobal; -mng_uint8 iType; -mng_uint32 iCount; -mng_uint8arr aAlphas; -mng_uint16 iGray; -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; -mng_uint32 iRawlen; -mng_uint8arr aRawdata; - - if( mng_getchunk_trns( hMNG, hChunk, - &bEmpty, &bGlobal, &iType, &iCount, - &aAlphas, - &iGray, &iRed, &iGreen, &iBlue, - &iRawlen, - &aRawdata ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; BARG( "bGlobal", bGlobal ); - NL; IARG( "iType", iType ); - NL; IARG( "iCount", iCount ); -//aAlphas aAlphas @todo@ - NL; IARG( "iGray", iGray ); - NL; IARG( "iRed", iRed ); - NL; IARG( "iGreen", iGreen ); - NL; IARG( "iBlue", iBlue ); - NL; IARG( "iRawlen", iRawlen ); -//aRawdata aRawdata @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_zTXt( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iKeywordsize; -mng_pchar zKeyword; -mng_uint8 iCompression; -mng_uint32 iTextsize; -mng_pchar zText; - - if( mng_getchunk_ztxt( hMNG, hChunk, - &iKeywordsize, &zKeyword, &iCompression, &iTextsize, &zText ) != 0 ) - return false; - - IARG( "iKeywordsize", iKeywordsize ); - NL; ZARG( "zKeyword", zKeyword ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iTextsize", iTextsize ); - NL; ZARG( "zText", zText ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_Unknown( mng_handle hMNG, mng_handle hChunk, String &as ) -{ - NL + TAB; STR( "Unknown Chunk" ); - NL + TAB; STR( nl + TAB + "(See help tab for a list of unsupported chunks)!" ); - - return true; -} -//--------------------------------------------------------------------------- - - - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp b/Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp deleted file mode 100644 index c9e1ab509..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//--------------------------------------------------------------------------- -// Help.cpp : Help pane text -//--------------------------------------------------------------------------- -#include "Help.h" - -// NB : If more text is to go in here don't forget to enlarge min/max -extern char *_szHelp = { -"\nA MNG developers tool to display the chunk data of MNG/JNG/PNG files."\ -"\n" -"\nMngDump - Version 1.0 - September 2000"\ -"\n"\ -"\n NOTE - This program comes with NO warranties whatsoever."\ -"\n"\ -"\nInstruction for use ... press the folder button and load a file !"\ -"\n"\ -"\nThe following chunks are (currently) unsupported :"\ -"\nIJNG, IPNG, JSEP, MaGN, MAGN, oFFs, pCAL, sCAL"\ -"\n"\ -"\nThe program will be periodically updated, inline with libmng's growth."\ -"\nPlease report any bugs, suggestions, etc to the maintainer." -}; -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Help.h b/Engine/lib/lmng/contrib/bcb/mngdump/Help.h deleted file mode 100644 index 736d562d2..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/Help.h +++ /dev/null @@ -1,6 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef HelpH -#define HelpH -//--------------------------------------------------------------------------- -extern char *_szHelp; -#endif diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR b/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR deleted file mode 100644 index 67845d0b0..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR +++ /dev/null @@ -1,195 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = MNGDUMP.exe -OBJFILES = MNGDUMP.obj Main.obj Chunks.obj About.obj Callback.obj Help.obj -RESFILES = MngDump.res -DEFFILE = -RESDEPEN = $(RESFILES) Main.dfm -LIBFILES = ..\..\..\bcb\win32dll\libmng.lib -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi bcbsmp35.bpi dclocx35.bpi \ - QRPT35.bpi -# --------------------------------------------------------------------------- -PATHCPP = .; -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -w -Ve -k- -vi -c -b- -w-par -w-inl -Vx -tW -CFLAG2 = -I..\win32dll;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -CFLAG3 = -Tkh30000 -6 -PFLAGS = -U..\win32dll;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ - -I..\win32dll;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b \ - -$L- -$D- -v -JPHN -M -RFLAGS = -i..\win32dll;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /i..\..\..\libmng /i..\..\..\zlib \ - /i..\..\..\jpgsrc6b /mx /w2 /zd /dMNG_SUPPORT_READ /dMNG_ACCESS_CHUNKS \ - /dMNG_STORE_CHUNKS /dMNG_NO_CMS /dMNG_USE_DLL /dHAVE_BOOLEAN -LFLAGS = -L..\win32dll;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpe -x -Gn -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=1 -Special=0 -Private=0 -DLL=0 -Locale=2057 -CodePage=1252 - -[Version Info Keys] -CompanyName=RDS -FileDescription=MngDump -FileVersion=1.0.0.0 -InternalName= -LegalCopyright=Copyright (c) 2000 G.Juyn -LegalTrademarks= -OriginalFilename=MngTree -ProductName= -ProductVersion=1.0.0.0 -Comments=Author Andy Protano - September 2000 - -[HistoryLists\hlIncludePath] -Count=10 -Item0=$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -Item1=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -Item2=..\mngtree;..\..\delphi\mngview;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -Item3=..\mngtree;..\..\delphi\mngview;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\libjpeg -Item4=..\..\delphi\mngview;$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\libjpeg -Item5=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\libjpeg -Item6=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\zlib;..\..\libjpeg -Item7=$(BCB)\include;$(BCB)\include\vcl;..\.. -Item8=$(BCB)\include;$(BCB)\include\vcl;.. -Item9=$(BCB)\include;$(BCB)\include\vcl - -[HistoryLists\hlLibraryPath] -Count=4 -Item0=$(BCB)\lib\obj;$(BCB)\lib -Item1=..\mngtree;$(BCB)\lib\obj;$(BCB)\lib -Item2=..\mngtree;..\..\delphi\mngview;$(BCB)\lib\obj;$(BCB)\lib -Item3=..\..\delphi\mngview;$(BCB)\lib\obj;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=6 -Item0=MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL;HAVE_BOOLEAN -Item1=_RTLDLL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL;HAVE_BOOLEAN -Item2=_RTLDLL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item3=_RTLDLL;HAVE_BOOLEAN -Item4=_RTLDLL -Item5=_RTLDLL;USEPACKAGES - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -[Parameters] -RunParams= -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.RES b/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.RES deleted file mode 100644 index f912f29b3..000000000 Binary files a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.RES and /dev/null differ diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp b/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp deleted file mode 100644 index 883f6d4b2..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -USERES("MngDump.res"); -USEFORM("Main.cpp", MainForm); -USEUNIT("Chunks.cpp"); -USEUNIT("About.cpp"); -USEUNIT("Callback.cpp"); -USEUNIT("Help.cpp"); -USELIB("..\..\..\bcb\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- -WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) -{ - try - { - Application->Initialize(); - Application->Title = "MngDump"; - Application->CreateForm(__classid(TMainForm), &MainForm); - Application->Run(); - } - catch (Exception &exception) - { - Application->ShowException(&exception); - } - return 0; -} -//--------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp b/Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp deleted file mode 100644 index af7a916d2..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp +++ /dev/null @@ -1,793 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#include -#include -#pragma hdrstop -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -#include "Main.h" -TMainForm *MainForm; -//--------------------------------------------------------------------------- -#include "About.h" -#include "Help.h" - -# define PAGE_CHUNKS 1 -# define PAGE_REPORT 2 -# define PAGE_OPTIONS 3 -# define PAGE_ABOUT 4 -# define PAGE_HELP 5 - -/* ************************************************************************** */ -/* * * */ -/* * MngDump is based on Gerard Juyn's MngTree * */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000 Andy Protano * */ -/* * Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn (gerard@libmng.com) * */ -/* * Andy Protano (a.a.protano@care4free.net) * */ -/* * * */ -/* * This program is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -__fastcall TMainForm::TMainForm(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -__fastcall TMainForm::~TMainForm( void ) -{ -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OnMinMax(TMessage& Msg) -{ - ((POINT far *)Msg.LParam)[3].x = 500; - ((POINT far *)Msg.LParam)[3].y = 450; - - TForm::Dispatch(&Msg); -} -//--------------------------------------------------------------------------- -// MessageBox Methods -// ---------------------------------------------------------------------- -int __fastcall TMainForm::MessageBox( String &as, UINT flags ) -{ - return ::MessageBox( Handle, as.c_str(), Application->Title.c_str(), flags ); -} -// ---------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxOk( String as ) -{ - (void)MessageBox( as, MB_ICONINFORMATION ); -} -//------------------------------------------------------------------------- -int __fastcall TMainForm::MsgBoxYN( String as ) -{ - return MessageBox( as, MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON1 ); -} -//------------------------------------------------------------------------- -int __fastcall TMainForm::MsgBoxYNC( String as ) -{ - return MessageBox( as, MB_YESNOCANCEL | MB_ICONQUESTION ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxStop( String as ) -{ - (void)MessageBox( as, MB_ICONSTOP ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxInfo( String as ) -{ - (void)MessageBox( as, MB_OK | MB_ICONINFORMATION ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxWarn( String as ) -{ - (void)MessageBox( as, MB_OK | MB_ICONWARNING ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::FormCreate(TObject *Sender) -{ - // For when the application name changes - coz i'll forget ! - asAppName = Application->Title; - // And while we've got it set the caption - Caption = Application->Title; - - // Load About Screen - LabelAbout->Caption = _szAbout; - // Load Help Screen - LabelHelp->Caption = _szHelp; - - fd = NULL; - strList = new TStringList(); - - asTab = " ";// default tab size 2 - RadioGroupTabSize->ItemIndex = 1; // range is zero based - - // Start with the help pane - PageControl1->ActivePage = tsHelp; - - mnuWordWrap->Checked = false; - // This call will TOGGLE and set word wrap for all the applicables - // editors and enable/disable the Horz scroll bar. - mnuWordWrapClick( this ); // So start with false to get to true; - - // Clear things from design time settings - StaticTextStatus->Caption = ""; - //strList->Clear(); constructor dodid that - pnlChunks->Caption = ""; - ListBoxChunks->Clear(); - RichEditChunks->Clear(); - RichEditReport->Clear(); - ProgressBar1->Min = 0; - ProgressBar1->Position = 0; - SetChunkCount( 0 ); - - // Set default states for switches - cbPaletteEntries->Checked = false; - cbRGBOrder->Checked = true; - cbRawData->Checked = true; - cbComments->Checked = true; - cbMacroIdentifier->Checked = true; - cbBool->Checked = true; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormDestroy(TObject *Sender) -{ - delete strList; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuExitClick(TObject *Sender) -{ - Close(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuFileOpenClick(TObject *Sender) -{ - if( !OpenDialog1->Execute() ) - return; - - Application->ProcessMessages(); // Refresh the screen - LoadFile(); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuReloadClick(TObject *Sender) -{ - // Only reload - if we have something to reload - if( OpenDialog1->FileName.Length() ) - LoadFile(); - else - MsgBoxStop( "Nothing to reload yet !" ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuUndoClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->Undo(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuCutClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->CutToClipboard(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuCopyClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->CopyToClipboard(); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::sbtnCopyChunkClick(TObject *Sender) -{ - if( RichEditChunks->Lines->Count ) // Do we have something in there ? - { - // Copy chunk data from Chunks pane to clipboard - RichEditChunks->SelectAll(); - RichEditChunks->CopyToClipboard(); - RichEditChunks->SelLength = 0; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuPasteClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->PasteFromClipboard(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuSelectAllClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->SelectAll(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuWordWrapClick(TObject *Sender) -{ -bool bWrap; - - mnuWordWrap->Checked = !mnuWordWrap->Checked; - bWrap = mnuWordWrap->Checked; - - RichEditChunks->WordWrap = bWrap; - RichEditReport->WordWrap = bWrap; - - if( bWrap ) { // if Word wrap on then no need for horizontal scrollbar - RichEditChunks->ScrollBars = ssVertical; - RichEditReport->ScrollBars = ssVertical; - } else { // Horizontal scrollbar required (auto) - RichEditChunks->ScrollBars = ssBoth; - RichEditReport->ScrollBars = ssBoth; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuSetFontClick(TObject *Sender) -{ - if( FontDialog1->Execute() ) - { - RichEditChunks->Font = FontDialog1->Font; - RichEditReport->Font = FontDialog1->Font; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FontDialog1Apply(TObject *Sender, HWND Wnd) -{ - RichEditChunks->Font = FontDialog1->Font; - RichEditReport->Font = FontDialog1->Font; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuFindClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "Find what ?."); - return; - } - - FindDialog->Execute(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FindDialogFind(TObject *Sender) -{ -TSearchTypes st; -TFindDialog *fd; -int newpos; - - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "Find what ?."); - return; - } - - fd = dynamic_cast( Sender ); - - if( fd->Options.Contains( frMatchCase ) ) - st << stMatchCase; - if( fd->Options.Contains( frWholeWord ) ) - st << stWholeWord; - - if( RichEditReport->SelLength ) - RichEditReport->SelStart += 1; - - newpos = RichEditReport->FindText( fd->FindText, - RichEditReport->SelStart, RichEditReport->Text.Length(), st ); - - if( newpos != -1 ) { - RichEditReport->SelStart = newpos; - RichEditReport->SelLength = fd->FindText.Length(); - } else { - MsgBoxInfo( "End of document reached." ); - RichEditReport->SelStart = 0; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuFindNextClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "Find what ?."); - return; - } - - FindDialogFind( FindDialog ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuPrintClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "I can't find anything to print !."); - return; - } - - RichEditReport->Print( ExtractFileName( OpenDialog1->FileName ) ); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuPrintSetupClick(TObject *Sender) -{ - PrinterSetupDialog->Execute(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuSaveClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "I can't find anything to save !."); - return; - } - - // Grab the graphic's filename and change to "txt" extension - { - char szFile[ MAXFILE ]; - char szExt[ MAXEXT ]; - char szDest[ MAXPATH ]; - String as; - - fnsplit( OpenDialog1->FileName.c_str(), NULL, NULL, szFile, szExt ); - - memset( szDest, 0, MAXPATH ); - strcat( szDest, szFile ); - strcat( szDest, "\." ); - strcat( szDest, "txt" ); - as = szDest; - - // Initially create a text file of the same name as the graphic - // but with "txt" extension - SaveDialog1->FileName = as; - } - - if( !SaveDialog1->Execute() ) - return; // Given up hey ? - - RichEditReport->Lines->SaveToFile( SaveDialog1->FileName ); -} -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -void __fastcall TMainForm::LoadFile( void ) -{ -int bStatus; - - // Can we open the file ? - if( (fd = fopen( OpenDialog1->FileName.c_str(), "rb") ) == NULL ) - { - MsgBoxStop( "Cannot open input file\n\n" + OpenDialog1->FileName ); - return; - } - - pnlChunks->Caption = ""; - strList->Clear(); - ListBoxChunks->Clear(); - RichEditChunks->Clear(); - RichEditReport->Clear(); - - ProgressBar1->Min = 0; - ProgressBar1->Position = 0; - SetChunkCount( 0 ); - - RichEditReport->Lines->Add( "" ); - RichEditReport->Lines->Add( "Chunk contents of file :" ); - RichEditReport->Lines->Add( OpenDialog1->FileName ); - RichEditReport->Lines->Add( "" ); - - // Make report pane visible - prove we are working and not locked up - PageControl1->ActivePage = tsReport; - -try { - StaticTextStatus->Caption = "Working ... please wait"; - StaticTextStatus->Update(); - bStatus = DumpTree(); // true indicates success -} -__finally { - ProgressBar1->Position = 0; - StaticTextStatus->Caption = "Ok"; - fclose( fd ); - fd = NULL; -} - - if( !bStatus ) // We have an error - { - pnlChunks->Caption = ""; - strList->Clear(); - ListBoxChunks->Clear(); - RichEditChunks->Clear(); - - RichEditReport->Lines->Add(""); - RichEditReport->Lines->Add("An error occurred while reading the file."); - - } else { // Read file and chunks without any problems - - // Set Report Panels caption - pnlChunks->Caption = "Chunk 1 of " + String( ListBoxChunks->Items->Count ); - - // Set Listbox to first item - ListBoxChunks->ItemIndex = 0; - - // Put gleeful message in report pane - RichEditChunks->Lines->Add( "" ); - RichEditChunks->Lines->Add( - "No error's found when reading file ... " ); - RichEditChunks->Lines->Add( - "Click the list box to display the data for each chunk."); - - // Place cursor at top of editor - RichEditChunks->SelStart = 0; - RichEditChunks->SelLength = 0; - - // Place cursor at top of editor - RichEditReport->SelStart = 0; - RichEditReport->SelLength = 0; - - // Lock richedits - so an immediate undo does not make data vanish ! - RichEditReport->Modified = false; - // @ap@ Borland should fix this ! (it don't work) - } - -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::DumpTree( void ) -{ -mng_handle hMNG; - - // let's initialize the library - hMNG = mng_initialize( (mng_ptr)this, Alloc, Free, NULL ); - - if( !hMNG ) // did that work out ? - { - MNGError( hMNG, "Cannot initialize libmng." ); - mng_cleanup( &hMNG ); // Always cleanup the library - MsgBoxStop( "Bye!" ); - Application->Terminate(); // Exit now - } - - // setup callbacks - if( (mng_setcb_openstream ( hMNG, OpenStream ) != 0) || - (mng_setcb_closestream ( hMNG, CloseStream ) != 0) || - (mng_setcb_processheader( hMNG,ProcessHeader ) != 0) || - (mng_setcb_readdata ( hMNG, FileReadData ) != 0) - ) - { - MNGError( hMNG, "Cannot set callbacks for libmng."); - mng_cleanup( &hMNG ); // Always cleanup the library - MsgBoxStop( "Bye!" ); - Application->Terminate(); // Exit now - } - else - { - // read the file into memory - if( mng_read( hMNG ) != 0 ) - { - // Because we read the whole file in first, - // here is where bad input files first choke ! - MNGError( hMNG, "Cannot read the file." ); - mng_cleanup( &hMNG ); // Always cleanup the library - return false; - } - else - { - // run through the chunk list - if( mng_iterate_chunks( hMNG, 0, IterateChunks ) != 0 ) - { - MNGError( hMNG, "Error Getting Chunk info!" ); - mng_cleanup( &hMNG ); // Always cleanup the library - return false; // Errors may occur with bad chunk data - } - } - } - - mng_cleanup( &hMNG ); // Always cleanup the library - - return true; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::MNGError( mng_handle hMNG, String SHMsg ) -{ -// get extended info -mng_uint32 iErrorcode; -mng_uint8 iSeverity; -mng_chunkid iChunkname; -mng_uint32 iChunkseq; -mng_int32 iExtra1; -mng_int32 iExtra2; -mng_pchar zErrortext; -char szFormatStr[ 256 ]; - - iErrorcode = mng_getlasterror( hMNG, &iSeverity, &iChunkname, - &iChunkseq, &iExtra1, &iExtra2, - &zErrortext); - - wsprintf( szFormatStr, - "Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d", - (int)iErrorcode, (int)iSeverity, (int)iChunkseq, (int)iExtra1 - ); - - MsgBoxStop( SHMsg + "\n\n" + String( zErrortext ) + "\n\n" + String( szFormatStr ) ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::ListBoxChunksClick(TObject *Sender) -{ -// When the Chunks listbox is clicked ... -// display strings from strlist in the RichEditChunks window. -int iIndex = ListBoxChunks->ItemIndex; - - if( !ListBoxChunks->Items->Count ) - return; - - // Update panel to reflect the selection : "Chunk N of NChunks" - pnlChunks->Caption = "Chunk " + String( iIndex + 1) + - " of " + String( ListBoxChunks->Items->Count ); - - // Reset Chunks windows ... - RichEditChunks->Clear(); - RichEditChunks->Lines->Add( "" ); - // ... Chunks header string : "Chunk N : XXXX" (XXXX == Chunk name) - RichEditChunks->Lines->Add( "Chunk " + String( iIndex + 1 ) + " : " + - ListBoxChunks->Items->Strings[ iIndex ] ); - // ... Seperator line - //RichEditChunks->Lines->Add(""); - - // ... add the data from the stringlist - { - String as = strList->Strings[ iIndex ] + 1; - String z; - int n =1; - do{ - if( as[n] == '\n' ) - { - RichEditChunks->Lines->Add( z ); - z = ""; - } - else - z = z + as[n]; - n+=1; - } while( n < as.Length() ); - RichEditChunks->Lines->Add( z ); - } - - // ... Seperator line - RichEditChunks->Lines->Add(""); - - // Place cursor at top of editor - RichEditChunks->SelStart = 0; - RichEditChunks->SelLength = 0; - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::EventShowPage(TObject *Sender) -{ - - switch( ((TTabSheet *)Sender)->Tag ) { - case PAGE_REPORT : - mnuPrint->Enabled = true; - mnuEdit->Enabled = true; - mnuUndo->Enabled = true; - mnuSave->Enabled = true; - sbtnSave->Enabled = true; - sbtnUndo->Enabled = true; - mnuCut->Enabled = true; - sbtnCut->Enabled = true; - mnuCopy->Enabled = true; - sbtnCopy->Enabled = true; - mnuPaste->Enabled = true; - sbtnPaste->Enabled = true; - mnuSearch->Enabled = true; - sbtnPrint->Enabled = true; - break; - //case PAGE_CHUNKS : - //case PAGE_OPTIONS : - ///case PAGE_ABOUT : - //case PAGE_HELP : - default : - mnuPrint->Enabled = false; - mnuEdit->Enabled = false; - // no need to enable/disable menu commands as none will be available - mnuSave->Enabled = false; - sbtnSave->Enabled = false; - sbtnUndo->Enabled = false; - sbtnCut->Enabled = false; - sbtnCopy->Enabled = false; - sbtnPaste->Enabled = false; - mnuSearch->Enabled = false; - sbtnPrint->Enabled = false; - } - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::RadioGroupTabSizeClick(TObject *Sender) -{ - switch( RadioGroupTabSize->ItemIndex ) { - case 0 : asTab = " "; break; - case 1 : asTab = " "; break; - case 2 : asTab = " "; break; - case 3 : asTab = " "; break; - case 4 : asTab = " "; break; - case 5 : asTab = " "; break; - } -} -//--------------------------------------------------------------------------- -String __fastcall TMainForm::PadInt( int iInt, int iWidth ) -{ - -char szFmtStr[ 24 ]; -char szInt[ 24 ]; // Should be wide enough ! -String as; - wsprintf( szFmtStr,"%%%d\d\0",iWidth ); //"%[iWidth]d" - as = szFmtStr; - wsprintf( szInt, szFmtStr, iInt ); - - return String( szInt ); -} -//--------------------------------------------------------------------------- -mng_bool __fastcall TMainForm::ShowChunk( - mng_handle hMNG, mng_handle hChunk, mng_chunkid iChunktype ) -{ -String asDataText; - - // Fill asDataText with string data including newline's ... - // this is added to string list for each chunk - // and also added to the tail end of "Report" - - // NOTE : - // Return True to continue processing. - // If mng_getchunk_xxxx fails just return false to the - // caller "(bool) myiterchunk" which inturn will then return false - // to "(mng_retcode) mng_iterate_chunks(...)" which will then - // give us the correct error code. - // In other words DON'T check for errors in "(bool) myiterchunk" ! - - switch( iChunktype ) { - case MNG_UINT_BACK : - if( !Info_BACK( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_BASI : - if( !Info_BASI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_CLIP : - if( !Info_CLIP( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_CLON : - if( !Info_CLON( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DBYK : // untested @ap@ - if( !Info_DBYK( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DEFI : - if( !Info_DEFI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DHDR : - if( !Info_DHDR( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DISC : // untested @ap@ - if( !Info_DISC( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DROP : // untested @ap@ - if( !Info_DROP( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_ENDL : - if( !Info_ENDL( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_FRAM : - if( !Info_FRAM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_IDAT : - if( !Info_IDAT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_IEND : - if( !Info_IEND( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_IHDR : - if( !Info_IHDR( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_IJNG 0x494a4e47L // Function AWOL @ap@ -#define MNG_UINT_IPNG 0x49504e47L // Function AWOL @ap@ - case MNG_UINT_JDAT : - if( !Info_JDAT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_JHDR : - if( !Info_JHDR( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_JSEP 0x4a534550L // Function AWOL @ap@ - case MNG_UINT_LOOP : - if( !Info_LOOP( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_MaGN 0x4d61474eL // which one "mng_getchunk_magn" ? - case MNG_UINT_MEND : - if( !Info_MEND( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_MHDR : - if( !Info_MHDR( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_MOVE : - if( !Info_MOVE( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_MaGN 0x4d61474eL // which one "mng_getchunk_magn" ? - case MNG_UINT_ORDR : - if( !Info_ORDR( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PAST : - if( !Info_PAST( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PLTE : - if( !Info_PLTE( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PPLT : - if( !Info_PPLT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PROM : - if( !Info_PROM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_SAVE : - if( !Info_SAVE( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_SEEK : - if( !Info_SEEK( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_SHOW : - if( !Info_SHOW( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_TERM : - if( !Info_TERM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_bKGD : - if( !Info_bKGD( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_cHRM : - if( !Info_cHRM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_eXPI : - if( !Info_eXPI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_fPRI : - if( !Info_fPRI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_gAMA : - if( !Info_gAMA( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_hIST : - if( !Info_hIST( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_iCCP : - if( !Info_iCCP( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_iTXt : // untested @ap@ - if( !Info_iTXt( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_nEED : - if( !Info_nEED( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_oFFs 0x6f464673L // Function AWOL @ap@ -#define MNG_UINT_pCAL 0x7043414cL // Function AWOL @ap@ - case MNG_UINT_pHYg : // untested @ap@ - if( !Info_pHYg( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_pHYs : - if( !Info_pHYs( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_sBIT : - if( !Info_sBIT( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_sCAL 0x7343414cL // Function AWOL @ap@ - case MNG_UINT_sPLT : // untested @ap@ - if( !Info_sPLT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_sRGB : - if( !Info_sRGB( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_tEXt : - if( !Info_tEXt( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_tIME : - if( !Info_tIME( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_tRNS : - if( !Info_tRNS( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_zTXt : - if( !Info_zTXt( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_HUH : - default : // this will catch unknown chunks - Huh ! - if( !Info_Unknown( hMNG, hChunk, asDataText ) ) return false; break; - } // end of switch - //------------------------------------------------- - - // Add this chunk's string to our string list - strList->Insert( GetChunkCount(), asDataText ); - - // Now's the time to bump chunk count - IncChunkCount(); - - // Add this chunk's string to the Report - MainForm->RichEditReport->Lines->Add( asDataText ); - - return true; -} -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Main.dfm b/Engine/lib/lmng/contrib/bcb/mngdump/Main.dfm deleted file mode 100644 index 3187217d0..000000000 Binary files a/Engine/lib/lmng/contrib/bcb/mngdump/Main.dfm and /dev/null differ diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Main.h b/Engine/lib/lmng/contrib/bcb/mngdump/Main.h deleted file mode 100644 index 09df9b688..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/Main.h +++ /dev/null @@ -1,296 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef MainH -#define MainH -//--------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//--------------------------------------------------------------------------- -// These MUST be defined before we include "Libmng.h -//# define MNG_SUPPORT_READ -//# define MNG_ACCESS_CHUNKS -//# define MNG_STORE_CHUNKS -//# define MNG_NO_CMS -# define MNG_USE_DLL -# define MNG_SKIP_ZLIB -# define MNG_SKIP_LCMS -# define MNG_SKIP_IJG6B - -#include "../../../libmng.h" -//--------------------------------------------------------------------------- -class TMainForm : public TForm -{ -__published: // IDE-managed Components - TMainMenu *MainMenu1; - TMenuItem *mnuFile; - TMenuItem *mnuOpen; - TMenuItem *mnuReload; - TMenuItem *mnuSave; - TMenuItem *N1; - TMenuItem *mnuPrint; - TMenuItem *mnuPrintSetup; - TMenuItem *N2; - TMenuItem *mnuExit; - TMenuItem *mnuEdit; - TMenuItem *mnuUndo; - TMenuItem *N3; - TMenuItem *mnuCut; - TMenuItem *mnuCopy; - TMenuItem *mnuPaste; - TMenuItem *N4; - TMenuItem *mnuSelectAll; - TMenuItem *N5; - TMenuItem *mnuSetFont; - TMenuItem *mnuWordWrap; - TMenuItem *mnuSearch; - TMenuItem *mnuFind; - TMenuItem *mnuFindNext; - TPanel *Panel1; - TSpeedButton *sbtnOpen; - TSpeedButton *sbtnReload; - TSpeedButton *sbtnSave; - TSpeedButton *sbtnPrint; - TSpeedButton *sbtnPrintSetup; - TSpeedButton *sbtnUndo; - TSpeedButton *sbtnCut; - TSpeedButton *sbtnCopy; - TSpeedButton *sbtnPaste; - TOpenDialog *OpenDialog1; - TSaveDialog *SaveDialog1; - TPrintDialog *PrintDialog; - TPrinterSetupDialog *PrinterSetupDialog; - TFontDialog *FontDialog1; - TFindDialog *FindDialog; - TPageControl *PageControl1; - TTabSheet *tsChunks; - TTabSheet *tsReport; - TPanel *pnlChunks; - TListBox *ListBoxChunks; - TSpeedButton *sbtnCopyChunk; - TRichEdit *RichEditChunks; - TRichEdit *RichEditReport; - TPanel *PanelStatusBar; - TProgressBar *ProgressBar1; - TTabSheet *tsOptions; - TTabSheet *tsAbout; - TLabel *LabelAbout; - TTabSheet *tsHelp; - TLabel *LabelHelp; - TCheckBox *cbBool; - TCheckBox *cbMacroIdentifier; - TCheckBox *cbRawData; - TCheckBox *cbRGBOrder; - TCheckBox *cbPaletteEntries; - TCheckBox *cbComments; - TRadioGroup *RadioGroupTabSize; - TStaticText *StaticTextStatus; - TStaticText *StaticText1; - void __fastcall mnuFileOpenClick(TObject *Sender); - void __fastcall FormCreate(TObject *Sender); - void __fastcall ListBoxChunksClick(TObject *Sender); - void __fastcall mnuReloadClick(TObject *Sender); - void __fastcall mnuExitClick(TObject *Sender); - void __fastcall FormDestroy(TObject *Sender); - void __fastcall mnuUndoClick(TObject *Sender); - void __fastcall mnuCutClick(TObject *Sender); - void __fastcall mnuCopyClick(TObject *Sender); - void __fastcall mnuPasteClick(TObject *Sender); - void __fastcall mnuSelectAllClick(TObject *Sender); - void __fastcall mnuWordWrapClick(TObject *Sender); - void __fastcall mnuSetFontClick(TObject *Sender); - void __fastcall FontDialog1Apply(TObject *Sender, HWND Wnd); - void __fastcall mnuFindClick(TObject *Sender); - void __fastcall FindDialogFind(TObject *Sender); - void __fastcall mnuFindNextClick(TObject *Sender); - void __fastcall sbtnCopyChunkClick(TObject *Sender); - void __fastcall mnuPrintClick(TObject *Sender); - void __fastcall mnuPrintSetupClick(TObject *Sender); - void __fastcall mnuSaveClick(TObject *Sender); - void __fastcall EventShowPage(TObject *Sender); - void __fastcall RadioGroupTabSizeClick(TObject *Sender); -protected : - void virtual __fastcall OnMinMax(TMessage& Msg); - BEGIN_MESSAGE_MAP // to limit minimum form size for about/help panes - MESSAGE_HANDLER( WM_GETMINMAXINFO, TMessage, OnMinMax ) - END_MESSAGE_MAP(TForm) -private: // User declarations - FILE *fd; - int iChunkCount; // To link stringList to listbox - String asTab; // Number of spaces to use as tab stop -public: // User declarations - // Constructor - __fastcall TMainForm(TComponent* Owner); - // Destructor - __fastcall ~TMainForm( void ); - - // ------------------------------------------------------------------ - // Callbacks ... as static member functions - // ------------------------------------------------------------------ - static mng_ptr __stdcall Alloc( mng_size_t iSize ); - static void __stdcall Free( mng_ptr pPtr, mng_size_t iSize ); - static mng_bool __stdcall FileReadData( mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead ); - static mng_bool __stdcall ProcessHeader( mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight ); - static mng_bool __stdcall OpenStream( mng_handle hMNG ); - static mng_bool __stdcall CloseStream( mng_handle hMNG ); - static mng_bool __stdcall IterateChunks( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq ); - - // ------------------------------------------------------------------ - //public data members - // ------------------------------------------------------------------ - // Associates a string, strList[n], with a chunk in the listbox[N] - TStringList *strList; - String asAppName; // pinch Application->Title at startup - - // ------------------------------------------------------------------ - // MessageBox functions - // ------------------------------------------------------------------ - int __fastcall MessageBox( String &as, UINT flags ); - void __fastcall MsgBoxOk( String as ); - int __fastcall MsgBoxYN( String as ); - int __fastcall MsgBoxYNC( String as ); - void __fastcall MsgBoxStop( String as ); - void __fastcall MsgBoxInfo( String as ); - void __fastcall MsgBoxWarn( String as ); - - // ------------------------------------------------------------------ - // Just to isolate teh "FILE *fd" variable from possible change. - inline FILE* __fastcall GetFd( void ) - { return fd; }; - - // ------------------------------------------------------------------ - // Options - // ------------------------------------------------------------------ - inline bool _fastcall WantsComments( void ) - { return cbComments->Checked; }; - - inline bool _fastcall WantsPaletteEntries( void ) - { return cbPaletteEntries->Checked; }; - - inline bool _fastcall WantsRgbOrder( void ) - { return cbRGBOrder->Checked; }; - - inline bool _fastcall WantsRawData( void ) - { return cbRawData->Checked; }; - - inline bool _fastcall WantsMacroIds( void ) - { return cbMacroIdentifier->Checked; }; - - inline bool _fastcall WantsBool( void ) - { return cbBool->Checked; }; - - // ------------------------------------------------------------------ - // Chunk count stuff - // ------------------------------------------------------------------ - inline int __fastcall IncChunkCount( void ) - { return iChunkCount += 1; }; - inline int __fastcall SetChunkCount( int anInt ) - { iChunkCount = anInt; }; - inline int __fastcall GetChunkCount( void ) - { return iChunkCount; }; - - // ------------------------------------------------------------------ - // Open a file, initialise things, and then calls "Dumptree(...)" - void __fastcall LoadFile( void ); - - // All LibMng calls involving the library handle are made from here : - // Initialize the library - // Setup callbacks - // Read the file into memory - // Run through the chunk list (mng_iterate_chunks) - // Cleanup the library - // Show Report page, all done. (then explode into the starry heavens!) - bool __fastcall DumpTree( void ); - - // Handle library errors gracefully. - void __fastcall MNGError( mng_handle hMNG, String SHMsg ); - - // Uesd with Palette entries - to right align int's to N chars width - String __fastcall PadInt( int iInt, int iWidth = 3 ); // default = 3 - - // A long switch that calls Info_XXXX's to assemble the chunks string - mng_bool __fastcall ShowChunk( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype ); - - // ------------------------------------------------------------------ - // The following functions are to assemble a string for each chunk. - // The function name "Info_????" denotes which chunk it handles - // Definitions can be found in "Chunks.cpp" - // ------------------------------------------------------------------ - bool __fastcall Info_BACK( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_BASI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_CLIP( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_CLON( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DBYK( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DEFI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DISC( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DROP( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_ENDL( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_FRAM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_IDAT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_IEND( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_IHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_IJNG - Function missing @ap@ - // MNG_UINT_IPNG - Function missing @ap@ - bool __fastcall Info_JDAT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_JHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_JSEP - Function missing @ap@ - bool __fastcall Info_LOOP( mng_handle hMNG, mng_handle hChunk, String &as ); - // MAGN ? MNG_UINT_MAGN @ap@ - bool __fastcall Info_MEND( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_MHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_MOVE( mng_handle hMNG, mng_handle hChunk, String &as ); - // MaGN ? MNG_UINT_MaGN @ap@ - bool __fastcall Info_ORDR( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PAST( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PLTE( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PPLT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PROM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_SAVE( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_SEEK( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_SHOW( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_TERM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_bKGD( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_cHRM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_eXPI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_fPRI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_gAMA( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_hIST( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_iCCP( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_iTXt( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_nEED( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_oFFs - Function missing @ap@ - // MNG_UINT_pCAL - Function missing @ap@ - bool __fastcall Info_pHYg( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_pHYs( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_sBIT( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_sCAL - Function missing @ap@ - bool __fastcall Info_sPLT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_sRGB( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_tEXt( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_tIME( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_tRNS( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_zTXt( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_Unknown( mng_handle hMNG, mng_handle hChunk, String &as ); - -}; -//--------------------------------------------------------------------------- -extern PACKAGE TMainForm *MainForm; -//--------------------------------------------------------------------------- -#endif diff --git a/Engine/lib/lmng/contrib/delphi/libmng.pas b/Engine/lib/lmng/contrib/delphi/libmng.pas deleted file mode 100644 index 1fabb2331..000000000 --- a/Engine/lib/lmng/contrib/delphi/libmng.pas +++ /dev/null @@ -1,1811 +0,0 @@ -unit libmng; - -{****************************************************************************} -{* *} -{* COPYRIGHT NOTICE: *} -{* *} -{* Copyright (c) 2000-2004 Gerard Juyn (gerard@libmng.com) *} -{* [You may insert additional notices after this sentence if you modify *} -{* this source] *} -{* *} -{* For the purposes of this copyright and license, "Contributing Authors" *} -{* is defined as the following set of individuals: *} -{* *} -{* Gerard Juyn *} -{* (hopefully some more to come...) *} -{* *} -{* The MNG Library is supplied "AS IS". The Contributing Authors *} -{* disclaim all warranties, expressed or implied, including, without *} -{* limitation, the warranties of merchantability and of fitness for any *} -{* purpose. The Contributing Authors assume no liability for direct, *} -{* indirect, incidental, special, exemplary, or consequential damages, *} -{* which may result from the use of the MNG Library, even if advised of *} -{* the possibility of such damage. *} -{* *} -{* Permission is hereby granted to use, copy, modify, and distribute this *} -{* source code, or portions hereof, for any purpose, without fee, subject *} -{* to the following restrictions: *} -{* *} -{* 1. The origin of this source code must not be misrepresented; *} -{* you must not claim that you wrote the original software. *} -{* *} -{* 2. Altered versions must be plainly marked as such and must not be *} -{* misrepresented as being the original source. *} -{* *} -{* 3. This Copyright notice may not be removed or altered from any source *} -{* or altered source distribution. *} -{* *} -{* The Contributing Authors specifically permit, without fee, and *} -{* encourage the use of this source code as a component to supporting *} -{* the MNG and JNG file format in commercial products. If you use this *} -{* source code in a product, acknowledgment would be highly appreciated. *} -{* *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : libmng.pas copyright (c) 2000-2004 G.Juyn *} -{* version : 1.0.8 *} -{* *} -{* purpose : libmng.dll wrapper unit *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info (at) 3-t (dot) com *} -{* *} -{* comment : contains the pascal-translation of libmng.h *} -{* can be used by Delphi programs to access the libmng.dll *} -{* *} -{* changes : 0.5.1 - 05/02/2000 - G.Juyn *} -{* - added this version block *} -{* 0.5.1 - 05/08/2000 - G.Juyn *} -{* - changed to stdcall convention *} -{* 0.5.1 - 05/11/2000 - G.Juyn *} -{* - changed callback prototypes *} -{* - added TRUE/FALSE/NULL constants *} -{* - added setoutputprofile2 & setsrgbprofile2 *} -{* - added several new types *} -{* - added chunk-access functions *} -{* - added new error- & tracecodes *} -{* *} -{* 0.5.2 - 05/24/2000 - G.Juyn *} -{* - removed error- & trace-strings since they are now *} -{* provided by the library *} -{* *} -{* 0.5.3 - 06/21/2000 - G.Juyn *} -{* - fixed definition of imagetype *} -{* - added definition of speedtype *} -{* - added get/set speed parameter *} -{* - added get imagelevel parameter *} -{* 0.5.3 - 06/26/2000 - G.Juyn *} -{* - changed definition of userdata to mng_ptr *} -{* 0.5.3 - 06/28/2000 - G.Juyn *} -{* - added mng_size_t definition *} -{* - changed definition of memory alloc size to mng_size_t *} -{* 0.5.3 - 06/29/2000 - G.Juyn *} -{* - changed order of refresh parameters *} -{* - changed definition of mng_handle *} -{* *} -{* 0.9.0 - 06/30/2000 - G.Juyn *} -{* - changed refresh parameters to 'x,y,width,height' *} -{* *} -{* 0.9.1 - 07/08/2000 - G.Juyn *} -{* - added libmng errorcode constants *} -{* 0.9.1 - 07/10/2000 - G.Juyn *} -{* - added new libmng functions *} -{* 0.9.1 - 07/19/2000 - G.Juyn *} -{* - fixed several type definitions *} -{* 0.9.1 - 07/25/2000 - G.Juyn *} -{* - fixed definition of mng_imgtype *} -{* *} -{* 0.9.2 - 08/04/2000 - G.Juyn *} -{* - fixed in line with libmng.h *} -{* 0.9.2 - 08/05/2000 - G.Juyn *} -{* - added function to set simplicity field *} -{* *} -{* 0.9.3 - 10/21/2000 - G.Juyn *} -{* - added several new HLAPI entry points *} -{* *} -{* 1.0.5 - 09/16/2002 - G.Juyn *} -{* - added dynamic MNG features *} -{* *} -{* 1.0.8 - 04/12/2004 - G.Juyn *} -{* - added CRC existence & checking flags *} -{* - added push mechanisms *} -{* *} -{****************************************************************************} - -interface - -{****************************************************************************} - -const MNG_TRUE = TRUE; - MNG_FALSE = FALSE; - MNG_NULL = nil; - -type mng_uint32 = cardinal; - mng_int32 = integer; - mng_uint16 = word; - mng_int16 = smallint; - mng_uint8 = byte; - mng_int8 = shortint; - mng_bool = boolean; - mng_ptr = pointer; - mng_pchar = pchar; - - mng_handle = pointer; - mng_retcode = mng_int32; - mng_chunkid = mng_uint32; - - mng_size_t = cardinal; - - mng_imgtype = (mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng); - mng_speedtype = (mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest); - - mng_uint32p = ^mng_uint32; - mng_uint16p = ^mng_uint16; - mng_uint8p = ^mng_uint8; - mng_chunkidp = ^mng_chunkid; - - mng_palette8e = packed record { 8-bit palette element } - iRed : mng_uint8; - iGreen : mng_uint8; - iBlue : mng_uint8; - end; - - mng_palette8 = packed array [0 .. 255] of mng_palette8e; - - mng_uint8arr = packed array [0 .. 255] of mng_uint8; - mng_uint8arr4 = packed array [0 .. 3] of mng_uint8; - mng_uint16arr = packed array [0 .. 255] of mng_uint16; - mng_uint32arr2 = packed array [0 .. 1] of mng_uint32; - -{****************************************************************************} - -type mng_memalloc = function ( iLen : mng_size_t) : mng_ptr; stdcall; -type mng_memfree = procedure ( pPtr : mng_ptr; - iLen : mng_size_t); stdcall; - -type mng_releasedata = procedure ( pUserData : mng_ptr; - pData : mng_ptr; - iLength : mng_size_t); stdcall; - -type mng_openstream = function ( hHandle : mng_handle) : mng_bool; stdcall; -type mng_closestream = function ( hHandle : mng_handle) : mng_bool; stdcall; - -type mng_readdata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; stdcall; - -type mng_writedata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pWritten : mng_uint32) : mng_bool; stdcall; - -type mng_errorproc = function ( hHandle : mng_handle; - iErrorcode : mng_retcode; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar ) : mng_bool; stdcall; -type mng_traceproc = function ( hHandle : mng_handle; - iFuncnr : mng_int32; - iFuncseq : mng_uint32; - zFuncname : mng_pchar ) : mng_bool; stdcall; - -type mng_processheader = function ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; -type mng_processtext = function ( hHandle : mng_handle; - iType : mng_uint8; - zKeyword : mng_pchar; - zText : mng_pchar; - zLanguage : mng_pchar; - zTranslation : mng_pchar ) : mng_bool; stdcall; - -type mng_processsave = function ( hHandle : mng_handle) : mng_bool; stdcall; -type mng_processseek = function ( hHandle : mng_handle; - zName : mng_pchar ) : mng_bool; stdcall; - -type mng_processneed = function ( hHandle : mng_handle; - zKeyword : mng_pchar ) : mng_bool; stdcall; - -type mng_processunknown = function ( hHandle : mng_handle; - iChunkid : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_bool; stdcall; - -type mng_getcanvasline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -type mng_getalphaline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -type mng_getbkgdline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -type mng_refresh = function ( hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; - -type mng_gettickcount = function ( hHandle : mng_handle) : mng_uint32; stdcall; -type mng_settimer = function ( hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; stdcall; - -type mng_processgamma = function ( hHandle : mng_handle; - iGamma : mng_uint32) : mng_bool; stdcall; -type mng_processchroma = function ( hHandle : mng_handle; - iWhitex : mng_uint32; - iWhitey : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32) : mng_bool; stdcall; -type mng_processsrgb = function ( hHandle : mng_handle; - iIntent : mng_uint8 ) : mng_bool; stdcall; -type mng_processiccp = function ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_bool; stdcall; -type mng_processarow = function ( hHandle : mng_handle; - iRowsamples : mng_uint32; - bIsRGBA16 : mng_bool; - pRow : mng_ptr ) : mng_bool; stdcall; - -type mng_iteratechunk = function ( hHandle : mng_handle; - hChunk : mng_handle; - iChunkid : mng_chunkid; - iChunkseq : mng_uint32) : mng_bool; stdcall; - -{****************************************************************************} - -function mng_initialize ( pUserdata : mng_ptr; - fMemalloc : mng_memalloc; - fMemfree : mng_memfree; - fTraceproc : mng_traceproc ) : mng_handle; stdcall; - -function mng_reset ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_cleanup (var hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_read ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_read_pushdata ( hHandle : mng_handle; - pData : mng_ptr; - iLength : mng_uint32; - bTakeownership : mng_bool ) : mng_retcode; stdcall; -function mng_read_pushsig ( hHandle : mng_handle; - eSigtype : mng_imgtype ) : mng_retcode; stdcall; -function mng_read_pushchunk ( hHandle : mng_handle; - pData : mng_ptr; - iLength : mng_uint32; - bTakeownership : mng_bool ) : mng_retcode; stdcall; -function mng_read_resume ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_write ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_create ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_readdisplay ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_resume ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_freeze ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_reset ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_goframe ( hHandle : mng_handle; - iFramenr : mng_uint32 ) : mng_retcode; stdcall; -function mng_display_golayer ( hHandle : mng_handle; - iLayernr : mng_uint32 ) : mng_retcode; stdcall; -function mng_display_gotime ( hHandle : mng_handle; - iPlaytime : mng_uint32 ) : mng_retcode; stdcall; - -function mng_trapevent ( hHandle : mng_handle; - iEventtype : mng_uint8; - iX : mng_int32; - iY : mng_int32 ) : mng_retcode; stdcall; - -function mng_getlasterror ( hHandle : mng_handle; - var iSeverity : mng_uint8; - var iChunkname : mng_chunkid; - var iChunkseq : mng_uint32; - var iExtra1 : mng_int32; - var iExtra2 : mng_int32; - var zErrortext : mng_pchar ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_setcb_memalloc ( hHandle : mng_handle; - fProc : mng_memalloc ) : mng_retcode; stdcall; -function mng_setcb_memfree ( hHandle : mng_handle; - fProc : mng_memfree ) : mng_retcode; stdcall; -function mng_setcb_releasedata ( hHandle : mng_handle; - fProc : mng_releasedata ) : mng_retcode; stdcall; - -function mng_setcb_openstream ( hHandle : mng_handle; - fProc : mng_openstream ) : mng_retcode; stdcall; -function mng_setcb_closestream ( hHandle : mng_handle; - fProc : mng_closestream ) : mng_retcode; stdcall; - -function mng_setcb_readdata ( hHandle : mng_handle; - fProc : mng_readdata ) : mng_retcode; stdcall; - -function mng_setcb_writedata ( hHandle : mng_handle; - fProc : mng_writedata ) : mng_retcode; stdcall; - -function mng_setcb_errorproc ( hHandle : mng_handle; - fProc : mng_errorproc ) : mng_retcode; stdcall; -function mng_setcb_traceproc ( hHandle : mng_handle; - fProc : mng_traceproc ) : mng_retcode; stdcall; - -function mng_setcb_processheader ( hHandle : mng_handle; - fProc : mng_processheader) : mng_retcode; stdcall; -function mng_setcb_processtext ( hHandle : mng_handle; - fProc : mng_processtext ) : mng_retcode; stdcall; - -function mng_setcb_getcanvasline ( hHandle : mng_handle; - fProc : mng_getcanvasline) : mng_retcode; stdcall; -function mng_setcb_getalphaline ( hHandle : mng_handle; - fProc : mng_getalphaline ) : mng_retcode; stdcall; -function mng_setcb_getbkgdline ( hHandle : mng_handle; - fProc : mng_getbkgdline ) : mng_retcode; stdcall; -function mng_setcb_refresh ( hHandle : mng_handle; - fProc : mng_refresh ) : mng_retcode; stdcall; - -function mng_setcb_gettickcount ( hHandle : mng_handle; - fProc : mng_gettickcount ) : mng_retcode; stdcall; -function mng_setcb_settimer ( hHandle : mng_handle; - fProc : mng_settimer ) : mng_retcode; stdcall; - -function mng_setcb_processgamma ( hHandle : mng_handle; - fProc : mng_processgamma ) : mng_retcode; stdcall; -function mng_setcb_processchroma ( hHandle : mng_handle; - fProc : mng_processchroma) : mng_retcode; stdcall; -function mng_setcb_processsrgb ( hHandle : mng_handle; - fProc : mng_processsrgb ) : mng_retcode; stdcall; -function mng_setcb_processiccp ( hHandle : mng_handle; - fProc : mng_processiccp ) : mng_retcode; stdcall; -function mng_setcb_processarow ( hHandle : mng_handle; - fProc : mng_processarow ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_getcb_memalloc ( hHandle : mng_handle ) : mng_memalloc; stdcall; -function mng_getcb_memfree ( hHandle : mng_handle ) : mng_memfree; stdcall; -function mng_getcb_releasedata ( hHandle : mng_handle ) : mng_releasedata; stdcall; - -function mng_getcb_openstream ( hHandle : mng_handle ) : mng_openstream; stdcall; -function mng_getcb_closestream ( hHandle : mng_handle ) : mng_closestream; stdcall; - -function mng_getcb_readdata ( hHandle : mng_handle ) : mng_readdata; stdcall; - -function mng_getcb_writedata ( hHandle : mng_handle ) : mng_writedata; stdcall; - -function mng_getcb_errorproc ( hHandle : mng_handle ) : mng_errorproc; stdcall; -function mng_getcb_traceproc ( hHandle : mng_handle ) : mng_traceproc; stdcall; - -function mng_getcb_processheader ( hHandle : mng_handle ) : mng_processheader; stdcall; -function mng_getcb_processtext ( hHandle : mng_handle ) : mng_processtext; stdcall; - -function mng_getcb_getcanvasline ( hHandle : mng_handle ) : mng_getcanvasline; stdcall; -function mng_getcb_getalphaline ( hHandle : mng_handle ) : mng_getalphaline; stdcall; -function mng_getcb_getbkgdline ( hHandle : mng_handle ) : mng_getbkgdline; stdcall; -function mng_getcb_refresh ( hHandle : mng_handle ) : mng_refresh; stdcall; - -function mng_getcb_gettickcount ( hHandle : mng_handle ) : mng_gettickcount; stdcall; -function mng_getcb_settimer ( hHandle : mng_handle ) : mng_settimer; stdcall; - -function mng_getcb_processgamma ( hHandle : mng_handle ) : mng_processgamma; stdcall; -function mng_getcb_processchroma ( hHandle : mng_handle ) : mng_processchroma; stdcall; -function mng_getcb_processsrgb ( hHandle : mng_handle ) : mng_processsrgb; stdcall; -function mng_getcb_processiccp ( hHandle : mng_handle ) : mng_processiccp; stdcall; -function mng_getcb_processarow ( hHandle : mng_handle ) : mng_processarow; stdcall; - -{****************************************************************************} - -function mng_set_userdata ( hHandle : mng_handle; - pUserdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_set_canvasstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_bkgdstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; stdcall; - -function mng_set_bgcolor ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; stdcall; - -function mng_set_usebkgd ( hHandle : mng_handle; - bUseBKGD : mng_bool ) : mng_retcode; stdcall; - -function mng_set_storechunks ( hHandle : mng_handle; - bStorechunks : mng_bool ) : mng_retcode; stdcall; - -function mng_set_cacheplayback ( hHandle : mng_handle; - bCacheplayback : mng_bool ) : mng_retcode; stdcall; - -function mng_set_viewgammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_displaygammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_dfltimggammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; stdcall; - -function mng_set_srgb ( hHandle : mng_handle; - bIssRGB : mng_bool ) : mng_retcode; stdcall; -function mng_set_outputprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; stdcall; -function mng_set_outputprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; stdcall; -function mng_set_srgbprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; stdcall; -function mng_set_srgbprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; stdcall; - -function mng_set_maxcanvaswidth ( hHandle : mng_handle; - iMaxwidth : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_maxcanvasheight ( hHandle : mng_handle; - iMaxheight : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_maxcanvassize ( hHandle : mng_handle; - iMaxwidth : mng_uint32; - iMaxheight : mng_uint32 ) : mng_retcode; stdcall; - -function mng_set_suspensionmode ( hHandle : mng_handle; - bSuspensionmode : mng_bool ) : mng_retcode; stdcall; - -function mng_set_speed ( hHandle : mng_handle; - iSpeed : mng_speedtype ) : mng_retcode; stdcall; - -function mng_set_crcmode ( hHandle : mng_handle; - iCrcmode : mng_uint32 ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_get_userdata ( hHandle : mng_handle ) : mng_ptr; stdcall; - -function mng_get_sigtype ( hHandle : mng_handle ) : mng_imgtype; stdcall; -function mng_get_imagetype ( hHandle : mng_handle ) : mng_imgtype; stdcall; -function mng_get_imagewidth ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_imageheight ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_ticks ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_framecount ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_layercount ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_playtime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_simplicity ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_canvasstyle ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_bkgdstyle ( hHandle : mng_handle ) : mng_uint32; stdcall; - -procedure mng_get_bgcolor ( hHandle : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ); stdcall; - -function mng_get_usebkgd ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_storechunks ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_get_cacheplayback ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_viewgammaint ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_displaygammaint ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_dfltimggammaint ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_srgb ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_maxcanvaswidth ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_maxcanvasheight ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_suspensionmode ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_speed ( hHandle : mng_handle ) : mng_speedtype; stdcall; -function mng_get_imagelevel ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_starttime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_runtime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_currentframe ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_currentlayer ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_currentplaytime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_totalframes ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_totallayers ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_totalplaytime ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_status_error ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_reading ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_suspendbreak ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_creating ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_writing ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_displaying ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_running ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_timerbreak ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_dynamic ( hHandle : mng_handle ) : mng_bool; stdcall; - -{****************************************************************************} - -function mng_iterate_chunks ( hHandle : mng_handle; - iChunkseq : mng_uint32; - fProc : mng_iteratechunk ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_getchunk_ihdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_plte ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var aPalette : mng_palette8 ) : mng_retcode; stdcall; - -function mng_getchunk_idat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_trns ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var bGlobal : mng_bool; - var iType : mng_uint8; - var iCount : mng_uint32; - var aAlphas : mng_uint8arr; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iRawlen : mng_uint32; - var aRawdata : mng_uint8arr ) : mng_retcode; stdcall; - -function mng_getchunk_gama ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iGamma : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_chrm ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iWhitepointx : mng_uint32; - var iWhitepointy : mng_uint32; - var iRedx : mng_uint32; - var iRedy : mng_uint32; - var iGreenx : mng_uint32; - var iGreeny : mng_uint32; - var iBluex : mng_uint32; - var iBluey : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_srgb ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iRenderingintent : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_iccp ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iCompression : mng_uint8; - var iProfilesize : mng_uint32; - var pProfile : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_text ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_ztxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompression : mng_uint8; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_itxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompressionflag : mng_uint8; - var iCompressionmethod : mng_uint8; - var iLanguagesize : mng_uint32; - var zLanguage : mng_pchar; - var iTranslationsize : mng_uint32; - var zTranslation : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_bkgd ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var iIndex : mng_uint8; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ) : mng_retcode; stdcall; - -function mng_getchunk_phys ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_sbit ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var aBits : mng_uint8arr4) : mng_retcode; stdcall; - -function mng_getchunk_splt ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iSampledepth : mng_uint8; - var iEntrycount : mng_uint32; - var pEntries : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_hist ( hHandle : mng_handle; - hChunk : mng_handle; - var iEntrycount : mng_uint32; - var aEntries : mng_uint16arr) : mng_retcode; stdcall; - -function mng_getchunk_time ( hHandle : mng_handle; - hChunk : mng_handle; - var iYear : mng_uint16; - var iMonth : mng_uint8; - var iDay : mng_uint8; - var iHour : mng_uint8; - var iMinute : mng_uint8; - var iSecond : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_mhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iTicks : mng_uint32; - var iLayercount : mng_uint32; - var iFramecount : mng_uint32; - var iPlaytime : mng_uint32; - var iSimplicity : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_loop ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8; - var iRepeat : mng_uint32; - var iTermination : mng_uint8; - var iItermin : mng_uint32; - var iItermax : mng_uint32; - var iCount : mng_uint32; - var pSignals : mng_uint32p ) : mng_retcode; stdcall; - -function mng_getchunk_endl ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_defi ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iXlocation : mng_int32; - var iYlocation : mng_int32; - var bHasclip : mng_bool; - var iLeftcb : mng_int32; - var iRightcb : mng_int32; - var iTopcb : mng_int32; - var iBottomcb : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_basi ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var iViewable : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_clon ( hHandle : mng_handle; - hChunk : mng_handle; - var iSourceid : mng_uint16; - var iCloneid : mng_uint16; - var iClonetype : mng_uint8; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iLocationtype : mng_uint8; - var iLocationx : mng_int32; - var iLocationy : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_past ( hHandle : mng_handle; - hChunk : mng_handle; - var iDestid : mng_uint16; - var iTargettype : mng_uint8; - var iTargetx : mng_int32; - var iTargety : mng_int32; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_past_src ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iSourceid : mng_uint16; - var iComposition : mng_uint8; - var iOrientation : mng_uint8; - var iOffsettype : mng_uint8; - var iOffsetx : mng_int32; - var iOffsety : mng_int32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_disc ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pObjectids : mng_uint16p ) : mng_retcode; stdcall; - -function mng_getchunk_back ( hHandle : mng_handle; - hChunk : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iMandatory : mng_uint8; - var iImageid : mng_uint16; - var iTile : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_fram ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iMode : mng_uint8; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iChangedelay : mng_uint8; - var iChangetimeout : mng_uint8; - var iChangeclipping : mng_uint8; - var iChangesyncid : mng_uint8; - var iDelay : mng_uint32; - var iTimeout : mng_uint32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32; - var iCount : mng_uint32; - var pSyncids : mng_uint32p ) : mng_retcode; stdcall; - -function mng_getchunk_move ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMovetype : mng_uint8; - var iMovex : mng_int32; - var iMovey : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_clip ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iCliptype : mng_uint8; - var iClipl : mng_int32; - var iClipr : mng_int32; - var iClipt : mng_int32; - var iClipb : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_show ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMode : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_term ( hHandle : mng_handle; - hChunk : mng_handle; - var iTermaction : mng_uint8; - var iIteraction : mng_uint8; - var iDelay : mng_uint32; - var iItermax : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_save ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iOffsettype : mng_uint8; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_save_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iEntrytype : mng_uint8; - var iOffset : mng_uint32arr2; - var iStarttime : mng_uint32arr2; - var iLayernr : mng_uint32; - var iFramenr : mng_uint32; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_seek ( hHandle : mng_handle; - hChunk : mng_handle; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_expi ( hHandle : mng_handle; - hChunk : mng_handle; - var iSnapshotid : mng_uint16; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_fpri ( hHandle : mng_handle; - hChunk : mng_handle; - var iDeltatype : mng_uint8; - var iPriority : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_need ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_phyg ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_jhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iColortype : mng_uint8; - var iImagesampledepth : mng_uint8; - var iImagecompression : mng_uint8; - var iImageinterlace : mng_uint8; - var iAlphasampledepth : mng_uint8; - var iAlphacompression : mng_uint8; - var iAlphafilter : mng_uint8; - var iAlphainterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_jdat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_dhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iImagetype : mng_uint8; - var iDeltatype : mng_uint8; - var iBlockwidth : mng_uint32; - var iBlockheight : mng_uint32; - var iBlockx : mng_uint32; - var iBlocky : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_prom ( hHandle : mng_handle; - hChunk : mng_handle; - var iColortype : mng_uint8; - var iSampledepth : mng_uint8; - var iFilltype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_pplt ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_pplt_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var bUsed : mng_bool ) : mng_retcode; stdcall; - -function mng_getchunk_drop ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pChunknames : mng_chunkidp ) : mng_retcode; stdcall; - -function mng_getchunk_dbyk ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iPolarity : mng_uint8; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_ordr ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_ordr_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iChunkname : mng_chunkid; - var iOrdertype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_unknown ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_putchunk_ihdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_plte ( hHandle : mng_handle; - iCount : mng_uint32; - aPalette : mng_palette8 ) : mng_retcode; stdcall; - -function mng_putchunk_idat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_iend ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_putchunk_trns ( hHandle : mng_handle; - bEmpty : mng_bool; - bGlobal : mng_bool; - iType : mng_uint8; - iCount : mng_uint32; - aAlphas : mng_uint8arr; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iRawlen : mng_uint32; - aRawdata : mng_uint8arr ) : mng_retcode; stdcall; - -function mng_putchunk_gama ( hHandle : mng_handle; - bEmpty : mng_bool; - iGamma : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_chrm ( hHandle : mng_handle; - bEmpty : mng_bool; - iWhitepointx : mng_uint32; - iWhitepointy : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_srgb ( hHandle : mng_handle; - bEmpty : mng_bool; - iRenderingintent : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_iccp ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iCompression : mng_uint8; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_text ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_ztxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompression : mng_uint8; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_itxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompressionflag : mng_uint8; - iCompressionmethod : mng_uint8; - iLanguagesize : mng_uint32; - zLanguage : mng_pchar; - iTranslationsize : mng_uint32; - zTranslation : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_bkgd ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - iIndex : mng_uint8; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; stdcall; - -function mng_putchunk_phys ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_sbit ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - aBits : mng_uint8arr4) : mng_retcode; stdcall; - -function mng_putchunk_splt ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iSampledepth : mng_uint8; - iEntrycount : mng_uint32; - pEntries : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_hist ( hHandle : mng_handle; - iEntrycount : mng_uint32; - aEntries : mng_uint16arr) : mng_retcode; stdcall; - -function mng_putchunk_time ( hHandle : mng_handle; - iYear : mng_uint16; - iMonth : mng_uint8; - iDay : mng_uint8; - iHour : mng_uint8; - iMinute : mng_uint8; - iSecond : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_mhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iTicks : mng_uint32; - iLayercount : mng_uint32; - iFramecount : mng_uint32; - iPlaytime : mng_uint32; - iSimplicity : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_mend ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_putchunk_loop ( hHandle : mng_handle; - iLevel : mng_uint8; - iRepeat : mng_uint32; - iTermination : mng_uint8; - iItermin : mng_uint32; - iItermax : mng_uint32; - iCount : mng_uint32; - pSignals : mng_uint32p ) : mng_retcode; stdcall; - -function mng_putchunk_endl ( hHandle : mng_handle; - iLevel : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_defi ( hHandle : mng_handle; - iObjectid : mng_uint16; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iXlocation : mng_int32; - iYlocation : mng_int32; - bHasclip : mng_bool; - iLeftcb : mng_int32; - iRightcb : mng_int32; - iTopcb : mng_int32; - iBottomcb : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_basi ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - iViewable : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_clon ( hHandle : mng_handle; - iSourceid : mng_uint16; - iCloneid : mng_uint16; - iClonetype : mng_uint8; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iLocationtype : mng_uint8; - iLocationx : mng_int32; - iLocationy : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_past ( hHandle : mng_handle; - iDestid : mng_uint16; - iTargettype : mng_uint8; - iTargetx : mng_int32; - iTargety : mng_int32; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_past_src ( hHandle : mng_handle; - iEntry : mng_uint32; - iSourceid : mng_uint16; - iComposition : mng_uint8; - iOrientation : mng_uint8; - iOffsettype : mng_uint8; - iOffsetx : mng_int32; - iOffsety : mng_int32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_disc ( hHandle : mng_handle; - iCount : mng_uint32; - pObjectids : mng_uint16p ) : mng_retcode; stdcall; - -function mng_putchunk_back ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iMandatory : mng_uint8; - iImageid : mng_uint16; - iTile : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_fram ( hHandle : mng_handle; - bEmpty : mng_bool; - iMode : mng_uint8; - iNamesize : mng_uint32; - zName : mng_pchar; - iChangedelay : mng_uint8; - iChangetimeout : mng_uint8; - iChangeclipping : mng_uint8; - iChangesyncid : mng_uint8; - iDelay : mng_uint32; - iTimeout : mng_uint32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32; - iCount : mng_uint32; - pSyncids : mng_uint32p ) : mng_retcode; stdcall; - -function mng_putchunk_move ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMovetype : mng_uint8; - iMovex : mng_int32; - iMovey : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_clip ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iCliptype : mng_uint8; - iClipl : mng_int32; - iClipr : mng_int32; - iClipt : mng_int32; - iClipb : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_show ( hHandle : mng_handle; - bEmpty : mng_bool; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMode : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_term ( hHandle : mng_handle; - iTermaction : mng_uint8; - iIteraction : mng_uint8; - iDelay : mng_uint32; - iItermax : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_save ( hHandle : mng_handle; - bEmpty : mng_bool; - iOffsettype : mng_uint8; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_save_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iEntrytype : mng_uint8; - iOffset : mng_uint32arr2; - iStarttime : mng_uint32arr2; - iLayernr : mng_uint32; - iFramenr : mng_uint32; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_seek ( hHandle : mng_handle; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_expi ( hHandle : mng_handle; - iSnapshotid : mng_uint16; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_fpri ( hHandle : mng_handle; - iDeltatype : mng_uint8; - iPriority : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_need ( hHandle : mng_handle; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_phyg ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_jhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iColortype : mng_uint8; - iImagesampledepth : mng_uint8; - iImagecompression : mng_uint8; - iImageinterlace : mng_uint8; - iAlphasampledepth : mng_uint8; - iAlphacompression : mng_uint8; - iAlphafilter : mng_uint8; - iAlphainterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_jdat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_dhdr ( hHandle : mng_handle; - iObjectid : mng_uint16; - iImagetype : mng_uint8; - iDeltatype : mng_uint8; - iBlockwidth : mng_uint32; - iBlockheight : mng_uint32; - iBlockx : mng_uint32; - iBlocky : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_prom ( hHandle : mng_handle; - iColortype : mng_uint8; - iSampledepth : mng_uint8; - iFilltype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_pplt ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_pplt_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - bUsed : mng_bool ) : mng_retcode; stdcall; - -function mng_putchunk_drop ( hHandle : mng_handle; - iCount : mng_uint32; - pChunknames : mng_chunkidp ) : mng_retcode; stdcall; - -function mng_putchunk_dbyk ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iPolarity : mng_uint8; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_ordr ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_ordr_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iChunkname : mng_chunkid; - iOrdertype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_unknown ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_updatemngheader ( hHandle : mng_handle; - iFramecount : mng_uint32; - iLayercount : mng_uint32; - iPlaytime : mng_uint32 ) : mng_retcode; stdcall; - -function mng_updatemngsimplicity ( hHandle : mng_handle; - iSimplicity : mng_uint32 ) : mng_retcode; stdcall; - -{****************************************************************************} - -const MNG_NOERROR = 0; - - MNG_OUTOFMEMORY = 1; - MNG_INVALIDHANDLE = 2; - MNG_NOCALLBACK = 3; - MNG_UNEXPECTEDEOF = 4; - MNG_ZLIBERROR = 5; - MNG_JPEGERROR = 6; - MNG_LCMSERROR = 7; - MNG_NOOUTPUTPROFILE = 8; - MNG_NOSRGBPROFILE = 9; - MNG_BUFOVERFLOW = 10; - MNG_FUNCTIONINVALID = 11; - MNG_OUTPUTERROR = 12; - MNG_JPEGBUFTOOSMALL = 13; - MNG_NEEDMOREDATA = 14; - MNG_NEEDTIMERWAIT = 15; - MNG_NEEDSECTIONWAIT = 16; - - MNG_APPIOERROR = 901; - MNG_APPTIMERERROR = 902; - MNG_APPCMSERROR = 903; - MNG_APPMISCERROR = 904; - MNG_APPTRACEABORT = 905; - - MNG_INTERNALERROR = 999; - - MNG_INVALIDSIG = 1025; - MNG_INVALIDCRC = 1027; - MNG_INVALIDLENGTH = 1028; - MNG_SEQUENCEERROR = 1029; - MNG_CHUNKNOTALLOWED = 1030; - MNG_MULTIPLEERROR = 1031; - MNG_PLTEMISSING = 1032; - MNG_IDATMISSING = 1033; - MNG_CANNOTBEEMPTY = 1034; - MNG_GLOBALLENGTHERR = 1035; - MNG_INVALIDBITDEPTH = 1036; - MNG_INVALIDCOLORTYPE = 1037; - MNG_INVALIDCOMPRESS = 1038; - MNG_INVALIDFILTER = 1039; - MNG_INVALIDINTERLACE = 1040; - MNG_NOTENOUGHIDAT = 1041; - MNG_PLTEINDEXERROR = 1042; - MNG_NULLNOTFOUND = 1043; - MNG_KEYWORDNULL = 1044; - MNG_OBJECTUNKNOWN = 1045; - MNG_OBJECTEXISTS = 1046; - MNG_TOOMUCHIDAT = 1047; - MNG_INVSAMPLEDEPTH = 1048; - MNG_INVOFFSETSIZE = 1049; - MNG_INVENTRYTYPE = 1050; - MNG_ENDWITHNULL = 1051; - MNG_INVIMAGETYPE = 1052; - MNG_INVDELTATYPE = 1053; - MNG_INVALIDINDEX = 1054; - MNG_TOOMUCHJDAT = 1055; - MNG_JPEGPARMSERR = 1056; - MNG_INVFILLMETHOD = 1057; - MNG_OBJNOTCONCRETE = 1058; - MNG_TARGETNOALPHA = 1059; - MNG_MNGTOOCOMPLEX = 1060; - MNG_UNKNOWNCRITICAL = 1061; - MNG_UNSUPPORTEDNEED = 1062; - MNG_INVALIDDELTA = 1063; - MNG_INVALIDMETHOD = 1064; - MNG_IMPROBABLELENGTH = 1065; - MNG_INVALIDBLOCK = 1066; - MNG_INVALIDEVENT = 1067; - MNG_INVALIDMASK = 1068; - MNG_NOMATCHINGLOOP = 1069; - MNG_SEEKNOTFOUND = 1070; - - MNG_INVALIDCNVSTYLE = 2049; - MNG_WRONGCHUNK = 2050; - MNG_INVALIDENTRYIX = 2051; - MNG_NOHEADER = 2052; - MNG_NOCORRCHUNK = 2053; - MNG_NOMHDR = 2054; - - MNG_IMAGETOOLARGE = 4097; - MNG_NOTANANIMATION = 4098; - MNG_FRAMENRTOOHIGH = 4099; - MNG_LAYERNRTOOHIGH = 4100; - MNG_PLAYTIMETOOHIGH = 4101; - MNG_FNNOTIMPLEMENTED = 4102; - - MNG_IMAGEFROZEN = 8193; - -{****************************************************************************} - -const MNG_CANVAS_RGB8 = $00000000; - MNG_CANVAS_RGBA8 = $00001000; - MNG_CANVAS_ARGB8 = $00003000; - MNG_CANVAS_RGB8_A8 = $00005000; - MNG_CANVAS_BGR8 = $00000001; - MNG_CANVAS_BGRX8 = $00010001; - MNG_CANVAS_BGRA8 = $00001001; - MNG_CANVAS_ABGR8 = $00003001; - MNG_CANVAS_RGB16 = $00000100; { not supported yet } - MNG_CANVAS_RGBA16 = $00001100; { not supported yet } - MNG_CANVAS_ARGB16 = $00003100; { not supported yet } - MNG_CANVAS_BGR16 = $00000101; { not supported yet } - MNG_CANVAS_BGRA16 = $00001101; { not supported yet } - MNG_CANVAS_ABGR16 = $00003101; { not supported yet } - MNG_CANVAS_GRAY8 = $00000002; { not supported yet } - MNG_CANVAS_GRAY16 = $00000102; { not supported yet } - MNG_CANVAS_GRAYA8 = $00001002; { not supported yet } - MNG_CANVAS_GRAYA16 = $00001102; { not supported yet } - MNG_CANVAS_AGRAY8 = $00003002; { not supported yet } - MNG_CANVAS_AGRAY16 = $00003102; { not supported yet } - MNG_CANVAS_DX15 = $00000003; { not supported yet } - MNG_CANVAS_DX16 = $00000004; { not supported yet } - -{****************************************************************************} - -const MNG_UINT_HUH = $40404040; - - MNG_UINT_BACK = $4241434b; - MNG_UINT_BASI = $42415349; - MNG_UINT_CLIP = $434c4950; - MNG_UINT_CLON = $434c4f4e; - MNG_UINT_DBYK = $4442594b; - MNG_UINT_DEFI = $44454649; - MNG_UINT_DHDR = $44484452; - MNG_UINT_DISC = $44495343; - MNG_UINT_DROP = $44524f50; - MNG_UINT_ENDL = $454e444c; - MNG_UINT_FRAM = $4652414d; - MNG_UINT_IDAT = $49444154; - MNG_UINT_IEND = $49454e44; - MNG_UINT_IHDR = $49484452; - MNG_UINT_IJNG = $494a4e47; - MNG_UINT_IPNG = $49504e47; - MNG_UINT_JDAT = $4a444154; - MNG_UINT_JHDR = $4a484452; - MNG_UINT_JSEP = $4a534550; - MNG_UINT_LOOP = $4c4f4f50; - MNG_UINT_MEND = $4d454e44; - MNG_UINT_MHDR = $4d484452; - MNG_UINT_MOVE = $4d4f5645; - MNG_UINT_ORDR = $4f524452; - MNG_UINT_PAST = $50415354; - MNG_UINT_PLTE = $504c5445; - MNG_UINT_PPLT = $50504c54; - MNG_UINT_PROM = $50524f4d; - MNG_UINT_SAVE = $53415645; - MNG_UINT_SEEK = $5345454b; - MNG_UINT_SHOW = $53484f57; - MNG_UINT_TERM = $5445524d; - MNG_UINT_bKGD = $624b4744; - MNG_UINT_cHRM = $6348524d; - MNG_UINT_eXPI = $65585049; - MNG_UINT_fPRI = $66505249; - MNG_UINT_gAMA = $67414d41; - MNG_UINT_hIST = $68495354; - MNG_UINT_iCCP = $69434350; - MNG_UINT_iTXt = $69545874; - MNG_UINT_nEED = $6e454544; - MNG_UINT_oFFs = $6f464673; - MNG_UINT_pCAL = $7043414c; - MNG_UINT_pHYg = $70444167; - MNG_UINT_pHYs = $70485973; - MNG_UINT_sBIT = $73424954; - MNG_UINT_sCAL = $7343414c; - MNG_UINT_sPLT = $73504c54; - MNG_UINT_sRGB = $73524742; - MNG_UINT_tEXt = $74455874; - MNG_UINT_tIME = $74494d45; - MNG_UINT_tRNS = $74524e53; - MNG_UINT_zTXt = $7a545874; - - MNG_UINT_evNT = $65764e54; - -{****************************************************************************} - -implementation - -{****************************************************************************} - -const mngdll = 'libmng.dll'; - -{****************************************************************************} - -function mng_initialize; external mngdll; -function mng_reset; external mngdll; -function mng_cleanup; external mngdll; - -function mng_read; external mngdll; -function mng_read_pushdata; external mngdll; -function mng_read_pushsig; external mngdll; -function mng_read_pushchunk; external mngdll; -function mng_read_resume; external mngdll; -function mng_write; external mngdll; -function mng_create; external mngdll; - -function mng_readdisplay; external mngdll; -function mng_display; external mngdll; -function mng_display_resume; external mngdll; -function mng_display_freeze; external mngdll; -function mng_display_reset; external mngdll; -function mng_display_goframe; external mngdll; -function mng_display_golayer; external mngdll; -function mng_display_gotime; external mngdll; - -function mng_trapevent; external mngdll; - -function mng_getlasterror; external mngdll; - -{****************************************************************************} - -function mng_setcb_memalloc; external mngdll; -function mng_setcb_memfree; external mngdll; -function mng_setcb_releasedata; external mngdll; - -function mng_setcb_openstream; external mngdll; -function mng_setcb_closestream; external mngdll; - -function mng_setcb_readdata; external mngdll; - -function mng_setcb_writedata; external mngdll; - -function mng_setcb_errorproc; external mngdll; -function mng_setcb_traceproc; external mngdll; - -function mng_setcb_processheader; external mngdll; -function mng_setcb_processtext; external mngdll; - -function mng_setcb_getcanvasline; external mngdll; -function mng_setcb_getalphaline; external mngdll; -function mng_setcb_getbkgdline; external mngdll; -function mng_setcb_refresh; external mngdll; - -function mng_setcb_gettickcount; external mngdll; -function mng_setcb_settimer; external mngdll; - -function mng_setcb_processgamma; external mngdll; -function mng_setcb_processchroma; external mngdll; -function mng_setcb_processsrgb; external mngdll; -function mng_setcb_processiccp; external mngdll; -function mng_setcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_getcb_memalloc; external mngdll; -function mng_getcb_memfree; external mngdll; -function mng_getcb_releasedata; external mngdll; - -function mng_getcb_openstream; external mngdll; -function mng_getcb_closestream; external mngdll; - -function mng_getcb_readdata; external mngdll; - -function mng_getcb_writedata; external mngdll; - -function mng_getcb_errorproc; external mngdll; -function mng_getcb_traceproc; external mngdll; - -function mng_getcb_processheader; external mngdll; -function mng_getcb_processtext; external mngdll; - -function mng_getcb_getcanvasline; external mngdll; -function mng_getcb_getalphaline; external mngdll; -function mng_getcb_getbkgdline; external mngdll; -function mng_getcb_refresh; external mngdll; - -function mng_getcb_gettickcount; external mngdll; -function mng_getcb_settimer; external mngdll; - -function mng_getcb_processgamma; external mngdll; -function mng_getcb_processchroma; external mngdll; -function mng_getcb_processsrgb; external mngdll; -function mng_getcb_processiccp; external mngdll; -function mng_getcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_set_userdata; external mngdll; - -function mng_set_canvasstyle; external mngdll; -function mng_set_bkgdstyle; external mngdll; - -function mng_set_bgcolor; external mngdll; -function mng_set_usebkgd; external mngdll; - -function mng_set_storechunks; external mngdll; -function mng_set_cacheplayback; external mngdll; - -// function mng_set_viewgamma; external mngdll; -// function mng_set_displaygamma; external mngdll; -// function mng_set_dfltimggamma; external mngdll; -function mng_set_viewgammaint; external mngdll; -function mng_set_displaygammaint; external mngdll; -function mng_set_dfltimggammaint; external mngdll; - -function mng_set_srgb; external mngdll; -function mng_set_outputprofile; external mngdll; -function mng_set_outputprofile2; external mngdll; -function mng_set_srgbprofile; external mngdll; -function mng_set_srgbprofile2; external mngdll; - -function mng_set_maxcanvaswidth; external mngdll; -function mng_set_maxcanvasheight; external mngdll; -function mng_set_maxcanvassize; external mngdll; - -function mng_set_suspensionmode; external mngdll; -function mng_set_speed; external mngdll; -function mng_set_crcmode; external mngdll; - -{****************************************************************************} - -function mng_get_userdata; external mngdll; - -function mng_get_sigtype; external mngdll; -function mng_get_imagetype; external mngdll; -function mng_get_imagewidth; external mngdll; -function mng_get_imageheight; external mngdll; -function mng_get_ticks; external mngdll; -function mng_get_framecount; external mngdll; -function mng_get_layercount; external mngdll; -function mng_get_playtime; external mngdll; -function mng_get_simplicity; external mngdll; - -function mng_get_canvasstyle; external mngdll; -function mng_get_bkgdstyle; external mngdll; - -procedure mng_get_bgcolor; external mngdll; -function mng_get_usebkgd; external mngdll; - -function mng_get_storechunks; external mngdll; -function mng_get_cacheplayback; external mngdll; - -// function mng_get_viewgamma; external mngdll; -// function mng_get_displaygamma; external mngdll; -// function mng_get_dfltimggamma; external mngdll; -function mng_get_viewgammaint; external mngdll; -function mng_get_displaygammaint; external mngdll; -function mng_get_dfltimggammaint; external mngdll; - -function mng_get_srgb; external mngdll; - -function mng_get_maxcanvaswidth; external mngdll; -function mng_get_maxcanvasheight; external mngdll; - -function mng_get_suspensionmode; external mngdll; - -function mng_get_speed; external mngdll; -function mng_get_imagelevel; external mngdll; - -function mng_get_starttime; external mngdll; -function mng_get_runtime; external mngdll; -function mng_get_currentframe; external mngdll; -function mng_get_currentlayer; external mngdll; -function mng_get_currentplaytime; external mngdll; -function mng_get_totalframes; external mngdll; -function mng_get_totallayers; external mngdll; -function mng_get_totalplaytime; external mngdll; - -function mng_status_error; external mngdll; -function mng_status_reading; external mngdll; -function mng_status_suspendbreak; external mngdll; -function mng_status_creating; external mngdll; -function mng_status_writing; external mngdll; -function mng_status_displaying; external mngdll; -function mng_status_running; external mngdll; -function mng_status_timerbreak; external mngdll; -function mng_status_dynamic; external mngdll; - -{****************************************************************************} - -function mng_iterate_chunks; external mngdll; - -{****************************************************************************} - -function mng_getchunk_ihdr; external mngdll; -function mng_getchunk_plte; external mngdll; -function mng_getchunk_idat; external mngdll; -function mng_getchunk_trns; external mngdll; -function mng_getchunk_gama; external mngdll; -function mng_getchunk_chrm; external mngdll; -function mng_getchunk_srgb; external mngdll; -function mng_getchunk_iccp; external mngdll; -function mng_getchunk_text; external mngdll; -function mng_getchunk_ztxt; external mngdll; -function mng_getchunk_itxt; external mngdll; -function mng_getchunk_bkgd; external mngdll; -function mng_getchunk_phys; external mngdll; -function mng_getchunk_sbit; external mngdll; -function mng_getchunk_splt; external mngdll; -function mng_getchunk_hist; external mngdll; -function mng_getchunk_time; external mngdll; -function mng_getchunk_mhdr; external mngdll; -function mng_getchunk_loop; external mngdll; -function mng_getchunk_endl; external mngdll; -function mng_getchunk_defi; external mngdll; -function mng_getchunk_basi; external mngdll; -function mng_getchunk_clon; external mngdll; -function mng_getchunk_past; external mngdll; -function mng_getchunk_past_src; external mngdll; -function mng_getchunk_disc; external mngdll; -function mng_getchunk_back; external mngdll; -function mng_getchunk_fram; external mngdll; -function mng_getchunk_move; external mngdll; -function mng_getchunk_clip; external mngdll; -function mng_getchunk_show; external mngdll; -function mng_getchunk_term; external mngdll; -function mng_getchunk_save; external mngdll; -function mng_getchunk_save_entry; external mngdll; -function mng_getchunk_seek; external mngdll; -function mng_getchunk_expi; external mngdll; -function mng_getchunk_fpri; external mngdll; -function mng_getchunk_need; external mngdll; -function mng_getchunk_phyg; external mngdll; -function mng_getchunk_jhdr; external mngdll; -function mng_getchunk_jdat; external mngdll; -function mng_getchunk_dhdr; external mngdll; -function mng_getchunk_prom; external mngdll; -function mng_getchunk_pplt; external mngdll; -function mng_getchunk_pplt_entry; external mngdll; -function mng_getchunk_drop; external mngdll; -function mng_getchunk_dbyk; external mngdll; -function mng_getchunk_ordr; external mngdll; -function mng_getchunk_ordr_entry; external mngdll; -function mng_getchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_putchunk_ihdr; external mngdll; -function mng_putchunk_plte; external mngdll; -function mng_putchunk_idat; external mngdll; -function mng_putchunk_iend; external mngdll; -function mng_putchunk_trns; external mngdll; -function mng_putchunk_gama; external mngdll; -function mng_putchunk_chrm; external mngdll; -function mng_putchunk_srgb; external mngdll; -function mng_putchunk_iccp; external mngdll; -function mng_putchunk_text; external mngdll; -function mng_putchunk_ztxt; external mngdll; -function mng_putchunk_itxt; external mngdll; -function mng_putchunk_bkgd; external mngdll; -function mng_putchunk_phys; external mngdll; -function mng_putchunk_sbit; external mngdll; -function mng_putchunk_splt; external mngdll; -function mng_putchunk_hist; external mngdll; -function mng_putchunk_time; external mngdll; -function mng_putchunk_mhdr; external mngdll; -function mng_putchunk_mend; external mngdll; -function mng_putchunk_loop; external mngdll; -function mng_putchunk_endl; external mngdll; -function mng_putchunk_defi; external mngdll; -function mng_putchunk_basi; external mngdll; -function mng_putchunk_clon; external mngdll; -function mng_putchunk_past; external mngdll; -function mng_putchunk_past_src; external mngdll; -function mng_putchunk_disc; external mngdll; -function mng_putchunk_back; external mngdll; -function mng_putchunk_fram; external mngdll; -function mng_putchunk_move; external mngdll; -function mng_putchunk_clip; external mngdll; -function mng_putchunk_show; external mngdll; -function mng_putchunk_term; external mngdll; -function mng_putchunk_save; external mngdll; -function mng_putchunk_save_entry; external mngdll; -function mng_putchunk_seek; external mngdll; -function mng_putchunk_expi; external mngdll; -function mng_putchunk_fpri; external mngdll; -function mng_putchunk_need; external mngdll; -function mng_putchunk_phyg; external mngdll; -function mng_putchunk_jhdr; external mngdll; -function mng_putchunk_jdat; external mngdll; -function mng_putchunk_dhdr; external mngdll; -function mng_putchunk_prom; external mngdll; -function mng_putchunk_pplt; external mngdll; -function mng_putchunk_pplt_entry; external mngdll; -function mng_putchunk_drop; external mngdll; -function mng_putchunk_dbyk; external mngdll; -function mng_putchunk_ordr; external mngdll; -function mng_putchunk_ordr_entry; external mngdll; -function mng_putchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_updatemngheader; external mngdll; -function mng_updatemngsimplicity; external mngdll; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/delphi/mngview/Main.dfm b/Engine/lib/lmng/contrib/delphi/mngview/Main.dfm deleted file mode 100644 index cb86b81c6..000000000 Binary files a/Engine/lib/lmng/contrib/delphi/mngview/Main.dfm and /dev/null differ diff --git a/Engine/lib/lmng/contrib/delphi/mngview/Main.pas b/Engine/lib/lmng/contrib/delphi/mngview/Main.pas deleted file mode 100644 index daf04cee5..000000000 --- a/Engine/lib/lmng/contrib/delphi/mngview/Main.pas +++ /dev/null @@ -1,692 +0,0 @@ -unit Main; - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - Menus, StdCtrls, ExtCtrls, Buttons, - libmng; - -{****************************************************************************} -{* For conditions of distribution and use, *} -{* see copyright notice in libmng.pas *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : main.pas copyright (c) 2000-2002 G.Juyn *} -{* version : 1.0.5 *} -{* *} -{* purpose : Main form for mngview application *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info@3-t.com *} -{* *} -{* comment : this is the heart of the mngview applciation *} -{* *} -{* changes : 0.5.1 - 05/02/2000 - G.Juyn *} -{* - added this version block *} -{* - made the initialization part more robust *} -{* eg. program aborts on initialization errors *} -{* - B002(105797) - added check for existence of default sRGB *} -{* profile (now included in distribution) *} -{* - added mng_cleanup to program exit *} -{* 0.5.1 - 05/08/2000 - G.Juyn *} -{* - changed to stdcall convention *} -{* 0.5.1 - 05/11/2000 - G.Juyn *} -{* - changed callback function declarations *} -{* *} -{* 0.5.3 - 06/16/2000 - G.Juyn *} -{* - removed processmessages call from refresh callback *} -{* 0.5.3 - 06/17/2000 - G.Juyn *} -{* - switched "storechunks" off *} -{* 0.5.3 - 06/26/2000 - G.Juyn *} -{* - changed definition of userdata to mng_ptr *} -{* 0.5.3 - 06/28/2000 - G.Juyn *} -{* - changed the default icon to something more appropriate *} -{* - changed definition of memory alloc size to mng_size_t *} -{* 0.5.3 - 06/29/2000 - G.Juyn *} -{* - changed order of refresh parameters *} -{* *} -{* 0.9.0 - 06/30/2000 - G.Juyn *} -{* - changed refresh parameters to 'x,y,width,height' *} -{* *} -{* 0.9.1 - 07/08/2000 - G.Juyn *} -{* - fixed to use returncode constants *} -{* - changed to accomodate MNG_NEEDTIMERWAIT returncode *} -{* 0.9.1 - 07/10/2000 - G.Juyn *} -{* - changed to use suspension-mode *} -{* *} -{* 0.9.3 - 09/11/2000 - G.Juyn *} -{* - removed some tesst-stuff *} -{* *} -{* 1.0.1 - 05/02/2000 - G.Juyn *} -{* - removed loading default sRGB profile (auto in libmng) *} -{* *} -{* 1.0.5 - 09/16/2002 - G.Juyn *} -{* - added dynamic MNG features *} -{* 1.0.5 - 11/27/2002 - G.Juyn *} -{* - fixed freeze during read-cycle *} -{* *} -{****************************************************************************} - -type - TMainForm = class(TForm) - - OFMainMenu: TMainMenu; - OFMenuFile: TMenuItem; - OFMenuFileOpen: TMenuItem; - OFMenuFileProfile: TMenuItem; - OFMenuFileN1: TMenuItem; - OFMenuFileExit: TMenuItem; - - OFMenuOptions: TMenuItem; - OFMenuOptionsModemSpeed: TMenuItem; - OFMenuOptionsModem28k8: TMenuItem; - OFMenuOptionsModem33k6: TMenuItem; - OFMenuOptionsModem56k: TMenuItem; - OFMenuOptionsModemISDN64: TMenuItem; - OFMenuOptionsModemISDN128: TMenuItem; - OFMenuOptionsModemCable512: TMenuItem; - OFMenuOptionsModemUnlimited: TMenuItem; - - OFTimer: TTimer; - - OFOpenDialog: TOpenDialog; - OFOpenDialogProfile: TOpenDialog; - - OFImage: TImage; - - procedure FormCreate(Sender: TObject); - procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); - procedure FormShow(Sender: TObject); - procedure FormResize(Sender: TObject); - procedure FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); - procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); - - procedure OFImageMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); - procedure OFImageMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure OFImageMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - - procedure OFTimerTimer(Sender: TObject); - - procedure OFMenuFileOpenClick(Sender: TObject); - procedure OFMenuFileProfileClick(Sender: TObject); - procedure OFMenuFileExitClick(Sender: TObject); - - procedure OFMenuOptionsModemSpeedClick(Sender: TObject); - procedure OFMenuOptionsModemXClick(Sender: TObject); - - private - { Private declarations } - - SFFileName : string; { filename of the input stream } - OFFile : TFileStream; { input stream } - IFHandle : mng_handle; { the libray handle } - OFBitmap : TBitmap; { drawing canvas } - BFCancelled : boolean; { or app-exit } - BFHasMouse : boolean; { mouse is/was over image } - - IFTicks : cardinal; { used to fake slow connections } - IFBytes : cardinal; - IFBytesPerSec : integer; - - procedure MNGerror (SHMsg : string); - - public - { Public declarations } - - end; - -var - MainForm: TMainForm; - -{****************************************************************************} - -implementation - -{$R *.DFM} - -{****************************************************************************} - -{$F+} -function Memalloc (iLen : mng_uint32) : mng_ptr; stdcall; -{$F-} -begin - getmem (Result, iLen); { get memory from the heap } - fillchar (Result^, iLen, 0); { and initialize it } -end; - -{****************************************************************************} - -{$F+} -procedure Memfree (iPtr : mng_ptr; - iLen : mng_size_t); stdcall; -{$F-} -begin - freemem (iPtr, iLen); { free the memory } -end; - -{****************************************************************************} - -{$F+} -function Openstream (hHandle : mng_handle) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - if OFFile <> nil then { free previous stream (if any) } - OFFile.Free; - { open a new stream } - OFFile := TFileStream.Create (SFFileName, fmOpenRead or fmShareDenyWrite); - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Closestream (hHandle : mng_handle) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - OFFile.Free; { cleanup the stream } - OFFile := nil; { don't use it again ! } - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Readdata ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - IHTicks : cardinal; - IHByte1 : cardinal; - IHByte2 : cardinal; - IHBytesPerSec : cardinal; - -begin - { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin { are we at EOF ? } - if OFFile.Position >= OFFile.Size then - begin - pRead := 0; { indicate so } - end - else - begin - IHBytesPerSec := IFBytesPerSec; { fake a slow connection } - - if IHBytesPerSec > 0 then - begin - IHTicks := Windows.GetTickCount; - IHByte1 := round (((IHTicks - IFTicks) / 1000) * IHBytesPerSec); - IHByte2 := (IFBytes + iBuflen); - - if ((IHByte2 - IHByte1) div IHBytesPerSec) > 10 then - Windows.Sleep ((IHByte2 - IHByte1) div IHBytesPerSec); - - end; - { read the requested data } - pRead := OFFile.Read (pBuf^, iBuflen); - IFBytes := IFBytes + pRead; - end; - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function ProcessHeader (hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin - OFBitmap.Width := iWidth; { store the new dimensions } - OFBitmap.Height := iHeight; - OFImage.Left := 0; { adjust the visible component } - OFImage.Top := 0; - OFImage.Width := iWidth; - OFImage.Height := iHeight; - - FormResize (OHForm); { force re-centering the image} - { clear the canvas & draw an outline } - OFBitmap.Canvas.Brush.Color := clGray; - OFBitmap.Canvas.Brush.Style := bsSolid; - OFBitmap.Canvas.FillRect (OFBitmap.Canvas.ClipRect); - OFBitmap.Canvas.Brush.Color := clRed; - OFBitmap.Canvas.Brush.Style := bsSolid; - OFBitmap.Canvas.Pen.Color := clRed; - OFBitmap.Canvas.Pen.Style := psSolid; - OFBitmap.Canvas.FrameRect (OFBitmap.Canvas.ClipRect); - - OFImage.Picture.Assign (OFBitmap); { make sure it gets out there } - { tell the library we want funny windows-bgr} - if mng_set_canvasstyle (hHandle, MNG_CANVAS_BGRX8) <> 0 then - MNGerror ('libmng reported an error setting the canvas style'); - - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function GetCanvasLine (hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { easy with these bitmap objects ! } - Result := OHForm.OFBitmap.ScanLine [iLinenr]; -end; - -{****************************************************************************} - -{$F+} -function ImageRefresh (hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { force redraw } - OHForm.OFImage.Picture.Assign (OHForm.OFBitmap); - - Result := MNG_TRUE; -end; - - -{****************************************************************************} - -{$F+} -function GetTickCount (hHandle : mng_handle) : mng_uint32; stdcall; -{$F-} -begin - Result := Windows.GetTickCount; { windows knows that } -end; - -{****************************************************************************} - -{$F+} -function SetTimer (hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - OHForm.OFTimer.Interval := iMsecs; { and set the timer } - OHForm.OFTimer.Enabled := true; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -procedure TMainForm.FormCreate(Sender: TObject); - -var IHRed, IHGreen, IHBlue : word; - -begin { initialize } - OFBitmap := TBitmap.Create; - IFBytesPerSec := 10000000; - BFHasMouse := false; - OFFile := nil; - - OFOpenDialog.Initialdir := ''; - OFBitmap.HandleType := bmDIB; { make it a 24-bit DIB } - OFBitmap.PixelFormat := pf32bit; - { now initialize the library } - IFHandle := mng_initialize (mng_ptr(self), Memalloc, Memfree, nil); - - if IFHandle = NIL then - begin - MNGerror ('libmng initialization error' + #13#10 + - 'Program aborted'); - Windows.Postmessage (handle, WM_Close, 0, 0); - Exit; - end; - { no need to store chunk-info ! } - mng_set_storechunks (IFHandle, MNG_FALSE); - { do not use suspension-buffer } - mng_set_suspensionmode (IFHandle, MNG_FALSE); - { set all the callbacks } - if (mng_setcb_openstream (IFHandle, Openstream ) <> MNG_NOERROR) or - (mng_setcb_closestream (IFHandle, Closestream ) <> MNG_NOERROR) or - (mng_setcb_readdata (IFHandle, Readdata ) <> MNG_NOERROR) or - (mng_setcb_processheader (IFHandle, ProcessHeader) <> MNG_NOERROR) or - (mng_setcb_getcanvasline (IFHandle, GetCanvasLine) <> MNG_NOERROR) or - (mng_setcb_refresh (IFHandle, ImageRefresh ) <> MNG_NOERROR) or - (mng_setcb_gettickcount (IFHandle, GetTickCount ) <> MNG_NOERROR) or - (mng_setcb_settimer (IFHandle, SetTimer ) <> MNG_NOERROR) then - begin - MNGerror ('libmng reported an error setting a callback function!' + #13#10 + - 'Program aborted'); - Windows.Postmessage (handle, WM_Close, 0, 0); - Exit; - end; - - IHRed := (Color ) and $FF; { supply our own bg-color } - IHGreen := (Color shr 8) and $FF; - IHBlue := (Color shr 16) and $FF; - - IHRed := (IHRed shl 8) + IHRed; - IHGreen := (IHGreen shl 8) + IHGreen; - IHBlue := (IHBlue shl 8) + IHBlue; - - if mng_set_bgcolor (IFHandle, IHRed, IHGreen, IHBlue) <> MNG_NOERROR then - MNGerror ('libmng reported an error setting the background color!'); - -end; - -{****************************************************************************} - -procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); -begin - OFTimer.Enabled := false; - BFCancelled := true; - { if we're still animating then stop it } - if mng_status_running (IFHandle) and not mng_status_reading (IFHandle) then - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - - mng_cleanup (IFHandle); -end; - -{****************************************************************************} - -procedure TMainForm.FormShow(Sender: TObject); -begin - FormResize (self); -end; - -{****************************************************************************} - -procedure TMainForm.FormResize(Sender: TObject); -begin { center the image in the window } - if ClientWidth < OFImage.Width then - OFImage.Left := 0 - else - OFImage.Left := (ClientWidth - OFImage.Width ) div 2; - - if ClientHeight < OFImage.Height then - OFImage.Top := 0 - else - OFImage.Top := (ClientHeight - OFImage.Height) div 2; - -end; - -{****************************************************************************} - -procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if Key = vk_Escape then { pressing will freeze an animation } - begin - OFTimer.Enabled := false; { don't let that timer go off then ! } - BFCancelled := true; - - if mng_status_running (IFHandle) and not mng_status_reading (IFHandle) then - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - end; -end; - -{****************************************************************************} - -procedure TMainForm.FormMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { if we had the mouse, it's left ! } - begin - if mng_trapevent (IFHandle, 3, 0, 0) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := false; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseMove(Sender: TObject; Shift: TShiftState; - X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { did we have the mouse already ? } - begin - if mng_trapevent (IFHandle, 2, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - end - else - begin { if not, it has entered ! } - if mng_trapevent (IFHandle, 1, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := true; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 4, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 5, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFTimerTimer(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFTimer.Enabled := false; { only once ! } - - if not BFCancelled then - begin { and inform the library } - IHRslt := mng_display_resume (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRslt <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error during display_resume!'); - - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileOpenClick(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFOpenDialog.InitialDir := ''; - OFOpenDialog.FileName := SFFileName; - - if OFOpenDialog.Execute then { get the filename } - begin - if OFTimer.Enabled then { if the lib was active; stop it } - begin - OFTimer.Enabled := false; - - Application.ProcessMessages; { process any timer requests (for safety) } - { now freeze the animation } - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - end; - { save interesting fields } - SFFileName := OFOpenDialog.FileName; - IFTicks := Windows.GetTickCount; - IFBytes := 0; - BFCancelled := false; - { always reset (just in case) } - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!') - else - begin { and let the lib do it's job ! } - IHRslt := mng_readdisplay (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRSLT <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error reading the input file!'); - - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileProfileClick(Sender: TObject); - -var SHProfileDir : array [0 .. MAX_PATH + 20] of char; - -begin - GetSystemDirectory (@SHProfileDir, MAX_PATH); - strcat (@SHProfileDir, '\Color'); - - OFOpenDialogProfile.InitialDir := strpas (@SHProfileDir); - - if OFOpenDialogProfile.Execute then - if mng_set_outputprofile (IFHandle, pchar (OFOpenDialogProfile.FileName)) <> 0 then - MNGerror ('libmng reported an error setting the output-profile!'); - -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileExitClick(Sender: TObject); -begin - if mng_cleanup (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng cleanup error'); - - Close; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuOptionsModemSpeedClick(Sender: TObject); -begin - OFMenuOptionsModem28k8.Checked := false; - OFMenuOptionsModem33k6.Checked := false; - OFMenuOptionsModem56k.Checked := false; - OFMenuOptionsModemISDN64.Checked := false; - OFMenuOptionsModemISDN128.Checked := false; - OFMenuOptionsModemCable512.Checked := false; - OFMenuOptionsModemUnlimited.Checked := false; - - if IFBytesPerSec = OFMenuOptionsModem28k8.Tag div 10 then - OFMenuOptionsModem28k8.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModem33k6.Tag div 10 then - OFMenuOptionsModem33k6.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModem56k.Tag div 10 then - OFMenuOptionsModem56k.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModemISDN64.Tag div 10 then - OFMenuOptionsModemISDN64.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModemISDN128.Tag div 10 then - OFMenuOptionsModemISDN128.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModemUnlimited.Tag div 10 then - OFMenuOptionsModemCable512.Checked := true - else - OFMenuOptionsModemUnlimited.Checked := true; - -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuOptionsModemXClick(Sender: TObject); -begin - IFBytesPerSec := TMenuItem (Sender).Tag div 10; -end; - -{****************************************************************************} - -procedure TMainForm.MNGerror; - -var iErrorcode : mng_uint32; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar; - -begin { get extended info } - iErrorcode := mng_getlasterror (IFHandle, iSeverity, iChunkname, iChunkseq, - iExtra1, iExtra2, zErrortext); - - MessageDlg (SHMsg + #13#10#13#10 + strpas (zErrortext) + #13#10#13#10 + - Format ('Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d', - [iErrorcode, iSeverity, iChunkseq, iExtra1]), - mtError, [mbOK], 0); -end; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/delphi/mngview/mngview.dpr b/Engine/lib/lmng/contrib/delphi/mngview/mngview.dpr deleted file mode 100644 index 6408c75de..000000000 --- a/Engine/lib/lmng/contrib/delphi/mngview/mngview.dpr +++ /dev/null @@ -1,14 +0,0 @@ -program mngview; - -uses - Forms, - Main in 'Main.pas' {MainForm}, - libmng in '..\libmng.pas'; - -{$R *.RES} - -begin - Application.Initialize; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING b/Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING deleted file mode 100644 index d60c31a97..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/ChangeLog b/Engine/lib/lmng/contrib/gcc/fbmngplay/ChangeLog deleted file mode 100644 index fd0859233..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/ChangeLog +++ /dev/null @@ -1,10 +0,0 @@ -******************* Thu Sep 13 15:28:01 CEST 2001 ******************** - -* new option -S to play on start console only. -* new option -c to play animationon any fb console -* split fbmngplay to several files. - -******************* Wed Sep 12 14:51:44 CEST 2001 ******************** - -* new option -p for dynamic positioning of the mng animation in the - upper right corner. diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/Makefile b/Engine/lib/lmng/contrib/gcc/fbmngplay/Makefile deleted file mode 100644 index 27ad8db33..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -SHELL = /bin/sh -CC = gcc - -SOURCES = fbmngplay.c -PROGRAMS = fbmngplay fbmngplay.static -OBJECTS = fbmngplay.o messages.o mng.o console.o - -LDFLAGS = -L/usr/lib -LIBSS = /usr/lib/libmng-mini.a /usr/lib/libz.a -lm -LIBSD = -lmng -lz -lm - -CFLAGS = -Os -Wall -Wmissing-prototypes -Wstrict-prototypes -D_REENTRANT -COMPILE = $(CC) $(CFLAGS) -LINKS = $(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ -LINKD = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ - -all: $(PROGRAMS) - strip -s $(PROGRAMS) -.SUFFIXES: -.SUFFIXES: .S .c .o .s - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean: - -rm -f *.o core -clean: mostlyclean - -rm -f fbmngplay fbmngplay.static - -fbmngplay: $(OBJECTS) - @rm -f fbmngplay - $(LINKD) $(LDFLAGS) $(OBJECTS) $(LIBSD) -fbmngplay.static: $(OBJECTS) - @rm -f fbmngplay.static - $(LINKS) $(LDFLAGS) $(OBJECTS) $(LIBSS) - -.PHONY: mostlyclean clean fbmngplay fbmngplay.static all diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/README b/Engine/lib/lmng/contrib/gcc/fbmngplay/README deleted file mode 100644 index 4e839370a..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/README +++ /dev/null @@ -1,30 +0,0 @@ -* fbmngplay * - -a simple fbcon based mng player - -This is a simple example program, using the kernel framebuffer device -to display mng animation decoded by the new libmng implementation. - -This player is based on the SDL version included in the libmng package -from Ralph Giles . The code's fairly rough at this -point, but there was no example player for *nix in the distribution. -Patches welcome, of course. - -On a unix-like system, the build instructions are simple: - -(install and/or build the mng library from libmng.com) -make -make install - -To use the player: - -fbmngplay .mng .mng ... - -To stop looping animations, press CTRL C or send a TERM or INT signal. - -See the options with -fbmngplay -h - ---- -Stefan Reinauer, -$Date: 2002/09/26 18:09:36 $ diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/console.c deleted file mode 100644 index 4b5d5fb43..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. - - This file is based on getfd.c from the kbd package. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "console.h" - -int start_console = 0; - -/* - * getfd.c - * - * Get an fd for use with kbd/console ioctls. - * We try several things because opening /dev/console will fail - * if someone else used X (which does a chown on /dev/console). - */ - -static int -is_a_console(const int fd) { - char arg; - - arg = 0; - return (ioctl(fd, KDGKBTYPE, &arg) == 0 - && ((arg == KB_101) || (arg == KB_84))); -} - -static int -open_a_console(const char * const fnam) { - int fd; - - fd = open(fnam, O_RDONLY); - if (fd < 0 && errno == EACCES) - fd = open(fnam, O_WRONLY); - if (fd < 0) - return -1; - if (!is_a_console(fd)) { - close(fd); - return -1; - } - return fd; -} - -int getfd (const char * const nm) { - int fd; - - if (nm) { - fd = open_a_console(nm); - if (fd >= 0) - return fd; - } else { - fd = open_a_console("/dev/tty"); - if (fd >= 0) - return fd; - - fd = open_a_console("/dev/tty0"); - if (fd >= 0) - return fd; - - fd = open_a_console("/dev/console"); - if (fd >= 0) - return fd; - - for (fd = 0; fd < 3; fd++) - if (is_a_console(fd)) - return fd; - } - fprintf(stderr, - "Couldnt get a file descriptor referring to the console\n"); - exit(1); /* total failure */ -} - -int fd; -int current_console(void) -{ - struct vt_stat vtstat; - if (ioctl(fd, VT_GETSTATE, &vtstat)) { - fprintf(stderr,"fbmngplay: VT_GETSTATE\n"); - exit(1); - } - return vtstat.v_active; - -} - -void init_consoles(void) -{ - // get current tty - fd = getfd(0); - start_console=current_console(); -} - diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/console.h deleted file mode 100644 index 465efb484..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __CONSOLES_H -#define __CONSOLES_H - -extern int getfd(const char* const); -extern void init_consoles(void); -extern int current_console(void); -extern int start_console; - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.c deleted file mode 100644 index 8f26a2c5a..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "fbmngplay.h" -#include "messages.h" -#include "console.h" -#include "mng.h" - -volatile int run = 1; -int verbose = 0; -int buffered = 0; -int dynpos = 0; -int waitsignal = 0; -int delta = 16; -int sconly=0; - -void sigint_handler(int signal); -void sigterm_handler(int signal); -void sigusr1_handler(int signal); - -void sigint_handler(int signal) -{ - run = 2; -} - -void sigterm_handler(int signal) -{ - restore_area(); - run = 0; -} - -void sigusr1_handler(int signal) -{ - run = 0; -} - -int main(int argc, char *argv[]) -{ - int fbdev,c,option_index; - unsigned int alpha; - struct fb_var_screeninfo var; - - /* Check which console we're running on */ - init_consoles(); - - /* allocate our stream data structure */ - mng = (mngstuff *) calloc(1, sizeof(*mng)); - if (mng == NULL) { - fprintf(stderr, "could not allocate stream structure.\n"); - exit(0); - } - alpha = 100; - mng->alpha = 100; - mng->fbx = 15; - mng->fby = 15; - mng->background = NULL; - - while (1) { - static struct option long_options[] = { - {"help", 0, 0, 'h'}, - {"verbose", 0, 0, 'v'}, - {"alpha", 1, 0, 'a'}, - {"buffered", 0, 0, 'b'}, - {"signal", 0, 0, 's'}, - {"delta", 0, 0, 'd'}, - {"position", 0, 0, 'p'}, - {"version", 0, 0, 'V'}, - {"start-console",0,0,'S'}, - {"console",1,0,'c'}, - {0, 0, 0, 0} - }; - - c = getopt_long(argc, argv, "a:x:y:bh?vsd:pVSc:", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case 'a': - alpha = atoi(optarg); - if (alpha > 100) - alpha = 100; - mng->alpha = alpha; - break; - case 'x': - mng->fbx = atoi(optarg); - break; - case 'y': - mng->fby = atoi(optarg); - break; - case 'd': - delta = atoi(optarg); - break; - case '?': - case 'h': - usage(argv[0]); - exit(0); - case 'v': - verbose = 1; - break; - case 's': - waitsignal = 1; - break; - case 'b': - buffered = 1; - break; - case 'p': - dynpos = 1; - break; - case 'V': - version(); - exit(0); - case 'c': - start_console=atoi(optarg); - case 'S': - sconly=1; - break; - default: - break; - } - } - - if (optind >= argc) { - printf("Which files do you want to play?\n"); - exit(0); - } - - //init_consoles(); - - /* Initialize framebuffer */ - fbdev = open("/dev/fb0", O_RDWR); - if (fbdev < 0) { - fprintf(stderr, "error while opening framebuffer.\n"); - exit(fbdev); - } - - ioctl(fbdev, FBIOGET_VSCREENINFO, &var); - mng->fbwidth = var.xres; - mng->fbheight = var.yres; - mng->fbbpp = var.bits_per_pixel; - - mng->display = - mmap(NULL, var.xres * var.yres * (var.bits_per_pixel >> 3), - PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, 0); - - /* arrange to call the shutdown routine before we exit */ - atexit(&cleanup); - - while (optind < argc) { - // leftover arguements are filenames. - mng->filename = argv[optind++]; - - /* set up the mng decoder for our stream */ - mng->mng = mng_initialize(mng, mngalloc, mngfree, MNG_NULL); - if (mng->mng == MNG_NULL) { - fprintf(stderr, "could not initialize libmng.\n"); - exit(1); - } - - /* set the callbacks */ - mng_setcb_errorproc(mng->mng, mngerror); - mng_setcb_openstream(mng->mng, mngopenstream); - mng_setcb_closestream(mng->mng, mngclosestream); - mng_setcb_readdata(mng->mng, mngreadstream); - mng_setcb_gettickcount(mng->mng, mnggetticks); - mng_setcb_settimer(mng->mng, mngsettimer); - mng_setcb_processheader(mng->mng, mngprocessheader); - mng_setcb_getcanvasline(mng->mng, mnggetcanvasline); - mng_setcb_refresh(mng->mng, mngrefresh); - /* FIXME: should check for errors here */ - - signal(SIGINT, sigint_handler); - signal(SIGTERM, sigterm_handler); - - mng_readdisplay(mng->mng); - - /* loop though the frames */ - while (mng->delay && run) { - mdelay(mng->delay); - mng->delay = 0; - mng_display_resume(mng->mng); - if (run == 2) { - if (mng->alpha == 0) - run = 0; - mng->alpha -= delta; - if (mng->alpha < 0) - mng->alpha = 0; - } - } - - if (waitsignal && optind < argc) { - signal(SIGUSR1, sigusr1_handler); - run = 1; - while (run) { - sleep(2); - } - } - - memset(mng->copybuffer, 0, - 4 * mng->width * mng->height); - run = 1; - mng->alpha = alpha; - if (optind == argc) { /* last file */ - restore_area(); - } - } - - /* cleanup and quit */ - return mngquit(mng->mng); -} diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.h deleted file mode 100644 index 9af1c2764..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __FBMNGPLAY_H -#define __FBMNGPLAY_H - -#include - -#define FBMNGPLAY_VERSION "0.3" - -/* structure for keeping track of our mng stream inside the callbacks */ -typedef struct { - FILE *file; /* pointer to the file we're decoding */ - char *filename; /* pointer to the file's path/name */ - mng_uint32 delay; /* ticks to wait before resuming decode */ - unsigned char *display; /* pointer to display */ - unsigned char *copybuffer; - unsigned char *background; - mng_handle mng; /* mng handle */ - int width, height; - int fbwidth, fbheight, fbbpp; - int fbx, fby; - int alpha; -} mngstuff; - -extern volatile int run; -extern int verbose; -extern int buffered; -extern int dynpos; -extern int waitsignal; -extern int delta; -extern int sconly; - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.c deleted file mode 100644 index 2356ddf66..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#include - -#include "fbmngplay.h" -#include "messages.h" - -void usage(char *name) -{ - fprintf(stderr, "\nusage: %s [ -x ] [ -y ] [ -a ] [-b] [-v]" - " [-s] [file.mng [file.mng [...]]]\n", name); - fprintf(stderr, "\n -x: x coordinate\n"); - fprintf(stderr, " -y: y coordinate\n"); - fprintf(stderr, " -a, --alpha: default alpha channel 1..100\n"); - fprintf(stderr, " -v, --verbose: verbose mode\n"); - fprintf(stderr, " -b, --buffered: buffered mode\n"); - fprintf(stderr, " -s, --signal: wait for SIGUSR1 between animations\n"); - fprintf(stderr, " -p, --position: dynamically select position\n"); - fprintf(stderr, " -V, --version: show version and exit\n"); - fprintf(stderr, " -?, -h, --help: print this help.\n\n"); - fprintf(stderr, " -S --start-console: only output animation on console it was started on.\n"); -} - -void version(void) -{ - fprintf(stderr, "fbmngplay v%s, Copyright (C) 2001 Stefan Reinauer\n",FBMNGPLAY_VERSION); - fprintf(stderr, "fbmngplay comes with ABSOLUTELY NO WARRANTY;\n"); - fprintf(stderr,"This is free software, and you are welcome to redistribute it\n"); - fprintf(stderr,"under certain conditions; Check the GPL for details.\n"); -} diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.h deleted file mode 100644 index fe20eea5a..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __MESSAGES_H -#define __MESSAGES_H - -extern void usage(char *name); -extern void version(void); - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c deleted file mode 100644 index b6564cce4..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#include -#include -#include - -#include "fbmngplay.h" -#include "console.h" -#include "mng.h" - -mngstuff *mng; -unsigned char *bufferstream; -unsigned long bufferpos = 0, buffersize = 0; - -inline void mdelay(unsigned long msec) -{ - usleep(msec * 1000); -} - -/* callbacks for the mng decoder */ - -/* memory allocation; data must be zeroed */ -mng_ptr mngalloc(mng_uint32 size) -{ - return (mng_ptr) calloc(1, size); -} - -/* memory deallocation */ -void mngfree(mng_ptr p, mng_uint32 size) -{ - free(p); - return; -} - -mng_bool mngopenstream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* open the file */ - mymng->file = fopen(mymng->filename, "rb"); - if (mymng->file == NULL) { - fprintf(stderr, "unable to open '%s'\n", mymng->filename); - run = 0; - return MNG_FALSE; - } - - if (buffered) { - unsigned long len; - fseek(mymng->file, 0, SEEK_END); - len = ftell(mymng->file); - rewind(mymng->file); - bufferstream = malloc(len); - if (!bufferstream) { - /* Not enough memory for buffers - * -> we go back to unbuffered mode - */ - printf("Reverted to non buffered mode.\n"); - buffered = 0; - return MNG_TRUE; - } - buffersize = len; - fread(bufferstream, 1, len, mymng->file); - bufferpos = 0; - fclose(mymng->file); - mymng->file = NULL; - } - - return MNG_TRUE; -} - -mng_bool mngclosestream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* close the file */ - if (mymng->file) - fclose(mymng->file); - mymng->file = NULL; /* for safety */ - - if (bufferstream) { - free(bufferstream); - bufferstream = 0; - buffersize = 0; - bufferpos = 0; - } - return MNG_TRUE; -} - -/* feed data to the decoder */ -mng_bool mngreadstream(mng_handle mng, mng_ptr buffer, - mng_uint32 size, mng_uint32 * bytesread) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - if (!buffered) { - /* read the requested amount of data from the file */ - *bytesread = fread(buffer, 1, size, mymng->file); - } else { - *bytesread = (buffersize - bufferpos) < - size ? (buffersize - bufferpos) : size; - memcpy(buffer, bufferstream + bufferpos, *bytesread); - bufferpos += (*bytesread); - } - return MNG_TRUE; -} - -/* the header's been read. set up the display stuff */ -mng_bool mngprocessheader(mng_handle mng, - mng_uint32 width, mng_uint32 height) -{ - mngstuff *mymng; - unsigned char *copybuffer, *background; - unsigned char *src; - - mymng = (mngstuff *) mng_get_userdata(mng); - mymng->width = width; - mymng->height = height; - - if (dynpos) { - mymng->fbx = (mymng->fbwidth)-width-15; - switch (mymng->fbheight) { - case 768: - mymng->fby = 15; - break; - case 1024: - mymng->fby = 30; - break; - default: - mymng->fby = 0; - break; - } - } - - copybuffer = (unsigned char *) malloc(width * height * 4); - if (copybuffer == NULL) { - fprintf(stderr, "could not allocate copy buffer.\n"); - exit(0); - } - mymng->copybuffer = copybuffer; - - if (!mymng->background) { - background = - (unsigned char *) malloc(width * height * - (mymng->fbbpp >> 3)); - if (background == NULL) { - fprintf(stderr, - "could not allocate background buffer.\n"); - exit(0); - } - mymng->background = background; - - src = mymng->display + (mymng->fbwidth * mymng->fby + - mymng->fbx) * (mymng->fbbpp >> 3); - - while (height--) { - memcpy(background, src, - width * (mymng->fbbpp >> 3)); - background += width * (mymng->fbbpp >> 3); - src += mymng->fbwidth * (mymng->fbbpp >> 3); - } - } - /* tell the mng decoder about our bit-depth choice */ - /* FIXME: this works on intel. is it correct in general? */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRA8); - - return MNG_TRUE; -} - -/* return a row pointer for the decoder to fill */ -mng_ptr mnggetcanvasline(mng_handle mng, mng_uint32 line) -{ - mngstuff *mymng; - mng_ptr row; - - /* dereference our structure */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* we assume any necessary locking has happened - outside, in the frame level code */ - row = mymng->copybuffer + mymng->width * 4 * line; - - return (row); -} - -/* timer */ -mng_uint32 mnggetticks(mng_handle mng) -{ - mng_uint32 ticks; - struct timeval tv; - struct timezone tz; - - gettimeofday(&tv, &tz); - ticks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000); - - return (ticks); -} - -static inline void copyline(unsigned char *dest, unsigned char *src, - unsigned char *background, mngstuff * mymng) -{ - // BGRA8 - unsigned int i = mymng->width; - unsigned int fr, fg, fb, br, bg, bb, r, g, b, a; - unsigned short output, input; - - while (i--) { - fb = *src++; - fg = *src++; - fr = *src++; - - a = *src++; - a = a * mymng->alpha / 100; - switch (mymng->fbbpp) { - case 16: - input = *((unsigned short *) background)++; - br = (input >> 8) & 0xf8; - bg = (input >> 3) & 0xfc; - bb = input << 3 & 0xff; - break; - case 24: - bb = *background++; - bg = *background++; - br = *background++; - break; - case 32: - bb = *background++; - bg = *background++; - br = *background++; - background++; - break; - default: - br = 0; - bg = 0; - bb = 0; - printf("depth not supported.\n"); - run = 0; - break; - } - - r = ((fr * a) + (br * (0x100 - a))) >> 8; - g = ((fg * a) + (bg * (0x100 - a))) >> 8; - b = ((fb * a) + (bb * (0x100 - a))) >> 8; - - switch (mymng->fbbpp) { - case 16: - // dumb 24->16 bit conversion. - r >>= 3; - g >>= 2; - b >>= 3; - - output = (r << 11) | (g << 5) | b; - *((unsigned short *) dest)++ = output; - break; - case 24: - *dest++ = b; - *dest++ = g; - *dest++ = r; - break; - case 32: - *dest++ = b; - *dest++ = g; - *dest++ = r; - dest++; - break; - default: - break; - } - } -} - -mng_bool mngrefresh(mng_handle mng, mng_uint32 x, mng_uint32 y, - mng_uint32 w, mng_uint32 h) -{ - mngstuff *mymng; - unsigned char *dest, *src, *background; - - if (sconly && current_console()!=start_console) - return MNG_TRUE; - - /* dereference our structure */ - mymng = (mngstuff *) mng_get_userdata(mng); - - dest = mymng->display + ((mymng->fby * mymng->fbwidth + mymng->fbx) - * (mymng->fbbpp >> 3)); - src = mymng->copybuffer; - background = mymng->background; - /* refresh the screen with the new frame */ - while (h-- > 0) { - copyline(dest, src, background, mymng); - dest += mymng->fbwidth * (mymng->fbbpp >> 3); - background += mymng->width * (mymng->fbbpp >> 3); - src += 4 * mymng->width; // 4 bytes per pixel due to RGBA - } - - // remove traces - memset(mymng->copybuffer, 0, 4 * mymng->width * mymng->height); - - return MNG_TRUE; -} - -/* interframe delay callback */ -mng_bool mngsettimer(mng_handle mng, mng_uint32 msecs) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* set the timer for when the decoder wants to be woken */ - mymng->delay = msecs; - - return MNG_TRUE; -} - -mng_bool mngerror(mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - mngstuff *mymng; - char chunk[5]; - - /* dereference our data so we can get the filename */ - mymng = (mngstuff *) mng_get_userdata(mng); - /* pull out the chuck type as a string */ - // FIXME: does this assume unsigned char? - chunk[0] = (char) ((chunktype >> 24) & 0xFF); - chunk[1] = (char) ((chunktype >> 16) & 0xFF); - chunk[2] = (char) ((chunktype >> 8) & 0xFF); - chunk[3] = (char) ((chunktype) & 0xFF); - chunk[4] = '\0'; - - /* output the error */ - fprintf(stderr, "error playing '%s' chunk %s (%d):\n", - mymng->filename, chunk, chunkseq); - fprintf(stderr, "%s\n", text); - - return 0; -} - -int mngquit(mng_handle mng) -{ - mngstuff *mymng; - - /* dereference our data so we can free it */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* cleanup. this will call mymngclosestream */ - mng_cleanup(&mng); - - /* free our data */ - free(mymng); - /* quit */ - exit(0); -} - -void cleanup(void) -{ - mngquit(mng->mng); - exit(0); -} - -void restore_area(void) -{ - int height, width; - unsigned char *dest, *background; - - if (sconly && current_console()!=start_console) - return; - - background = mng->background; - height = mng->height; - width = mng->width; - dest = mng->display + (mng->fbwidth * mng->fby + - mng->fbx) * (mng->fbbpp >> 3); - while (height--) { - memcpy(dest, background, width * (mng->fbbpp >> 3)); - background += width * (mng->fbbpp >> 3); - dest += mng->fbwidth * (mng->fbbpp >> 3); - } -} diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h deleted file mode 100644 index 11dfb94b2..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __HOOKS_H -#define __HOOKS_H - -#include "fbmngplay.h" - -extern mngstuff *mng; - -extern inline void mdelay(unsigned long msec); -extern mng_ptr mngalloc(mng_uint32 size); -extern void mngfree(mng_ptr p, mng_uint32 size); -extern mng_bool mngopenstream(mng_handle mng); -extern mng_bool mngclosestream(mng_handle mng); -extern mng_bool mngreadstream( mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32 * bytesread); -extern mng_bool mngprocessheader( mng_handle mng, mng_uint32 width, mng_uint32 height); -extern mng_ptr mnggetcanvasline(mng_handle mng, mng_uint32 line); -extern mng_uint32 mnggetticks(mng_handle mng); -extern mng_bool mngrefresh(mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h); -extern mng_bool mngsettimer(mng_handle mng, mng_uint32 msecs); -extern mng_bool mngerror(mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text); -extern int mngquit(mng_handle mng); -extern void cleanup(void); -extern void restore_area(void); -#endif - diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/COPYING b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/COPYING deleted file mode 100644 index eb685a5ec..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/COPYING +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/Makefile b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/Makefile deleted file mode 100644 index 6e0783e40..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -LIBMNG_PREFIX = /usr/local - -CC = gcc - -CFLAGS = -g -O2 -Wall \ - `pkg-config --cflags gtk+-2.0` \ - -I$(LIBMNG_PREFIX)/include - -LIBS = `pkg-config --libs gtk+-2.0` \ - -L$(LIBMNG_PREFIX)/lib -lmng -ljpeg -llcms -lz - -OBJ = dummy.o \ - gtk-mng-view.o - -EXE_BASENAME=gmngview - -all: $(EXE_BASENAME) - -$(EXE_BASENAME): $(OBJ) - $(CC) -o $(EXE_BASENAME) $(OBJ) $(LIBS) - -#$(EXE_BASENAME)-static: $(OBJ) -# $(CC) -static -o $(EXE_BASENAME)-static $(OBJ) $(LIBS) - -.c.o: gtk-mng-view.h - $(CC) -c $(CFLAGS) $< - -clean: - rm -f core $(EXE_BASENAME) $(EXE_BASENAME)-static $(OBJ) diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README deleted file mode 100644 index af7a21ff0..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README +++ /dev/null @@ -1,38 +0,0 @@ -From dummy.c: - -/* - * Very simple program, that has been used by us - * (V. Babin and - * S. Kondrat ) - * during toying with libmng (http://www.limng.com) - * - * License: GPL :-)) - * - * 7 July 2001: added key-press/button-press handling to exit viewer without - * window-manager help; added libmng version info [Greg Roelofs] - */ - -From gtk-mng-view.c: - -/* Toy widget for GTK+ for displaying MNG animations. - * - * Copyright (C) 2000 The Free Software Foundation - * - * Author(s): Volodymyr Babin - * - * This code is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README.compile b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README.compile deleted file mode 100644 index fb97b563b..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README.compile +++ /dev/null @@ -1,8 +0,0 @@ -Require: - - * gtk+ >= 1.2.0 (tested on 1.2.8) - * libmng (tested on 0.9.2) - -You have specify Your libmng instalation prefix -before typing `make' in the first line of a Makefile -in this directory. Later type `make'. diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/dummy.c b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/dummy.c deleted file mode 100644 index c0aa16ec2..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/dummy.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Very simple program, that has been used by us - * (V. Babin and - * S. Kondrat ) - * during toying with libmng (http://www.libmng.com) - * - * License: GPL :-)) - * - * 7 July 2001: added key-press/button-press handling to exit viewer without - * window-manager help; added libmng version info [Greg Roelofs] - */ - -#include -#include -#include -#include -#include -#include -#include "gtk-mng-view.h" - -#define BLOCK_SIZE 4096 - -static guint -read_file (const gchar* file_name, guchar ** ptr) -{ - gint fd; - guint size = 0; - guint bytes_read = 0; - - if ((fd = open (file_name, O_RDONLY)) == -1) - { - perror (file_name); - * ptr = NULL; - return 0; - } - - * ptr = g_new (guchar, BLOCK_SIZE); - while ((bytes_read = read (fd, * ptr + size, BLOCK_SIZE))) - { - size += bytes_read; - * ptr = (guchar *) g_realloc (* ptr, size + BLOCK_SIZE); - } - close (fd); - - * ptr = (guchar *) g_realloc (* ptr, size); - return size; -} - -int -main (int argc, char ** argv) -{ - GtkMngView * mng_view; - GtkWidget * window; - GtkWidget * align; - GtkWidget * frame; - guchar * mng_data = NULL; - guint mng_data_size; - - if (argc < 2) - { - g_print ("Usage: %s \n\n", argv[0]); - - g_print (" Compiled with GTK+ %d.%d.%d; using GTK+ %d.%d.%d.\n", - GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, - gtk_major_version, gtk_minor_version, gtk_micro_version); -#ifdef GDK_PIXBUF_VERSION - g_print (" Compiled with gdk-pixbuf %s; using gdk-pixbuf %s.\n", - GDK_PIXBUF_VERSION, gdk_pixbuf_version); -#endif - g_print (" Compiled with libmng %s; using libmng %s.\n", - MNG_VERSION_TEXT, mng_version_text()); - g_print (" Compiled with zlib %s; using zlib %s.\n", - ZLIB_VERSION, zlib_version); -#ifdef JPEG_LIB_VERSION - { - int major = JPEG_LIB_VERSION / 10; - int minor = JPEG_LIB_VERSION % 10; - char minoralpha[2]; - - if (minor) - { - minoralpha[0] = (char)(minor - 1 + 'a'); - minoralpha[1] = '\0'; - } - else - minoralpha[0] = '\0'; - g_print (" Compiled with libjpeg %d%s.\n", major, minoralpha); - } -#endif - g_print ("\nPress Esc or Q, or click mouse button, to quit.\n"); - return 1; - } - - mng_data_size = read_file (* (argv + 1), &mng_data); - - if (mng_data == NULL) - return 1; - - gtk_init (&argc, &argv); - gdk_rgb_init (); - gdk_rgb_set_verbose (TRUE); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - - window = gtk_widget_new (GTK_TYPE_WINDOW, - "GtkWindow::type", GTK_WINDOW_TOPLEVEL, - "GtkWindow::title", "MNG animation", - "GtkContainer::border_width", 5, - NULL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - /* any keypress (e.g., Esc or Q) or mouse-button click will quit viewer */ - gtk_signal_connect (GTK_OBJECT (window), "key_press_event", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK); - gtk_signal_connect (GTK_OBJECT (window), "button_press_event", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (window), align); - frame = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (align), frame); - - /* actually it */ - mng_view = GTK_MNG_VIEW (gtk_mng_view_new ()); - gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (mng_view)); - - gtk_mng_view_load_mng_from_memory (mng_view, mng_data, mng_data_size); - g_free (mng_data); - - /* rest in piece */ - gtk_widget_show_all (window); - gtk_main (); - - return 0; -} diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.c b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.c deleted file mode 100644 index 2a10d7c33..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.c +++ /dev/null @@ -1,471 +0,0 @@ -/* Toy widget for GTK+ for displaying MNG animations. - * - * Copyright (C) 2000 The Free Software Foundation - * - * Author(s): Volodymyr Babin - * - * This code is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "gtk-mng-view.h" -#include - -/* MNG callbacks */ - -static mng_ptr -mng_malloc_callback (mng_size_t how_many) -{ - return (mng_ptr) g_new0 (gchar, how_many); -} - -static void -mng_free_callback (mng_ptr pointer, mng_size_t number) -{ - g_free (pointer); -} - -static mng_bool -mng_open_stream_callback (mng_handle mng_h) -{ - return MNG_TRUE; -} - -static mng_bool -mng_close_stream_callback (mng_handle mng_h) -{ - return MNG_TRUE; -} - -static mng_bool -mng_read_data_callback (mng_handle mng_h, - mng_ptr buffer, - mng_uint32 bytes_requested, - mng_uint32 * bytes_read) -{ - guint available_mng_food; - - GtkMngView * mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - - available_mng_food = mng_view->bytes_to_eat - mng_view->bytes_eaten; - if (available_mng_food > 0 && mng_view->mng_food != NULL) - { - * bytes_read = (mng_uint32) MIN ((mng_uint32) available_mng_food, bytes_requested); - memcpy (buffer, mng_view->mng_food + mng_view->bytes_eaten, * bytes_read); - mng_view->bytes_eaten += * bytes_read; - return MNG_TRUE; - } - else - return MNG_FALSE; -} - -static mng_bool -mng_process_header_callback (mng_handle mng_h, - mng_uint32 width, - mng_uint32 height) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - - mng_view->width = width; - mng_view->height = height; - - g_free (mng_view->MNG_drawing_buffer); - mng_view->MNG_drawing_buffer = g_new0 (guchar, 3 * width * height); - - gtk_widget_queue_resize (GTK_WIDGET (mng_view)); - return MNG_TRUE; -} - -static gboolean -gtk_mng_view_animator (GtkMngView * mng_view) -{ - mng_retcode retcode; - - retcode = mng_display_resume (mng_view->MNG_handle); - - if (retcode == MNG_NOERROR) - { - mng_view->timeout_ID = 0; - return FALSE; - } - else if (retcode == MNG_NEEDTIMERWAIT) - return FALSE; - else - g_warning ("mng_display_resume() return not good value"); - - return FALSE; -} - -static mng_bool -mng_set_timer_callback (mng_handle mng_h, - mng_uint32 delay) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - mng_view->timeout_ID = gtk_timeout_add (delay, - (GtkFunction) gtk_mng_view_animator, - mng_view); - return MNG_TRUE; -} - -static mng_uint32 -mng_get_tickcount_callback (mng_handle mng_h) -{ - gdouble seconds; - gulong microseconds; - - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - seconds = g_timer_elapsed (mng_view->timer, - µseconds); - - return ((mng_uint32) (seconds*1000.0 + ((gdouble) microseconds)/1000.0)); -} - -static mng_ptr -mng_get_canvas_line_callback (mng_handle mng_h, - mng_uint32 line) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - return mng_view->MNG_drawing_buffer + 3 * line * mng_view->width; -} - -static void gtk_mng_view_paint (GtkMngView *, GdkRectangle *); - -static mng_bool -mng_refresh_callback (mng_handle mng_h, - mng_uint32 x, - mng_uint32 y, - mng_uint32 width, - mng_uint32 height) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - - if (GTK_WIDGET_REALIZED (mng_view)) - { - GdkRectangle rectangle; - - rectangle.x = x; - rectangle.y = y; - rectangle.width = width; - rectangle.height = height; - gtk_mng_view_paint (mng_view, &rectangle); - } - return MNG_TRUE; -} - -static gboolean -gtk_mng_view_init_libmng (GtkMngView * mng_view) -{ - GtkWidget * widget; - - g_return_val_if_fail (IS_GTK_MNG_VIEW (mng_view), FALSE); - - if (mng_view->MNG_handle) - mng_cleanup (&mng_view->MNG_handle); - - mng_view->MNG_handle = mng_initialize (mng_view, - mng_malloc_callback, - mng_free_callback, - MNG_NULL); - - if (mng_view->MNG_handle == MNG_NULL) - return FALSE; - - if (mng_setcb_openstream (mng_view->MNG_handle, mng_open_stream_callback) != MNG_NOERROR || - mng_setcb_closestream (mng_view->MNG_handle, mng_close_stream_callback) != MNG_NOERROR || - mng_setcb_readdata (mng_view->MNG_handle, mng_read_data_callback) != MNG_NOERROR || - mng_setcb_processheader (mng_view->MNG_handle, mng_process_header_callback) != MNG_NOERROR || - mng_setcb_settimer (mng_view->MNG_handle, mng_set_timer_callback) != MNG_NOERROR || - mng_setcb_gettickcount (mng_view->MNG_handle, mng_get_tickcount_callback) != MNG_NOERROR || - mng_setcb_getcanvasline (mng_view->MNG_handle, mng_get_canvas_line_callback) != MNG_NOERROR || - mng_setcb_refresh (mng_view->MNG_handle, mng_refresh_callback) != MNG_NOERROR) - { - mng_cleanup (&mng_view->MNG_handle); - return FALSE; - } - - mng_set_canvasstyle (mng_view->MNG_handle, MNG_CANVAS_RGB8); - - widget = GTK_WIDGET (mng_view); - - if (!GTK_WIDGET_REALIZED (widget)) - gtk_widget_realize (widget); - - mng_set_bgcolor (mng_view->MNG_handle, - widget->style->bg[GTK_STATE_NORMAL].red, - widget->style->bg[GTK_STATE_NORMAL].green, - widget->style->bg[GTK_STATE_NORMAL].blue); - return TRUE; -} - -/* GTK+ widget methods */ - -static GtkWidgetClass * parent_class = NULL; - -static void -gtk_mng_view_finalize (GObject * obj) -{ - GtkMngView * mng_view = GTK_MNG_VIEW (obj); - - g_timer_destroy (mng_view->timer); - - if (mng_view->timeout_ID) - gtk_timeout_remove (mng_view->timeout_ID); - - g_free (mng_view->MNG_drawing_buffer); - - if (mng_view->MNG_handle) - mng_cleanup (&mng_view->MNG_handle); - - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -gtk_mng_view_size_request (GtkWidget * widget, GtkRequisition * requisition) -{ - GtkMngView * mng_view; - - g_return_if_fail (IS_GTK_MNG_VIEW (widget)); - g_return_if_fail (requisition != NULL); - - mng_view = (GtkMngView *) widget; - - requisition->width = mng_view->width; - requisition->height = mng_view->height; -} - -static void -gtk_mng_view_size_allocate (GtkWidget * widget, GtkAllocation * allocation) -{ - g_return_if_fail (IS_GTK_MNG_VIEW (widget)); - g_return_if_fail (allocation != NULL); - - if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, - allocation->x, - allocation->y, - allocation->width, - allocation->height); -} - -static void -gtk_mng_view_paint (GtkMngView * mng_view, - GdkRectangle * area) -{ - GtkWidget * widget; - guint rowstride; - guchar * buffer; - register guchar * ptr; - register guchar * bptr; - - widget = GTK_WIDGET (mng_view); - - g_assert (GTK_WIDGET_REALIZED (widget)); - - rowstride = 3 * area->width; - buffer = g_new (guchar, rowstride * area->height); - - - bptr = buffer; - ptr = mng_view->MNG_drawing_buffer - + 3 * (area->y * mng_view->width + area->x); - - while (bptr < buffer + rowstride * area->height) - { - memcpy (bptr, ptr, rowstride); - bptr += rowstride; - ptr += 3 * mng_view->width; - } - - gdk_draw_rgb_image (widget->window, - widget->style->white_gc, - area->x, - area->y, - area->width, - area->height, - GDK_RGB_DITHER_NORMAL, - buffer, - rowstride); - - g_free (buffer); - gdk_flush (); -} - -static gboolean -gtk_mng_view_expose (GtkWidget * widget, GdkEventExpose * event) -{ - g_return_val_if_fail (IS_GTK_MNG_VIEW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - if (GTK_WIDGET_REALIZED (widget)) - { - GdkRectangle dummy; - GdkRectangle rectangle; - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (widget); - dummy.x = dummy.y = 0; - dummy.width = mng_view->width; - dummy.height = mng_view->height; - - if (gdk_rectangle_intersect (&dummy, &event->area, &rectangle)) - gtk_mng_view_paint (mng_view, &rectangle); - } - return FALSE; -} - -static void -gtk_mng_view_realize (GtkWidget * widget) -{ - GdkWindowAttr attributes; - gint attributes_mask; - - g_return_if_fail (IS_GTK_MNG_VIEW (widget)); - - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); - attributes.event_mask = gtk_widget_get_events (widget); - attributes.event_mask |= GDK_EXPOSURE_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, widget); - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); -} - -static void -gtk_mng_view_init (GtkMngView * mng_view) -{ - g_return_if_fail (IS_GTK_MNG_VIEW (mng_view)); - - GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (mng_view), GTK_NO_WINDOW); - - mng_view->MNG_handle = NULL; - mng_view->MNG_drawing_buffer = NULL; - mng_view->timeout_ID = 0; - mng_view->timer = g_timer_new (); - g_timer_start (mng_view->timer); - mng_view->mng_food = NULL; -} - -static void -gtk_mng_view_class_init (GtkMngViewClass * klass) -{ - GObjectClass * object_class; - GtkWidgetClass * widget_class; - - parent_class = g_type_class_peek_parent (klass); - - object_class = G_OBJECT_CLASS (klass); - object_class->finalize = gtk_mng_view_finalize; - - widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_request = gtk_mng_view_size_request; - widget_class->size_allocate = gtk_mng_view_size_allocate; - widget_class->expose_event = gtk_mng_view_expose; - widget_class->realize = gtk_mng_view_realize; -} - -GtkType -gtk_mng_view_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo type_info = - { - "GtkMngView", - sizeof (GtkMngView), - sizeof (GtkMngViewClass), - (GtkClassInitFunc) gtk_mng_view_class_init, - (GtkObjectInitFunc) gtk_mng_view_init, - NULL, NULL, - (GtkClassInitFunc) NULL - }; - type = gtk_type_unique (GTK_TYPE_WIDGET, &type_info); - } - return type; -} - -GtkWidget * -gtk_mng_view_new (void) -{ - return GTK_WIDGET (gtk_type_new (GTK_MNG_VIEW_TYPE)); -} - -gboolean -gtk_mng_view_load_mng_from_memory (GtkMngView * mng_view, - guchar * data_to_eat, - guint data_size) -{ - g_return_val_if_fail (IS_GTK_MNG_VIEW (mng_view), FALSE); - g_return_val_if_fail (data_size > 27, FALSE); - g_return_val_if_fail (data_to_eat != NULL, FALSE); - - if (data_to_eat[0] != 0x8a || - data_to_eat[1] != 'M' || - data_to_eat[2] != 'N' || - data_to_eat[3] != 'G' || - data_to_eat[4] != 0x0d || - data_to_eat[5] != 0x0a || - data_to_eat[6] != 0x1a || - data_to_eat[7] != 0x0a) - { - g_warning ("not mng format"); - return FALSE; - } - - if (gtk_mng_view_init_libmng (mng_view)) - { - mng_view->bytes_to_eat = data_size; - mng_view->bytes_eaten = 0; - mng_view->mng_food = data_to_eat; - - if (mng_read (mng_view->MNG_handle) != MNG_NOERROR) - { - g_warning ("libmng read error"); - mng_cleanup (&mng_view->MNG_handle); - return FALSE; - } - else - return mng_display (mng_view->MNG_handle); - } - else - { - g_warning ("error initializing libmng"); - return FALSE; - } - return TRUE; -} diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.h b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.h deleted file mode 100644 index 1cbb33524..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Toy widget for GTK+ for displaying MNG animations. - * - * Copyright (C) 2000 The Free Software Foundation - * - * Author(s): Volodymyr Babin - * - * This code is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GTK_MNG_VIEW_H__ -#define __GTK_MNG_VIEW_H__ - -#include -#include - -#define GTK_MNG_VIEW_TYPE (gtk_mng_view_get_type ()) -#define GTK_MNG_VIEW(o) (GTK_CHECK_CAST ((o), GTK_MNG_VIEW_TYPE, GtkMngView)) -#define GTK_MNG_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), GTK_MNG_VIEW_TYPE, GtkMngViewClass)) -#define IS_GTK_MNG_VIEW(o) (GTK_CHECK_TYPE ((o), GTK_MNG_VIEW_TYPE)) -#define IS_GTK_MNG_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GTK_MNG_VIEW_TYPE)) - -typedef struct _GtkMngView GtkMngView; -typedef struct _GtkMngViewClass GtkMngViewClass; - -struct _GtkMngView -{ - GtkWidget widget; - /* private */ - GTimer * timer; - guint timeout_ID; - guint width; - guint height; - mng_handle MNG_handle; - guchar * MNG_drawing_buffer; - guchar * mng_food; - guint bytes_to_eat; - guint bytes_eaten; -}; - -struct _GtkMngViewClass -{ - GtkWidgetClass klass; -}; - -GtkType gtk_mng_view_get_type (void); -GtkWidget * gtk_mng_view_new (void); - -/* returns !FALSE on success */ -gboolean gtk_mng_view_load_mng_from_memory (GtkMngView *, guchar *, guint); - -#endif /* __GTK_MNG_VIEW_H__ */ diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/linux.mng b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/linux.mng deleted file mode 100644 index 16ffa0436..000000000 Binary files a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/linux.mng and /dev/null differ diff --git a/Engine/lib/lmng/contrib/gcc/mngtree/makefile.linux b/Engine/lib/lmng/contrib/gcc/mngtree/makefile.linux deleted file mode 100644 index 14b985eb4..000000000 --- a/Engine/lib/lmng/contrib/gcc/mngtree/makefile.linux +++ /dev/null @@ -1,43 +0,0 @@ -# makefile for mngtree test-program on Linux ELF with gcc - -prefix=/usr/local - -CC=gcc - -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -JPEGLIB=/usr/lib - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes #-Wconversion - -# for pgcc version 2.95.1, -O3 is buggy; don't use it. - -CFLAGS=-I$(INCPATH) -Wall -O3 -funroll-loops -DMNG_USE_SO $(ALIGN) # $(WARNMORE) -g -LDFLAGS=-L. -Wl,-rpath,. -L$(LIBPATH) -Wl,-rpath,$(LIBPATH) \ - -L$(JPEGLIB) -Wl,-rpath,$(JPEGLIB) -lmng -lz -ljpeg -lm - -OBJS = mngtree.o - -.SUFFIXES: .c .o - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c - -all: mngtree - -mngtree: mngtree.o - $(CC) -o mngtree $(CFLAGS) mngtree.o $(LDFLAGS) - -clean: - /bin/rm -f *.o mngtree - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -mngtree.o: mngtree.c diff --git a/Engine/lib/lmng/contrib/gcc/mngtree/mngtree.c b/Engine/lib/lmng/contrib/gcc/mngtree/mngtree.c deleted file mode 100644 index daa613c4a..000000000 --- a/Engine/lib/lmng/contrib/gcc/mngtree/mngtree.c +++ /dev/null @@ -1,237 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000 Gerard Juyn (gerard :at: libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : mngtree * */ -/* * file : mngtree.c copyright (c) 2000 G.Juyn * */ -/* * version : 1.0.1 * */ -/* * * */ -/* * purpose : main project file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : mngtree simply dumps the chunk-structure of the supplied * */ -/* * first parameter to stdout (should be a xNG-file) * */ -/* * * */ -/* * changes : 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed for compilation under Linux * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed definition of userdata to mng_ptr * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - changed memory allocation size parameters to mng_size_t * */ -/* * * */ -/* * 1.0.1 - 12/07/2003 - G.Juyn * */ -/* * - fixed inclusion of libmng.h (Thanks Raphael) * */ -/* * * */ -/* ************************************************************************** */ - -#include -#include -#include - -#include "../../../libmng.h" - -/* ************************************************************************** */ - -typedef struct user_struct { - - FILE *hFile; /* file handle */ - int iIndent; /* for nice indented formatting */ - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -mng_ptr myalloc (mng_size_t iSize) -{ /* duh! */ - return (mng_ptr)calloc (1, (size_t)iSize); -} - -/* ************************************************************************** */ - -void myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -mng_bool myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -mng_bool myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool myreaddata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* read it */ - *iRead = fread (pBuf, 1, iSize, pMydata->hFile); - /* iRead will indicate EOF */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool myiterchunk (mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - char aCh[4]; - char zIndent[80]; - int iX; - /* decode the chunkname */ - aCh[0] = (char)((iChunktype >> 24) & 0xFF); - aCh[1] = (char)((iChunktype >> 16) & 0xFF); - aCh[2] = (char)((iChunktype >> 8) & 0xFF); - aCh[3] = (char)((iChunktype ) & 0xFF); - /* indent less ? */ - if ( (iChunktype == MNG_UINT_MEND) || (iChunktype == MNG_UINT_IEND) || - (iChunktype == MNG_UINT_ENDL) ) - pMydata->iIndent -= 2; - /* this looks ugly; but I haven't - figured out how to do it prettier */ - for (iX = 0; iX < pMydata->iIndent; iX++) - zIndent[iX] = ' '; - zIndent[pMydata->iIndent] = '\0'; - /* print a nicely indented line */ - printf ("%s%c%c%c%c\n", zIndent, aCh[0], aCh[1], aCh[2], aCh[3]); - /* indent more ? */ - if ( (iChunktype == MNG_UINT_MHDR) || (iChunktype == MNG_UINT_IHDR) || - (iChunktype == MNG_UINT_JHDR) || (iChunktype == MNG_UINT_DHDR) || - (iChunktype == MNG_UINT_BASI) || (iChunktype == MNG_UINT_LOOP) ) - pMydata->iIndent += 2; - - return MNG_TRUE; /* keep'm coming... */ -} - -/* ************************************************************************** */ - -int dumptree (char * zFilename) -{ - userdatap pMydata; - mng_handle hMNG; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - /* can we open the file ? */ - if ((pMydata->hFile = fopen (zFilename, "rb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open input file %s.\n", zFilename); - return 1; - } - /* let's initialize the library */ - hMNG = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!hMNG) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (hMNG, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (hMNG, myclosestream)) != 0) || - ((iRC = mng_setcb_readdata (hMNG, myreaddata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* read the file into memory */ - if ((iRC = mng_read (hMNG)) != 0) - fprintf (stderr, "Cannot read the file.\n"); - else - { - pMydata->iIndent = 2; /* start of the indenting at a nice level */ - - printf ("Starting dump of %s.\n\n", zFilename); - /* run through the chunk list */ - if ((iRC = mng_iterate_chunks (hMNG, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - - printf ("\nDone.\n"); - } - } - - mng_cleanup (&hMNG); /* cleanup the library */ - } - - fclose (pMydata->hFile); /* cleanup */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -int main(int argc, char *argv[]) -{ - if (argc > 1) /* need that first parameter ! */ - return dumptree (argv[1]); - else - printf ("\nUsage: mngtree \n\n"); - - return 0; -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/.deps/mngplay.P b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/.deps/mngplay.P deleted file mode 100644 index 6d68a8a48..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/.deps/mngplay.P +++ /dev/null @@ -1,114 +0,0 @@ -mngplay.o: mngplay.c /usr/include/stdio.h /usr/include/features.h \ - /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stddef.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stdarg.h \ - /usr/include/bits/types.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/bits/stdio_lim.h \ - /usr/include/bits/stdio.h /usr/include/stdlib.h \ - /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/sys/sysmacros.h /usr/include/alloca.h \ - /usr/local/include/SDL/SDL.h /usr/local/include/SDL/SDL_main.h \ - /usr/local/include/SDL/SDL_types.h \ - /usr/local/include/SDL/SDL_getenv.h \ - /usr/local/include/SDL/SDL_error.h \ - /usr/local/include/SDL/begin_code.h \ - /usr/local/include/SDL/close_code.h \ - /usr/local/include/SDL/SDL_rwops.h /usr/local/include/SDL/SDL_timer.h \ - /usr/local/include/SDL/SDL_audio.h \ - /usr/local/include/SDL/SDL_byteorder.h \ - /usr/local/include/SDL/SDL_cdrom.h \ - /usr/local/include/SDL/SDL_joystick.h \ - /usr/local/include/SDL/SDL_events.h \ - /usr/local/include/SDL/SDL_active.h \ - /usr/local/include/SDL/SDL_keyboard.h \ - /usr/local/include/SDL/SDL_keysym.h \ - /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h \ - /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h \ - /usr/local/include/SDL/SDL_version.h /usr/local/include/libmng.h \ - /usr/local/include/libmng_conf.h /usr/local/include/libmng_types.h \ - /usr/local/include/zlib.h /usr/local/include/zconf.h \ - /usr/include/setjmp.h /usr/include/bits/setjmp.h \ - /usr/local/include/jpeglib.h /usr/local/include/jconfig.h \ - /usr/local/include/jmorecfg.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/limits.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/string.h \ - /usr/include/bits/string.h /usr/include/bits/string2.h \ - /usr/include/math.h /usr/include/bits/huge_val.h \ - /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/float.h \ - /usr/include/bits/mathinline.h -mngplay.c : -/usr/include/stdio.h : -/usr/include/features.h : -/usr/include/sys/cdefs.h : -/usr/include/gnu/stubs.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stddef.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stdarg.h : -/usr/include/bits/types.h : -/usr/include/libio.h : -/usr/include/_G_config.h : -/usr/include/bits/stdio_lim.h : -/usr/include/bits/stdio.h : -/usr/include/stdlib.h : -/usr/include/sys/types.h : -/usr/include/time.h : -/usr/include/endian.h : -/usr/include/bits/endian.h : -/usr/include/sys/select.h : -/usr/include/bits/select.h : -/usr/include/bits/sigset.h : -/usr/include/sys/sysmacros.h : -/usr/include/alloca.h : -/usr/local/include/SDL/SDL.h : -/usr/local/include/SDL/SDL_main.h : -/usr/local/include/SDL/SDL_types.h : -/usr/local/include/SDL/SDL_getenv.h : -/usr/local/include/SDL/SDL_error.h : -/usr/local/include/SDL/begin_code.h : -/usr/local/include/SDL/close_code.h : -/usr/local/include/SDL/SDL_rwops.h : -/usr/local/include/SDL/SDL_timer.h : -/usr/local/include/SDL/SDL_audio.h : -/usr/local/include/SDL/SDL_byteorder.h : -/usr/local/include/SDL/SDL_cdrom.h : -/usr/local/include/SDL/SDL_joystick.h : -/usr/local/include/SDL/SDL_events.h : -/usr/local/include/SDL/SDL_active.h : -/usr/local/include/SDL/SDL_keyboard.h : -/usr/local/include/SDL/SDL_keysym.h : -/usr/local/include/SDL/SDL_mouse.h : -/usr/local/include/SDL/SDL_video.h : -/usr/local/include/SDL/SDL_mutex.h : -/usr/local/include/SDL/SDL_quit.h : -/usr/local/include/SDL/SDL_version.h : -/usr/local/include/libmng.h : -/usr/local/include/libmng_conf.h : -/usr/local/include/libmng_types.h : -/usr/local/include/zlib.h : -/usr/local/include/zconf.h : -/usr/include/setjmp.h : -/usr/include/bits/setjmp.h : -/usr/local/include/jpeglib.h : -/usr/local/include/jconfig.h : -/usr/local/include/jmorecfg.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/limits.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/syslimits.h : -/usr/include/limits.h : -/usr/include/bits/posix1_lim.h : -/usr/include/bits/local_lim.h : -/usr/include/linux/limits.h : -/usr/include/bits/posix2_lim.h : -/usr/include/string.h : -/usr/include/bits/string.h : -/usr/include/bits/string2.h : -/usr/include/math.h : -/usr/include/bits/huge_val.h : -/usr/include/bits/mathdef.h : -/usr/include/bits/mathcalls.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/float.h : -/usr/include/bits/mathinline.h : diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS deleted file mode 100644 index 4ff88f20e..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS +++ /dev/null @@ -1,7 +0,0 @@ -Contributors to mnyplay - -Ralph Giles -Greg Roelofs (minor contribs!) - --- -$Date: 2002/09/26 18:09:37 $ diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/COPYING b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/COPYING deleted file mode 100644 index d60c31a97..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/ChangeLog b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/ChangeLog deleted file mode 100644 index c7605a8b1..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/ChangeLog +++ /dev/null @@ -1,29 +0,0 @@ -2001-07-08 Greg Roelofs - - added SDL/libmng/zlib/libjpeg version info to usage screen - - added mouse-click handling (as an alternate quit mode) - - added completely static build - - fixed automake setup to order options and libraries correctly on - link line, and included resulting files (configure, Makefile.in, - etc.) in order to match instructions in INSTALL file - -2000-07-06 Ralph Giles - * Release 0.1 - - added error handling callback - - added event system so you can actually quit - (click the window closebox or type 'escape' or 'q') - - window titles from the filename - - added basic auto* - -2000-07-05 Ralph Giles - * snapshot; - - changed refresh parameters to patch libmng 0.9 - -2000-06-06 Ralph Giles - * snapshot; - - basic playing works now with the MNGsuite tests - -2000-06-06 Ralph Giles - * snapshot; - - doesn't really work yet - -# beginning =) diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/INSTALL b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/INSTALL deleted file mode 100644 index b42a17ac4..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.am b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.am deleted file mode 100644 index 059b1d3e7..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -# process this with automake to create Makefile.in - -bin_PROGRAMS = mngplay mngplay-static - -mngplay_SOURCES = mngplay.c -mngplay_static_SOURCES = mngplay.c - -mngplay_static_LDFLAGS = -static - -# end diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.in b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.in deleted file mode 100644 index 2881fb680..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.in +++ /dev/null @@ -1,534 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# process this with automake to create Makefile.in - -SOURCES = $(mngplay_SOURCES) $(mngplay_static_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -bin_PROGRAMS = mngplay$(EXEEXT) mngplay-static$(EXEEXT) -subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ - ChangeLog INSTALL depcomp install-sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_mngplay_OBJECTS = mngplay.$(OBJEXT) -mngplay_OBJECTS = $(am_mngplay_OBJECTS) -mngplay_DEPENDENCIES = -am_mngplay_static_OBJECTS = mngplay.$(OBJEXT) -mngplay_static_OBJECTS = $(am_mngplay_static_OBJECTS) -mngplay_static_DEPENDENCIES = -DEFAULT_INCLUDES = -I. -I$(srcdir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(mngplay_SOURCES) $(mngplay_static_SOURCES) -DIST_SOURCES = $(mngplay_SOURCES) $(mngplay_static_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GREP = @GREP@ -HAS_SDL = @HAS_SDL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mngplay_LDADD = @mngplay_LDADD@ -mngplay_static_LDADD = @mngplay_static_LDADD@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -mngplay_SOURCES = mngplay.c -mngplay_static_SOURCES = mngplay.c -mngplay_static_LDFLAGS = -static -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -mngplay$(EXEEXT): $(mngplay_OBJECTS) $(mngplay_DEPENDENCIES) - @rm -f mngplay$(EXEEXT) - $(LINK) $(mngplay_LDFLAGS) $(mngplay_OBJECTS) $(mngplay_LDADD) $(LIBS) -mngplay-static$(EXEEXT): $(mngplay_static_OBJECTS) $(mngplay_static_DEPENDENCIES) - @rm -f mngplay-static$(EXEEXT) - $(LINK) $(mngplay_static_LDFLAGS) $(mngplay_static_OBJECTS) $(mngplay_static_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mngplay.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ - clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ - dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-compile distclean-generic distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am - - -# end -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/README b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/README deleted file mode 100644 index 0a99d0a62..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/README +++ /dev/null @@ -1,27 +0,0 @@ -* mngplay * - -a simple SDL-based mng player - -This is a simple example program, using the Simple Direct media Layer -to display mng animation decoded by the new libmng implementation. - -SDL and libmng are quite portable, but I've only tried it on x86 Linux. -Project files for MacOS, BeOS and Win32 are welcome. The code's fairly -rough at this point, but there was no example player for *nix in the -distribution. Patches welcome, of course. - -On a unix-like system, the build instructions are simple: - -(install and/or build the SDL libraries from libsdl.org) -(install and/or build the mng library from libmng.com) -./configure (or ./autogen.sh if you're using the cvs source) -make -make install - -To use the player: - -mngplay .mng - ---- -Ralph Giles -$Date: 2002/09/26 18:09:37 $ diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/acinclude.m4 b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/acinclude.m4 deleted file mode 100644 index 9505b56ba..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/acinclude.m4 +++ /dev/null @@ -1,34 +0,0 @@ -dnl autoconf macros for detecting libmng -dnl add this to your aclocal or acinclude to make use of it -dnl -dnl (c) 2000 Ralph Giles -dnl - -dnl A basic check: looks for libmng and its dependencies -dnl and adds the required bits to CFLAGS and LIBS - -# check for libmng -AC_DEFUN(LIBMNG_CHECK, [ - dnl prerequisites first - AC_CHECK_LIB(jpeg, jpeg_set_defaults) - AC_CHECK_LIB(z, inflate) - dnl now the library - AC_CHECK_LIB(mng, mng_readdisplay, [_libmng_present=1]) - AC_CHECK_HEADER(libmng.h) - dnl see if we need the optional link dependency - AC_CHECK_LIB(lcms, cmsCreateRGBProfile, [ - AC_CHECK_HEADER(lcms.h) - AC_CHECK_LIB(mng, mnglcms_initlibrary, [ - LIBS="$LIBS -llcms" - AC_DEFINE(HAVE_LIBLCMS) - _libmng_present=1 - ]) - ]) - if test $_libmng_present -eq 1; then - LIBS="-lmng $LIBS" - AC_DEFINE(HAVE_LIBMNG) - fi - _libmng_present= -]) - -dnl end LIBMNG macros diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/aclocal.m4 b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/aclocal.m4 deleted file mode 100644 index 6b72bbb1e..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/aclocal.m4 +++ /dev/null @@ -1,851 +0,0 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.6])]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 7 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -#serial 3 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 12 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.58])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) -AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([acinclude.m4]) diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.notes b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.notes deleted file mode 100644 index 8f217578d..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.notes +++ /dev/null @@ -1,54 +0,0 @@ -[The end of this file is the result of the following command, executed - under tcsh: - - (time /bin/sh autogen.sh) >>&! autogen.log & - - If you have automake and autoconf, the following minimal set of files - is sufficient to rerun the autogen.sh script: - - Makefile.am - acinclude.m4 - autogen.sh - configure.in - mngplay.c - - It will then create the following files: - - aclocal.m4 - mkinstalldirs [symbolic link to utility supplied with automake] - missing [symbolic link to utility supplied with automake] - install-sh [symbolic link to utility supplied with automake] - Makefile.in - configure - - The following documentation files are also part of mngplay: - - AUTHORS - COPYING - ChangeLog - INSTALL - README - - I have replaced the symbolic links with copies of the actual utilities and - included all files in order to match the instructions in the INSTALL file. - Either run configure and make in the usual manner, or, if you prefer, rerun - autogen.sh from scratch and then run configure and make. - - Greg Roelofs, 20010708 -] - ------------------------------------------------------------------------------- - -If you wish to pass any options to configure, please specify them on the -`autogen.sh' command line. -For example use --prefix= to specify the install directory. - -processing . -Running aclocal ... -Running automake --foreign ... -automake: configure.in: installing `./install-sh' -automake: configure.in: installing `./mkinstalldirs' -automake: configure.in: installing `./missing' -Running autoconf ... -Skipping configure process. -1.370u 0.220s 0:03.32 47.8% 0+0k 0+0io 3201pf+0w diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.sh b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.sh deleted file mode 100644 index 73864c449..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. - -PKGNAME="mngplay" - -# GRR 20010708: added this; just want to create configure script, not run it: -NOCONFIGURE="true" - -am_opt="--foreign" - -DIE=0 - -# try to guess the proper treetop -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. -(test -f $srcdir/configure.in \ - && test -f $srcdir/mngplay.c) || { - echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" - echo " top-level $PKGNAME directory" - exit 1 -} - - -# check for autoconf -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile $PKGNAME." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -# check for automake -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile $PKGNAME." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)." - DIE=1 - NO_AUTOMAKE=yes -} - - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)." - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$*"; then - echo - echo "If you wish to pass any options to configure, please specify them on the" - echo \`$0\'" command line." - echo "For example use --prefix= to specify the install directory." - echo -fi - -case $CC in -xlc ) - am_opt="$(am_opt) --include-deps";; -esac - -for coin in `find $srcdir -name configure.in -print` -do - dr=`dirname $coin` - if test -f $dr/NO-AUTO-GEN; then - echo skipping $dr -- flagged as no auto-gen - else - echo processing $dr - macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` - ( cd $dr - aclocalinclude="$ACLOCAL_FLAGS" - for k in $macrodirs; do - if test -d $k; then - aclocalinclude="$aclocalinclude -I $k" - ##else - ## echo "**Warning**: No such directory \`$k'. Ignored." - fi - done - if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then - if grep "sed.*POTFILES" configure.in >/dev/null; then - : do nothing -- we still have an old unmodified configure.in - else - echo "Creating $dr/aclocal.m4 ..." - test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 - echo "Running gettextize... Ignore non-fatal messages." - echo "no" | gettextize --force --copy - echo "Making $dr/aclocal.m4 writable ..." - test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 - fi - fi - if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then - echo "Creating $dr/aclocal.m4 ..." - test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 - echo "Running gettextize... Ignore non-fatal messages." - echo "no" | gettextize --force --copy - echo "Making $dr/aclocal.m4 writable ..." - test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 - fi - if grep "^AC_PROG_LIBTOOL" configure.in >/dev/null; then - echo "Running libtoolize..." - libtoolize --force --copy - fi - echo "Running aclocal $aclocalinclude ..." - aclocal $aclocalinclude - if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then - echo "Running autoheader..." - autoheader - fi - echo "Running automake $am_opt ..." - automake --add-missing $am_opt - echo "Running autoconf ..." - autoconf - ) - fi -done - -#conf_flags="--enable-maintainer-mode --enable-debug " - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" -else - echo Skipping configure process. -fi - -# end diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure deleted file mode 100644 index 857b82741..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure +++ /dev/null @@ -1,5782 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61. -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="mngplay.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -CYGPATH_W -PACKAGE -VERSION -ACLOCAL -AUTOCONF -AUTOMAKE -AUTOHEADER -MAKEINFO -install_sh -STRIP -INSTALL_STRIP_PROGRAM -mkdir_p -AWK -SET_MAKE -am__leading_dot -AMTAR -am__tar -am__untar -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -DEPDIR -am__include -am__quote -AMDEP_TRUE -AMDEP_FALSE -AMDEPBACKSLASH -CCDEPMODE -am__fastdepCC_TRUE -am__fastdepCC_FALSE -CPP -GREP -EGREP -HAS_SDL -mngplay_LDADD -mngplay_static_LDADD -LIBOBJS -LTLIBOBJS' -ac_subst_files='' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute directory names. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.61 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" -else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" -fi -shift -for ac_site_file -do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -am__api_version="1.9" -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done -IFS=$as_save_IFS - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm -f conftest.sed - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } -set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - SET_MAKE= -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE=mngplay - VERSION=$VERSION - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - - -depcc="$CC" am_compiler_list= - -{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - - -# Extract the first word of "sdl-config", so it can be a program name with args. -set dummy sdl-config; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_HAS_SDL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$HAS_SDL"; then - ac_cv_prog_HAS_SDL="$HAS_SDL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_HAS_SDL="yes" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -HAS_SDL=$ac_cv_prog_HAS_SDL -if test -n "$HAS_SDL"; then - { echo "$as_me:$LINENO: result: $HAS_SDL" >&5 -echo "${ECHO_T}$HAS_SDL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -if test "x$HAS_SDL" != "xyes"; then - { { echo "$as_me:$LINENO: error: SDL library not found! - You need this for any display to happen. (rather the point) - You can get a copy at " >&5 -echo "$as_me: error: SDL library not found! - You need this for any display to happen. (rather the point) - You can get a copy at " >&2;} - { (exit 1); exit 1; }; } -fi -CFLAGS="$CFLAGS `sdl-config --cflags`" - -mngplay_LDADD="`sdl-config --libs`" -mngplay_static_LDADD="`sdl-config --static-libs`" - - - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - -{ echo "$as_me:$LINENO: checking for jpeg_set_defaults in -ljpeg" >&5 -echo $ECHO_N "checking for jpeg_set_defaults in -ljpeg... $ECHO_C" >&6; } -if test "${ac_cv_lib_jpeg_jpeg_set_defaults+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ljpeg $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char jpeg_set_defaults (); -int -main () -{ -return jpeg_set_defaults (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_jpeg_jpeg_set_defaults=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_jpeg_jpeg_set_defaults=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_set_defaults" >&5 -echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_set_defaults" >&6; } -if test $ac_cv_lib_jpeg_jpeg_set_defaults = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBJPEG 1 -_ACEOF - - LIBS="-ljpeg $LIBS" - -fi - - -{ echo "$as_me:$LINENO: checking for inflate in -lz" >&5 -echo $ECHO_N "checking for inflate in -lz... $ECHO_C" >&6; } -if test "${ac_cv_lib_z_inflate+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char inflate (); -int -main () -{ -return inflate (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_z_inflate=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_z_inflate=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflate" >&5 -echo "${ECHO_T}$ac_cv_lib_z_inflate" >&6; } -if test $ac_cv_lib_z_inflate = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBZ 1 -_ACEOF - - LIBS="-lz $LIBS" - -fi - - { echo "$as_me:$LINENO: checking for mng_readdisplay in -lmng" >&5 -echo $ECHO_N "checking for mng_readdisplay in -lmng... $ECHO_C" >&6; } -if test "${ac_cv_lib_mng_mng_readdisplay+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmng $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char mng_readdisplay (); -int -main () -{ -return mng_readdisplay (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_mng_mng_readdisplay=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mng_mng_readdisplay=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_mng_mng_readdisplay" >&5 -echo "${ECHO_T}$ac_cv_lib_mng_mng_readdisplay" >&6; } -if test $ac_cv_lib_mng_mng_readdisplay = yes; then - _libmng_present=1 -fi - - if test "${ac_cv_header_libmng_h+set}" = set; then - { echo "$as_me:$LINENO: checking for libmng.h" >&5 -echo $ECHO_N "checking for libmng.h... $ECHO_C" >&6; } -if test "${ac_cv_header_libmng_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_libmng_h" >&5 -echo "${ECHO_T}$ac_cv_header_libmng_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking libmng.h usability" >&5 -echo $ECHO_N "checking libmng.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking libmng.h presence" >&5 -echo $ECHO_N "checking libmng.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: libmng.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: libmng.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: libmng.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: libmng.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: libmng.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: libmng.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: libmng.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: libmng.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: libmng.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: libmng.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for libmng.h" >&5 -echo $ECHO_N "checking for libmng.h... $ECHO_C" >&6; } -if test "${ac_cv_header_libmng_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_libmng_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_libmng_h" >&5 -echo "${ECHO_T}$ac_cv_header_libmng_h" >&6; } - -fi - - - { echo "$as_me:$LINENO: checking for cmsCreateRGBProfile in -llcms" >&5 -echo $ECHO_N "checking for cmsCreateRGBProfile in -llcms... $ECHO_C" >&6; } -if test "${ac_cv_lib_lcms_cmsCreateRGBProfile+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llcms $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char cmsCreateRGBProfile (); -int -main () -{ -return cmsCreateRGBProfile (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_lcms_cmsCreateRGBProfile=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_lcms_cmsCreateRGBProfile=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_lcms_cmsCreateRGBProfile" >&5 -echo "${ECHO_T}$ac_cv_lib_lcms_cmsCreateRGBProfile" >&6; } -if test $ac_cv_lib_lcms_cmsCreateRGBProfile = yes; then - - if test "${ac_cv_header_lcms_h+set}" = set; then - { echo "$as_me:$LINENO: checking for lcms.h" >&5 -echo $ECHO_N "checking for lcms.h... $ECHO_C" >&6; } -if test "${ac_cv_header_lcms_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_lcms_h" >&5 -echo "${ECHO_T}$ac_cv_header_lcms_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking lcms.h usability" >&5 -echo $ECHO_N "checking lcms.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking lcms.h presence" >&5 -echo $ECHO_N "checking lcms.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: lcms.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: lcms.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: lcms.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: lcms.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: lcms.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: lcms.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: lcms.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: lcms.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: lcms.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: lcms.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for lcms.h" >&5 -echo $ECHO_N "checking for lcms.h... $ECHO_C" >&6; } -if test "${ac_cv_header_lcms_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_lcms_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_lcms_h" >&5 -echo "${ECHO_T}$ac_cv_header_lcms_h" >&6; } - -fi - - - { echo "$as_me:$LINENO: checking for mnglcms_initlibrary in -lmng" >&5 -echo $ECHO_N "checking for mnglcms_initlibrary in -lmng... $ECHO_C" >&6; } -if test "${ac_cv_lib_mng_mnglcms_initlibrary+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmng $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char mnglcms_initlibrary (); -int -main () -{ -return mnglcms_initlibrary (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_mng_mnglcms_initlibrary=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mng_mnglcms_initlibrary=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_mng_mnglcms_initlibrary" >&5 -echo "${ECHO_T}$ac_cv_lib_mng_mnglcms_initlibrary" >&6; } -if test $ac_cv_lib_mng_mnglcms_initlibrary = yes; then - - LIBS="$LIBS -llcms" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBLCMS 1 -_ACEOF - - _libmng_present=1 - -fi - - -fi - - if test $_libmng_present -eq 1; then - LIBS="-lmng $LIBS" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBMNG 1 -_ACEOF - - fi - _libmng_present= - - -ac_config_files="$ac_config_files Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# Files that config.status was made for. -config_files="$ac_config_files" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2006 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL - export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - -_ACEOF - - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -CYGPATH_W!$CYGPATH_W$ac_delim -PACKAGE!$PACKAGE$ac_delim -VERSION!$VERSION$ac_delim -ACLOCAL!$ACLOCAL$ac_delim -AUTOCONF!$AUTOCONF$ac_delim -AUTOMAKE!$AUTOMAKE$ac_delim -AUTOHEADER!$AUTOHEADER$ac_delim -MAKEINFO!$MAKEINFO$ac_delim -install_sh!$install_sh$ac_delim -STRIP!$STRIP$ac_delim -INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim -mkdir_p!$mkdir_p$ac_delim -AWK!$AWK$ac_delim -SET_MAKE!$SET_MAKE$ac_delim -am__leading_dot!$am__leading_dot$ac_delim -AMTAR!$AMTAR$ac_delim -am__tar!$am__tar$ac_delim -am__untar!$am__untar$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -DEPDIR!$DEPDIR$ac_delim -am__include!$am__include$ac_delim -am__quote!$am__quote$ac_delim -AMDEP_TRUE!$AMDEP_TRUE$ac_delim -AMDEP_FALSE!$AMDEP_FALSE$ac_delim -AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim -CCDEPMODE!$CCDEPMODE$ac_delim -am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim -am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -HAS_SDL!$HAS_SDL$ac_delim -mngplay_LDADD!$mngplay_LDADD$ac_delim -mngplay_static_LDADD!$mngplay_static_LDADD$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 82; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof -_ACEOF - - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF -fi # test -n "$CONFIG_FILES" - - -for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - ac_file_inputs="$ac_file_inputs $ac_f" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - fi - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' $ac_file_inputs` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac - ;; - - - :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 -echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir=$dirpart/$fdir - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - - esac -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure.in b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure.in deleted file mode 100644 index 758926411..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure.in +++ /dev/null @@ -1,35 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl Version of this release -VERSION=0.1 - -AC_INIT(mngplay.c) -AM_INIT_AUTOMAKE(mngplay, $VERSION) - -dnl AC_CANONICAL_SYSTEM -AC_LANG_C - -dnl Checks for programs. -AC_PROG_CC - -dnl Checks for header files. -AC_HEADER_STDC - -dnl check for Simple Direct Media Layer -AC_CHECK_PROG(HAS_SDL, sdl-config, yes) -if test "x$HAS_SDL" != "xyes"; then - AC_MSG_ERROR([ SDL library not found! - You need this for any display to happen. (rather the point) - You can get a copy at ]) -fi -CFLAGS="$CFLAGS `sdl-config --cflags`" - -mngplay_LDADD="`sdl-config --libs`" -mngplay_static_LDADD="`sdl-config --static-libs`" -AC_SUBST(mngplay_LDADD) -AC_SUBST(mngplay_static_LDADD) - -dnl check for libmng - macro in acinclude.m4 -LIBMNG_CHECK() - -AC_OUTPUT(Makefile) diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/depcomp b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/depcomp deleted file mode 100644 index 04701da53..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/depcomp +++ /dev/null @@ -1,530 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2005-07-09.11 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/install-sh b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/install-sh deleted file mode 100644 index 4d4a9519e..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/missing b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/missing deleted file mode 100644 index 894e786e1..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2005-06-08.21 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/mngplay.c b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/mngplay.c deleted file mode 100644 index b6bc0fa82..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/mngplay.c +++ /dev/null @@ -1,507 +0,0 @@ -/* - mngplay - - $Date: 2003/12/07 09:45:16 $ - - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. - - (this assuming there's no problem with libmng not being GPL...) - - - this is an SDL based mng player. the code is very rough; - patches welcome. - - - GRR 20010708: added SDL/libmng/zlib/libjpeg version info, mouse-click - handling (alternate quit mode); improved automake setup - - Raphael Assenat - 2003/11/26: added command line options to run in alternate color depths. - -*/ - -#include -#include - -#include -#include - -#include // basename - - -#define DEFAULT_SDL_VIDEO_DEPTH 32 - -/* structure for keeping track of our mng stream inside the callbacks */ -typedef struct { - FILE *file; /* pointer to the file we're decoding */ - char *filename; /* pointer to the file's path/name */ - SDL_Surface *surface; /* SDL display */ - mng_uint32 delay; /* ticks to wait before resuming decode */ - int sdl_video_depth; /* The depth for SDL_SetVideoMode */ -} mngstuff; - -/* callbacks for the mng decoder */ - -/* memory allocation; data must be zeroed */ -mng_ptr mymngalloc(mng_uint32 size) -{ - return (mng_ptr)calloc(1, size); -} - -/* memory deallocation */ -void mymngfree(mng_ptr p, mng_uint32 size) -{ - free(p); - return; -} - -mng_bool mymngopenstream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* open the file */ - mymng->file = fopen(mymng->filename, "rb"); - if (mymng->file == NULL) { - fprintf(stderr, "unable to open '%s'\n", mymng->filename); - return MNG_FALSE; - } - - return MNG_TRUE; -} - -mng_bool mymngclosestream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* close the file */ - fclose(mymng->file); - mymng->file = NULL; /* for safety */ - - return MNG_TRUE; -} - -/* feed data to the decoder */ -mng_bool mymngreadstream(mng_handle mng, mng_ptr buffer, - mng_uint32 size, mng_uint32 *bytesread) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* read the requested amount of data from the file */ - *bytesread = fread(buffer, 1, size, mymng->file); - - return MNG_TRUE; -} - -/* the header's been read. set up the display stuff */ -mng_bool mymngprocessheader(mng_handle mng, - mng_uint32 width, mng_uint32 height) -{ - mngstuff *mymng; - SDL_Surface *screen; - char title[256]; - -// fprintf(stderr, "our mng is %dx%d\n", width,height); - - /* retreive our user data */ - mymng = (mngstuff*)mng_get_userdata(mng); - - screen = SDL_SetVideoMode(width,height, mymng->sdl_video_depth, SDL_SWSURFACE); - if (screen == NULL) { - fprintf(stderr, "unable to allocate %dx%d video memory: %s\n", - width, height, SDL_GetError()); - return MNG_FALSE; - } - - printf("SDL Video Mode: %dx%d bpp=%d\n", width, height, mymng->sdl_video_depth); - - /* save the surface pointer */ - mymng->surface = screen; - - /* set a descriptive window title */ - snprintf(title, 256, "mngplay: %s", mymng->filename); - SDL_WM_SetCaption(title, "mngplay"); - - /* in necessary, lock the drawing surface to the decoder - can safely fill it. We'll unlock elsewhere before display */ - if (SDL_MUSTLOCK(mymng->surface)) { - if ( SDL_LockSurface(mymng->surface) < 0 ) { - fprintf(stderr, "could not lock display surface\n"); - exit(1); - } - } - -/* - printf("RGBA Masks: %08X %08X %08X %08X\n", - mymng->surface->format->Rmask, - mymng->surface->format->Gmask, - mymng->surface->format->Bmask, - mymng->surface->format->Amask); - printf("RGBA Shifts: %08X %08X %08X %08X\n", - mymng->surface->format->Rshift, - mymng->surface->format->Gshift, - mymng->surface->format->Bshift, - mymng->surface->format->Ashift); -*/ - /* Choose a canvas style which matches the SDL_Surface pixel format */ - switch(mymng->surface->format->BitsPerPixel) - { - case 32: - if (mymng->surface->format->Amask==0) { - /* No alpha (padding byte) */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRX8); - } else { - /* Red first */ - fprintf(stderr, "No matching mng canvas for sdl pixel format. Colors may be wrong.\n"); - mng_set_canvasstyle(mng, MNG_CANVAS_BGRX8); - } - } - else { - /* Real alpha */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRA8); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - } - } - break; - case 24: - if (mymng->surface->format->Amask==0) { - /* No alpha here should mean true rgb24bit */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGR8); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - } - } - else { - /* If there is an alpha and we are in 24 bpp, this must - * mean rgb5658 */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRA565); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA565); - } - } - break; - case 16: - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGR565); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGB565); - } - break; - default: - return MNG_FALSE; - } - - return MNG_TRUE; -} - -/* return a row pointer for the decoder to fill */ -mng_ptr mymnggetcanvasline(mng_handle mng, mng_uint32 line) -{ - mngstuff *mymng; - SDL_Surface *surface; - mng_ptr row; - - /* dereference our structure */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* we assume any necessary locking has happened - outside, in the frame level code */ - row = mymng->surface->pixels + mymng->surface->pitch*line; - -// fprintf(stderr, " returning pointer to line %d (%p)\n", line, row); - - return (row); -} - -/* timer */ -mng_uint32 mymnggetticks(mng_handle mng) -{ - mng_uint32 ticks; - - ticks = (mng_uint32)SDL_GetTicks(); -// fprintf(stderr, " %d\t(returning tick count)\n",ticks); - - return(ticks); -} - -mng_bool mymngrefresh(mng_handle mng, mng_uint32 x, mng_uint32 y, - mng_uint32 w, mng_uint32 h) -{ - mngstuff *mymng; - SDL_Rect frame; - - frame.x = x; - frame.y = y; - frame.w = w; - frame.h = h; - - /* dereference our structure */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* if necessary, unlock the display */ - if (SDL_MUSTLOCK(mymng->surface)) { - SDL_UnlockSurface(mymng->surface); - } - - /* refresh the screen with the new frame */ - SDL_UpdateRects(mymng->surface, 1, &frame); - - /* in necessary, relock the drawing surface */ - if (SDL_MUSTLOCK(mymng->surface)) { - if ( SDL_LockSurface(mymng->surface) < 0 ) { - fprintf(stderr, "could not lock display surface\n"); - return MNG_FALSE; - } - } - - - return MNG_TRUE; -} - -/* interframe delay callback */ -mng_bool mymngsettimer(mng_handle mng, mng_uint32 msecs) -{ - mngstuff *mymng; - -// fprintf(stderr," pausing for %d ms\n", msecs); - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* set the timer for when the decoder wants to be woken */ - mymng->delay = msecs; - - return MNG_TRUE; - -} - -mng_bool mymngerror(mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - mngstuff *mymng; - char chunk[5]; - - /* dereference our data so we can get the filename */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* pull out the chuck type as a string */ - // FIXME: does this assume unsigned char? - chunk[0] = (char)((chunktype >> 24) & 0xFF); - chunk[1] = (char)((chunktype >> 16) & 0xFF); - chunk[2] = (char)((chunktype >> 8) & 0xFF); - chunk[3] = (char)((chunktype ) & 0xFF); - chunk[4] = '\0'; - - /* output the error */ - fprintf(stderr, "error playing '%s' chunk %s (%d):\n", - mymng->filename, chunk, chunkseq); - fprintf(stderr, "%s\n", text); - - return (0); -} - -int mymngquit(mng_handle mng) -{ - mngstuff *mymng; - - /* dereference our data so we can free it */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* cleanup. this will call mymngclosestream */ - mng_cleanup(&mng); - - /* free our data */ - free(mymng); - - /* quit */ - exit(0); -} - -int checkevents(mng_handle mng) -{ - SDL_Event event; - - /* check if there's an event pending */ - if (!SDL_PollEvent(&event)) { - return 0; /* no events pending */ - } - - /* we have an event; process it */ - switch (event.type) { - case SDL_QUIT: - mymngquit(mng); /* quit */ - break; - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - mymngquit(mng); - break; - case SDL_KEYUP: - switch (event.key.keysym.sym) { - case SDLK_ESCAPE: - case SDLK_q: - mymngquit(mng); - break; - } - /* FALL THROUGH */ - default: - return 1; - } - - return 0; /* GRR ADDED: non-void function */ -} - -int main(int argc, char *argv[]) -{ - mngstuff *mymng; - mng_handle mng; - SDL_Rect updaterect; - - if (argc < 2) { - const SDL_version *pSDLver = SDL_Linked_Version(); - - fprintf(stderr, "Usage: %s mngfile [depth]\n\n", basename(argv[0])); - fprintf(stderr, " where 'depth' is 15,16,24 or 32\n"); - fprintf(stderr, - " Compiled with SDL %d.%d.%d; using SDL %d.%d.%d.\n", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL, - pSDLver->major, pSDLver->minor, pSDLver->patch); - fprintf(stderr, " Compiled with libmng %s; using libmng %s.\n", - MNG_VERSION_TEXT, mng_version_text()); - fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n", - ZLIB_VERSION, zlib_version); -#ifdef JPEG_LIB_VERSION - { - int major = JPEG_LIB_VERSION / 10; - int minor = JPEG_LIB_VERSION % 10; - char minoralpha[2]; - - if (minor) { - minoralpha[0] = (char)(minor - 1 + 'a'); - minoralpha[1] = '\0'; - } else - minoralpha[0] = '\0'; - fprintf(stderr, " Compiled with libjpeg %d%s.\n", - major, minoralpha); - } -#endif - fprintf(stderr, - "\nPress Esc or Q, or click mouse button, to quit.\n"); - exit(1); - } - - /* allocate our stream data structure */ - mymng = (mngstuff*)calloc(1, sizeof(*mymng)); - if (mymng == NULL) { - fprintf(stderr, "could not allocate stream structure.\n"); - exit(0); - } - - /* pass the name of the file we want to play */ - mymng->filename = argv[1]; - - /* pass the color depth we wish to use */ - if (argc>=3) { - mymng->sdl_video_depth = atoi(argv[2]); - switch(mymng->sdl_video_depth) { - case 15: - case 16: - case 24: - case 32: - break; - default: - fprintf(stderr, "Unsupported color depth. Choices are: 15, 16, 24 and 32\n"); - exit(1); - } - } - else { - mymng->sdl_video_depth = DEFAULT_SDL_VIDEO_DEPTH; - } - - /* set up the mng decoder for our stream */ - mng = mng_initialize(mymng, mymngalloc, mymngfree, MNG_NULL); - if (mng == MNG_NULL) { - fprintf(stderr, "could not initialize libmng.\n"); - exit(1); - } - - /* set the callbacks */ - mng_setcb_errorproc(mng, mymngerror); - mng_setcb_openstream(mng, mymngopenstream); - mng_setcb_closestream(mng, mymngclosestream); - mng_setcb_readdata(mng, mymngreadstream); - mng_setcb_gettickcount(mng, mymnggetticks); - mng_setcb_settimer(mng, mymngsettimer); - mng_setcb_processheader(mng, mymngprocessheader); - mng_setcb_getcanvasline(mng, mymnggetcanvasline); - mng_setcb_refresh(mng, mymngrefresh); - /* FIXME: should check for errors here */ - - /* initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO) < 0) { - fprintf(stderr, "%s: Unable to initialize SDL (%s)\n", - argv[0], SDL_GetError()); - exit(1); - } - /* arrange to call the shutdown routine before we exit */ - atexit(SDL_Quit); - - /* restrict event handling to the relevant bits */ - SDL_EventState(SDL_KEYDOWN, SDL_IGNORE); /* keyup only */ - SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); -// SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE); -// SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE); - -// fprintf(stderr, "playing mng...maybe.\n"); - - mng_readdisplay(mng); - - /* loop though the frames */ - while (mymng->delay) { -// fprintf(stderr, " waiting for %d ms\n", mymng->delay); - SDL_Delay(mymng->delay); - - /* reset the delay in case the decoder - doesn't update it again */ - mymng->delay = 0; - - mng_display_resume(mng); - - /* check for user input (just quit at this point) */ - checkevents(mng); - } - - /* ¿hay alguno? pause before quitting */ - fprintf(stderr, "pausing before shutdown...\n"); - SDL_Delay(1000); - - /* cleanup and quit */ - mymngquit(mng); -} - diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/Makefile b/Engine/lib/lmng/contrib/gcc/xmngview/Makefile deleted file mode 100644 index 4b38662f7..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PROC=athlon -CFLAGS=-g -Wall -O2 -march=$(PROC) -mcpu=$(PROC) -MOTIFLIB=/usr/local/lesstif/lib -MOTIFINC=/usr/local/lesstif/include -MNGLIB=-lmng -LIBS=-L/usr/X11R6/lib -L$(MOTIFLIB) -lXm -lXt -lX11 $(MNGLIB) -lm -INC=-I/usr/X11R6/include -I$(MOTIFINC) -CC=gcc -LDFLAGS= - -all: clean compile - -compile: - $(CC) $(CFLAGS) $(INC) color.c xmngview.c -o xmngview $(LIBS) - -clean: - rm -f xmngview core - -install: - cp -a xmngview /usr/local/bin/xmngview diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/README b/Engine/lib/lmng/contrib/gcc/xmngview/README deleted file mode 100644 index 576228efa..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/README +++ /dev/null @@ -1,23 +0,0 @@ -Program: -======== - -'xmngview' displays MNG/JNG/PNG files. The program can be called - - xmngview - xmngview filename - -This program is used within a plugin library for a browser: - xmngview -wWINDOWID -bgBGPIXEL filename - -Limitations: -============ - needs Lesstif/Motif, i.e. '-lXm -lXt -lX11'. - depth >= 8 (tested with 8bpp, 16bpp, 24bpp) - perhaps INTEL only - perhaps LINUX only - -libmng: -======= - read the first lines of xmngview.c - -szukw000, March 2003 diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/color.c b/Engine/lib/lmng/contrib/gcc/xmngview/color.c deleted file mode 100644 index 2e75a1c92..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/color.c +++ /dev/null @@ -1,645 +0,0 @@ -/* - * This code is mainly code I have found in - * ida-0.14 Gerd Knorr - * http://bytesex.org/ida - * Ida is a small and fast image viewer, motif-based. - * - * Copyright (C) 2002 Gerd Knorr - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * -*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "xmng.h" - -static void (*dither_line)(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width); -static void dither_line_gray(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width); -static void dither_line_color(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width); -static void init_dither(int shades_r, int shades_g, int shades_b, - int shades_gray); - -static XVisualInfo *vis_info; - -/* PseudoColor: ditherresult => colormap-entry -*/ -static int x11_colors; -static int x11_grays; -static unsigned long *x11_map; -static unsigned long x11_map_color[256]; -static unsigned long x11_map_gray[64]; - -static unsigned long x11_red; -static unsigned long x11_green; -static unsigned long x11_blue; - -static int try_red[] = {4, 6, 6, 5, 4}; -static int try_green[] = {8, 6, 6, 5, 4}; -static int try_blue[] = {4, 6, 4, 5, 4}; - -/* TrueColor: r,g,b => X11-color -*/ -static unsigned long x11_lut_red[256]; -static unsigned long x11_lut_green[256]; -static unsigned long x11_lut_blue[256]; -static unsigned long x11_lut_gray[256]; - -#define x11_black x11_map_gray[0] -#define x11_gray x11_map_gray[47*x11_grays/64] -#define x11_lightgray x11_map_gray[55*x11_grays/64] -#define x11_white x11_map_gray[63*x11_grays/64] - -static int x11_alloc_grays(Display * dpy, Colormap cmap, unsigned long *colors, - int gray) -{ - XColor akt_color; - int i, upb; - upb = gray - 1; - - for (i = 0; i < gray; i++) - { -/* FIXME: original code - akt_color.red = i * 65535 / upb; - akt_color.green = i * 65535 / upb; - akt_color.blue = i * 65535 / upb; -*/ - akt_color.red = i * 255 / upb; - akt_color.green = i * 255 / upb; - akt_color.blue = i * 255 / upb; - - if (!XAllocColor(dpy, cmap, &akt_color)) - { -/* no free color cell available -*/ - XFreeColors(dpy, cmap, colors, i, 0); - return 1; - } - colors[i] = akt_color.pixel; - } - return 0; -} - -static int x11_alloc_colorcube(Display * dpy, Colormap cmap, - unsigned long *colors, int red, int green, int blue) -{ - XColor akt_color; - int i, upb_r, upb_g, upb_b; - - upb_r = red - 1; upb_g = green - 1; upb_b = blue - 1; - - for (i = 0; i < red * green * blue; i++) - { - akt_color.red = ((i / (green * blue)) % red) * 65535 / upb_r; - akt_color.green = ((i / blue) % green) * 65535 / upb_g; - akt_color.blue = (i % blue) * 65535 / upb_b; - - if (!XAllocColor(dpy, cmap, &akt_color)) - { -/* no free color cell available -*/ - XFreeColors(dpy, cmap, colors, i, 0); - return 1; - } - colors[i] = akt_color.pixel; - } - return 0; -} - -static unsigned long x11_alloc_color(Display * dpy, Colormap cmap, int red, - int green, int blue) -{ - XColor akt_color; - - akt_color.red = red; - akt_color.green = green; - akt_color.blue = blue; - - XAllocColor(dpy, cmap, &akt_color); - return akt_color.pixel; -} - -static void x11_create_lut(unsigned long red_mask, - unsigned long green_mask, - unsigned long blue_mask) -{ - int rgb_red_bits = 0; - int rgb_red_shift = 0; - int rgb_green_bits = 0; - int rgb_green_shift = 0; - int rgb_blue_bits = 0; - int rgb_blue_shift = 0; - int i; - unsigned long mask; - - for (i = 0; i < 24; i++) - { - mask = (1 << i); - if (red_mask & mask) - rgb_red_bits++; - else - if (!rgb_red_bits) - rgb_red_shift++; - if (green_mask & mask) - rgb_green_bits++; - else - if (!rgb_green_bits) - rgb_green_shift++; - - if (blue_mask & mask) - rgb_blue_bits++; - else - if (!rgb_blue_bits) - rgb_blue_shift++; - } - - for (i = 0; i < 256; i++) - { - x11_lut_red[i] = (i >> (8 - rgb_red_bits)) << rgb_red_shift; - x11_lut_green[i] = (i >> (8 - rgb_green_bits)) << rgb_green_shift; - x11_lut_blue[i] = (i >> (8 - rgb_blue_bits)) << rgb_blue_shift; - x11_lut_gray[i] = - x11_lut_red[i] | x11_lut_green[i] | x11_lut_blue[i]; - } -} - -void x11_init_color(ImageInfo *img) -{ - Colormap cmap; - XVisualInfo vis_template; - int found, vis_class; - unsigned int i; - Display *dpy; - - dpy = img->dpy; - cmap = DefaultColormap(dpy, DefaultScreen(dpy)); - if (0 == x11_grays) - x11_grays = 8; - -/* Ask for visual type -*/ - vis_template.screen = XDefaultScreen(dpy); - vis_template.visualid = - XVisualIDFromVisual(img->visual); - vis_info = - XGetVisualInfo(dpy, VisualIDMask | VisualScreenMask, &vis_template, - &found); - if (XShmQueryExtension(dpy)) - img->have_shmem = 1; - -#if defined(__cplusplus) || defined(c_plusplus) - vis_class = vis_info->c_class; -#else - vis_class = vis_info->class; -#endif - if(vis_class == TrueColor) - { - img->gray = 0; /* XXX testing... */ - img->display_depth = 4; - img->display_type = TRUECOLOR; - - x11_create_lut(vis_info->red_mask, vis_info->green_mask, - vis_info->blue_mask); - x11_black = x11_alloc_color(dpy, cmap, 0, 0, 0); - x11_gray = x11_alloc_color(dpy, cmap, 0xc000, 0xc000, 0xc000); - x11_lightgray = x11_alloc_color(dpy, cmap, 0xe000, 0xe000, 0xe000); - x11_white = x11_alloc_color(dpy, cmap, 0xffff, 0xffff, 0xffff); - } - else - if(vis_class == PseudoColor && vis_info->depth == 8) - { - img->display_depth = 1; - img->display_type = PSEUDOCOLOR; - if (0 != x11_alloc_grays(dpy, cmap, x11_map_gray, x11_grays)) - { - fprintf(stderr, "%s:%d:Sorry, can't allocate %d grays\n", - __FILE__,__LINE__,x11_grays); - Viewer_postlude(); - exit(1); - } - if (!img->gray) - { - for (i = 0; i < sizeof(try_red) / sizeof(int); i++) - { - if (0 == x11_alloc_colorcube - (dpy, cmap, x11_map_color, - try_red[i], try_green[i], try_blue[i])) - { - x11_colors = try_red[i] * try_green[i] * try_blue[i]; - - init_dither(try_red[i], try_green[i], try_blue[i], x11_grays); - - break; - } - } - if (i == sizeof(try_red) / sizeof(int)) - { - img->gray = 1; - fputs("failed to allocate colors, using grayscaled\n", stderr); - } - } - if (img->gray) - init_dither(2, 2, 2, x11_grays); - } - else - if(vis_class == StaticGray || vis_class == GrayScale) - { - img->display_depth = 1; - img->display_type = PSEUDOCOLOR; - x11_grays = 64; - img->gray = 1; - - init_dither(2, 2, 2, x11_grays); - - if (0 != x11_alloc_grays(dpy, cmap, x11_map_gray, x11_grays)) - { - fprintf(stderr, "%s:%d: Sorry, can't allocate %d grays\n", - __FILE__,__LINE__, x11_grays); - Viewer_postlude(); - exit(1); - } - } - else - { - fprintf(stderr, "%s:%d: Sorry, can't handle visual\n", __FILE__,__LINE__); - Viewer_postlude(); - exit(1); - } -/* some common colors -*/ - x11_red = x11_alloc_color(dpy, cmap, 65535, 0, 0); - x11_green = x11_alloc_color(dpy, cmap, 0, 65535, 0); - x11_blue = x11_alloc_color(dpy, cmap, 0, 0, 65535); - - if (img->gray) - { - x11_map = x11_map_gray; - - dither_line = dither_line_gray; - } - else - { - x11_map = x11_map_color; - - dither_line = dither_line_color; - } -} - -static int mitshm_bang = 0; - -static int x11_error_dev_null(Display * dpy, XErrorEvent * event) -{ - mitshm_bang = 1; - return 0; -} - -XImage *x11_create_ximage(ImageInfo *img) -{ - XImage *ximage = NULL; - unsigned char *data; - XShmSegmentInfo *shminfo = NULL; - int (*old_handler)(Display * dpy, XErrorEvent * event); - - if (img->have_shmem) - { - old_handler = XSetErrorHandler(x11_error_dev_null); - img->shm = shminfo = (XShmSegmentInfo*)malloc(sizeof(XShmSegmentInfo)); - memset(shminfo, 0, sizeof(XShmSegmentInfo)); - ximage = XShmCreateImage(img->dpy, - img->visual, - img->depth, - ZPixmap, NULL, - shminfo, img->img_width, img->img_height); - if (ximage) - { - shminfo->shmid = shmget(IPC_PRIVATE, - ximage->bytes_per_line * ximage->height, - IPC_CREAT | 0777); - - if (-1 == shminfo->shmid) - { - fprintf(stderr,"shmget(%dMB): %s\n", - ximage->bytes_per_line * ximage->height / 1024 / 1024, - strerror(errno)); - goto oom; - } - shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); - - if ((void *) -1 == shminfo->shmaddr) - { - perror("shmat"); - goto oom; - } - ximage->data = shminfo->shmaddr; - shminfo->readOnly = False; - - XShmAttach(img->dpy, shminfo); - XSync(img->dpy, False); - shmctl(shminfo->shmid, IPC_RMID, 0); - - if (mitshm_bang) - { - img->have_shmem = 0; - shmdt(shminfo->shmaddr); - free(shminfo); - img->shm = shminfo = NULL; - XDestroyImage(ximage); - ximage = NULL; - } - } - else - { - img->have_shmem = 0; - free(shminfo); - img->shm = shminfo = NULL; - } - XSetErrorHandler(old_handler); - } - - if (ximage == NULL) - { - img->shm = NULL; - if (NULL == (data = (unsigned char*) - malloc(img->img_width * img->img_height * img->display_depth))) - { - fprintf(stderr,"Oops: out of memory\n"); - goto oom; - } - ximage = XCreateImage(img->dpy, - img->visual, - img->depth, - ZPixmap, 0, (char*)data, - img->img_width, img->img_height, - 8, 0); - } - memset(ximage->data, 0, ximage->bytes_per_line * ximage->height); - - return ximage; - - oom: - if (shminfo) - { - if (shminfo->shmid && shminfo->shmid != -1) - shmctl(shminfo->shmid, IPC_RMID, 0); - free(shminfo); - } - if (ximage) - XDestroyImage(ximage); - img->shm = 0; - return NULL; -} - -void x11_destroy_ximage(ImageInfo *img) -{ - XShmSegmentInfo *shminfo = (XShmSegmentInfo*)img->shm; - - if (shminfo) - { - XShmDetach(img->dpy, shminfo); - XDestroyImage(img->ximage); - shmdt(shminfo->shmaddr); - free(shminfo); - } - else - XDestroyImage(img->ximage); -} -/* - * ordered dither routines - * - * stolen from The GIMP and trimmed for speed - */ -#define DITHER_LEVEL 8 - -static long red_mult, green_mult; -static long red_dither[256]; -static long green_dither[256]; -static long blue_dither[256]; -static long gray_dither[256]; - -typedef unsigned long vector[DITHER_LEVEL]; -typedef vector matrix[DITHER_LEVEL]; - -#if DITHER_LEVEL == 8 -#define DITHER_MASK 7 -static matrix origDM = -{ - {0, 32, 8, 40, 2, 34, 10, 42}, - {48, 16, 56, 24, 50, 18, 58, 26}, - {12, 44, 4, 36, 14, 46, 6, 38}, - {60, 28, 52, 20, 62, 30, 54, 22}, - {3, 35, 11, 43, 1, 33, 9, 41}, - {51, 19, 59, 27, 49, 17, 57, 25}, - {15, 47, 7, 39, 13, 45, 5, 37}, - {63, 31, 55, 23, 61, 29, 53, 21} -}; -static matrix DM; - -#endif /* DITHER_LEVEL == 8 */ - -#if DITHER_LEVEL == 4 -#define DITHER_MASK 3 -static matrix origDM = -{ - {0, 8, 2, 10}, - {12, 4, 14, 6}, - {3, 11, 1, 9}, - {15, 7, 13, 5} -}; -static matrix DM; - -#endif - -static void init_dither(int shades_r, int shades_g, int shades_b, - int shades_gray) -{ - int i, j; - unsigned char low_shade, high_shade; - unsigned short index; - float red_colors_per_shade; - float green_colors_per_shade; - float blue_colors_per_shade; - float gray_colors_per_shade; - - red_mult = shades_g * shades_b; - green_mult = shades_b; - - red_colors_per_shade = 256.0 / (shades_r - 1); - green_colors_per_shade = 256.0 / (shades_g - 1); - blue_colors_per_shade = 256.0 / (shades_b - 1); - gray_colors_per_shade = 256.0 / (shades_gray - 1); - -/* this avoids a shift when checking these values -*/ - memcpy(DM, origDM, sizeof(unsigned long)*DITHER_LEVEL*DITHER_LEVEL); - for (i = 0; i < DITHER_LEVEL; i++) - for (j = 0; j < DITHER_LEVEL; j++) - DM[i][j] *= 0x10000; - -/* setup arrays containing three bytes of information for red, green, & blue - * the arrays contain : - * 1st byte: low end shade value - * 2nd byte: high end shade value - * 3rd & 4th bytes: ordered dither matrix index -*/ - - for (i = 0; i < 256; i++) - { -/* setup the red information -*/ - low_shade = (unsigned char) (i / red_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * red_colors_per_shade) / red_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - low_shade *= red_mult; - high_shade *= red_mult; - - red_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - -/* setup the green information -*/ - low_shade = (unsigned char) (i / green_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * green_colors_per_shade) / green_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - low_shade *= green_mult; - high_shade *= green_mult; - - green_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - -/* setup the blue information -*/ - low_shade = (unsigned char) (i / blue_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * blue_colors_per_shade) / blue_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - blue_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - -/* setup the gray information -*/ - low_shade = (unsigned char) (i / gray_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * gray_colors_per_shade) / gray_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - gray_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - } -} - -static void dither_line_color(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width) -{ - unsigned long a, b, dval, *ymod; - unsigned int x; - ymod = DM[y & DITHER_MASK]; - - for(x = 0; x < width; x++) - { - dval = ymod[x & DITHER_MASK]; - - b = red_dither[src[0]]; - if (dval < b) - b >>= 8; - - a = green_dither[src[1]]; - if (dval < a) - a >>= 8; - b += a; - - a = blue_dither[src[2]]; - if (dval < a) - a >>= 8; - b += a; - src += RGB_SIZE; - *dest++ = (unsigned char)(b & 0xff); - } -} - -static void dither_line_gray(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width) -{ - unsigned long a, g, *ymod; - unsigned int x; - - ymod = DM[y & DITHER_MASK]; - - for(x = 0; x < width; x++) - { - g = (src[0]*3 + src[1]*6 + src[2]) / 10; - a = gray_dither[g]; - src += RGB_SIZE; - - if (ymod[x & DITHER_MASK] < a) - a >>= 8; - - *dest++ = a & 0xff; - } -} - -void viewer_renderline(ImageInfo *img, unsigned char *scanline, - unsigned int row, unsigned int x, unsigned int width) -{ - unsigned char *src, *dst; - unsigned long pix; - XImage *ximage; - unsigned int col, max_col; - unsigned short mng_rgb_size; - - mng_rgb_size = img->mng_rgb_size; - ximage = img->ximage; - src = scanline; - col = x; - max_col = x + width; - - if (img->display_type == PSEUDOCOLOR) - { - dst = img->dither_line; - dither_line(src, dst, row, width); - - while(col < max_col) - { - XPutPixel(ximage, col, row, x11_map[dst[0]]); - ++col; - ++dst; - } - return; - } -/* display_type == TRUECOLOR -*/ - while(col < max_col) - { - pix = x11_lut_red[src[0]] | x11_lut_green[src[1]] | x11_lut_blue[src[2]]; - - XPutPixel(ximage, col, row, pix); - - ++col; - src += RGB_SIZE; - } -} diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/xmng.h b/Engine/lib/lmng/contrib/gcc/xmngview/xmng.h deleted file mode 100644 index 3012b4e9f..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/xmng.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef _XMNG_H_ -#define _XMNG_H -#define RGB_SIZE 3 -#define CANVAS_RGB8_SIZE 3 -#define CANVAS_RGBA8_SIZE 4 -#define CANVAS_ARGB8_SIZE 4 -#define CANVAS_RGB8_A8_SIZE 4 -#define CANVAS_BGR8_SIZE 3 -#define CANVAS_BGRA8_SIZE 4 -#define CANVAS_BGRA8PM_SIZE 4 -#define CANVAS_ABGR8_SIZE 4 - -#define MNG_MAGIC "\x8aMNG\x0d\x0a\x1a\x0a" -#define JNG_MAGIC "\x8bJNG\x0d\x0a\x1a\x0a" -#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a" -#define PSEUDOCOLOR 1 -#define TRUECOLOR 2 - -#define MNG_TYPE 1 -#define JNG_TYPE 2 -#define PNG_TYPE 3 - -#define SPACE_X 10 -#define SPACE_Y 10 -#define BUT_ENTRY_BORDER 0 -#define FRAME_SHADOW_WIDTH 2 -#define ANY_WIDTH 4 - -#define OK MNG_NOERROR -#define MAX_COLORBUF 64 - -typedef struct -{ - unsigned int frozen:1; - unsigned int restarted:1; - unsigned int stopped:1; - unsigned int single_step_wanted:1; - unsigned int single_step_served:1; - unsigned int has_bg_color:1; - unsigned int has_bg_pixel:1; - unsigned int x11_init:1; - unsigned int timer_active:1; - - mng_handle user_handle; - Widget canvas; - int type; - XtIntervalId timeout_ID; - mng_uint32 counter; - mng_uint32 delay; - mng_uint32 img_width, img_height; - mng_uint32 read_len; - mng_uint32 read_pos; - unsigned char *read_buf; - unsigned char *mng_buf; - unsigned char *dither_line; - - Window external_win; - Window frame_win; - Window control_win; - GC gc; - Display *dpy; - Window win; - unsigned short mng_rgb_size; - unsigned short mng_bytes_per_line; - XImage *ximage; - int src_x, src_y; - int dst_x, dst_y; - unsigned int frame_w, frame_h; - - void *shm; - int gray; - int display_depth, display_type; - int have_shmem; - Pixel bg_pixel; - unsigned short xbg_red, xbg_green, xbg_blue; - unsigned char bg_red, bg_green, bg_blue; - Visual *visual; - unsigned int depth; -/* do not free */ - struct timeval timer_start; - struct timeval timer_end; - - char *read_idf; - FILE *reader; - int *argc_ptr; - char **argv; - char bg_color[MAX_COLORBUF]; -} ImageInfo; - -#define XPUTIMAGE(dpy,dr,gc,xi,a,b,c,d,w,h) \ - if (have_shmem) \ - XShmPutImage(dpy,dr,gc,xi,a,b,c,d,w,h,True); \ - else \ - XPutImage(dpy,dr,gc,xi,a,b,c,d,w,h) - -extern void Viewer_postlude(void); -extern XImage *x11_create_ximage(ImageInfo *data); -extern void x11_destroy_ximage(ImageInfo *data); -extern void x11_init_color(ImageInfo *data); -extern void viewer_renderline(ImageInfo *data, unsigned char *scanline, - unsigned int row, unsigned int x, unsigned int width); - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/xmngview.c b/Engine/lib/lmng/contrib/gcc/xmngview/xmngview.c deleted file mode 100644 index 3198c7b95..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/xmngview.c +++ /dev/null @@ -1,1185 +0,0 @@ -/* Built with libmng-1.0.9 - * Compiled on linux with gcc-3.3.4 - * james@blastwave.org suggested the single step mode and wrote: - * "xmngview works on Solaris both Sparc and Intel and compiles with Sun's cc" - * - * - * This program my be redistributed under the terms of the - * GNU General Public Licence, version 2, or at your preference, - * any later version. - * - * For more information about libmng please visit: - * - * The official libmng web-site: - * http://www.libmng.com - * - * Libmng on SourceForge: - * http://libmng.sourceforge.net - * - * The official MNG homepage: - * http://www.libpng.org/pub/mng - * - * The official PNG homepage: - * http://www.libpng.org/pub/png -*/ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "xmng.h" - -#define DEFAULT_BACKGROUND "grey77" -static char version[]={"0.6"}; - -static void run_viewer(FILE *reader, char *read_idf); - -static mng_handle user_handle; -static ImageInfo img; -static struct timeval start_tv, now_tv; -static XtIntervalId timeout_ID; -static char *prg_idf; - -static XtAppContext app_context; -static Widget toplevel, main_form, canvas, file_label; -static XmFontList file_font; -static Dimension start_width; - -#define SLASH '/' -/* - * Cnf: XQueryColor(3X11) -*/ -static char *parse_rgb_color(char *val) -{ - char *s, *d; - int ch; - char status, rgb_type; - char r[6], g[6], b[6], rgb[24]; - - rgb_type = 0; - status = 1; - s = val; - memset(r, 0, 6); - memset(g, 0, 6); - memset(b, 0, 6); - - if(strncasecmp(s, "rgb:", 4) == 0) - { - rgb_type = 1; - s += 4; - if((d = strchr(s, SLASH))) - { - *d = 0; - - if(d - s > 4) - s[4] = 0; - strcpy(r, s); - - s = ++d; - - if((d = strchr(s, SLASH))) - { - *d = 0; - if(d - s > 4) - s[4] = 0; - strcpy(g, s); - - s = d + 1; - while((ch = *++d) && isxdigit(ch)); - *d = 0; - if(d - s > 4) - s[4] = 0; - strcpy(b, s); - - } - if(*r == 0 || *g == 0 || *b == 0) - return NULL; - - s = r - 1; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = rgb_type = 0; - break; - } - s = g - 1; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = rgb_type = 0; - break; - } - s = b - 1; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = rgb_type = 0; - break; - } - if(status) - { - strcpy(rgb, "rgb:"); - d = rgb + 4; - s = r; - while(*s) *d++ = *s++; - *d++ = SLASH; - s = g; - while(*s) *d++ = *s++; - *d++ = SLASH; - s = b; - while(*s) *d++ = *s++; - *d = 0; - - return strdup(rgb); - } - } /* if((slash = strchr(s, SLASH))) */ - return NULL; - } - - s = val; - if(*s == '#' || isdigit(*s)) - { - if(*s != '#') - --s; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = 0; - break; - } - if(status) - { - d = rgb; - s = val; - if(*s == '#') - ++s; -/* - * #RGB (4 bits each) - * #RRGGBB (8 bits each) - * #RRRGGGBBB (12 bits each) - * #RRRRGGGGBBBB (16 bits each) -*/ - if(strlen(s) > 12) - s[12] = 0; - *d++ = '#'; - strcpy(d, s); - return strdup(rgb); - } - return NULL; - } - -/* - * 'white', 'LavenderBlush', 'dark slate gray', 'grey12' -*/ - s = val - 1; - while((ch = *++s)) - { - if(isalnum(ch) || isspace(ch)) continue; - status = 0; - break; - } - if(!status) - return NULL; - return strdup(val); - -}/* parse_rgb_color() */ - -static void set_bg_pixel(ImageInfo *img) -{ - XColor xcolor; - Widget w; - char *s, *d; - int found; - - w = img->canvas; - - if(!img->has_bg_pixel) - { - if(img->has_bg_color) - { - s = strdup(img->bg_color); - - d = parse_rgb_color(s); - - free(s); - - if(d) - { - strcpy(img->bg_color, d); - free(d); - } - else - img->has_bg_color = 0; - } - if(!img->has_bg_color) - { - strcpy(img->bg_color, DEFAULT_BACKGROUND); - img->has_bg_color = 1; - } - - found = XParseColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - img->bg_color, &xcolor); - - if(!found) - { - strcpy(img->bg_color, DEFAULT_BACKGROUND); - - found = XParseColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - img->bg_color, &xcolor); - - } - xcolor.flags = DoRed | DoGreen | DoBlue; - - XAllocColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - &xcolor); - } - else - { - xcolor.pixel = img->bg_pixel; - xcolor.flags = DoRed|DoGreen|DoBlue; - - found = XQueryColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - &xcolor); - } - img->bg_pixel = xcolor.pixel; - img->xbg_red = xcolor.red; - img->xbg_green = xcolor.green; - img->xbg_blue = xcolor.blue; - img->bg_red = (unsigned char)xcolor.red&0xff; - img->bg_green = (unsigned char)xcolor.green&0xff; - img->bg_blue = (unsigned char)xcolor.blue&0xff; - img->has_bg_pixel = 1; - -}/* set_bg_pixel() */ - -static void fsb_cancel_cb(Widget w, XtPointer client, XtPointer call) -{ - XtUnmanageChild(w); -} - -void create_file_dialog(Widget w, char *button_text, char *title_text, - void(*fsb_select_cb)(Widget,XtPointer,XtPointer)) -{ - Arg args[4]; - int cnt; - Widget dialog; - XmString button_str, title_str, filter; - Widget child; - - cnt = 0; - dialog = XmCreateFileSelectionDialog(w, "Files", args, cnt); - - XtUnmanageChild(XmFileSelectionBoxGetChild(dialog,XmDIALOG_HELP_BUTTON)); - XtAddCallback(dialog, XmNcancelCallback, fsb_cancel_cb, NULL); - XtAddCallback(dialog, XmNokCallback, fsb_select_cb, NULL); - button_str = XmStringCreateLocalized(button_text); - title_str = XmStringCreateLocalized(title_text); - filter = XmStringCreateLocalized("*.[jmp]ng"); - XtVaSetValues(dialog, - XmNokLabelString, button_str, - XmNdialogTitle, title_str, - XmNpattern, filter, - XmNfileFilterStyle, XmFILTER_NONE, - NULL); - XmStringFree(button_str); - XmStringFree(title_str); - XmStringFree(filter); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_FILTER_TEXT); - XtVaSetValues(child, XmNfontList, file_font, NULL); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_DIR_LIST); - XtVaSetValues(child, XmNfontList, file_font, NULL); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_LIST); - XtVaSetValues(child, XmNfontList, file_font, NULL); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_TEXT); - XtVaSetValues(child, XmNfontList, file_font, NULL); - - XtManageChild(dialog); - XMapRaised(XtDisplay (dialog), XtWindow (XtParent (dialog))); -} - -void run_mng_file_cb(Widget w, XtPointer client, XtPointer call) -{ - XmFileSelectionBoxCallbackStruct *fsb; - char *read_idf; - FILE *reader; - - XtUnmanageChild(w); - fsb = (XmFileSelectionBoxCallbackStruct *)call; - XmStringGetLtoR(fsb->value, XmSTRING_DEFAULT_CHARSET, &read_idf); - - if(read_idf == NULL || *read_idf == 0) return; - - reader = fopen(read_idf, "r"); - if(reader == NULL) - { - perror(read_idf); - fprintf(stderr, "\n\n%s: cannot open file '%s'\n\n", prg_idf, read_idf); - return; - } - run_viewer(reader, read_idf); - - free(read_idf); -} - -static void user_reset_data(void) -{ - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - mng_cleanup(&img.user_handle); - - img.read_pos = 0; - free(img.read_buf); - img.read_buf = NULL; - img.read_len = 0; - img.img_width = 0; - img.img_height = 0; - img.mng_bytes_per_line = 0; - img.read_idf = NULL; - img.frozen = 0; - img.restarted = 0; - img.single_step_wanted = 0; - img.single_step_served = 0; - - XClearWindow(img.dpy, img.win); -} - -void browse_file_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.user_handle) - user_reset_data(); - - img.stopped = 0; - img.frozen = 0; - img.restarted = 0; - create_file_dialog(w, "Select", "Select MNG file", run_mng_file_cb); -} - -void Viewer_postlude(void) -{ - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - mng_cleanup(&img.user_handle); - if(img.reader) fclose(img.reader); - if(img.ximage) XDestroyImage(img.ximage); - if(img.read_buf) free(img.read_buf); - if(img.mng_buf) free(img.mng_buf); - if(img.dither_line) free(img.dither_line); - if(!img.external_win && img.dpy) XtCloseDisplay(img.dpy); - fputc('\n', stderr); -} - -static void user_init_data(ImageInfo *img) -{ - unsigned int depth; - int screen; - Display *dpy; - - dpy = img->dpy; - screen = DefaultScreen(dpy); - depth = DefaultDepth(dpy, screen); - img->depth = depth; - - if(!img->visual) - { - img->visual = DefaultVisual(dpy, screen); - img->gc = DefaultGC(dpy, DefaultScreen(dpy)); - } - else - { - if(img->mng_buf) free(img->mng_buf); - if(img->dither_line) free(img->dither_line); - - x11_destroy_ximage(img); - } - - set_bg_pixel(img); - - mng_set_bgcolor(img->user_handle, - img->xbg_red, img->xbg_green, img->xbg_blue); - - img->mng_bytes_per_line = img->img_width * img->mng_rgb_size; - img->mng_buf = (unsigned char*) - calloc(1, img->mng_bytes_per_line * img->img_height); - img->dither_line = (unsigned char*) - calloc(1, img->mng_bytes_per_line); - - if(!img->x11_init) - { - x11_init_color(img); - - img->x11_init = 1; - } - img->ximage = x11_create_ximage(img); - - if(img->ximage == NULL) - { - Viewer_postlude(); - exit(0); - } -} - -static void player_exit_cb(Widget w, XtPointer client, XtPointer call) -{ - Viewer_postlude(); - exit(0); -} - -static void player_stop_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - user_reset_data(); - img.stopped = 1; -} - -static void player_single_step_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - if(img.single_step_served) - { - img.single_step_served = 0; - img.frozen = 0; - - img.single_step_wanted = 1; - return; - } - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - img.single_step_wanted = 1; - mng_display_resume(img.user_handle); -} - -static void player_pause_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - if(img.frozen) return; - - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - img.frozen = 1; - img.single_step_served = 0; - img.single_step_wanted = 0; -} - -static void player_resume_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - if(!img.frozen - && !img.single_step_served) - return; - img.frozen = 0; - - if(img.single_step_served - || img.single_step_wanted) - { - img.single_step_served = 0; - img.single_step_wanted = 0; - - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - } - mng_display_resume(img.user_handle); -} - -static void player_restart_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - img.frozen = 1; - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - - img.frozen = 0; - img.single_step_served = 0; - img.single_step_wanted = 0; - - img.read_pos = 0; - mng_reset(img.user_handle); - img.restarted = 1; - gettimeofday(&start_tv, NULL); - mng_read(img.user_handle); - mng_display(img.user_handle); -} - -static void release_event_cb(Widget w, XtPointer client, XEvent *event, - Boolean *cont) -{ - Viewer_postlude(); - exit(0); -} - -static void redraw(int type) -{ - if((type == Expose || type == GraphicsExpose) - && img.ximage) - { - XPutImage(img.dpy, img.win, img.gc, img.ximage, - 0, 0, 0, 0, img.img_width, img.img_height); - } -} - -static void exposures_cb(Widget w, XtPointer client, - XmDrawingAreaCallbackStruct *cbs) -{ - - redraw(cbs->event->xany.type); -} - -static mng_ptr user_alloc(mng_size_t len) -{ - return calloc(1, len + 2); -} - -static void user_free(mng_ptr buf, mng_size_t len) -{ - free(buf); -} - -static mng_bool user_read(mng_handle user_handle, mng_ptr out_buf, - mng_uint32 req_len, mng_uint32 *out_len) -{ - mng_uint32 more; - ImageInfo *img; - - img = (ImageInfo *)mng_get_userdata(user_handle); - - more = img->read_len - img->read_pos; - - if(more > 0 - && img->read_buf != NULL) - { - if(req_len < more) - more = req_len; - memcpy(out_buf, img->read_buf + img->read_pos, more); - img->read_pos += more; - *out_len = more; - - return MNG_TRUE; - } - return MNG_FALSE; -} - -static mng_bool user_open_stream(mng_handle user_handle) -{ - return MNG_TRUE; -} - -static mng_bool user_close_stream(mng_handle user_handle) -{ - return MNG_TRUE; -} - -static void create_widgets(mng_uint32 width, mng_uint32 height) -{ - Widget but_rc, but_frame, canvas_frame; - Widget but1, but2, but3, but4, but5, but6, but7; - - toplevel = XtAppInitialize(&app_context, "xmngview", NULL, 0, - img.argc_ptr, img.argv, - 0, 0, 0); - - main_form = XtVaCreateManagedWidget("main_form", - xmFormWidgetClass, toplevel, - XmNhorizontalSpacing, SPACE_X, - XmNverticalSpacing, SPACE_Y, - XmNresizable, True, - NULL); - but_frame = XtVaCreateManagedWidget("but_frame", - xmFrameWidgetClass, main_form, - XmNshadowType, XmSHADOW_ETCHED_OUT, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNshadowThickness, FRAME_SHADOW_WIDTH, - NULL); - but_rc = XtVaCreateManagedWidget("but_rc", - xmRowColumnWidgetClass, but_frame, - XmNentryAlignment, XmALIGNMENT_CENTER, - XmNorientation, XmHORIZONTAL, - XmNpacking, XmPACK_COLUMN, - XmNnumColumns, 1, - XmNresizeWidth, True, - XmNentryBorder, BUT_ENTRY_BORDER, - NULL); - but1 = XtVaCreateManagedWidget("Exit", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but1, XmNactivateCallback, - player_exit_cb, (XtPointer)toplevel); - - but2 = XtVaCreateManagedWidget("Pause", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but2, XmNactivateCallback, - player_pause_cb, (XtPointer)toplevel); - - but3 = XtVaCreateManagedWidget("GoOn", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but3, XmNactivateCallback, - player_resume_cb, NULL); - - but4 = XtVaCreateManagedWidget("Restart", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but4, XmNactivateCallback, - player_restart_cb, NULL); - - but5 = XtVaCreateManagedWidget("Step", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but5, XmNactivateCallback, - player_single_step_cb, NULL); - - but6 = XtVaCreateManagedWidget("Finish", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but6, XmNactivateCallback, - player_stop_cb, NULL); - - but7 = XtVaCreateManagedWidget("Browse", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but7, XmNactivateCallback, - browse_file_cb, NULL); - - file_label = XtVaCreateManagedWidget("FILE: ", - xmLabelWidgetClass, main_form, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, but_frame, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - - canvas_frame = XtVaCreateManagedWidget("canvas_frame", - xmFrameWidgetClass, main_form, - XmNshadowType, XmSHADOW_ETCHED_OUT, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, file_label, - XmNbottomAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - - canvas = XtVaCreateManagedWidget("canvas", - xmDrawingAreaWidgetClass, canvas_frame, - XmNheight, height, - XmNwidth, width, - NULL); - - XtAddEventHandler(canvas, - ButtonReleaseMask|ButtonPressMask, - False, release_event_cb, (XtPointer)toplevel); - - XtAddCallback(canvas, - XmNexposeCallback, (XtCallbackProc)exposures_cb, (XtPointer)&img); - - XtRealizeWidget(toplevel); - - if(start_width == 0) - { - width = height = 0; - - start_width = (FRAME_SHADOW_WIDTH<<1); - XtVaGetValues(but1, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but2, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but3, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but4, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but5, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but6, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1); - XtVaGetValues(but7, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1); - } - img.canvas = canvas; - img.dpy = XtDisplay(img.canvas); - img.win = XtWindow(img.canvas); - file_font = XmFontListAppendEntry(NULL, - XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG, - XmFONT_IS_FONT, - XLoadQueryFont(img.dpy, - "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1"))); -} - -static mng_bool user_process_header(mng_handle user_handle, - mng_uint32 width, mng_uint32 height) -{ - ImageInfo *img; - Dimension cw, ch, tw, th, dh, dw, fw, fh; - XmString xmstr; - char *s, buf[128]; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - if(img->restarted) - { - img->restarted = 0; - return MNG_TRUE; - } - img->img_width = width; - img->img_height = height; - - if(!img->external_win) - { - if(!img->canvas) - create_widgets(width, height); - else - { - tw = th = fw = fh = cw = ch = 0; - - XtVaGetValues(toplevel, XmNwidth, &tw, XmNheight, &th, NULL); - XtVaGetValues(main_form, XmNwidth, &fw, XmNheight, &fh, NULL); - XtVaGetValues(img->canvas, XmNwidth, &cw, XmNheight, &ch, NULL); - - if(height > ch) - { - dh = height - ch; - th += dh; - fh += dh; - } else - if(ch > height) - { - dh = ch - height; - th -= dh; - fh -= dh; - } - if(width > cw) - { - dw = width - cw; - tw += dw; - fw += dw; - } else - if(cw > width) - { - if(width > start_width) - dw = cw - width; - else - dw = cw - start_width; - tw -= dw; - fw -= dw; - } - if(fw < start_width) - { - tw = start_width + (SPACE_X<<1); - fw = start_width; - } - XtVaSetValues(toplevel, XmNwidth,tw , XmNheight,th , NULL); - XtVaSetValues(main_form, XmNwidth,fw , XmNheight,fh , NULL); - XtVaSetValues(img->canvas, XmNwidth,width , XmNheight,height , NULL); - } - } - else - if(img->external_win) - { - Display *dpy; - - XtToolkitInitialize(); - app_context = XtCreateApplicationContext(); - dpy = XtOpenDisplay(app_context, NULL,NULL,"xmngview", - NULL, 0, img->argc_ptr, img->argv); - img->dpy = dpy; - img->win = img->external_win; - - XSelectInput(dpy, img->win, ExposureMask); - } - user_init_data(img); - - if(img->canvas) - { - s = strrchr(img->read_idf, '/'); - if(s == NULL) s = img->read_idf; else ++s; - s = strdup(s); - if(strlen(s) > 64) s[64] = 0; - sprintf(buf, "%s (%d x %d)", s, img->img_width, img->img_height); - xmstr = XmStringCreateLtoR((char*)buf, XmSTRING_DEFAULT_CHARSET); - XtVaSetValues(file_label, XmNlabelString, xmstr, NULL); - XmStringFree(xmstr); - free(s); - } - gettimeofday(&start_tv, NULL); - return MNG_TRUE; -} - -static void wait_cb(XtPointer client, XtIntervalId * id) -{ - timeout_ID = 0; - - if(img.frozen - || img.single_step_served) - { -// gettimeofday(&start_tv, NULL); - - timeout_ID = XtAppAddTimeOut(app_context, - img.delay, wait_cb, NULL); - } - else - { - mng_display_resume(img.user_handle); - } -} - -static mng_bool user_set_timer(mng_handle user_handle, mng_uint32 delay) -{ - ImageInfo *img; - - img = (ImageInfo*)mng_get_userdata(user_handle); - img->delay = delay; - - timeout_ID = XtAppAddTimeOut(app_context, - delay, wait_cb, NULL); - - return MNG_TRUE; -} - -static mng_uint32 user_get_tick_count(mng_handle user_handle) -{ - double sec, usec; - mng_uint32 ticks; - - gettimeofday(&now_tv, NULL); - - sec = (double)(now_tv.tv_sec - start_tv.tv_sec); - usec = (double)now_tv.tv_usec - (double)start_tv.tv_usec; - ticks = (mng_uint32)(sec * 1000.0 + usec/1000.0); -//fprintf(stderr,"TICKS %u (%f:%f)\n", ticks, sec, usec); - return ticks; -} - -static mng_ptr user_get_canvas_line(mng_handle user_handle, mng_uint32 line) -{ - ImageInfo *img; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - return img->mng_buf + img->mng_bytes_per_line * line; -} - -static mng_bool user_refresh(mng_handle user_handle, mng_uint32 x, - mng_uint32 y, mng_uint32 width, mng_uint32 height) -{ - ImageInfo *img; - mng_uint32 src_len; - unsigned char *src_start, *src_buf; - int row, max_row; - Display *dpy; - GC gc; - Window win; - XImage *ximage; - Visual *visual; - int have_shmem; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - if(img->single_step_wanted) - img->single_step_served = 1; - - win = img->win; - gc = img->gc; - dpy = img->dpy; - ximage = img->ximage; - visual = img->visual; - have_shmem = img->have_shmem; - - max_row = y + height; - row = y; - src_len = img->mng_bytes_per_line; - src_buf = src_start = img->mng_buf + img->mng_rgb_size * x + y * src_len; - - while(row < max_row) - { - viewer_renderline(img, src_start, row, x, width); - - ++row; - src_start += src_len; - } - XPUTIMAGE(dpy, win, gc, ximage, x, y, x, y, width, height); - XSync(dpy, False); - return MNG_TRUE; -} - -static mng_bool user_error(mng_handle user_handle, mng_int32 code, - mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - ImageInfo *img; - unsigned char chunk[5]; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - chunk[0] = (char)((chunktype >> 24) & 0xFF); - chunk[1] = (char)((chunktype >> 16) & 0xFF); - chunk[2] = (char)((chunktype >> 8) & 0xFF); - chunk[3] = (char)((chunktype ) & 0xFF); - chunk[4] = '\0'; - - fprintf(stderr, "\n\n%s: error playing(%s) chunk[%d]'%s':\n", - prg_idf, img->read_idf, chunkseq, chunk); - fprintf(stderr, "code(%d) severity(%d) extra1(%d) extra2(%d)" - "\ntext:'%s'\n\n", code, severity, extra1, extra2, text); - return 0; -} - -static mng_bool prelude(void) -{ -#define MAXBUF 8 - unsigned char buf[MAXBUF]; - - if(fread(buf, 1, MAXBUF, img.reader) != MAXBUF) - { - fprintf(stderr,"\n%s:prelude\n\tcannot read signature \n", - prg_idf); - return MNG_FALSE; - } - - if(memcmp(buf, MNG_MAGIC, 8) == 0) - img.type = MNG_TYPE; - else - if(memcmp(buf, JNG_MAGIC, 8) == 0) - img.type = JNG_TYPE; - else - if(memcmp(buf, PNG_MAGIC, 8) == 0) - img.type = PNG_TYPE; - if(!img.type) - { - fprintf(stderr,"\n%s:'%s' is no MNG / JNG / PNG file\n", - prg_idf, img.read_idf); - return MNG_FALSE; - } - fseek(img.reader, 0, SEEK_SET); - fseek(img.reader, 0, SEEK_END); - img.read_len = ftell(img.reader); - fseek(img.reader, 0, SEEK_SET); - - if(!img.user_handle) - { - user_handle = mng_initialize(&img, user_alloc, user_free, MNG_NULL); - - if(user_handle == MNG_NULL) - { - fprintf(stderr, "\n%s: cannot initialize libmng.\n", prg_idf); - return MNG_FALSE; - } - img.user_handle = user_handle; - - mng_set_canvasstyle(user_handle, MNG_CANVAS_RGB8); - img.mng_rgb_size = CANVAS_RGB8_SIZE; - - if(mng_setcb_openstream(user_handle, user_open_stream) != OK - || mng_setcb_closestream(user_handle, user_close_stream) != OK - || mng_setcb_readdata(user_handle, user_read) != OK - || mng_setcb_settimer(user_handle, user_set_timer) != OK - || mng_setcb_gettickcount(user_handle, user_get_tick_count) != OK - || mng_setcb_processheader(user_handle, user_process_header) != OK - || mng_setcb_getcanvasline(user_handle, user_get_canvas_line) != OK - || mng_setcb_refresh(user_handle, user_refresh) != OK - || mng_setcb_errorproc(user_handle, user_error) != OK - ) - { - fprintf(stderr,"\n%s: cannot set callbacks for libmng.\n", - prg_idf); - return MNG_FALSE; - } - } - img.read_buf = (unsigned char*)calloc(1, img.read_len + 2); - fread(img.read_buf, 1, img.read_len, img.reader); - fclose(img.reader); - img.reader = NULL; - - return MNG_TRUE; -} - -static void run_viewer(FILE *reader, char *read_idf) -{ - XEvent event; - - img.read_idf = read_idf; - img.reader = reader; - - if(read_idf != NULL) - { - if(prelude() == MNG_FALSE) - return ; - - gettimeofday(&start_tv, NULL); - - mng_read(img.user_handle); - mng_display(img.user_handle); - } - - if(!img.external_win) - { - XtAppMainLoop(app_context); - } - else - while(1) - { - XtAppNextEvent(app_context, &event); - - redraw(event.type); - } -} - -static void usage(const char *prg) -{ - const char *bar= -"\n------------------------------------------------------------------------\n"; - - fputs(bar, stderr); - fprintf(stderr,"%s version %s\n" - "USAGE: %s [--w WINDOW] [--bg BACKGROUND_COLOR] [FILE]\n", - prg, version, prg); - fputs("\twith BACKGROUND_COLOR = " - "(\"TEXT\" | \"#RGB\" | \"rgb:R/G/B\" | \"PIXEL\")\n" - "\te.g.\n\t(--bg \"red\" | --bg \"#ff0000\" " - "| --bg \"rgb:ff/00/00\" | --bg \"0xf800\")\n" - "\twith FILE=(idf.mng | idf.jng | idf.png)",stderr); - fputs(bar, stderr); -} - -static void shrink_name(char *buf) -{ - char *s, *d; - int ch; - - s = d = buf; - while((ch = *s++)) - { - if(isspace(ch)) continue; - *d++ = tolower(ch); - } - *d = 0; -} - -int main(int argc, char **argv) -{ - FILE *reader; - char *read_idf, *s; - char *ok; - int i; - unsigned char has_bg_color, has_bg_pixel; - Window external_win; - Pixel bg_pixel; - - if((prg_idf = strrchr(argv[0], '/')) == NULL) - prg_idf = argv[0]; - else - ++prg_idf; - - memset(&img, 0, sizeof(ImageInfo)); - external_win = 0; read_idf = NULL; reader = NULL; - has_bg_color = has_bg_pixel = 0; - bg_pixel = 0; - i = 0; - - while(++i < argc) - { - s = argv[i]; - - if(strcmp(s, "--help") == 0 - || strcmp(s, "-help") == 0 - || *s == '?') - { - usage(prg_idf); - return 0; - } - if(strcasecmp(s, "--w") == 0) - { - ++i; - s = argv[i]; - external_win = strtoul(s, &ok, 10); - if(*ok) - return 0; - continue; - } - if(strcasecmp(s, "--bg") == 0) - { - ++i; - s = argv[i]; - if(*s == '#' || strncasecmp(s, "rgb:", 4) == 0 || isalpha(*s)) - { - strncpy(img.bg_color, s, MAX_COLORBUF); - img.bg_color[MAX_COLORBUF] = 0; - has_bg_color = 1; - - if(*s != '#') - shrink_name(img.bg_color); - continue; - } - bg_pixel = strtoul(s, &ok, 16); - - if(*ok == 0) - has_bg_pixel = 1; - continue; - } - if(*s != '-') - { - read_idf = s; continue; - } - } - if(read_idf != NULL) - { - reader = fopen(read_idf, "rb"); - if(reader == NULL) - { - perror(read_idf); - fprintf(stderr, "\n\n%s: cannot open file '%s'\n\n", prg_idf, read_idf); - return 0; - } - } - img.argv = argv; - img.argc_ptr = &argc; - img.external_win = external_win; - img.has_bg_pixel = has_bg_pixel; - img.bg_pixel = bg_pixel; - img.has_bg_color = has_bg_color; - - if(!has_bg_pixel && !has_bg_color) - { - strcpy(img.bg_color, DEFAULT_BACKGROUND); - img.has_bg_color = 1; - } - - if(read_idf == NULL && external_win == 0) - create_widgets(5,5); - - run_viewer(reader, read_idf); - - Viewer_postlude(); - return 0; -} diff --git a/Engine/lib/lmng/contrib/kylix/libmng.pas b/Engine/lib/lmng/contrib/kylix/libmng.pas deleted file mode 100644 index f81c17645..000000000 --- a/Engine/lib/lmng/contrib/kylix/libmng.pas +++ /dev/null @@ -1,1726 +0,0 @@ -unit libmng; - -{****************************************************************************} -{* *} -{* COPYRIGHT NOTICE: *} -{* *} -{* Copyright (c) 2000-2002 Gerard Juyn (gerard@libmng.com) *} -{* [You may insert additional notices after this sentence if you modify *} -{* this source] *} -{* *} -{* For the purposes of this copyright and license, "Contributing Authors" *} -{* is defined as the following set of individuals: *} -{* *} -{* Gerard Juyn *} -{* (hopefully some more to come...) *} -{* *} -{* The MNG Library is supplied "AS IS". The Contributing Authors *} -{* disclaim all warranties, expressed or implied, including, without *} -{* limitation, the warranties of merchantability and of fitness for any *} -{* purpose. The Contributing Authors assume no liability for direct, *} -{* indirect, incidental, special, exemplary, or consequential damages, *} -{* which may result from the use of the MNG Library, even if advised of *} -{* the possibility of such damage. *} -{* *} -{* Permission is hereby granted to use, copy, modify, and distribute this *} -{* source code, or portions hereof, for any purpose, without fee, subject *} -{* to the following restrictions: *} -{* *} -{* 1. The origin of this source code must not be misrepresented; *} -{* you must not claim that you wrote the original software. *} -{* *} -{* 2. Altered versions must be plainly marked as such and must not be *} -{* misrepresented as being the original source. *} -{* *} -{* 3. This Copyright notice may not be removed or altered from any source *} -{* or altered source distribution. *} -{* *} -{* The Contributing Authors specifically permit, without fee, and *} -{* encourage the use of this source code as a component to supporting *} -{* the MNG and JNG file format in commercial products. If you use this *} -{* source code in a product, acknowledgment would be highly appreciated. *} -{* *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : libmng.pas copyright (c) 2000-2002 G.Juyn *} -{* version : 1.0.5 *} -{* *} -{* purpose : libmng.so wrapper unit *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info@3-t.com *} -{* *} -{* comment : contains the pascal-translation of libmng.h *} -{* can be used by Kylix programs to access the libmng.so *} -{* *} -{* changes : 1.0.5 - 09/21/2002 - G.Juyn *} -{* - modified for Kylix use *} -{* *} -{****************************************************************************} - -interface - -{****************************************************************************} - -const MNG_TRUE = TRUE; - MNG_FALSE = FALSE; - MNG_NULL = nil; - -type mng_uint32 = cardinal; - mng_int32 = integer; - mng_uint16 = word; - mng_int16 = smallint; - mng_uint8 = byte; - mng_int8 = shortint; - mng_bool = boolean; - mng_ptr = pointer; - mng_pchar = pchar; - - mng_handle = pointer; - mng_retcode = mng_int32; - mng_chunkid = mng_uint32; - - mng_size_t = cardinal; - - mng_imgtype = (mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng); - mng_speedtype = (mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest); - - mng_uint32p = ^mng_uint32; - mng_uint16p = ^mng_uint16; - mng_uint8p = ^mng_uint8; - mng_chunkidp = ^mng_chunkid; - - mng_palette8e = packed record { 8-bit palette element } - iRed : mng_uint8; - iGreen : mng_uint8; - iBlue : mng_uint8; - end; - - mng_palette8 = packed array [0 .. 255] of mng_palette8e; - - mng_uint8arr = packed array [0 .. 255] of mng_uint8; - mng_uint8arr4 = packed array [0 .. 3] of mng_uint8; - mng_uint16arr = packed array [0 .. 255] of mng_uint16; - mng_uint32arr2 = packed array [0 .. 1] of mng_uint32; - -{****************************************************************************} - -type mng_memalloc = function ( iLen : mng_size_t) : mng_ptr; cdecl; - mng_memfree = procedure ( iPtr : mng_ptr; - iLen : mng_size_t); cdecl; - -type mng_openstream = function ( hHandle : mng_handle) : mng_bool; cdecl; -type mng_closestream = function ( hHandle : mng_handle) : mng_bool; cdecl; - -type mng_readdata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; cdecl; - -type mng_writedata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pWritten : mng_uint32) : mng_bool; cdecl; - -type mng_errorproc = function ( hHandle : mng_handle; - iErrorcode : mng_retcode; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar ) : mng_bool; cdecl; -type mng_traceproc = function ( hHandle : mng_handle; - iFuncnr : mng_int32; - iFuncseq : mng_uint32; - zFuncname : mng_pchar ) : mng_bool; cdecl; - -type mng_processheader = function ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; -type mng_processtext = function ( hHandle : mng_handle; - iType : mng_uint8; - zKeyword : mng_pchar; - zText : mng_pchar; - zLanguage : mng_pchar; - zTranslation : mng_pchar ) : mng_bool; cdecl; - -type mng_processsave = function ( hHandle : mng_handle) : mng_bool; cdecl; -type mng_processseek = function ( hHandle : mng_handle; - zName : mng_pchar ) : mng_bool; cdecl; - -type mng_processneed = function ( hHandle : mng_handle; - zKeyword : mng_pchar ) : mng_bool; cdecl; - -type mng_processunknown = function ( hHandle : mng_handle; - iChunkid : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_bool; cdecl; - -type mng_getcanvasline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -type mng_getalphaline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -type mng_getbkgdline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -type mng_refresh = function ( hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; - -type mng_gettickcount = function ( hHandle : mng_handle) : mng_uint32; cdecl; -type mng_settimer = function ( hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; cdecl; - -type mng_processgamma = function ( hHandle : mng_handle; - iGamma : mng_uint32) : mng_bool; cdecl; -type mng_processchroma = function ( hHandle : mng_handle; - iWhitex : mng_uint32; - iWhitey : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32) : mng_bool; cdecl; -type mng_processsrgb = function ( hHandle : mng_handle; - iIntent : mng_uint8 ) : mng_bool; cdecl; -type mng_processiccp = function ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_bool; cdecl; -type mng_processarow = function ( hHandle : mng_handle; - iRowsamples : mng_uint32; - bIsRGBA16 : mng_bool; - pRow : mng_ptr ) : mng_bool; cdecl; - -type mng_iteratechunk = function ( hHandle : mng_handle; - hChunk : mng_handle; - iChunkid : mng_chunkid; - iChunkseq : mng_uint32) : mng_bool; cdecl; - -{****************************************************************************} - -function mng_initialize ( pUserdata : mng_ptr; - fMemalloc : mng_memalloc; - fMemfree : mng_memfree; - fTraceproc : mng_traceproc ) : mng_handle; cdecl; - -function mng_reset ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_cleanup (var hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_read ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_read_resume ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_write ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_create ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_readdisplay ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_resume ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_freeze ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_reset ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_goframe ( hHandle : mng_handle; - iFramenr : mng_uint32 ) : mng_retcode; cdecl; -function mng_display_golayer ( hHandle : mng_handle; - iLayernr : mng_uint32 ) : mng_retcode; cdecl; -function mng_display_gotime ( hHandle : mng_handle; - iPlaytime : mng_uint32 ) : mng_retcode; cdecl; - -function mng_trapevent ( hHandle : mng_handle; - iEventtype : mng_uint8; - iX : mng_int32; - iY : mng_int32 ) : mng_retcode; cdecl; - -function mng_getlasterror ( hHandle : mng_handle; - var iSeverity : mng_uint8; - var iChunkname : mng_chunkid; - var iChunkseq : mng_uint32; - var iExtra1 : mng_int32; - var iExtra2 : mng_int32; - var zErrortext : mng_pchar ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_setcb_memalloc ( hHandle : mng_handle; - fProc : mng_memalloc ) : mng_retcode; cdecl; -function mng_setcb_memfree ( hHandle : mng_handle; - fProc : mng_memfree ) : mng_retcode; cdecl; - -function mng_setcb_openstream ( hHandle : mng_handle; - fProc : mng_openstream ) : mng_retcode; cdecl; -function mng_setcb_closestream ( hHandle : mng_handle; - fProc : mng_closestream ) : mng_retcode; cdecl; - -function mng_setcb_readdata ( hHandle : mng_handle; - fProc : mng_readdata ) : mng_retcode; cdecl; - -function mng_setcb_writedata ( hHandle : mng_handle; - fProc : mng_writedata ) : mng_retcode; cdecl; - -function mng_setcb_errorproc ( hHandle : mng_handle; - fProc : mng_errorproc ) : mng_retcode; cdecl; -function mng_setcb_traceproc ( hHandle : mng_handle; - fProc : mng_traceproc ) : mng_retcode; cdecl; - -function mng_setcb_processheader ( hHandle : mng_handle; - fProc : mng_processheader) : mng_retcode; cdecl; -function mng_setcb_processtext ( hHandle : mng_handle; - fProc : mng_processtext ) : mng_retcode; cdecl; - -function mng_setcb_getcanvasline ( hHandle : mng_handle; - fProc : mng_getcanvasline) : mng_retcode; cdecl; -function mng_setcb_getalphaline ( hHandle : mng_handle; - fProc : mng_getalphaline ) : mng_retcode; cdecl; -function mng_setcb_getbkgdline ( hHandle : mng_handle; - fProc : mng_getbkgdline ) : mng_retcode; cdecl; -function mng_setcb_refresh ( hHandle : mng_handle; - fProc : mng_refresh ) : mng_retcode; cdecl; - -function mng_setcb_gettickcount ( hHandle : mng_handle; - fProc : mng_gettickcount ) : mng_retcode; cdecl; -function mng_setcb_settimer ( hHandle : mng_handle; - fProc : mng_settimer ) : mng_retcode; cdecl; - -function mng_setcb_processgamma ( hHandle : mng_handle; - fProc : mng_processgamma ) : mng_retcode; cdecl; -function mng_setcb_processchroma ( hHandle : mng_handle; - fProc : mng_processchroma) : mng_retcode; cdecl; -function mng_setcb_processsrgb ( hHandle : mng_handle; - fProc : mng_processsrgb ) : mng_retcode; cdecl; -function mng_setcb_processiccp ( hHandle : mng_handle; - fProc : mng_processiccp ) : mng_retcode; cdecl; -function mng_setcb_processarow ( hHandle : mng_handle; - fProc : mng_processarow ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_getcb_memalloc ( hHandle : mng_handle ) : mng_memalloc; cdecl; -function mng_getcb_memfree ( hHandle : mng_handle ) : mng_memfree; cdecl; - -function mng_getcb_openstream ( hHandle : mng_handle ) : mng_openstream; cdecl; -function mng_getcb_closestream ( hHandle : mng_handle ) : mng_closestream; cdecl; - -function mng_getcb_readdata ( hHandle : mng_handle ) : mng_readdata; cdecl; - -function mng_getcb_writedata ( hHandle : mng_handle ) : mng_writedata; cdecl; - -function mng_getcb_errorproc ( hHandle : mng_handle ) : mng_errorproc; cdecl; -function mng_getcb_traceproc ( hHandle : mng_handle ) : mng_traceproc; cdecl; - -function mng_getcb_processheader ( hHandle : mng_handle ) : mng_processheader; cdecl; -function mng_getcb_processtext ( hHandle : mng_handle ) : mng_processtext; cdecl; - -function mng_getcb_getcanvasline ( hHandle : mng_handle ) : mng_getcanvasline; cdecl; -function mng_getcb_getalphaline ( hHandle : mng_handle ) : mng_getalphaline; cdecl; -function mng_getcb_getbkgdline ( hHandle : mng_handle ) : mng_getbkgdline; cdecl; -function mng_getcb_refresh ( hHandle : mng_handle ) : mng_refresh; cdecl; - -function mng_getcb_gettickcount ( hHandle : mng_handle ) : mng_gettickcount; cdecl; -function mng_getcb_settimer ( hHandle : mng_handle ) : mng_settimer; cdecl; - -function mng_getcb_processgamma ( hHandle : mng_handle ) : mng_processgamma; cdecl; -function mng_getcb_processchroma ( hHandle : mng_handle ) : mng_processchroma; cdecl; -function mng_getcb_processsrgb ( hHandle : mng_handle ) : mng_processsrgb; cdecl; -function mng_getcb_processiccp ( hHandle : mng_handle ) : mng_processiccp; cdecl; -function mng_getcb_processarow ( hHandle : mng_handle ) : mng_processarow; cdecl; - -{****************************************************************************} - -function mng_set_userdata ( hHandle : mng_handle; - pUserdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_set_canvasstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_bkgdstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; cdecl; - -function mng_set_bgcolor ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; cdecl; - -function mng_set_usebkgd ( hHandle : mng_handle; - bUseBKGD : mng_bool ) : mng_retcode; cdecl; - -function mng_set_storechunks ( hHandle : mng_handle; - bStorechunks : mng_bool ) : mng_retcode; cdecl; - -function mng_set_cacheplayback ( hHandle : mng_handle; - bCacheplayback : mng_bool ) : mng_retcode; cdecl; - -function mng_set_viewgammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_displaygammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_dfltimggammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; cdecl; - -function mng_set_srgb ( hHandle : mng_handle; - bIssRGB : mng_bool ) : mng_retcode; cdecl; -function mng_set_outputprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; cdecl; -function mng_set_outputprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; cdecl; -function mng_set_srgbprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; cdecl; -function mng_set_srgbprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; cdecl; - -function mng_set_maxcanvaswidth ( hHandle : mng_handle; - iMaxwidth : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_maxcanvasheight ( hHandle : mng_handle; - iMaxheight : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_maxcanvassize ( hHandle : mng_handle; - iMaxwidth : mng_uint32; - iMaxheight : mng_uint32 ) : mng_retcode; cdecl; - -function mng_set_suspensionmode ( hHandle : mng_handle; - bSuspensionmode : mng_bool ) : mng_retcode; cdecl; - -function mng_set_speed ( hHandle : mng_handle; - iSpeed : mng_speedtype ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_get_userdata ( hHandle : mng_handle ) : mng_ptr; cdecl; - -function mng_get_sigtype ( hHandle : mng_handle ) : mng_imgtype; cdecl; -function mng_get_imagetype ( hHandle : mng_handle ) : mng_imgtype; cdecl; -function mng_get_imagewidth ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_imageheight ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_ticks ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_framecount ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_layercount ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_playtime ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_simplicity ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_canvasstyle ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_bkgdstyle ( hHandle : mng_handle ) : mng_uint32; cdecl; - -procedure mng_get_bgcolor ( hHandle : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ); cdecl; - -function mng_get_usebkgd ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_storechunks ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_get_cacheplayback ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_viewgammaint ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_displaygammaint ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_dfltimggammaint ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_srgb ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_maxcanvaswidth ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_maxcanvasheight ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_suspensionmode ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_speed ( hHandle : mng_handle ) : mng_speedtype; cdecl; -function mng_get_imagelevel ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_starttime ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_runtime ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_currentframe ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_currentlayer ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_currentplaytime ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_status_error ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_reading ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_suspendbreak ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_creating ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_writing ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_displaying ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_running ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_timerbreak ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_dynamic ( hHandle : mng_handle ) : mng_bool; cdecl; - -{****************************************************************************} - -function mng_iterate_chunks ( hHandle : mng_handle; - iChunkseq : mng_uint32; - fProc : mng_iteratechunk ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_getchunk_ihdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_plte ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var aPalette : mng_palette8 ) : mng_retcode; cdecl; - -function mng_getchunk_idat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_trns ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var bGlobal : mng_bool; - var iType : mng_uint8; - var iCount : mng_uint32; - var aAlphas : mng_uint8arr; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iRawlen : mng_uint32; - var aRawdata : mng_uint8arr ) : mng_retcode; cdecl; - -function mng_getchunk_gama ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iGamma : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_chrm ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iWhitepointx : mng_uint32; - var iWhitepointy : mng_uint32; - var iRedx : mng_uint32; - var iRedy : mng_uint32; - var iGreenx : mng_uint32; - var iGreeny : mng_uint32; - var iBluex : mng_uint32; - var iBluey : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_srgb ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iRenderingintent : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_iccp ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iCompression : mng_uint8; - var iProfilesize : mng_uint32; - var pProfile : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_text ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_ztxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompression : mng_uint8; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_itxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompressionflag : mng_uint8; - var iCompressionmethod : mng_uint8; - var iLanguagesize : mng_uint32; - var zLanguage : mng_pchar; - var iTranslationsize : mng_uint32; - var zTranslation : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_bkgd ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var iIndex : mng_uint8; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ) : mng_retcode; cdecl; - -function mng_getchunk_phys ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_sbit ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var aBits : mng_uint8arr4) : mng_retcode; cdecl; - -function mng_getchunk_splt ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iSampledepth : mng_uint8; - var iEntrycount : mng_uint32; - var pEntries : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_hist ( hHandle : mng_handle; - hChunk : mng_handle; - var iEntrycount : mng_uint32; - var aEntries : mng_uint16arr) : mng_retcode; cdecl; - -function mng_getchunk_time ( hHandle : mng_handle; - hChunk : mng_handle; - var iYear : mng_uint16; - var iMonth : mng_uint8; - var iDay : mng_uint8; - var iHour : mng_uint8; - var iMinute : mng_uint8; - var iSecond : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_mhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iTicks : mng_uint32; - var iLayercount : mng_uint32; - var iFramecount : mng_uint32; - var iPlaytime : mng_uint32; - var iSimplicity : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_loop ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8; - var iRepeat : mng_uint32; - var iTermination : mng_uint8; - var iItermin : mng_uint32; - var iItermax : mng_uint32; - var iCount : mng_uint32; - var pSignals : mng_uint32p ) : mng_retcode; cdecl; - -function mng_getchunk_endl ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_defi ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iXlocation : mng_int32; - var iYlocation : mng_int32; - var bHasclip : mng_bool; - var iLeftcb : mng_int32; - var iRightcb : mng_int32; - var iTopcb : mng_int32; - var iBottomcb : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_basi ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var iViewable : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_clon ( hHandle : mng_handle; - hChunk : mng_handle; - var iSourceid : mng_uint16; - var iCloneid : mng_uint16; - var iClonetype : mng_uint8; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iLocationtype : mng_uint8; - var iLocationx : mng_int32; - var iLocationy : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_past ( hHandle : mng_handle; - hChunk : mng_handle; - var iDestid : mng_uint16; - var iTargettype : mng_uint8; - var iTargetx : mng_int32; - var iTargety : mng_int32; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_past_src ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iSourceid : mng_uint16; - var iComposition : mng_uint8; - var iOrientation : mng_uint8; - var iOffsettype : mng_uint8; - var iOffsetx : mng_int32; - var iOffsety : mng_int32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_disc ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pObjectids : mng_uint16p ) : mng_retcode; cdecl; - -function mng_getchunk_back ( hHandle : mng_handle; - hChunk : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iMandatory : mng_uint8; - var iImageid : mng_uint16; - var iTile : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_fram ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iMode : mng_uint8; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iChangedelay : mng_uint8; - var iChangetimeout : mng_uint8; - var iChangeclipping : mng_uint8; - var iChangesyncid : mng_uint8; - var iDelay : mng_uint32; - var iTimeout : mng_uint32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32; - var iCount : mng_uint32; - var pSyncids : mng_uint32p ) : mng_retcode; cdecl; - -function mng_getchunk_move ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMovetype : mng_uint8; - var iMovex : mng_int32; - var iMovey : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_clip ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iCliptype : mng_uint8; - var iClipl : mng_int32; - var iClipr : mng_int32; - var iClipt : mng_int32; - var iClipb : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_show ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMode : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_term ( hHandle : mng_handle; - hChunk : mng_handle; - var iTermaction : mng_uint8; - var iIteraction : mng_uint8; - var iDelay : mng_uint32; - var iItermax : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_save ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iOffsettype : mng_uint8; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_save_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iEntrytype : mng_uint8; - var iOffset : mng_uint32arr2; - var iStarttime : mng_uint32arr2; - var iLayernr : mng_uint32; - var iFramenr : mng_uint32; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_seek ( hHandle : mng_handle; - hChunk : mng_handle; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_expi ( hHandle : mng_handle; - hChunk : mng_handle; - var iSnapshotid : mng_uint16; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_fpri ( hHandle : mng_handle; - hChunk : mng_handle; - var iDeltatype : mng_uint8; - var iPriority : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_need ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_phyg ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_jhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iColortype : mng_uint8; - var iImagesampledepth : mng_uint8; - var iImagecompression : mng_uint8; - var iImageinterlace : mng_uint8; - var iAlphasampledepth : mng_uint8; - var iAlphacompression : mng_uint8; - var iAlphafilter : mng_uint8; - var iAlphainterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_jdat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_dhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iImagetype : mng_uint8; - var iDeltatype : mng_uint8; - var iBlockwidth : mng_uint32; - var iBlockheight : mng_uint32; - var iBlockx : mng_uint32; - var iBlocky : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_prom ( hHandle : mng_handle; - hChunk : mng_handle; - var iColortype : mng_uint8; - var iSampledepth : mng_uint8; - var iFilltype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_pplt ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_pplt_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var bUsed : mng_bool ) : mng_retcode; cdecl; - -function mng_getchunk_drop ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pChunknames : mng_chunkidp ) : mng_retcode; cdecl; - -function mng_getchunk_dbyk ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iPolarity : mng_uint8; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_ordr ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_ordr_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iChunkname : mng_chunkid; - var iOrdertype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_unknown ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_putchunk_ihdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_plte ( hHandle : mng_handle; - iCount : mng_uint32; - aPalette : mng_palette8 ) : mng_retcode; cdecl; - -function mng_putchunk_idat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_iend ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_putchunk_trns ( hHandle : mng_handle; - bEmpty : mng_bool; - bGlobal : mng_bool; - iType : mng_uint8; - iCount : mng_uint32; - aAlphas : mng_uint8arr; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iRawlen : mng_uint32; - aRawdata : mng_uint8arr ) : mng_retcode; cdecl; - -function mng_putchunk_gama ( hHandle : mng_handle; - bEmpty : mng_bool; - iGamma : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_chrm ( hHandle : mng_handle; - bEmpty : mng_bool; - iWhitepointx : mng_uint32; - iWhitepointy : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_srgb ( hHandle : mng_handle; - bEmpty : mng_bool; - iRenderingintent : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_iccp ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iCompression : mng_uint8; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_text ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_ztxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompression : mng_uint8; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_itxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompressionflag : mng_uint8; - iCompressionmethod : mng_uint8; - iLanguagesize : mng_uint32; - zLanguage : mng_pchar; - iTranslationsize : mng_uint32; - zTranslation : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_bkgd ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - iIndex : mng_uint8; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; cdecl; - -function mng_putchunk_phys ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_sbit ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - aBits : mng_uint8arr4) : mng_retcode; cdecl; - -function mng_putchunk_splt ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iSampledepth : mng_uint8; - iEntrycount : mng_uint32; - pEntries : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_hist ( hHandle : mng_handle; - iEntrycount : mng_uint32; - aEntries : mng_uint16arr) : mng_retcode; cdecl; - -function mng_putchunk_time ( hHandle : mng_handle; - iYear : mng_uint16; - iMonth : mng_uint8; - iDay : mng_uint8; - iHour : mng_uint8; - iMinute : mng_uint8; - iSecond : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_mhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iTicks : mng_uint32; - iLayercount : mng_uint32; - iFramecount : mng_uint32; - iPlaytime : mng_uint32; - iSimplicity : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_mend ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_putchunk_loop ( hHandle : mng_handle; - iLevel : mng_uint8; - iRepeat : mng_uint32; - iTermination : mng_uint8; - iItermin : mng_uint32; - iItermax : mng_uint32; - iCount : mng_uint32; - pSignals : mng_uint32p ) : mng_retcode; cdecl; - -function mng_putchunk_endl ( hHandle : mng_handle; - iLevel : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_defi ( hHandle : mng_handle; - iObjectid : mng_uint16; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iXlocation : mng_int32; - iYlocation : mng_int32; - bHasclip : mng_bool; - iLeftcb : mng_int32; - iRightcb : mng_int32; - iTopcb : mng_int32; - iBottomcb : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_basi ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - iViewable : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_clon ( hHandle : mng_handle; - iSourceid : mng_uint16; - iCloneid : mng_uint16; - iClonetype : mng_uint8; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iLocationtype : mng_uint8; - iLocationx : mng_int32; - iLocationy : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_past ( hHandle : mng_handle; - iDestid : mng_uint16; - iTargettype : mng_uint8; - iTargetx : mng_int32; - iTargety : mng_int32; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_past_src ( hHandle : mng_handle; - iEntry : mng_uint32; - iSourceid : mng_uint16; - iComposition : mng_uint8; - iOrientation : mng_uint8; - iOffsettype : mng_uint8; - iOffsetx : mng_int32; - iOffsety : mng_int32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_disc ( hHandle : mng_handle; - iCount : mng_uint32; - pObjectids : mng_uint16p ) : mng_retcode; cdecl; - -function mng_putchunk_back ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iMandatory : mng_uint8; - iImageid : mng_uint16; - iTile : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_fram ( hHandle : mng_handle; - bEmpty : mng_bool; - iMode : mng_uint8; - iNamesize : mng_uint32; - zName : mng_pchar; - iChangedelay : mng_uint8; - iChangetimeout : mng_uint8; - iChangeclipping : mng_uint8; - iChangesyncid : mng_uint8; - iDelay : mng_uint32; - iTimeout : mng_uint32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32; - iCount : mng_uint32; - pSyncids : mng_uint32p ) : mng_retcode; cdecl; - -function mng_putchunk_move ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMovetype : mng_uint8; - iMovex : mng_int32; - iMovey : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_clip ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iCliptype : mng_uint8; - iClipl : mng_int32; - iClipr : mng_int32; - iClipt : mng_int32; - iClipb : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_show ( hHandle : mng_handle; - bEmpty : mng_bool; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMode : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_term ( hHandle : mng_handle; - iTermaction : mng_uint8; - iIteraction : mng_uint8; - iDelay : mng_uint32; - iItermax : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_save ( hHandle : mng_handle; - bEmpty : mng_bool; - iOffsettype : mng_uint8; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_save_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iEntrytype : mng_uint8; - iOffset : mng_uint32arr2; - iStarttime : mng_uint32arr2; - iLayernr : mng_uint32; - iFramenr : mng_uint32; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_seek ( hHandle : mng_handle; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_expi ( hHandle : mng_handle; - iSnapshotid : mng_uint16; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_fpri ( hHandle : mng_handle; - iDeltatype : mng_uint8; - iPriority : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_need ( hHandle : mng_handle; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_phyg ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_jhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iColortype : mng_uint8; - iImagesampledepth : mng_uint8; - iImagecompression : mng_uint8; - iImageinterlace : mng_uint8; - iAlphasampledepth : mng_uint8; - iAlphacompression : mng_uint8; - iAlphafilter : mng_uint8; - iAlphainterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_jdat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_dhdr ( hHandle : mng_handle; - iObjectid : mng_uint16; - iImagetype : mng_uint8; - iDeltatype : mng_uint8; - iBlockwidth : mng_uint32; - iBlockheight : mng_uint32; - iBlockx : mng_uint32; - iBlocky : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_prom ( hHandle : mng_handle; - iColortype : mng_uint8; - iSampledepth : mng_uint8; - iFilltype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_pplt ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_pplt_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - bUsed : mng_bool ) : mng_retcode; cdecl; - -function mng_putchunk_drop ( hHandle : mng_handle; - iCount : mng_uint32; - pChunknames : mng_chunkidp ) : mng_retcode; cdecl; - -function mng_putchunk_dbyk ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iPolarity : mng_uint8; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_ordr ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_ordr_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iChunkname : mng_chunkid; - iOrdertype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_unknown ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_updatemngheader ( hHandle : mng_handle; - iFramecount : mng_uint32; - iLayercount : mng_uint32; - iPlaytime : mng_uint32 ) : mng_retcode; cdecl; - -function mng_updatemngsimplicity ( hHandle : mng_handle; - iSimplicity : mng_uint32 ) : mng_retcode; cdecl; - -{****************************************************************************} - -const MNG_NOERROR = 0; - - MNG_OUTOFMEMORY = 1; - MNG_INVALIDHANDLE = 2; - MNG_NOCALLBACK = 3; - MNG_UNEXPECTEDEOF = 4; - MNG_ZLIBERROR = 5; - MNG_JPEGERROR = 6; - MNG_LCMSERROR = 7; - MNG_NOOUTPUTPROFILE = 8; - MNG_NOSRGBPROFILE = 9; - MNG_BUFOVERFLOW = 10; - MNG_FUNCTIONINVALID = 11; - MNG_OUTPUTERROR = 12; - MNG_JPEGBUFTOOSMALL = 13; - MNG_NEEDMOREDATA = 14; - MNG_NEEDTIMERWAIT = 15; - MNG_NEEDSECTIONWAIT = 16; - - MNG_APPIOERROR = 901; - MNG_APPTIMERERROR = 902; - MNG_APPCMSERROR = 903; - MNG_APPMISCERROR = 904; - MNG_APPTRACEABORT = 905; - - MNG_INTERNALERROR = 999; - - MNG_INVALIDSIG = 1025; - MNG_INVALIDCRC = 1027; - MNG_INVALIDLENGTH = 1028; - MNG_SEQUENCEERROR = 1029; - MNG_CHUNKNOTALLOWED = 1030; - MNG_MULTIPLEERROR = 1031; - MNG_PLTEMISSING = 1032; - MNG_IDATMISSING = 1033; - MNG_CANNOTBEEMPTY = 1034; - MNG_GLOBALLENGTHERR = 1035; - MNG_INVALIDBITDEPTH = 1036; - MNG_INVALIDCOLORTYPE = 1037; - MNG_INVALIDCOMPRESS = 1038; - MNG_INVALIDFILTER = 1039; - MNG_INVALIDINTERLACE = 1040; - MNG_NOTENOUGHIDAT = 1041; - MNG_PLTEINDEXERROR = 1042; - MNG_NULLNOTFOUND = 1043; - MNG_KEYWORDNULL = 1044; - MNG_OBJECTUNKNOWN = 1045; - MNG_OBJECTEXISTS = 1046; - MNG_TOOMUCHIDAT = 1047; - MNG_INVSAMPLEDEPTH = 1048; - MNG_INVOFFSETSIZE = 1049; - MNG_INVENTRYTYPE = 1050; - MNG_ENDWITHNULL = 1051; - MNG_INVIMAGETYPE = 1052; - MNG_INVDELTATYPE = 1053; - MNG_INVALIDINDEX = 1054; - MNG_TOOMUCHJDAT = 1055; - MNG_JPEGPARMSERR = 1056; - MNG_INVFILLMETHOD = 1057; - MNG_OBJNOTCONCRETE = 1058; - MNG_TARGETNOALPHA = 1059; - MNG_MNGTOOCOMPLEX = 1060; - MNG_UNKNOWNCRITICAL = 1061; - MNG_UNSUPPORTEDNEED = 1062; - MNG_INVALIDDELTA = 1063; - MNG_INVALIDMETHOD = 1064; - MNG_IMPROBABLELENGTH = 1065; - MNG_INVALIDBLOCK = 1066; - MNG_INVALIDEVENT = 1067; - MNG_INVALIDMASK = 1068; - MNG_NOMATCHINGLOOP = 1069; - MNG_SEEKNOTFOUND = 1070; - - MNG_INVALIDCNVSTYLE = 2049; - MNG_WRONGCHUNK = 2050; - MNG_INVALIDENTRYIX = 2051; - MNG_NOHEADER = 2052; - MNG_NOCORRCHUNK = 2053; - MNG_NOMHDR = 2054; - - MNG_IMAGETOOLARGE = 4097; - MNG_NOTANANIMATION = 4098; - MNG_FRAMENRTOOHIGH = 4099; - MNG_LAYERNRTOOHIGH = 4100; - MNG_PLAYTIMETOOHIGH = 4101; - MNG_FNNOTIMPLEMENTED = 4102; - - MNG_IMAGEFROZEN = 8193; - -{****************************************************************************} - -const MNG_CANVAS_RGB8 = $00000000; - MNG_CANVAS_RGBA8 = $00001000; - MNG_CANVAS_ARGB8 = $00003000; - MNG_CANVAS_RGB8_A8 = $00005000; - MNG_CANVAS_BGR8 = $00000001; - MNG_CANVAS_BGRX8 = $00010001; - MNG_CANVAS_BGRA8 = $00001001; - MNG_CANVAS_ABGR8 = $00003001; - MNG_CANVAS_RGB16 = $00000100; { not supported yet } - MNG_CANVAS_RGBA16 = $00001100; { not supported yet } - MNG_CANVAS_ARGB16 = $00003100; { not supported yet } - MNG_CANVAS_BGR16 = $00000101; { not supported yet } - MNG_CANVAS_BGRA16 = $00001101; { not supported yet } - MNG_CANVAS_ABGR16 = $00003101; { not supported yet } - MNG_CANVAS_GRAY8 = $00000002; { not supported yet } - MNG_CANVAS_GRAY16 = $00000102; { not supported yet } - MNG_CANVAS_GRAYA8 = $00001002; { not supported yet } - MNG_CANVAS_GRAYA16 = $00001102; { not supported yet } - MNG_CANVAS_AGRAY8 = $00003002; { not supported yet } - MNG_CANVAS_AGRAY16 = $00003102; { not supported yet } - MNG_CANVAS_DX15 = $00000003; { not supported yet } - MNG_CANVAS_DX16 = $00000004; { not supported yet } - -{****************************************************************************} - -const MNG_UINT_HUH = $40404040; - - MNG_UINT_BACK = $4241434b; - MNG_UINT_BASI = $42415349; - MNG_UINT_CLIP = $434c4950; - MNG_UINT_CLON = $434c4f4e; - MNG_UINT_DBYK = $4442594b; - MNG_UINT_DEFI = $44454649; - MNG_UINT_DHDR = $44484452; - MNG_UINT_DISC = $44495343; - MNG_UINT_DROP = $44524f50; - MNG_UINT_ENDL = $454e444c; - MNG_UINT_FRAM = $4652414d; - MNG_UINT_IDAT = $49444154; - MNG_UINT_IEND = $49454e44; - MNG_UINT_IHDR = $49484452; - MNG_UINT_IJNG = $494a4e47; - MNG_UINT_IPNG = $49504e47; - MNG_UINT_JDAT = $4a444154; - MNG_UINT_JHDR = $4a484452; - MNG_UINT_JSEP = $4a534550; - MNG_UINT_LOOP = $4c4f4f50; - MNG_UINT_MEND = $4d454e44; - MNG_UINT_MHDR = $4d484452; - MNG_UINT_MOVE = $4d4f5645; - MNG_UINT_ORDR = $4f524452; - MNG_UINT_PAST = $50415354; - MNG_UINT_PLTE = $504c5445; - MNG_UINT_PPLT = $50504c54; - MNG_UINT_PROM = $50524f4d; - MNG_UINT_SAVE = $53415645; - MNG_UINT_SEEK = $5345454b; - MNG_UINT_SHOW = $53484f57; - MNG_UINT_TERM = $5445524d; - MNG_UINT_bKGD = $624b4744; - MNG_UINT_cHRM = $6348524d; - MNG_UINT_eXPI = $65585049; - MNG_UINT_fPRI = $66505249; - MNG_UINT_gAMA = $67414d41; - MNG_UINT_hIST = $68495354; - MNG_UINT_iCCP = $69434350; - MNG_UINT_iTXt = $69545874; - MNG_UINT_nEED = $6e454544; - MNG_UINT_oFFs = $6f464673; - MNG_UINT_pCAL = $7043414c; - MNG_UINT_pHYg = $70444167; - MNG_UINT_pHYs = $70485973; - MNG_UINT_sBIT = $73424954; - MNG_UINT_sCAL = $7343414c; - MNG_UINT_sPLT = $73504c54; - MNG_UINT_sRGB = $73524742; - MNG_UINT_tEXt = $74455874; - MNG_UINT_tIME = $74494d45; - MNG_UINT_tRNS = $74524e53; - MNG_UINT_zTXt = $7a545874; - - MNG_UINT_evNT = $65764e54; - -{****************************************************************************} - -implementation - -{****************************************************************************} - -const mngdll = 'libmng.so'; - -{****************************************************************************} - -function mng_initialize; external mngdll; -function mng_reset; external mngdll; -function mng_cleanup; external mngdll; - -function mng_read; external mngdll; -function mng_read_resume; external mngdll; -function mng_write; external mngdll; -function mng_create; external mngdll; - -function mng_readdisplay; external mngdll; -function mng_display; external mngdll; -function mng_display_resume; external mngdll; -function mng_display_freeze; external mngdll; -function mng_display_reset; external mngdll; -function mng_display_goframe; external mngdll; -function mng_display_golayer; external mngdll; -function mng_display_gotime; external mngdll; - -function mng_trapevent; external mngdll; - -function mng_getlasterror; external mngdll; - -{****************************************************************************} - -function mng_setcb_memalloc; external mngdll; -function mng_setcb_memfree; external mngdll; - -function mng_setcb_openstream; external mngdll; -function mng_setcb_closestream; external mngdll; - -function mng_setcb_readdata; external mngdll; - -function mng_setcb_writedata; external mngdll; - -function mng_setcb_errorproc; external mngdll; -function mng_setcb_traceproc; external mngdll; - -function mng_setcb_processheader; external mngdll; -function mng_setcb_processtext; external mngdll; - -function mng_setcb_getcanvasline; external mngdll; -function mng_setcb_getalphaline; external mngdll; -function mng_setcb_getbkgdline; external mngdll; -function mng_setcb_refresh; external mngdll; - -function mng_setcb_gettickcount; external mngdll; -function mng_setcb_settimer; external mngdll; - -function mng_setcb_processgamma; external mngdll; -function mng_setcb_processchroma; external mngdll; -function mng_setcb_processsrgb; external mngdll; -function mng_setcb_processiccp; external mngdll; -function mng_setcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_getcb_memalloc; external mngdll; -function mng_getcb_memfree; external mngdll; - -function mng_getcb_openstream; external mngdll; -function mng_getcb_closestream; external mngdll; - -function mng_getcb_readdata; external mngdll; - -function mng_getcb_writedata; external mngdll; - -function mng_getcb_errorproc; external mngdll; -function mng_getcb_traceproc; external mngdll; - -function mng_getcb_processheader; external mngdll; -function mng_getcb_processtext; external mngdll; - -function mng_getcb_getcanvasline; external mngdll; -function mng_getcb_getalphaline; external mngdll; -function mng_getcb_getbkgdline; external mngdll; -function mng_getcb_refresh; external mngdll; - -function mng_getcb_gettickcount; external mngdll; -function mng_getcb_settimer; external mngdll; - -function mng_getcb_processgamma; external mngdll; -function mng_getcb_processchroma; external mngdll; -function mng_getcb_processsrgb; external mngdll; -function mng_getcb_processiccp; external mngdll; -function mng_getcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_set_userdata; external mngdll; - -function mng_set_canvasstyle; external mngdll; -function mng_set_bkgdstyle; external mngdll; - -function mng_set_bgcolor; external mngdll; -function mng_set_usebkgd; external mngdll; - -function mng_set_storechunks; external mngdll; -function mng_set_cacheplayback; external mngdll; - -// function mng_set_viewgamma; external mngdll; -// function mng_set_displaygamma; external mngdll; -// function mng_set_dfltimggamma; external mngdll; -function mng_set_viewgammaint; external mngdll; -function mng_set_displaygammaint; external mngdll; -function mng_set_dfltimggammaint; external mngdll; - -function mng_set_srgb; external mngdll; -function mng_set_outputprofile; external mngdll; -function mng_set_outputprofile2; external mngdll; -function mng_set_srgbprofile; external mngdll; -function mng_set_srgbprofile2; external mngdll; - -function mng_set_maxcanvaswidth; external mngdll; -function mng_set_maxcanvasheight; external mngdll; -function mng_set_maxcanvassize; external mngdll; - -function mng_set_suspensionmode; external mngdll; - -function mng_set_speed; external mngdll; - -{****************************************************************************} - -function mng_get_userdata; external mngdll; - -function mng_get_sigtype; external mngdll; -function mng_get_imagetype; external mngdll; -function mng_get_imagewidth; external mngdll; -function mng_get_imageheight; external mngdll; -function mng_get_ticks; external mngdll; -function mng_get_framecount; external mngdll; -function mng_get_layercount; external mngdll; -function mng_get_playtime; external mngdll; -function mng_get_simplicity; external mngdll; - -function mng_get_canvasstyle; external mngdll; -function mng_get_bkgdstyle; external mngdll; - -procedure mng_get_bgcolor; external mngdll; -function mng_get_usebkgd; external mngdll; - -function mng_get_storechunks; external mngdll; -function mng_get_cacheplayback; external mngdll; - -// function mng_get_viewgamma; external mngdll; -// function mng_get_displaygamma; external mngdll; -// function mng_get_dfltimggamma; external mngdll; -function mng_get_viewgammaint; external mngdll; -function mng_get_displaygammaint; external mngdll; -function mng_get_dfltimggammaint; external mngdll; - -function mng_get_srgb; external mngdll; - -function mng_get_maxcanvaswidth; external mngdll; -function mng_get_maxcanvasheight; external mngdll; - -function mng_get_suspensionmode; external mngdll; - -function mng_get_speed; external mngdll; -function mng_get_imagelevel; external mngdll; - -function mng_get_starttime; external mngdll; -function mng_get_runtime; external mngdll; -function mng_get_currentframe; external mngdll; -function mng_get_currentlayer; external mngdll; -function mng_get_currentplaytime; external mngdll; - -function mng_status_error; external mngdll; -function mng_status_reading; external mngdll; -function mng_status_suspendbreak; external mngdll; -function mng_status_creating; external mngdll; -function mng_status_writing; external mngdll; -function mng_status_displaying; external mngdll; -function mng_status_running; external mngdll; -function mng_status_timerbreak; external mngdll; -function mng_status_dynamic; external mngdll; - -{****************************************************************************} - -function mng_iterate_chunks; external mngdll; - -{****************************************************************************} - -function mng_getchunk_ihdr; external mngdll; -function mng_getchunk_plte; external mngdll; -function mng_getchunk_idat; external mngdll; -function mng_getchunk_trns; external mngdll; -function mng_getchunk_gama; external mngdll; -function mng_getchunk_chrm; external mngdll; -function mng_getchunk_srgb; external mngdll; -function mng_getchunk_iccp; external mngdll; -function mng_getchunk_text; external mngdll; -function mng_getchunk_ztxt; external mngdll; -function mng_getchunk_itxt; external mngdll; -function mng_getchunk_bkgd; external mngdll; -function mng_getchunk_phys; external mngdll; -function mng_getchunk_sbit; external mngdll; -function mng_getchunk_splt; external mngdll; -function mng_getchunk_hist; external mngdll; -function mng_getchunk_time; external mngdll; -function mng_getchunk_mhdr; external mngdll; -function mng_getchunk_loop; external mngdll; -function mng_getchunk_endl; external mngdll; -function mng_getchunk_defi; external mngdll; -function mng_getchunk_basi; external mngdll; -function mng_getchunk_clon; external mngdll; -function mng_getchunk_past; external mngdll; -function mng_getchunk_past_src; external mngdll; -function mng_getchunk_disc; external mngdll; -function mng_getchunk_back; external mngdll; -function mng_getchunk_fram; external mngdll; -function mng_getchunk_move; external mngdll; -function mng_getchunk_clip; external mngdll; -function mng_getchunk_show; external mngdll; -function mng_getchunk_term; external mngdll; -function mng_getchunk_save; external mngdll; -function mng_getchunk_save_entry; external mngdll; -function mng_getchunk_seek; external mngdll; -function mng_getchunk_expi; external mngdll; -function mng_getchunk_fpri; external mngdll; -function mng_getchunk_need; external mngdll; -function mng_getchunk_phyg; external mngdll; -function mng_getchunk_jhdr; external mngdll; -function mng_getchunk_jdat; external mngdll; -function mng_getchunk_dhdr; external mngdll; -function mng_getchunk_prom; external mngdll; -function mng_getchunk_pplt; external mngdll; -function mng_getchunk_pplt_entry; external mngdll; -function mng_getchunk_drop; external mngdll; -function mng_getchunk_dbyk; external mngdll; -function mng_getchunk_ordr; external mngdll; -function mng_getchunk_ordr_entry; external mngdll; -function mng_getchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_putchunk_ihdr; external mngdll; -function mng_putchunk_plte; external mngdll; -function mng_putchunk_idat; external mngdll; -function mng_putchunk_iend; external mngdll; -function mng_putchunk_trns; external mngdll; -function mng_putchunk_gama; external mngdll; -function mng_putchunk_chrm; external mngdll; -function mng_putchunk_srgb; external mngdll; -function mng_putchunk_iccp; external mngdll; -function mng_putchunk_text; external mngdll; -function mng_putchunk_ztxt; external mngdll; -function mng_putchunk_itxt; external mngdll; -function mng_putchunk_bkgd; external mngdll; -function mng_putchunk_phys; external mngdll; -function mng_putchunk_sbit; external mngdll; -function mng_putchunk_splt; external mngdll; -function mng_putchunk_hist; external mngdll; -function mng_putchunk_time; external mngdll; -function mng_putchunk_mhdr; external mngdll; -function mng_putchunk_mend; external mngdll; -function mng_putchunk_loop; external mngdll; -function mng_putchunk_endl; external mngdll; -function mng_putchunk_defi; external mngdll; -function mng_putchunk_basi; external mngdll; -function mng_putchunk_clon; external mngdll; -function mng_putchunk_past; external mngdll; -function mng_putchunk_past_src; external mngdll; -function mng_putchunk_disc; external mngdll; -function mng_putchunk_back; external mngdll; -function mng_putchunk_fram; external mngdll; -function mng_putchunk_move; external mngdll; -function mng_putchunk_clip; external mngdll; -function mng_putchunk_show; external mngdll; -function mng_putchunk_term; external mngdll; -function mng_putchunk_save; external mngdll; -function mng_putchunk_save_entry; external mngdll; -function mng_putchunk_seek; external mngdll; -function mng_putchunk_expi; external mngdll; -function mng_putchunk_fpri; external mngdll; -function mng_putchunk_need; external mngdll; -function mng_putchunk_phyg; external mngdll; -function mng_putchunk_jhdr; external mngdll; -function mng_putchunk_jdat; external mngdll; -function mng_putchunk_dhdr; external mngdll; -function mng_putchunk_prom; external mngdll; -function mng_putchunk_pplt; external mngdll; -function mng_putchunk_pplt_entry; external mngdll; -function mng_putchunk_drop; external mngdll; -function mng_putchunk_dbyk; external mngdll; -function mng_putchunk_ordr; external mngdll; -function mng_putchunk_ordr_entry; external mngdll; -function mng_putchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_updatemngheader; external mngdll; -function mng_updatemngsimplicity; external mngdll; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/kylix/mngview/Main.dfm b/Engine/lib/lmng/contrib/kylix/mngview/Main.dfm deleted file mode 100644 index 5d231e759..000000000 Binary files a/Engine/lib/lmng/contrib/kylix/mngview/Main.dfm and /dev/null differ diff --git a/Engine/lib/lmng/contrib/kylix/mngview/Main.pas b/Engine/lib/lmng/contrib/kylix/mngview/Main.pas deleted file mode 100644 index 0407b2408..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/Main.pas +++ /dev/null @@ -1,555 +0,0 @@ -unit Main; - -interface - -uses - Qt, QExtCtrls, QDialogs, QMenus, QTypes, QGraphics, QControls, QForms, - SysUtils, Classes, QStdCtrls, IdGlobal, - libmng; - -{****************************************************************************} -{* For conditions of distribution and use, *} -{* see copyright notice in libmng.pas *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : main.pas copyright (c) 2000-2002 G.Juyn *} -{* version : 1.0.5 *} -{* *} -{* purpose : Main form for mngview application *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info@3-t.com *} -{* *} -{* comment : this is the heart of the mngview applciation *} -{* *} -{* changes : 1.0.5 - 09/21/2002 - G.Juyn *} -{* - modified for Kylix use *} -{* *} -{****************************************************************************} - -type - TMainForm = class(TForm) - - OFMainMenu: TMainMenu; - OFMenuFile: TMenuItem; - OFMenuFileOpen: TMenuItem; - OFMenuFileN1: TMenuItem; - OFMenuFileExit: TMenuItem; - - OFTimer: TTimer; - - OFOpenDialog: TOpenDialog; - OFPanel: TPanel; - OFImage: TImage; - - procedure FormCreate(Sender: TObject); - procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); - procedure FormShow(Sender: TObject); - procedure FormResize(Sender: TObject); - procedure FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); - procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); - - procedure OFImageMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); - procedure OFImageMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure OFImageMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - - procedure OFTimerTimer(Sender: TObject); - - procedure OFMenuFileOpenClick(Sender: TObject); - procedure OFMenuFileExitClick(Sender: TObject); - - private - { Private declarations } - - SFFileName : string; { filename of the input stream } - OFFile : TFileStream; { input stream } - IFHandle : mng_handle; { the libray handle } - OFBitmap : TBitmap; { drawing canvas } - BFCancelled : boolean; { or app-exit } - BFHasMouse : boolean; { mouse is/was over image } - - procedure MNGerror (SHMsg : string); - - public - { Public declarations } - - end; - -var - MainForm: TMainForm; - -{****************************************************************************} - -implementation - -{$R *.dfm} - -{****************************************************************************} - -{$F+} -function Memalloc (iLen : mng_uint32) : mng_ptr; cdecl; -{$F-} -begin - getmem (Result, iLen); { get memory from the heap } - fillchar (Result^, iLen, 0); { and initialize it } -end; - -{****************************************************************************} - -{$F+} -procedure Memfree (iPtr : mng_ptr; - iLen : mng_size_t); cdecl; -{$F-} -begin - freemem (iPtr, iLen); { free the memory } -end; - -{****************************************************************************} - -{$F+} -function Openstream (hHandle : mng_handle) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - if OFFile <> nil then { free previous stream (if any) } - OFFile.Free; - { open a new stream } - OFFile := TFileStream.Create (SFFileName, fmOpenRead or fmShareDenyWrite); - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Closestream (hHandle : mng_handle) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - OFFile.Free; { cleanup the stream } - OFFile := nil; { don't use it again ! } - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Readdata ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin - { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin { are we at EOF ? } - if OFFile.Position >= OFFile.Size then - begin - pRead := 0; { indicate so } - end - else - begin - { read the requested data } - pRead := OFFile.Read (pBuf^, iBuflen); - end; - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function ProcessHeader (hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin - OFBitmap.Width := iWidth; { store the new dimensions } - OFBitmap.Height := iHeight; - OFBitmap.PixelFormat := pf32bit; - - OFImage.Left := 0; { adjust the visible component } - OFImage.Top := 0; - OFImage.Width := iWidth; - OFImage.Height := iHeight; - - FormResize (OHForm); { force re-centering the image} - { clear the canvas & draw an outline } - OFBitmap.Canvas.Brush.Color := clGray; - OFBitmap.Canvas.Brush.Style := bsSolid; - OFBitmap.Canvas.FillRect (OFBitmap.Canvas.ClipRect); - - OFImage.Picture.Assign (OFBitmap); { make sure it gets out there } - { tell the library we want funny windows-bgr} - if mng_set_canvasstyle (hHandle, MNG_CANVAS_BGRX8) <> 0 then - MNGerror ('libmng reported an error setting the canvas style'); - - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function GetCanvasLine (hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { easy with these bitmap objects ! } - Result := TBitmap(OHForm.OFImage.Picture.Graphic).ScanLine [iLinenr]; -end; - -{****************************************************************************} - -{$F+} -function ImageRefresh (hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { force redraw } - OHForm.OFImage.Refresh; - - Result := MNG_TRUE; -end; - - -{****************************************************************************} - -{$F+} -function MyGetTickCount (hHandle : mng_handle) : mng_uint32; cdecl; -{$F-} -begin - Result := GetTickCount; { the system knows that } -end; - -{****************************************************************************} - -{$F+} -function SetTimer (hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - OHForm.OFTimer.Interval := iMsecs; { and set the timer } - OHForm.OFTimer.Enabled := true; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -procedure TMainForm.FormCreate(Sender: TObject); - -var IHRed, IHGreen, IHBlue : word; - -begin { initialize } - OFBitmap := TBitmap.Create; - BFHasMouse := false; - OFFile := nil; - - OFOpenDialog.Initialdir := ''; - { now initialize the library } - IFHandle := mng_initialize (mng_ptr(self), Memalloc, Memfree, nil); - - if IFHandle = NIL then - begin - MNGerror ('libmng initialization error' + #13#10 + - 'Program aborted'); - Application.Terminate; - end; - { no need to store chunk-info ! } - mng_set_storechunks (IFHandle, MNG_FALSE); - { do not use suspension-buffer } - mng_set_suspensionmode (IFHandle, MNG_FALSE); - { set all the callbacks } - if (mng_setcb_openstream (IFHandle, Openstream ) <> MNG_NOERROR) or - (mng_setcb_closestream (IFHandle, Closestream ) <> MNG_NOERROR) or - (mng_setcb_readdata (IFHandle, Readdata ) <> MNG_NOERROR) or - (mng_setcb_processheader (IFHandle, ProcessHeader ) <> MNG_NOERROR) or - (mng_setcb_getcanvasline (IFHandle, GetCanvasLine ) <> MNG_NOERROR) or - (mng_setcb_refresh (IFHandle, ImageRefresh ) <> MNG_NOERROR) or - (mng_setcb_gettickcount (IFHandle, MyGetTickCount ) <> MNG_NOERROR) or - (mng_setcb_settimer (IFHandle, SetTimer ) <> MNG_NOERROR) then - begin - MNGerror ('libmng reported an error setting a callback function!' + #13#10 + - 'Program aborted'); - Application.Terminate; - end; - - IHRed := (Color ) and $FF; { supply our own bg-color } - IHGreen := (Color shr 8) and $FF; - IHBlue := (Color shr 16) and $FF; - - IHRed := (IHRed shl 8) + IHRed; - IHGreen := (IHGreen shl 8) + IHGreen; - IHBlue := (IHBlue shl 8) + IHBlue; - - if mng_set_bgcolor (IFHandle, IHRed, IHGreen, IHBlue) <> MNG_NOERROR then - MNGerror ('libmng reported an error setting the background color!'); - -end; - -{****************************************************************************} - -procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); -begin - BFCancelled := true; - - if OFTimer.Enabled then { if we're still animating then stop it } - begin - OFTimer.Enabled := false; - - Application.ProcessMessages; - - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!'); - - end; - - mng_cleanup (IFHandle); -end; - -{****************************************************************************} - -procedure TMainForm.FormShow(Sender: TObject); -begin - FormResize (self); -end; - -{****************************************************************************} - -procedure TMainForm.FormResize(Sender: TObject); -begin { center the image in the window } - if ClientWidth < OFImage.Width then - OFImage.Left := 0 - else - OFImage.Left := (ClientWidth - OFImage.Width ) div 2; - - if ClientHeight < OFImage.Height then - OFImage.Top := 0 - else - OFImage.Top := (ClientHeight - OFImage.Height) div 2; - -end; - -{****************************************************************************} - -procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if Key = Key_Escape then { pressing will freeze an animation } - begin - if OFTimer.Enabled then - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - - OFTimer.Enabled := false; { don't let that timer go off then ! } - BFCancelled := true; - end; -end; - -{****************************************************************************} - -procedure TMainForm.FormMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { if we had the mouse, it's left ! } - begin - if mng_trapevent (IFHandle, 3, 0, 0) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := false; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseMove(Sender: TObject; Shift: TShiftState; - X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { did we have the mouse already ? } - begin - if mng_trapevent (IFHandle, 2, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - end - else - begin { if not, it has entered ! } - if mng_trapevent (IFHandle, 1, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := true; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 4, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 5, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFTimerTimer(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFTimer.Enabled := false; { only once ! } - - if not BFCancelled then - begin { and inform the library } - IHRslt := mng_display_resume (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRslt <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error during display_resume!'); - - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileOpenClick(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFOpenDialog.InitialDir := ''; - OFOpenDialog.FileName := SFFileName; - - if OFOpenDialog.Execute then { get the filename } - begin - if OFTimer.Enabled then { if the lib was active; stop it } - begin - OFTimer.Enabled := false; - - Application.ProcessMessages; { process any timer requests (for safety) } - { now freeze the animation } - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!'); - end; - { save interesting fields } - SFFileName := OFOpenDialog.FileName; - BFCancelled := false; - - OFImage.Picture.Graphic := nil; { clear the output-canvas } - OFImage.Refresh; - { always reset (just in case) } - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!') - else - begin { and let the lib do it's job ! } - IHRslt := mng_readdisplay (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRSLT <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error reading the input file!'); - - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileExitClick(Sender: TObject); -begin - if mng_cleanup (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng cleanup error'); - - Close; -end; - -{****************************************************************************} - -procedure TMainForm.MNGerror; - -var iErrorcode : mng_uint32; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar; - -begin { get extended info } - iErrorcode := mng_getlasterror (IFHandle, iSeverity, iChunkname, iChunkseq, - iExtra1, iExtra2, zErrortext); - - MessageDlg (SHMsg + #13#10#13#10 + strpas (zErrortext) + #13#10#13#10 + - Format ('Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d', - [iErrorcode, iSeverity, iChunkseq, iExtra1]), - mtError, [mbOK], 0); - Application.Terminate; -end; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview b/Engine/lib/lmng/contrib/kylix/mngview/mngview deleted file mode 100644 index bd29748bc..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -app_install_dir=/data/Triple-T/Software/mnglib3t/libmng-devel/contrib/kylix/mngview -app_path=$app_install_dir/mngview.bin -app_ld_path=$app_install_dir/lib -# -if [ -n "$LD_LIBRARY_PATH" ]; then - export LD_LIBRARY_PATH="$app_ld_path:$LD_LIBRARY_PATH" -else - export LD_LIBRARY_PATH="$app_ld_path" -fi -# -if [ -z "$LANG" ]; then - export LANG="en_US" -fi -# -exec $app_path $* diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.conf b/Engine/lib/lmng/contrib/kylix/mngview/mngview.conf deleted file mode 100644 index f2aed0130..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview.conf +++ /dev/null @@ -1,33 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I+ --$J- --$K- --$L+ --$M- --$N+ --$O+ --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --H+ --W+ --M --$M16384,1048576 --K$00400000 --DCLX_USE_LIBQT diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.dpr b/Engine/lib/lmng/contrib/kylix/mngview/mngview.dpr deleted file mode 100644 index d16a2ce38..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview.dpr +++ /dev/null @@ -1,17 +0,0 @@ -program mngview; - -uses - QForms, - Main in 'Main.pas' {MainForm}, - libmng in '../libmng.pas'; - -{$E .bin} - -{$R *.res} - -begin - Application.Initialize; - Application.Title := 'mngview - libmng test-viewer in Kylix'; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.kof b/Engine/lib/lmng/contrib/kylix/mngview/mngview.kof deleted file mode 100644 index 70dc3abfc..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview.kof +++ /dev/null @@ -1,61 +0,0 @@ -[Compiler] -A=8 -B=0 -C=1 -D=1 -E=0 -F=0 -G=1 -H=1 -I=1 -J=0 -K=0 -L=1 -M=0 -N=1 -O=1 -P=1 -Q=0 -R=0 -S=0 -T=0 -U=0 -V=1 -W=0 -X=1 -Y=1 -Z=1 -ShowHints=1 -ShowWarnings=1 -UnitAliases= - -[Linker] -MapFile=0 -OutputObjs=0 -ConsoleApp=1 -DebugInfo=0 -RemoteSymbols=0 -MinStackSize=16384 -MaxStackSize=1048576 -ImageBase=4194304 -ExeDescription= -DynamicLoader=/lib/ld-linux.so.2 - -[Directories] -OutputDir= -UnitOutputDir= -PackageDLLOutputDir= -PackageDCPOutputDir= -SearchPath= -Packages=baseclx:visualclx:dataclx:visualdbclx:netclx:netdataclx:xmlrtl:indy:webdsnapclx:websnapclx -Conditionals=CLX_USE_LIBQT -DebugSourceDirs= -UsePackages=0 - -[Parameters] -RunParams= -HostApplication= -Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee% -UseLauncher=0 -DebugCWD= - diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.res b/Engine/lib/lmng/contrib/kylix/mngview/mngview.res deleted file mode 100644 index fec7f73ca..000000000 Binary files a/Engine/lib/lmng/contrib/kylix/mngview/mngview.res and /dev/null differ diff --git a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/README.txt b/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/README.txt deleted file mode 100644 index 23b9f1d5a..000000000 --- a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/README.txt +++ /dev/null @@ -1,26 +0,0 @@ -.lib & .def files to link an MSVC project against the standard DLL build with BCB. - -Please note that this version is created for libmng 1.0.5, but should work with -1.0.6 as there were no API changes between the two versions. - -These files are courtesy of Alex Volkov. Here's what he had to say about it: - -------------------------------------------------------------------------------- - -That reminds me, I remade the MSVC libmng.lib for linking to the -bcb-generated dll. The .lib and its corresponding .def are attached. The -.def I generated by simply dumping all the exports from the bcb .dll and -later added the .def to the contrib/msvc/win32dll project. The .def is -necessary for MSVC to name the imports correctly, otherwise it produces -mangled symbol names. What is ironic is that it is not necessary to -completely build the dll with msvc -- you need just the resulting .lib -- -but you still have to setup the entire project for building the dll because of -the stdcall calling convention. The resulting .lib is not perfect -- the hints -are all off, of course -- but it does the job. In any case, the win32 exes -linked with the attached .lib in fact work with bcb-generated dll just fine. I -know the building process can be somehow automated, but I have not had the time -to work on that, and for me it was a one-shot deal. - -Alex. - -------------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.def b/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.def deleted file mode 100644 index 5f4f18758..000000000 --- a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.def +++ /dev/null @@ -1,380 +0,0 @@ -LIBRARY libmng -EXPORTS - jcopy_block_row - jcopy_sample_rows - jdiv_round_up - jinit_1pass_quantizer - jinit_2pass_quantizer - jinit_c_coef_controller - jinit_c_main_controller - jinit_c_master_control - jinit_c_prep_controller - jinit_color_converter - jinit_color_deconverter - jinit_compress_master - jinit_d_coef_controller - jinit_d_main_controller - jinit_d_post_controller - jinit_downsampler - jinit_forward_dct - jinit_huff_decoder - jinit_huff_encoder - jinit_input_controller - jinit_inverse_dct - jinit_marker_reader - jinit_marker_writer - jinit_master_decompress - jinit_memory_mgr - jinit_merged_upsampler - jinit_phuff_decoder - jinit_phuff_encoder - jinit_upsampler - jpeg_CreateCompress - jpeg_CreateDecompress - jpeg_abort - jpeg_abort_compress - jpeg_abort_decompress - jpeg_add_quant_table - jpeg_alloc_huff_table - jpeg_alloc_quant_table - jpeg_calc_output_dimensions - jpeg_consume_input - jpeg_copy_critical_parameters - jpeg_default_colorspace - jpeg_destroy - jpeg_destroy_compress - jpeg_destroy_decompress - jpeg_fdct_float - jpeg_fdct_ifast - jpeg_fdct_islow - jpeg_fill_bit_buffer - jpeg_finish_compress - jpeg_finish_decompress - jpeg_finish_output - jpeg_free_large - jpeg_free_small - jpeg_gen_optimal_table - jpeg_get_large - jpeg_get_small - jpeg_has_multiple_scans - jpeg_huff_decode - jpeg_save_markers - jpeg_set_colorspace - jpeg_set_defaults - jpeg_set_linear_quality - jpeg_set_marker_processor - jpeg_set_quality - jpeg_simple_progression - jpeg_start_compress - jpeg_start_decompress - jpeg_start_output - jpeg_std_error - jpeg_stdio_dest - jpeg_stdio_src - jpeg_suppress_tables - jpeg_write_coefficients - jpeg_write_m_byte - jpeg_write_m_header - jpeg_write_marker - jpeg_write_raw_data - jpeg_write_scanlines - jpeg_write_tables - jround_up - jzero_far - mng_cleanup - mng_copy_chunk - mng_create - mng_display - mng_display_freeze - mng_display_goframe - mng_display_golayer - mng_display_gotime - mng_display_reset - mng_display_resume - mng_get_alphabitdepth - mng_get_alphacompression - mng_get_alphadepth - mng_get_alphafilter - mng_get_alphainterlace - mng_get_bgcolor - mng_get_bitdepth - mng_get_bkgdstyle - mng_get_cacheplayback - mng_get_canvasstyle - mng_get_colortype - mng_get_compression - mng_get_currentframe - mng_get_currentlayer - mng_get_currentplaytime - mng_get_dfltimggamma - mng_get_dfltimggammaint - mng_get_displaygamma - mng_get_displaygammaint - mng_get_doprogressive - mng_get_filter - mng_get_framecount - mng_get_imageheight - mng_get_imagelevel - mng_get_imagetype - mng_get_imagewidth - mng_get_interlace - mng_get_jpeg_dctmethod - mng_get_jpeg_maxjdat - mng_get_jpeg_optimized - mng_get_jpeg_progressive - mng_get_jpeg_quality - mng_get_jpeg_smoothing - mng_get_lastbackchunk - mng_get_lastseekname - mng_get_layercount - mng_get_maxcanvasheight - mng_get_maxcanvaswidth - mng_get_playtime - mng_get_refreshpass - mng_get_runtime - mng_get_sectionbreaks - mng_get_sigtype - mng_get_simplicity - mng_get_speed - mng_get_srgb - mng_get_starttime - mng_get_storechunks - mng_get_suspensionmode - mng_get_ticks - mng_get_totalframes - mng_get_totallayers - mng_get_totalplaytime - mng_get_usebkgd - mng_get_userdata - mng_get_viewgamma - mng_get_viewgammaint - mng_get_zlib_level - mng_get_zlib_maxidat - mng_get_zlib_memlevel - mng_get_zlib_method - mng_get_zlib_strategy - mng_get_zlib_windowbits - mng_getcb_closestream - mng_getcb_errorproc - mng_getcb_getalphaline - mng_getcb_getbkgdline - mng_getcb_getcanvasline - mng_getcb_gettickcount - mng_getcb_memalloc - mng_getcb_memfree - mng_getcb_openstream - mng_getcb_processheader - mng_getcb_processneed - mng_getcb_processsave - mng_getcb_processseek - mng_getcb_processterm - mng_getcb_processtext - mng_getcb_processunknown - mng_getcb_readdata - mng_getcb_refresh - mng_getcb_settimer - mng_getcb_writedata - mng_getchunk_back - mng_getchunk_basi - mng_getchunk_bkgd - mng_getchunk_chrm - mng_getchunk_clip - mng_getchunk_clon - mng_getchunk_dbyk - mng_getchunk_defi - mng_getchunk_dhdr - mng_getchunk_disc - mng_getchunk_drop - mng_getchunk_endl - mng_getchunk_evnt - mng_getchunk_evnt_entry - mng_getchunk_expi - mng_getchunk_fpri - mng_getchunk_fram - mng_getchunk_gama - mng_getchunk_hist - mng_getchunk_iccp - mng_getchunk_idat - mng_getchunk_ihdr - mng_getchunk_itxt - mng_getchunk_jdat - mng_getchunk_jhdr - mng_getchunk_loop - mng_getchunk_magn - mng_getchunk_mhdr - mng_getchunk_move - mng_getchunk_need - mng_getchunk_ordr - mng_getchunk_ordr_entry - mng_getchunk_past - mng_getchunk_past_src - mng_getchunk_phyg - mng_getchunk_phys - mng_getchunk_plte - mng_getchunk_pplt - mng_getchunk_pplt_entry - mng_getchunk_prom - mng_getchunk_save - mng_getchunk_save_entry - mng_getchunk_sbit - mng_getchunk_seek - mng_getchunk_show - mng_getchunk_splt - mng_getchunk_srgb - mng_getchunk_term - mng_getchunk_text - mng_getchunk_time - mng_getchunk_trns - mng_getchunk_unknown - mng_getchunk_ztxt - mng_getimgdata_chunk - mng_getimgdata_chunkseq - mng_getimgdata_seq - mng_getlasterror - mng_initialize - mng_iterate_chunks - mng_putchunk_back - mng_putchunk_basi - mng_putchunk_bkgd - mng_putchunk_chrm - mng_putchunk_clip - mng_putchunk_clon - mng_putchunk_dbyk - mng_putchunk_defi - mng_putchunk_dhdr - mng_putchunk_disc - mng_putchunk_drop - mng_putchunk_endl - mng_putchunk_evnt - mng_putchunk_evnt_entry - mng_putchunk_expi - mng_putchunk_fpri - mng_putchunk_fram - mng_putchunk_gama - mng_putchunk_hist - mng_putchunk_iccp - mng_putchunk_idat - mng_putchunk_iend - mng_putchunk_ihdr - mng_putchunk_ipng - mng_putchunk_itxt - mng_putchunk_jdat - mng_putchunk_jhdr - mng_putchunk_jsep - mng_putchunk_loop - mng_putchunk_magn - mng_putchunk_mend - mng_putchunk_mhdr - mng_putchunk_move - mng_putchunk_need - mng_putchunk_ordr - mng_putchunk_ordr_entry - mng_putchunk_past - mng_putchunk_past_src - mng_putchunk_phyg - mng_putchunk_phys - mng_putchunk_plte - mng_putchunk_pplt - mng_putchunk_pplt_entry - mng_putchunk_prom - mng_putchunk_save - mng_putchunk_save_entry - mng_putchunk_sbit - mng_putchunk_seek - mng_putchunk_show - mng_putchunk_splt - mng_putchunk_srgb - mng_putchunk_term - mng_putchunk_text - mng_putchunk_time - mng_putchunk_trns - mng_putchunk_unknown - mng_putchunk_ztxt - mng_putimgdata_ihdr - mng_putimgdata_jhdr - mng_read - mng_read_resume - mng_readdisplay - mng_reset - mng_set_bgcolor - mng_set_bkgdstyle - mng_set_cacheplayback - mng_set_canvasstyle - mng_set_dfltimggamma - mng_set_dfltimggammaint - mng_set_displaygamma - mng_set_displaygammaint - mng_set_doprogressive - mng_set_jpeg_dctmethod - mng_set_jpeg_maxjdat - mng_set_jpeg_optimized - mng_set_jpeg_progressive - mng_set_jpeg_quality - mng_set_jpeg_smoothing - mng_set_maxcanvasheight - mng_set_maxcanvassize - mng_set_maxcanvaswidth - mng_set_outputprofile - mng_set_outputprofile2 - mng_set_outputsrgb - mng_set_sectionbreaks - mng_set_speed - mng_set_srgb - mng_set_srgbimplicit - mng_set_srgbprofile - mng_set_srgbprofile2 - mng_set_storechunks - mng_set_suspensionmode - mng_set_usebkgd - mng_set_userdata - mng_set_viewgamma - mng_set_viewgammaint - mng_set_zlib_level - mng_set_zlib_maxidat - mng_set_zlib_memlevel - mng_set_zlib_method - mng_set_zlib_strategy - mng_set_zlib_windowbits - mng_setcb_closestream - mng_setcb_errorproc - mng_setcb_getalphaline - mng_setcb_getbkgdline - mng_setcb_getcanvasline - mng_setcb_gettickcount - mng_setcb_memalloc - mng_setcb_memfree - mng_setcb_openstream - mng_setcb_processheader - mng_setcb_processmend - mng_setcb_processneed - mng_setcb_processsave - mng_setcb_processseek - mng_setcb_processterm - mng_setcb_processtext - mng_setcb_processunknown - mng_setcb_readdata - mng_setcb_refresh - mng_setcb_settimer - mng_setcb_writedata - mng_status_creating - mng_status_displaying - mng_status_dynamic - mng_status_error - mng_status_reading - mng_status_running - mng_status_runningevent - mng_status_suspendbreak - mng_status_timerbreak - mng_status_writing - mng_supports_func - mng_trapevent - mng_updatemngheader - mng_updatemngsimplicity - mng_version_beta - mng_version_dll - mng_version_major - mng_version_minor - mng_version_release - mng_version_so - mng_version_text - mng_write diff --git a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.lib b/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.lib deleted file mode 100644 index 375db10d5..000000000 Binary files a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.lib and /dev/null differ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/Makefile b/Engine/lib/lmng/contrib/msvc/makemng/Makefile deleted file mode 100644 index b5c31b5f5..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -######################################################################## -# This is a GNU makefile - tested on CYGWIN and Linux -# -# You may need to compile or install libmng before compiling this. -# Libmng also requires zlib, jpeg and lcms -# - -TARGET = makemng -# These flags are needed to get it to compile with libmng.dll on CYGWIN -# CYGWINFLAGS = -DMNG_USE_DLL -CYGWINFLAGS = -MNGFLAGS = -I. -DMNG_SKIP_LCMS -DMNG_SKIP_IJG6B \ - -DMNG_SUPPORT_READ -DMNG_SUPPORT_WRITE -DMNG_SUPPORT_DISPLAY \ - -DMNG_ACCESS_CHUNKS - -CC = gcc -CFLAGS = -W -Wall -O0 # -g -LIBS = -L/usr/local/lib -lmng -lm -lz -ljpeg -llcms -LDFLAGS= - -BINS = $(TARGET) $(TARGET).exe -SRCS = makemng.c filelist.c -OBJS = makemng.o filelist.o - -.SUFFIXES: .c .o - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c $(MNGFLAGS) $(CYGWINFLAGS) - -all: $(TARGET) - -$(TARGET): $(OBJS) - $(CC) -o $(TARGET) $(OBJS) $(LIBS) $(LDFLAGS) - -clean: - rm -f $(BINS) *.o - diff --git a/Engine/lib/lmng/contrib/msvc/makemng/README b/Engine/lib/lmng/contrib/msvc/makemng/README deleted file mode 100644 index dbd26ea89..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/README +++ /dev/null @@ -1,24 +0,0 @@ -MAKEMNG - Jan 10, 2003 - -A simple MNG encoder. MAKEMNG takes a bunch of still frames (PNGs) -as input, computes delta images and stuffs it all into an MNG, thus -creating an animation. - -You will need zlib to compile and run this app. -The included Makefile should work on Linux and CYGWIN. -The MSVC project will most likely need modifications for your -environment. - -usage: makemng [-v] [-f rate] [-r] [-s size] [-o outputfile] -produces an MNG animation from a bunch of frame images -options: - -v : be verbose, explains things no human should know - -f rate : sets the framerate; rate is 1..100 per second (default 5) - -b : auto-select background frame (instead of frame0) - -r : split delta frames into full rectangles only - -s size : enable sector cleanup and set sector size (8..64) -diagnostical options: - -d : generate delta-mask PNGs (form: mask_FRM1_FRM2.png) - -------------- -Alex Volkov diff --git a/Engine/lib/lmng/contrib/msvc/makemng/filelist.c b/Engine/lib/lmng/contrib/msvc/makemng/filelist.c deleted file mode 100644 index 852d018f6..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/filelist.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* This file contains two versions of make_file_list(); one for Windows, and - * one for other systems (POSIX). - */ -#ifdef WIN32 -#include -#include -#include -#include - -char** -make_file_list (const char* pattern, int* pnum_entries) -{ - int num_entries, length; - char** StringTable; - char** lpLastOffs; - - num_entries = 0; - StringTable = 0; - do - { - int slen; - long handle; - struct _finddata_t f; - - if (num_entries == 0) - length = 0; - else - { - slen = (num_entries + 1) * sizeof (char*); - StringTable = (char**) malloc (slen + length); - if (StringTable == 0) - break; - - lpLastOffs = StringTable; - *lpLastOffs = (char*)StringTable + slen; - - num_entries = 0; - length = slen; - } - - handle = _findfirst (pattern, &f); - if (handle != -1) - { - do - { - if (f.attrib & (_A_HIDDEN | _A_SUBDIR | _A_SYSTEM)) - continue; - - slen = strlen (f.name) + 1; - length += slen; - - if (StringTable) - { - char *lpStr; - char **lpLo, **lpHi; - - lpLo = StringTable; - lpHi = lpLastOffs - 1; - while (lpLo <= lpHi) - { - char c1, c2; - char *pStr; - int LocLen; - char **lpMid; - - lpMid = lpLo + ((lpHi - lpLo) >> 1); - - LocLen = lpMid[1] - lpMid[0]; - if (LocLen > slen) - LocLen = slen; - - lpStr = lpMid[0]; - pStr = f.name; - while (LocLen-- - && (c1 = toupper (*lpStr++)) - == (c2 = toupper (*pStr++))) - ; - - if (c1 <= c2) - lpLo = lpMid + 1; - else - lpHi = lpMid - 1; - } - - lpStr = lpLo[0]; - memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]); - strcpy (lpStr, f.name); - - for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi) - lpHi[1] = lpHi[0] + slen; - } - - ++num_entries; - - } while (_findnext (handle, &f) == 0); - - _findclose (handle); - } - } while (num_entries && StringTable == 0); - - if (StringTable == 0) - *pnum_entries = 0; - else - *pnum_entries = num_entries; - - return StringTable; -} - -#else /* ! defined(WIN32) */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -char** -make_file_list (const char* pattern, int* pnum_entries) -{ - size_t num_entries, length; - char** StringTable; - char** lpLastOffs; - char* slash; // Pointer inside pattern to the last / - char path[PATH_MAX]; // buffer for a filename with path - char* file; // Pointer inside path to the filename - size_t pathlen; // length of path, excluding last / and filename - - slash = (char*) strrchr ((const char *) pattern, '/'); - if (slash == NULL) - { - pathlen = 1; - path[0] = '.'; - } - else - { - pathlen = slash - pattern; - memcpy (path, pattern, pathlen); - pattern = slash + 1; - } - file = path + pathlen + 1; - - num_entries = 0; - StringTable = 0; - do - { - int slen; - DIR *handle; - - if (num_entries == 0) - length = 0; - else - { - slen = (num_entries + 1) * sizeof (char*); - StringTable = (char**) malloc (slen + length); - if (StringTable == 0) - break; - - lpLastOffs = StringTable; - *lpLastOffs = (char*)StringTable + slen; - - num_entries = 0; - length = slen; - } - - path[pathlen] = '\0'; // strip any file part - handle = opendir((const char *) path); - if (handle != NULL) - { - path[pathlen] = '/'; - // change the 0 char to a slash; a filename will be - // attached here. - while (1) - { - struct dirent *de; - struct stat sb; - - de = readdir(handle); - if (de == NULL) - break; - if (de->d_name[0] == '.') - continue; - strcpy (file, de->d_name); - // attach the filename to path - if (stat(path, &sb) == -1) - continue; - if (!S_ISREG(sb.st_mode)) - continue; - if (fnmatch(pattern, de->d_name, 0) != 0) - continue; - - slen = strlen (de->d_name) + 1; - length += slen; - - if (StringTable) - { - char *lpStr; - char **lpLo, **lpHi; - - lpLo = StringTable; - lpHi = lpLastOffs - 1; - while (lpLo <= lpHi) - { - char c1, c2; - char *pStr; - int LocLen; - char **lpMid; - - lpMid = lpLo + ((lpHi - lpLo) >> 1); - - LocLen = lpMid[1] - lpMid[0]; - if (LocLen > slen) - LocLen = slen; - - lpStr = lpMid[0]; - pStr = de->d_name; - while (LocLen-- - && (c1 = toupper (*lpStr++)) - == (c2 = toupper (*pStr++))) - ; - - if (c1 <= c2) - lpLo = lpMid + 1; - else - lpHi = lpMid - 1; - } - - lpStr = lpLo[0]; - memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]); - strcpy (lpStr, de->d_name); - - for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi) - lpHi[1] = lpHi[0] + slen; - } - - ++num_entries; - } - closedir(handle); - } - } while (num_entries && StringTable == 0); - - if (StringTable == 0) - *pnum_entries = 0; - else - *pnum_entries = num_entries; - - return StringTable; -} - -#endif - -void -free_file_list (char** list) -{ - if (list) - free(list); -} diff --git a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.c b/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.c deleted file mode 100644 index 08d13d4aa..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.c +++ /dev/null @@ -1,1060 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#include - -#ifndef HAVE_GETOPT_H -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. */ -# if defined HAVE_LIBINTL_H || defined _LIBC -# include -# ifndef _ -# define _(msgid) gettext (msgid) -# endif -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -int optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -#ifndef WIN32 -# if HAVE_STRING_H -# include -# else -# include -# endif -#else -# include -#endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Stored original parameters. - XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ -extern int __libc_argc; -extern char **__libc_argv; - -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -# ifdef USE_NONOPTION_FLAGS -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; -# endif - -# ifdef USE_NONOPTION_FLAGS -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -# else -# define SWAP_FLAGS(ch1, ch2) -# endif -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#if defined _LIBC && defined USE_NONOPTION_FLAGS - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = HMalloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#if defined _LIBC && defined USE_NONOPTION_FLAGS - if (posixly_correct == NULL - && argc == __libc_argc && argv == __libc_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) HMalloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int print_errors = opterr; - if (optstring[0] == ':') - print_errors = 0; - - if (argc < 1) - return -1; - - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#if defined _LIBC && defined USE_NONOPTION_FLAGS -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else if (long_only - || pfound->has_arg != p->has_arg - || pfound->flag != p->flag - || pfound->val != p->val) - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (print_errors) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (print_errors) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - -#endif /* HAVE_GETOPT_H */ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.h b/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.h deleted file mode 100644 index a1b8dd665..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.h +++ /dev/null @@ -1,180 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include , but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include , which will pull in for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -# if (defined __STDC__ && __STDC__) || defined __cplusplus - const char *name; -# else - char *name; -# endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ - -#if (defined __STDC__ && __STDC__) || defined __cplusplus -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt1.c b/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt1.c deleted file mode 100644 index 57eee0821..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt1.c +++ /dev/null @@ -1,189 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include - -#ifndef HAVE_GETOPT_H -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - -#endif /* HAVE_GETOPT_H */ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/makemng.c b/Engine/lib/lmng/contrib/msvc/makemng/makemng.c deleted file mode 100644 index 878b07134..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/makemng.c +++ /dev/null @@ -1,1765 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -# include -#else -# include -#endif - - -struct options -{ - char *inmask; - char *inpath; - char *outfile; - int framerate; - char verbose; - char backimage; - char deltamask; - int sectorsize; - int fullrects; -} opts; - -// externals -char** make_file_list (const char* pattern, int* pnum_entries); -void free_file_list (char** list); - -// internals -int error (int errn, const char* fmt, const char* s); -void verbose (const char* fmt, const char* s); -void verbose_d (const char* fmt, int val); -void parse_arguments (int argc, char *argv[], struct options *opts); -int read_file_list (void); -void calc_mng_dims (void); -void select_back_image (void); -void delta_images (void); -int write_mng_file (void); - -typedef union -{ - struct - { - unsigned char r, g, b, a; - } bchan; - unsigned char channels[4]; - unsigned int value; -} RGBA; - -typedef struct _file_info -{ - FILE* f; - char* fname; - char* fmode; - int w, h; - int x, y; - RGBA* image; - unsigned char* indimg; - int delay; - int identical; - unsigned short objid; - unsigned short cloneid; - int clone; - unsigned short precloneid; - int preclone; - struct _file_info* next; -} file_info; - -void file_info_free (); - -// MNG callbacks -mng_ptr MNG_DECL mng_alloc (mng_size_t iLen); -void MNG_DECL mng_free (mng_ptr pPtr, mng_size_t iLen); -mng_bool MNG_DECL mng_open_stream(mng_handle mng); -mng_bool MNG_DECL mng_close_stream(mng_handle mng); -mng_bool MNG_DECL mng_read_stream(mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes); -mng_bool MNG_DECL mng_write_stream (mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes); -mng_bool MNG_DECL mng_process_header(mng_handle mng, mng_uint32 width, mng_uint32 height); -mng_ptr MNG_DECL mng_get_canvasline_read(mng_handle mng, mng_uint32 line); -mng_ptr MNG_DECL mng_get_canvasline_write(mng_handle mng, mng_uint32 line); -mng_bool MNG_DECL mng_refresh_display(mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h); -mng_uint32 MNG_DECL mng_get_tickcount(mng_handle mng); -mng_bool MNG_DECL mng_set_timer(mng_handle mng, mng_uint32 msecs); - -#define MAX_COLORS 0x100 - -// global png/mng data -char** Files = 0; -int cFiles = 0; -file_info* Infos = 0; -mng_palette8 Pal; -int cPalClr = 0; -int mngw = 0, mngh = 0; -int iback = 0; -int timerate = 100; // default 100 ticks per second -int framedelay = 20; // default 5 fps -int _curframe = -1; -int _curdeltaframe = -1; - -int -main(int argc, char* argv[]) -{ - int ret = 0; - - parse_arguments (argc, argv, &opts); - - if (opts.framerate) // update delay - framedelay = timerate / opts.framerate; - - if (!opts.inpath && (strchr (opts.inmask, '/') || strchr (opts.inmask, '\\'))) - { - char *pch1, *pch2; - - opts.inpath = (char*) calloc (strlen (opts.inmask), 1); - if (!opts.inpath) - return error (EXIT_FAILURE, "No memory", 0); - - strcpy (opts.inpath, opts.inmask); - pch1 = strrchr (opts.inpath, '/'); - pch2 = strrchr (opts.inpath, '\\'); - if (pch2 > pch1) - pch1 = pch2; - - pch1[1] = 0; // term the path - - verbose ("Frame files in dir: %s\n", opts.inpath); - } - - if (!opts.outfile) - { - char* pch; - - opts.outfile = (char*) calloc (strlen(opts.inmask) + 6, 1); - if (!opts.outfile) - return error (EXIT_FAILURE, "No memory", 0); - - strcpy (opts.outfile, opts.inmask); - while ((pch = strchr (opts.outfile, '*')) != 0) - strcpy (pch, pch + 1); - - pch = strstr (opts.outfile, ".png"); - if (!pch) - pch = opts.outfile + strlen (opts.outfile); - strcpy (pch, ".mng"); - - if (pch == opts.outfile || pch[-1] == '/' || pch[-1] == '\\') - { // have to fix blank name - memmove (pch + 1, pch, strlen(pch) + 1); - *pch = '1'; - } - - verbose ("Output file: %s\n", opts.outfile); - } - - fprintf (stderr, "using timerate of %d and framedelay of %d\n", timerate, framedelay); - - ret = read_file_list (); - if (!ret) - { - calc_mng_dims (); - if (opts.backimage) - select_back_image (); - delta_images (); - - ret = write_mng_file (); - } - - file_info_free (); - free_file_list (Files); - - return ret; -} - -int -error(int errn, const char* fmt, const char* s) -{ - fprintf(stderr, fmt, s); - return errn; -} - -void -verbose(const char* fmt, const char* s) -{ - if (!opts.verbose) - return; - - fprintf(stderr, fmt, s); -} - -void verbose_d (const char* fmt, int val) -{ - if (!opts.verbose) - return; - - fprintf(stderr, fmt, val); -} - -void -usage() -{ - fprintf(stderr, "usage: makemng [-v] [-f rate] [-r] [-s size] [-o outputfile] \n"); - fprintf(stderr, "produces an MNG animation from a bunch of frame images\n"); - fprintf(stderr, "options:\n"); - fprintf(stderr, " -v\t\t : be verbose, explains things no human should know\n"); - fprintf(stderr, " -f rate\t : sets the framerate; rate is 1..100 per second (default 5)\n"); - fprintf(stderr, " -b\t\t : auto-select background frame (instead of frame0)\n"); - fprintf(stderr, " -r\t\t : split delta frames into full rectangles only\n"); - fprintf(stderr, " -s size\t : enable sector cleanup and set sector size (8..64)\n"); - fprintf(stderr, "diagnostical options:\n"); - fprintf(stderr, " -d\t\t : generate delta-mask PNGs (form: mask_FRM1_FRM2.png)\n"); -} - -void -parse_arguments(int argc, char *argv[], struct options *opts) -{ - char ch; - - memset(opts, '\0', sizeof (struct options)); - while ((ch = getopt(argc, argv, "?hvbdrf:s:o:")) != -1) - { - switch(ch) - { - case 'o': - opts->outfile = optarg; - break; - case 'f': - opts->framerate = atoi(optarg); - if (opts->framerate < 1 || opts->framerate > 100) - { - fprintf(stderr, "invalid -f option value\n"); - usage(); - exit(EXIT_FAILURE); - } - break; - case 'd': - opts->deltamask = 1; - break; - case 'b': - opts->backimage = 1; - break; - case 'r': - opts->fullrects = 1; - break; - case 's': - opts->sectorsize = atoi(optarg); - if (opts->sectorsize < 8 || opts->sectorsize > 64) - { - fprintf(stderr, "invalid -r option value\n"); - usage(); - exit(EXIT_FAILURE); - } - break; - case 'v': - opts->verbose = 1; - break; - case '?': - case 'h': - default: - usage(); - exit(EXIT_FAILURE); - } - } - - argc -= optind; - argv += optind; - if (argc != 1) - { - usage(); - exit(EXIT_FAILURE); - } - - opts->inmask = argv[0]; -} - -void -make_file_name(int index, char* buf) -{ - if (opts.inpath) - strcpy(buf, opts.inpath); - else - *buf = 0; - - strcat(buf, Files[index]); -} - -void -file_info_init (file_info* ms) -{ - memset(ms, 0, sizeof(*ms)); - ms->identical = -1; - ms->clone = -1; - ms->preclone = -1; -} - -void -file_info_cleanup (file_info* ms) -{ - file_info* fi = ms; - - while (fi) - { - file_info* tempi = fi; - - if (fi->image) - { - free(fi->image); - fi->image = 0; - } - - if (fi->indimg) - { - free(fi->indimg); - fi->indimg = 0; - } - - if (fi->f) - { - fclose(fi->f); - fi->f = 0; - } - - - fi = fi->next; - if (tempi != ms) - free (tempi); - } -} - -void -file_info_free () -{ - int i; - - if (Infos) - { - for (i = 0; i < cFiles; i++) - file_info_cleanup (Infos + i); - - free (Infos); - Infos = 0; - } -} - -int -equal_colors (RGBA rgba, mng_palette8e mng_clr) -{ - return rgba.bchan.r == mng_clr.iRed && - rgba.bchan.g == mng_clr.iGreen && - rgba.bchan.b == mng_clr.iBlue; -} - -int -lookup_palette (RGBA rgba) -{ - int i; - - for (i = 0; i < cPalClr && !equal_colors(rgba, Pal[i]); i++) - ; - - return i < cPalClr ? i : -1; -} - -int -update_palette (file_info* ms) -{ - int i; - - for (i = 0; i < ms->w * ms->h; i++) - { - RGBA rgba = ms->image[i]; - int ipal = lookup_palette (rgba); - if (ipal == -1) - { // add color - if (cPalClr >= MAX_COLORS) - return 1; - - Pal[cPalClr].iRed = rgba.bchan.r; - Pal[cPalClr].iGreen = rgba.bchan.g; - Pal[cPalClr].iBlue = rgba.bchan.b; - cPalClr++; - } - } - return 0; -} - -int -convert_image_indexed (file_info* ms) -{ - int i; - - ms->indimg = (unsigned char*) malloc (ms->w * ms->h); - if (!ms->indimg) - return 230; - - for (i = 0; i < ms->w * ms->h; i++) - { - int ipal = lookup_palette (ms->image[i]); - - if (ipal == -1) - return 1; // something is screwed - - ms->indimg[i] = ipal; - } - - free (ms->image); - ms->image = 0; - - return 0; -} - -int -read_file_list (void) -{ - int ret = 0; - mng_handle mng; - char namebuf[260]; - int i; - - cFiles = 0; - Files = make_file_list(opts.inmask, &cFiles); - - if (!Files || cFiles == 0) - { - fprintf (stderr, "No frame files found\n"); - return 1; - } - - Infos = (file_info*) malloc (sizeof(file_info) * cFiles); - if (!Infos) - return 251; - - memset(Infos, 0, sizeof(file_info) * cFiles); - - mng = mng_initialize (MNG_NULL, mng_alloc, mng_free, MNG_NULL); - if (mng == MNG_NULL) - return 250; - - // set the callbacks - mng_setcb_openstream(mng, mng_open_stream); - mng_setcb_closestream(mng, mng_close_stream); - mng_setcb_readdata(mng, mng_read_stream); - mng_setcb_processheader(mng, mng_process_header); - mng_setcb_getcanvasline(mng, mng_get_canvasline_read); - mng_setcb_gettickcount(mng, mng_get_tickcount); - mng_setcb_settimer(mng, mng_set_timer); - mng_setcb_refresh(mng, mng_refresh_display); - - for (i = 0; i < cFiles && !ret; i++) - { - file_info* rf = Infos + i; - - file_info_init (rf); - make_file_name (i, namebuf); - rf->fname = namebuf; - rf->fmode = "rb"; - - verbose_d ("%03d ", i); verbose ("reading '%s'...", rf->fname); - - mng_reset (mng); - mng_set_userdata (mng, rf); - - for (ret = mng_readdisplay (mng); - ret == MNG_NEEDMOREDATA || ret == MNG_NEEDTIMERWAIT; - ret = mng_display_resume (mng)) - { - if (ret == MNG_NEEDTIMERWAIT) - rf->delay = 0; - } - - if (ret) - { - fprintf (stderr, "Could not read '%s'\n", rf->fname); - ret = 2; - } - - ret = update_palette (rf); - if (ret) - { - fprintf (stderr, "Too many unique colors (%d processed), giving up\n", i); - ret = 3; - } - - ret = convert_image_indexed (rf); - if (ret) - { - fprintf (stderr, "Image conversion failed on '%s'\n", rf->fname); - ret = 4; - } - - verbose (" done\n", 0); - } - - mng_cleanup (&mng); - - if (ret == MNG_NOERROR) - fprintf (stderr, "%d animation frames\n", cFiles); - - return ret; -} - -void -calc_mng_dims (void) -{ - int i; - - mngw = mngh = -1; - - // get max dims - for (i = 0; i < cFiles; i++) - { - if (Infos[i].w > mngw) - mngw = Infos[i].w; - - if (Infos[i].h > mngh) - mngh = Infos[i].h; - } - - // adjust images - center - for (i = 0; i < cFiles; i++) - { - if (Infos[i].w < mngw) - Infos[i].x = (mngw - Infos[i].w) >> 1; - - if (Infos[i].h < mngh) - Infos[i].y = (mngh - Infos[i].h) >> 1; - } -} - -int -compare_images (file_info* i1, file_info* i2) -{ - int cnt = 0; - int w, h, x, y; - int dx1, dx2, dy1, dy2; - - if (i1->w > i2->w) - { - w = i2->w; - dx1 = i2->x; - dx2 = 0; - } - else if (i1->w < i2->w) - { - w = i1->w; - dx1 = 0; - dx2 = i1->x; - } - else - { - w = i1->w; - dx1 = dx2 = 0; - } - - if (i1->h > i2->h) - { - h = i2->h; - dy1 = i2->y; - dy2 = 0; - } - else if (i1->h < i2->h) - { - h = i1->h; - dy1 = 0; - dy2 = i1->y; - } - else - { - h = i1->h; - dy1 = dy2 = 0; - } - - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (i1->indimg[(y + dy1) * i1->w + x + dx1] != i2->indimg[(y + dy2) * i2->w + x + dx2]) - cnt++; - } - } - return cnt; -} - -void -select_back_image (void) -{ - int i; - int* cdiff; - int max; - - cdiff = (int*) calloc (cFiles, sizeof(int)); - if (!cdiff) - return; - - verbose ("selecting optimal background image...", 0); - - for (i = 2; i < cFiles; i++) - { - if (Infos[i].w == mngw && Infos[i].h == mngh) - { - cdiff[i] = compare_images (Infos + i, Infos + i - 1) - - compare_images (Infos + i, Infos + 0); - } - else - { - // image is smaller than animation and cannot be background - cdiff[i] = 0x7fffffff; - } - } - - // the difference has to be big enough - // or it will be useless - iback = 0; - max = mngw * mngh / 32; - - for (i = 2; i < cFiles; i++) - { - if (cdiff[i] > max) - { - iback = i; - max = cdiff[i]; - } - } - - verbose (" done\n", 0); - fprintf(stderr, "frame %03d selected as background\n", iback); -} - -int -equal_images (int i1, int i2) -{ - // deference identical chain - while (Infos[i1].identical != -1) - i1 = Infos[i1].identical; - while (Infos[i2].identical != -1) - i2 = Infos[i2].identical; - - if (i1 == i2) - return 1; - - if (Infos[i1].x != Infos[i2].x || Infos[i1].y != Infos[i2].y - || Infos[i1].w != Infos[i2].w || Infos[i1].h != Infos[i2].h) - return 0; - - return compare_images (Infos + i1, Infos + i2) == 0; -} - -int -delta_adjust_positions (int* pos1, int* pos2) -{ - if (*pos1 <= *pos2) - return 1; - else - { - (*pos1)--; - (*pos2)--; - return -1; - } -} - -void -clean_expansion_horz (unsigned char* mask, int w, int x1, int y1, int x2, int y2, int threshold) -{ - int x, y, dx, dy; - // assume anything out of bounds is cleared - int prevclear = threshold + 1; - - dy = delta_adjust_positions (&y1, &y2); - dx = delta_adjust_positions (&x1, &x2); - - for (y = y1; y != y2; y += dy) - { - int dcnt, ecnt; - - dcnt = ecnt = 0; - - for (x = x1; x != x2; x += dx) - { - if (mask[y * w + x] == 1) - dcnt++; - else if (mask[y * w + x] == 2 || mask[y * w + x] == 3) - ecnt++; - } - - if (dcnt == 0 && ecnt == 0) - { // line is clear - prevclear++; - } - else if (dcnt == 0) - { - if (prevclear >= threshold) - { // it's not clear yet, but it will be in a moment ;) - int lx, ly = y; - - if (prevclear == threshold) - { // need to clean everything we just checked - ly = y - prevclear * dy; - } - - for (ly = ly; ly != y + dy; ly += dy) - for (lx = x1; lx != x2; lx += dx) - mask[ly * w + lx] = 0; - } - prevclear++; - } - else - { // line is dirty - prevclear = 0; - } - } -} - -void -clean_expansion_vert (unsigned char* mask, int w, int x1, int y1, int x2, int y2, int threshold) -{ - int x, y, dx, dy; - // assume anything out of bounds is cleared - int prevclear = threshold + 1; - - dy = delta_adjust_positions (&y1, &y2); - dx = delta_adjust_positions (&x1, &x2); - - for (x = x1; x != x2; x += dx) - { - int dcnt, ecnt; - - dcnt = ecnt = 0; - - for (y = y1; y != y2; y += dy) - { - if (mask[y * w + x] == 1) - dcnt++; - else if (mask[y * w + x] == 2 || mask[y * w + x] == 3) - ecnt++; - } - - if (dcnt == 0 && ecnt == 0) - { // line is clear - prevclear++; - } - else if (dcnt == 0) - { - if (prevclear >= threshold) - { // it's not clear yet, but it will be in a moment ;) - int ly, lx = x; - - if (prevclear == threshold) - { // need to clean everything we just checked - lx = x - prevclear * dx; - } - - for (lx = lx; lx != x + dx; lx += dx) - for (ly = y1; ly != y2; ly += dy) - mask[ly * w + lx] = 0; - } - prevclear++; - } - else - { // line is dirty - prevclear = 0; - } - } -} - -struct _expand_corner -{ - int x, y; - int tx1, ty1; - int tx2, ty2; -} -const expand_corner [] = -{ - {0, 0, 1, 0, 0, 1}, // top-left - {1, 0, 0, 0, 0, 1}, // top-mid, from left - {1, 0, 2, 0, 2, 1}, // top-mid, from right - {2, 0, 1, 0, 2, 1}, // top-right - {0, 1, 0, 0, 1, 0}, // mid-left, from top - {0, 1, 0, 2, 1, 2}, // mid-left, from bottom - {2, 1, 1, 0, 2, 0}, // mid-right, from top - {2, 1, 1, 2, 2, 2}, // mid-right, from bottom - {0, 2, 1, 2, 0, 1}, // bot-left - {1, 2, 0, 1, 0, 2}, // bot-mid, from left - {1, 2, 2, 1, 2, 2}, // bot-mid, from right - {2, 2, 1, 2, 2, 1}, // bot-right - - {-1,-1, -1,-1, -1,-1} // term -}; - -// this will recursively expand the missing corner pixels -// recursion is limited so we dont overflow the stack -int -expand_rect (char* mask, int x, int y, int w, int h) -{ - static int level = 0; - int x1, y1, x2, y2, i, lx, ly; - const struct _expand_corner* pc; - signed char matrix[3][3]; - int cnt = 0; - - if (level > 99) - return 1; // make sure parent knows it failed - - level++; - - if (x > 0) - x1 = x - 1; - else - { - for (i = 0; i < 3; i++) - matrix[0][i] = -1; - - x1 = x; - } - - if (y > 0) - y1 = y - 1; - else - { - for (i = 0; i < 3; i++) - matrix[i][0] = -1; - - y1 = y; - } - - if (x + 1 < w) - x2 = x + 2; - else - { - for (i = 0; i < 3; i++) - matrix[2][i] = -1; - - x2 = x + 1; - } - - if (y + 1 < h) - y2 = y + 2; - else - { - for (i = 0; i < 3; i++) - matrix[i][2] = -1; - - y2 = y + 1; - } - - for (ly = y1; ly < y2; ly++) - for (lx = x1; lx < x2; lx++) - matrix[lx - x + 1][ly - y + 1] = mask[ly * w + lx]; - - // check corner pixels - for (pc = expand_corner; pc->x != -1; pc++) - { - if (matrix[pc->x][pc->y] == 0 && matrix[pc->tx1][pc->ty1] > 0 && matrix[pc->tx2][pc->ty2] > 0) - { // corner pixel missing - int ofs = (y - 1 + pc->y) * w + (x - 1 + pc->x); - - matrix[pc->x][pc->y] = 3; - - // but it may already be present in the mask (recursive) - if (mask[ofs] == 0) - { - mask[ofs] = 3; - cnt += 1 + expand_rect (mask, x - 1 + pc->x, y - 1 + pc->y, w, h); - } - } - } - - level--; - - return cnt; -} - -file_info* -file_info_add_image (file_info* fi) -{ - file_info* ni; - - ni = (file_info*) malloc (sizeof(file_info)); - if (!ni) - return 0; - - file_info_init (ni); - - while (fi->next) - fi = fi->next; - - return fi->next = ni; -} - -int -is_multi_delta_image (file_info* fi) -{ - return fi && fi->next; -} - -#define MASK_COLORS 4 -mng_palette8e mask_pal[MASK_COLORS] = -{ - {0x00, 0x00, 0x00}, - {0xff, 0xff, 0xff}, - {0x00, 0xff, 0x00}, - {0x00, 0x00, 0xff} -}; - -void -create_mask_png (char* mask, int w, int h) -{ - int ret = 0; - mng_handle mng; - file_info wf; - char fname[260]; - mng_ptr imgdata; - unsigned char* tempdata; - unsigned char* p; - uLong srcLen; - uLong dstLen; - int i; - - file_info_init (&wf); - sprintf(fname, "mask_%03d_%03d.png", _curframe, _curdeltaframe); - - wf.fname = fname; - wf.fmode = "wb"; - - // extra byte in front of each line for filter type - srcLen = w * h + h; - tempdata = (mng_ptr) malloc(srcLen); - if (!tempdata) - return; - - // maximum necessary space - // deflated data can be 100.1% + 12 bytes in worst case - dstLen = srcLen + srcLen / 100 + 20; // extra 8 for safety - imgdata = (mng_ptr) malloc(dstLen); - if (!imgdata) - return; - - for (i = 0, p = tempdata; i < w * h; i++, p++) - { - if (i % w == 0) - { // write filter byte - *p++ = 0; - } - - *p = mask[i]; - } - - if (Z_OK != compress2(imgdata, &dstLen, tempdata, srcLen, 9)) - return; - - free(tempdata); - - mng = mng_initialize (&wf, mng_alloc, mng_free, MNG_NULL); - if (mng == MNG_NULL) - return; - - // set the callbacks - mng_setcb_openstream(mng, mng_open_stream); - mng_setcb_closestream(mng, mng_close_stream); - mng_setcb_writedata(mng, mng_write_stream); - - ret = mng_create (mng); - - ret = mng_putchunk_ihdr (mng, w, h, - MNG_BITDEPTH_8, MNG_COLORTYPE_INDEXED, MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, MNG_INTERLACE_NONE); - - if (ret == MNG_NOERROR) - ret = mng_putchunk_plte (mng, 4, mask_pal); - if (ret == MNG_NOERROR) - ret = mng_putchunk_idat (mng, dstLen, imgdata); - if (ret == MNG_NOERROR) - ret = mng_putchunk_iend (mng); - - free (imgdata); - - if (ret == MNG_NOERROR) - ret = mng_write (mng); - - mng_cleanup (&mng); - - file_info_cleanup (&wf); -} - -int -build_delta (file_info* i1, file_info* i2) -{ - int w, h, x, y; - int dx1, dx2, dy1, dy2; - int cnt; - char* mask = 0; - - if (i1->w > i2->w) - { - w = i2->w; - dx1 = i2->x; - dx2 = 0; - } - else if (i1->w < i2->w) - { - w = i1->w; - dx1 = 0; - dx2 = i1->x; - } - else - { - w = i1->w; - dx1 = dx2 = 0; - } - - if (i1->h > i2->h) - { - h = i2->h; - dy1 = i2->y; - dy2 = 0; - } - else if (i1->h < i2->h) - { - h = i1->h; - dy1 = 0; - dy2 = i1->y; - } - else - { - h = i1->h; - dy1 = dy2 = 0; - } - - mask = (char*) malloc (w * h); - if (!mask) - return 220; - memset(mask, 0, w * h); - - // build diff mask first - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (i1->indimg[(y + dy1) * i1->w + x + dx1] != i2->indimg[(y + dy2) * i2->w + x + dx2]) - // diff pixel - mask[y * w + x] = 1; - } - } - - // coarse expand the diff pixels - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (mask[y * w + x] == 1) - { - int x1 = x - 2; - int x2 = x + 3; - int y1 = y - 2; - int y2 = y + 3; - int lx; - if (x1 < 0) - x1 = 0; - if (x2 > w) - x2 = w; - if (y1 < 0) - y1 = 0; - if (y2 > h) - y2 = h; - - for (y1 = y1; y1 < y2; y1++) - for (lx = x1; lx < x2; lx++) - if (mask[y1 * w + lx] == 0) - mask[y1 * w + lx] = 2; - } - } - } - - // scan and remove extra expansion horizontally and vertically - clean_expansion_vert (mask, w, 0, 0, w, h, 1); - clean_expansion_vert (mask, w, w, 0, 0, h, 1); - clean_expansion_horz (mask, w, 0, 0, w, h, 1); - clean_expansion_horz (mask, w, 0, h, w, 0, 1); - - - do // coarse expand the diff pixels - { // merge would-be diff rectangles in the process - cnt = 0; - - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (mask[y * w + x] != 0) - cnt += expand_rect (mask, x, y, w, h); - } - } - // repeat is something was expanded - } while (cnt != 0); - - // at this point we should have guaranteed non-overlapping - // rectangles that cover all of the delta areas - - if (opts.sectorsize) - { // final expansion cleanup - for (y = 0; y < h; y += opts.sectorsize) - { - for (x = 0; x < w; x += opts.sectorsize) - { - int x2, y2; - - cnt = 0; - for (y2 = y; y2 < y + opts.sectorsize && y2 < h; y2++) - for (x2 = x; x2 < x + opts.sectorsize && x2 < w; x2++) - if (mask[y2 * w + x2] == 1) - cnt++; - - if (cnt > 0) - continue; // dirty sector - - // clean up sector - for (y2 = y; y2 < y + opts.sectorsize && y2 < h; y2++) - for (x2 = x; x2 < x + opts.sectorsize && x2 < w; x2++) - mask[y2 * w + x2] = 0; - - } - } - } - - // check how muany pixels have to be replaced - for (x = 0, cnt = 0; x < w * h; x++) - if (mask[x]) - cnt++; - - if (opts.deltamask) - create_mask_png (mask, w, h); - - // generate delta images - if (cnt != w * h) - { - int ofs; - - for (y = 0, ofs = 0; y < h; y++) - { - for (x = 0; x < w; x++, ofs++) - { - if (mask[ofs] != 0) - { // copy masked rectangle into a new image - // and clear the mask - int i; - int rw, rh; - int x2, y2; - unsigned char* src; - unsigned char* dst; - file_info* ni; - - ni = file_info_add_image (i1); - if (!ni) - { - x = w; - y = h; - break; - } - - - // lookup delta rectangle - for (i = x, src = mask + ofs; i < w && *src != 0; i++, src++) - ; - ni->w = rw = i - x; - - if (opts.fullrects) - { // locate only complete rectangles - y2 = y + 1; - for (i = y + 1, src = mask + ofs; i < h && *src != 0; i++, src += w) - { - unsigned char* src2; - - y2 = i; - for (x2 = x, src2 = src; x2 < x + rw && *src2 != 0; x2++, src2++) - ; - - if (x2 < x + rw) - break; - } - } - else - { // any rectangles - for (y2 = y + 1, src = mask + ofs; y2 < h && *src != 0; y2++, src += w) - ; - } - - ni->h = rh = y2 - y; - - ni->indimg = (unsigned char*) malloc (rw * rh); - if (!ni->indimg) - { - x = w; - y = h; - break; - } - - // copy the pixels - for (i = 0, src = i1->indimg + (dy1 + y) * i1->w + dx1 + x, dst = ni->indimg; - i < rh; - i++, src += i1->w, dst += rw - ) - { - memcpy (dst, src, rw); - memset (mask + ofs + i * w, 0, rw); - } - - ni->x = i1->x + dx1 + x; - ni->y = i1->y + dy1 + y; - } - } - } - - if (i1->next) - { // dispose of the original - file_info* ni = i1->next; - free (i1->indimg); - i1->indimg = ni->indimg; - i1->x = ni->x; - i1->y = ni->y; - i1->w = ni->w; - i1->h = ni->h; - i1->next = ni->next; - - free (ni); - } - } - else - { // break here - cnt = 1; - } - - if (mask) - free (mask); - - return 0; -} - -void -delta_images (void) -{ - int i; - unsigned short nextid = 0x101; - - verbose ("calculating frame image deltas", 0); - - Infos[iback].objid = nextid++; - if (iback != 0) - { // set the first frame objid different - // from back id - Infos[0].objid = nextid++; - } - - // remove dupes - for (i = 1; i < cFiles; i++) - { - int i2; - - if (i == iback) - continue; - - Infos[i].objid = Infos[i - 1].objid; - - for (i2 = i - 1; i2 >= 0 && Infos[i].identical == -1; i2--) - { - int orgi2 = i2; - - // deference identical chain - while (Infos[i2].identical != -1) - i2 = Infos[i2].identical; - - if (equal_images (i, i2)) - { - Infos[i].identical = i2; - // dont need image data anymore - if (Infos[i].indimg) - { - free (Infos[i].indimg); - Infos[i].indimg = 0; - } - - if (orgi2 != i - 1) - { // detached descendant - // clone the object for it - if (Infos[i2].clone == -1) - { // no clones yet - Infos[i2].cloneid = nextid++; - Infos[i2].clone = i; - Infos[i].objid = Infos[i2].cloneid; - } - else - { // already cloned for another frame - // tell the frame to preclone it for - // this frame too - // dereference preclone chain first - for (i2 = Infos[i2].clone; Infos[i2].preclone != -1; i2 = Infos[i2].preclone) - ; - Infos[i2].preclone = i; - Infos[i2].precloneid = nextid++; - Infos[i].objid = Infos[i2].precloneid; - } - } - } - } - verbose (".", 0); - } - verbose ("|", 0); - - // compute deltas - for (i = cFiles - 1; i >= 0; i--) - { - int i2; - - if (i == iback || Infos[i].identical != -1) - // no delta needed - continue; - else - { - if (i == 0 && i != iback) - { // delta against original background - i2 = iback; - } - else - { // deref indentical chain - for (i2 = i - 1; i2 >= 0 && Infos[i2].identical != -1; i2 = Infos[i2].identical) - ; - - // sanity check - if (Infos[i2].objid != Infos[i].objid) - { - fprintf (stderr, "delta_images: logical error 1\n"); - exit(EXIT_FAILURE); - } - } - - // debug info - _curframe = i; - _curdeltaframe = i2; - - build_delta (Infos + i, Infos + i2); - } - verbose (".", 0); - } - - verbose ("\n", 0); -} - -int -get_png_image_data (file_info* ms, unsigned char* imgdata) -{ - int i; - - for (i = 0; i < ms->w * ms->h; i++, imgdata++) - { - if (i % ms->w == 0) - { // write filter byte - *imgdata++ = 0; - } - - *imgdata = ms->indimg[i]; - } - return 0; -} - -int -compress_png (file_info* ms, mng_ptr imgdata, mng_uint32 imglen, mng_uint32p bytes) -{ - int ret = 0; - unsigned char* tempdata; - uLong srcLen; - - *bytes = 0; - - // extra byte in front of each line for filter type - srcLen = ms->w * ms->h + ms->h; - tempdata = (mng_ptr) malloc(srcLen); - if (!tempdata) - return 241; - - ret = get_png_image_data (ms, tempdata); - if (!ret) - { - uLong dstLen = imglen; - - if (Z_OK == compress2(imgdata, &dstLen, tempdata, srcLen, 9)) - *bytes = dstLen; - else - ret = 253; - } - - free(tempdata); - - return ret; -} - -int -output_png (mng_handle mng, file_info* rf, int delta) -{ - int ret = 0; - mng_ptr imgdata; - mng_uint32 imglen; - mng_uint32 cbcomp; - unsigned short objid = rf->objid; - - // maximum necessary space - // deflated data can be 100.1% + 12 bytes in worst case - imglen = mngw * mngh + mngh; - imglen += imglen / 100 + 20; // extra 8 for safety - imgdata = (mng_ptr) malloc(imglen); - if (!imgdata) - return 252; - - do - { - if (delta) - { // output delta - ret = mng_putchunk_dhdr (mng, objid, - MNG_IMAGETYPE_PNG, MNG_DELTATYPE_BLOCKPIXELREPLACE, - rf->w, rf->h, rf->x, rf->y); - } - else - { // output image verbatim - ret = mng_putchunk_ihdr (mng, rf->w, rf->h, - MNG_BITDEPTH_8, MNG_COLORTYPE_INDEXED, MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, MNG_INTERLACE_NONE); - - if (ret == MNG_NOERROR) - { // write empty PLTE to use the global PLTE - ret = mng_putchunk_plte (mng, 0, Pal); - //ret = mng_putchunk_plte (mng, cPalClr, Pal); // enable to write plain PNG - } - } - - if (ret == MNG_NOERROR) - ret = compress_png (rf, imgdata, imglen, &cbcomp); - - if (ret == MNG_NOERROR) - ret = mng_putchunk_idat (mng, cbcomp, imgdata); - - if (ret == MNG_NOERROR) - ret = mng_putchunk_iend (mng); - - } while ((rf = rf->next) != 0 && ret == MNG_NOERROR); - - free (imgdata); - - return ret; -} - -int -write_mng_file (void) -{ - int ret = 0; - mng_handle mng; - file_info wf; - file_info rf; - file_info backf; - int i; - unsigned short lastobjid; - char curframemode, newframemode; - - mng = mng_initialize (MNG_NULL, mng_alloc, mng_free, MNG_NULL); - if (mng == MNG_NULL) - { - fprintf (stderr, "libmng did not init properly\n"); - return 250; - } - - // set the callbacks - mng_setcb_openstream(mng, mng_open_stream); - mng_setcb_closestream(mng, mng_close_stream); - mng_setcb_writedata(mng, mng_write_stream); - - file_info_init (&wf); - wf.fname = opts.outfile; - wf.fmode = "wb"; - mng_set_userdata (mng, &wf); - - ret = mng_create (mng); - if (ret != MNG_NOERROR) - fprintf (stderr, "Could not create '%s'\n", wf.fname); - else - verbose ("writing MNG file '%s'", wf.fname); - - ret = mng_putchunk_mhdr (mng, mngw, mngh, timerate, 0, 0, 0, - MNG_SIMPLICITY_VALID | MNG_SIMPLICITY_SIMPLEFEATURES | - MNG_SIMPLICITY_COMPLEXFEATURES | MNG_SIMPLICITY_DELTAPNG | 0x240); - - //ret = mng_putchunk_term (mng, MNG_TERMACTION_LASTFRAME, MNG_ITERACTION_LASTFRAME, 0, 0); - - ret = mng_putchunk_plte (mng, cPalClr, Pal); - - ret = mng_putchunk_back (mng, 0,0,0, 0, 0, MNG_BACKGROUNDIMAGE_NOTILE); - - curframemode = MNG_FRAMINGMODE_1; - ret = mng_putchunk_fram (mng, MNG_FALSE, curframemode, 0,MNG_NULL, - MNG_CHANGEDELAY_DEFAULT, MNG_CHANGETIMOUT_NO, MNG_CHANGECLIPPING_NO, MNG_CHANGESYNCID_NO, - framedelay, 0,0,0,0,0,0, MNG_NULL,0); - - // define the staring image/object - backf = Infos[iback]; - ret = mng_putchunk_defi (mng, backf.objid, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE, MNG_FALSE, 0,0, MNG_FALSE, 0,0,0,0); - ret = output_png (mng, &backf, 0); - - //ret = mng_putchunk_save (mng, MNG_TRUE, 0,0); - //ret = mng_putchunk_seek (mng, 5, "start"); - - if (iback != 0) - { // clone the starting object for the first frame - ret = mng_putchunk_clon (mng, backf.objid, Infos[0].objid, - MNG_FULL_CLONE, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE_ASPARENT, - MNG_FALSE, 0,0,0); - } - - lastobjid = 0; - - for (i = 0; i < cFiles && ret == MNG_NOERROR; i++) - { - rf = Infos[i]; - - if (rf.precloneid != 0) - { // pre-clone the object for another frame - ret = mng_putchunk_clon (mng, rf.objid, rf.precloneid, - MNG_FULL_CLONE, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE_ASPARENT, - MNG_FALSE, 0,0,0); - } - - if (is_multi_delta_image (&rf)) - // multi-delta png; frame mode: 0-delay for subframe - newframemode = MNG_FRAMINGMODE_2; - else - // frame mode: 1 image per frame - newframemode = MNG_FRAMINGMODE_1; - - - if (newframemode != curframemode) - { // change framing mode only - ret = mng_putchunk_fram (mng, MNG_FALSE, newframemode, 0,MNG_NULL, - MNG_CHANGEDELAY_NO, MNG_CHANGETIMOUT_NO, MNG_CHANGECLIPPING_NO, MNG_CHANGESYNCID_NO, - 0,0,0,0,0,0,0, MNG_NULL,0); - curframemode = newframemode; - } - else if (curframemode == MNG_FRAMINGMODE_2) - { // start new subframe - ret = mng_putchunk_fram (mng, MNG_TRUE, 0,0,MNG_NULL,0,0,0,0,0,0,0,0,0,0,0,0,0); - } - - if (rf.indimg != 0 && i != iback) - { // display a delta png - ret = output_png (mng, &rf, 1); - } - - if (rf.cloneid != 0) - { // post-clone the object for another frame - ret = mng_putchunk_clon (mng, rf.objid, rf.cloneid, - MNG_FULL_CLONE, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE_ASPARENT, - MNG_FALSE, 0,0,0); - } - - if (rf.objid != lastobjid || rf.identical != -1) - { // show the object for this frame - ret = mng_putchunk_show (mng, MNG_FALSE, rf.objid, rf.objid, MNG_SHOWMODE_0); - lastobjid = rf.objid; - } - - verbose (".", 0); - } - - //ret = mng_putchunk_seek (mng, 3, "end"); - ret = mng_putchunk_mend (mng); - - ret = mng_write (mng); - - file_info_cleanup (&wf); - - mng_cleanup (&mng); - - if (ret == MNG_NOERROR) - verbose ("finished.\n", 0); - else - fprintf (stderr, "Could not create MNG file\n"); - - return ret; -} - -mng_ptr MNG_DECL -mng_alloc (mng_size_t iLen) -{ - mng_ptr ptr; - - if (iLen & 0x80000000) - return 0; // MNG error! - - ptr = malloc (iLen); - if (ptr) - memset(ptr, 0, iLen); - - return ptr; -} - -void MNG_DECL -mng_free (mng_ptr pPtr, mng_size_t iLen) -{ - if (iLen) - free (pPtr); -} - -mng_bool MNG_DECL -mng_open_stream (mng_handle mng) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - ms->f = fopen (ms->fname, ms->fmode); - if (!ms->f) - { - fprintf(stderr, "unable to open '%s'\n", ms->fname); - return MNG_FALSE; - } - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_close_stream (mng_handle mng) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - fclose(ms->f); - ms->f = NULL; - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_read_stream (mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - *bytes = fread(buffer, 1, size, ms->f); - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_write_stream (mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - *bytes = fwrite(buffer, 1, size, ms->f); - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_process_header (mng_handle mng, mng_uint32 width, mng_uint32 height) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - ms->w = width; - ms->h = height; - ms->image = (RGBA*) malloc(sizeof(RGBA) * width * height); - if (!ms->image) - return MNG_FALSE; - - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - - return MNG_TRUE; -} - -mng_ptr MNG_DECL -mng_get_canvasline_read (mng_handle mng, mng_uint32 line) -{ - file_info* ms; - mng_ptr row; - - ms = (file_info*) mng_get_userdata (mng); - - row = ms->image + ms->w * line; - - return row; -} - -mng_ptr MNG_DECL -mng_get_canvasline_write (mng_handle mng, mng_uint32 line) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - //if (!ms->rowdata) - // ms->rowdata = (unsigned char*) malloc (ms->w); - //if (!ms->rowdata) - // return MNG_NULL; - - //make_pal_row (ms, line, ms->rowdata); - - // satisfying compiler - line = 0; - - return MNG_NULL; -} - -mng_bool MNG_DECL -mng_refresh_display (mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h) -{ - // not implemented - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - // satisfying compiler - x = y = w = h = 0; - - return MNG_TRUE; -} - -mng_uint32 MNG_DECL -mng_get_tickcount (mng_handle mng) -{ - // not implemented - file_info* ms; - static int tick = 0; - - ms = (file_info*) mng_get_userdata (mng); - - return tick += 50; -} - -mng_bool MNG_DECL -mng_set_timer (mng_handle mng, mng_uint32 msecs) -{ - // not implemented - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - ms->delay = msecs; - - return MNG_TRUE; -} diff --git a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsp b/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsp deleted file mode 100644 index c5b5aca22..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsp +++ /dev/null @@ -1,114 +0,0 @@ -# Microsoft Developer Studio Project File - Name="makemng" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=makemng - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "makemng.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "makemng.mak" CFG="makemng - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "makemng - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "makemng - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=xicl6.exe -RSC=rc.exe - -!IF "$(CFG)" == "makemng - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "NDEBUG" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /D "ZLIB_DLL" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /machine:I386 /libpath:"." - -!ELSEIF "$(CFG)" == "makemng - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "_DEBUG" /D "ZLIB_DLL" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"." - -!ENDIF - -# Begin Target - -# Name "makemng - Win32 Release" -# Name "makemng - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\filelist.c -# End Source File -# Begin Source File - -SOURCE=..\..\src\getopt\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\makemng.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\getopt.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsw b/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsw deleted file mode 100644 index ab12fac01..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "makemng"=.\makemng.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/COPYING-LCMS b/Engine/lib/lmng/contrib/msvc/mngplg/COPYING-LCMS deleted file mode 100644 index e98f0e17b..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/COPYING-LCMS +++ /dev/null @@ -1,515 +0,0 @@ - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ie.cur b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ie.cur deleted file mode 100644 index 159ad4e86..000000000 Binary files a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ie.cur and /dev/null differ diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ns.cur b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ns.cur deleted file mode 100644 index 196bb25c1..000000000 Binary files a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ns.cur and /dev/null differ diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/license.txt b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/license.txt deleted file mode 100644 index 6756e5e7e..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/license.txt +++ /dev/null @@ -1,40 +0,0 @@ -MNGPLG -A simple browser plug-in for the MNG image/animation file format. - -By Jason Summers -Web site: - - -COPYRIGHT NOTICE - -Copyright (c) 2000-2002 by Jason Summers - -THIS SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT -ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE -THIS SOFTWARE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING -ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THIS SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THIS SOFTWARE TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this source code must not be misrepresented; - you must not claim that you wrote the original software. - 2. Altered source versions must be plainly marked as such, and must not - be misrepresented as being the original source. - 3. Altered binary versions must not be misrepresented as being the - original. - 4. This Copyright notice may not be removed or altered from any source - or altered source distribution, although you may add a Copyright - notice for yourself for any code that you have written. diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npapidefs.h b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npapidefs.h deleted file mode 100644 index 3d6f82132..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npapidefs.h +++ /dev/null @@ -1,245 +0,0 @@ -// npapidefs.h -// minimal version of the defs from the NS plugin SDK - -#ifndef NPAPIDEFS_H -#define NPAPIDEFS_H - -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 11 - -#define NPVERS_HAS_STREAMOUTPUT 8 -#define NPVERS_HAS_NOTIFICATION 9 -#define NPVERS_HAS_LIVECONNECT 9 -#define NPVERS_HAS_WINDOWLESS 11 - -#define NPERR_NO_ERROR 0 -#define NPERR_GENERIC_ERROR 1 -#define NPERR_INVALID_INSTANCE_ERROR 2 -#define NPERR_INVALID_FUNCTABLE_ERROR 3 -#define NPERR_MODULE_LOAD_FAILED_ERROR 4 -#define NPERR_OUT_OF_MEMORY_ERROR 5 -#define NPERR_INVALID_PLUGIN_ERROR 6 -#define NPERR_INVALID_PLUGIN_DIR_ERROR 7 -#define NPERR_INCOMPATIBLE_VERSION_ERROR 8 -#define NPERR_INVALID_PARAM 9 -#define NPERR_INVALID_URL 10 -#define NPERR_FILE_NOT_FOUND 11 -#define NPERR_NO_DATA 12 -#define NPERR_STREAM_NOT_SEEKABLE 13 - -#define NP_EMBED 1 -#define NP_FULL 2 - -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 -#define NP_ASFILEONLY 4 - -#define NPRES_DONE 0 -#define NPRES_NETWORK_ERR 1 -#define NPRES_USER_BREAK 2 - -typedef unsigned short uint16; -typedef unsigned long uint32; -typedef short int16; -typedef long int32; - -typedef unsigned char NPBool; -typedef int16 NPError; -typedef int16 NPReason; -typedef char* NPMIMEType; -typedef HRGN NPRegion; - -typedef void* JRIGlobalRef; -struct JRIEnvInterface; -typedef struct JRIEnvInterface JRIEnvInterface; -typedef const JRIEnvInterface* JRIEnv; -struct _jobject; -typedef struct _jobject *jobject; -typedef jobject jref; - -typedef struct _NPRect -{ - uint16 top; - uint16 left; - uint16 bottom; - uint16 right; -} NPRect; - -typedef struct _NPP -{ - void* pdata; - void* ndata; -} NPP_t; - -typedef NPP_t* NPP; - -typedef struct _NPStream -{ - void* pdata; - void* ndata; - const char* url; - uint32 end; - uint32 lastmodified; - void* notifyData; -} NPStream; - -typedef enum { - NPPVpluginNameString = 1, - NPPVpluginDescriptionString, - NPPVpluginWindowBool, - NPPVpluginTransparentBool -} NPPVariable; - -typedef enum { - NPNVxDisplay = 1, - NPNVxtAppContext, - NPNVnetscapeWindow, - NPNVjavascriptEnabledBool, - NPNVasdEnabledBool, - NPNVisOfflineBool -} NPNVariable; - -typedef enum { - NPWindowTypeWindow = 1, - NPWindowTypeDrawable -} NPWindowType; - -typedef struct _NPSavedData -{ - int32 len; - void* buf; -} NPSavedData; - -typedef struct _NPByteRange -{ - int32 offset; - uint32 length; - struct _NPByteRange* next; -} NPByteRange; - -typedef struct _NPFullPrint -{ - NPBool pluginPrinted; - NPBool printOne; - void* platformPrint; -} NPFullPrint; - -typedef struct _NPWindow -{ - void* window; - int32 x; - int32 y; - uint32 width; - uint32 height; - NPRect clipRect; - NPWindowType type; -} NPWindow; - -typedef struct _NPEmbedPrint -{ - NPWindow window; - void* platformPrint; -} NPEmbedPrint; - -typedef struct _NPPrint -{ - uint16 mode; - union - { - NPFullPrint fullPrint; - NPEmbedPrint embedPrint; - } print; -} NPPrint; - -typedef struct _NPEvent -{ - uint16 event; - uint32 wParam; - uint32 lParam; -} NPEvent; - - -typedef NPError (*NPP_NewUPP)(NPMIMEType,NPP,uint16,int16,char* argn[],char* argv[],NPSavedData*); -typedef NPError (*NPP_DestroyUPP)(NPP instance, NPSavedData** save); -typedef NPError (*NPP_SetWindowUPP)(NPP,NPWindow*); -typedef NPError (*NPP_NewStreamUPP)(NPP,NPMIMEType,NPStream*,NPBool,uint16*); -typedef NPError (*NPP_DestroyStreamUPP)(NPP,NPStream*,NPReason); -typedef int32 (*NPP_WriteReadyUPP)(NPP instance,NPStream*); -typedef int32 (*NPP_WriteUPP)(NPP,NPStream*,int32,int32,void*); -typedef void (*NPP_StreamAsFileUPP)(NPP,NPStream*,const char*); -typedef void (*NPP_PrintUPP)(NPP,NPPrint*); -typedef int16 (*NPP_HandleEventUPP)(NPP,void*); -typedef void (*NPP_URLNotifyUPP)(NPP,const char*,NPReason,void*); -typedef NPError (*NPP_GetValueUPP)(NPP,NPPVariable,void*); -typedef NPError (*NPP_SetValueUPP)(NPP,NPNVariable,void*); -typedef NPError (*NPN_GetValueUPP)(NPP,NPNVariable,void*); -typedef NPError (*NPN_SetValueUPP)(NPP,NPPVariable,void*); -typedef NPError (*NPN_GetURLNotifyUPP)(NPP,const char*,const char*,void*); -typedef NPError (*NPN_PostURLNotifyUPP)(NPP,const char*,const char*,uint32,const char*,NPBool,void*); -typedef NPError (*NPN_GetURLUPP)(NPP,const char*,const char*); -typedef NPError (*NPN_PostURLUPP)(NPP,const char*,const char*,uint32,const char*,NPBool); -typedef NPError (*NPN_RequestReadUPP)(NPStream*,NPByteRange*); -typedef NPError (*NPN_NewStreamUPP)(NPP,NPMIMEType,const char*,NPStream**); -typedef int32 (*NPN_WriteUPP)(NPP,NPStream*,int32,void*); -typedef NPError (*NPN_DestroyStreamUPP)(NPP,NPStream*,NPReason); -typedef void (*NPN_StatusUPP)(NPP instance, const char*); -typedef const char* (*NPN_UserAgentUPP)(NPP); -typedef void* (*NPN_MemAllocUPP)(uint32); -typedef void (*NPN_MemFreeUPP)(void*); -typedef uint32 (*NPN_MemFlushUPP)(uint32); -typedef void (*NPN_ReloadPluginsUPP)(NPBool); -typedef JRIEnv* (*NPN_GetJavaEnvUPP)(void); -typedef jref (*NPN_GetJavaPeerUPP)(NPP); -typedef void (*NPN_InvalidateRectUPP)(NPP,NPRect*); -typedef void (*NPN_InvalidateRegionUPP)(NPP,NPRegion); -typedef void (*NPN_ForceRedrawUPP)(NPP); - - -typedef struct _NPPluginFuncs { - uint16 size; - uint16 version; - NPP_NewUPP newp; - NPP_DestroyUPP destroy; - NPP_SetWindowUPP setwindow; - NPP_NewStreamUPP newstream; - NPP_DestroyStreamUPP destroystream; - NPP_StreamAsFileUPP asfile; - NPP_WriteReadyUPP writeready; - NPP_WriteUPP write; - NPP_PrintUPP print; - NPP_HandleEventUPP event; - NPP_URLNotifyUPP urlnotify; - JRIGlobalRef javaClass; - NPP_GetValueUPP getvalue; - NPP_SetValueUPP setvalue; -} NPPluginFuncs; - -typedef struct _NPNetscapeFuncs { - uint16 size; - uint16 version; - NPN_GetURLUPP geturl; - NPN_PostURLUPP posturl; - NPN_RequestReadUPP requestread; - NPN_NewStreamUPP newstream; - NPN_WriteUPP write; - NPN_DestroyStreamUPP destroystream; - NPN_StatusUPP status; - NPN_UserAgentUPP uagent; - NPN_MemAllocUPP memalloc; - NPN_MemFreeUPP memfree; - NPN_MemFlushUPP memflush; - NPN_ReloadPluginsUPP reloadplugins; - NPN_GetJavaEnvUPP getJavaEnv; - NPN_GetJavaPeerUPP getJavaPeer; - NPN_GetURLNotifyUPP geturlnotify; - NPN_PostURLNotifyUPP posturlnotify; - NPN_GetValueUPP getvalue; - NPN_SetValueUPP setvalue; - NPN_InvalidateRectUPP invalidaterect; - NPN_InvalidateRegionUPP invalidateregion; - NPN_ForceRedrawUPP forceredraw; -} NPNetscapeFuncs; - - -#endif // NPAPIDEFS_H diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.c b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.c deleted file mode 100644 index 91719bdf3..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.c +++ /dev/null @@ -1,1936 +0,0 @@ -/* -*- Mode: C; tab-width: 4; -*- */ -/* npmngplg.c - * MNG browser plugin - * By Jason Summers - * Based on libmng by Gerard Juyn - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "resource.h" -#include "libmng.h" -#include "jversion.h" // part of libjpeg -#include "zlib.h" // for zlibVersion -#include "npapidefs.h" - -#define MNGPLG_CMS -//#define MNGPLG_TRACE - -#define IDBASE 47000 -#define ID_SAVEAS (IDBASE+0) -#define ID_COPYIMAGE (IDBASE+1) -#define ID_COPYURL (IDBASE+2) -#define ID_VIEWIMAGE (IDBASE+3) -#define ID_ABOUT (IDBASE+4) -#define ID_FREEZE (IDBASE+5) -#define ID_RESTARTANIM (IDBASE+6) -#define ID_COPYLINKLOC (IDBASE+7) -#define ID_STOPANIM (IDBASE+8) -#define ID_SHOWERROR (IDBASE+9) -#define ID_PROPERTIES (IDBASE+10) - -#define MNGPLGVERS "1.0.1" - -/* instance-specific data */ -typedef struct pluginstruct_ -{ - NPWindow* fWindow; - uint16 fMode; - HWND fhWnd; - WNDPROC fDefaultWindowProc; - NPP instance; - - mng_handle mng; - -#define STATE_INIT 0 -#define STATE_LOADING 1 // stream opened -#define STATE_VALIDFRAME 2 // at least one frame has been displayed -#define STATE_LOADED 3 // image loaded; stream closed - - -#define MAXLEN_TEXT 5000 - -#define MAXLEN_URL 300 -#define MAXLEN_TARGET 100 - - // I think I'm not doing this very well. Probably there really needs to be - // two state variables, one for loading from the network, and one for - // the libmng processing. (or use libmng's new getstate API?) - int loadstate; - - int paintedyet; - - int scrolling; // allow scrolling of the image? - int xscrollpos, yscrollpos; - int windowwidth, windowheight; // client size of current window - - int diblinesize; - DWORD dibsize; - DWORD filesize; - DWORD libmngpos; // count of bytes that have been sent to libmng - DWORD byteswanted; // libmng asked for this many more bytes (add to libmngpos) - - unsigned char *mngdata; // stores the MNG file in memory - DWORD bytesloaded; // - DWORD bytesalloc; // size of mngdata - int needresume; // if previous mng_readdisplay call returned NEEDMOREDATA - - char *textdata; - - int errorflag; // set if an error occurs that prevents displaying the image - char errormsg[256]; - - unsigned char *lpdib; // pointer to header section of dib - unsigned char *lpdibbits; // pointer to "bits" section of dib (follows the header) - LPBITMAPINFOHEADER lpdibinfo; // alias for lpdib - int frozen; - int timer_set; - int timer2_set; - int dynamicmng; - int mouse_over_mng; - int mouse_captured; - - int force_bgcolor; - mng_uint16 bg_r,bg_g,bg_b; // background color - - unsigned char url[MAX_PATH]; // the url of the stream - - int islink; - HCURSOR linkcursor; - HBRUSH bkgdbrush; - unsigned char linkurl[MAXLEN_URL]; - unsigned char linktarget[MAXLEN_TARGET]; - -} PluginInstance; - - -/* global variables */ - -#ifdef MNGPLG_TRACE -static FILE *tracefile; -#endif - -static const char* gInstanceLookupString = "pdata"; -static HMODULE g_hInst = NULL; -static HCURSOR hcurHandNS; -static HFONT hfontMsg; - -/* function prototypes */ -LRESULT CALLBACK DlgProcAbout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK DlgProcProp(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK PluginWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); - -void set_scrollbars(PluginInstance *This); - - -//////////////////////////// NPN_functions - -static NPNetscapeFuncs* g_pNavigatorFuncs; -static NPPluginFuncs* g_pluginFuncs; - -static const char* NPN_UserAgent(NPP instance) -{ - return g_pNavigatorFuncs->uagent(instance); -} - -static NPError NPN_GetURL(NPP instance, const char *url, const char *target) -{ - return g_pNavigatorFuncs->geturl(instance, url, target); -} - - - -/* ----------------------------------------------------------------------- */ - -BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved) -{ - switch(reason) { - case DLL_PROCESS_ATTACH: - g_hInst=hModule; - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -/* ----------------------------------------------------------------------- */ - -static void warn(PluginInstance *This, char *fmt, ...) -{ - va_list ap; - char buf[2048]; - HWND hwnd; - - va_start(ap, fmt); - wvsprintf(buf,fmt, ap); - va_end(ap); - - if(This) hwnd= This->fhWnd; - else hwnd=NULL; - - MessageBox(hwnd,buf,"MNG Plug-in",MB_OK|MB_ICONWARNING); -} - - -static void set_error(PluginInstance *This, char *fmt, ...) -{ - va_list ap; - char buf[2048]; - HWND hwnd; - - va_start(ap, fmt); - wvsprintf(buf,fmt, ap); - va_end(ap); - - if(This) hwnd= This->fhWnd; - else hwnd=NULL; - - This->errorflag=1; - lstrcpyn(This->errormsg,buf,256); - - if(This->lpdib) { - free(This->lpdib); - This->lpdib=NULL; - } - This->xscrollpos = This->yscrollpos = 0; - - if(This->fhWnd) - InvalidateRect(This->fhWnd,NULL,TRUE); -} - -/* ----------------------------------------------------------------------- */ -// MNG callbacks -#define MNGPLG_CALLBACK MNG_DECL - -static mng_ptr MNGPLG_CALLBACK memallocfunc(mng_size_t n) -{ - return (mng_ptr) calloc(n,1); -} - - -static void MNGPLG_CALLBACK memfreefunc(mng_ptr p, mng_size_t n) -{ - free((void*)p); -} - - -static mng_bool MNGPLG_CALLBACK callback_openstream (mng_handle mng) -{ -// PluginInstance *This; -// This = (PluginInstance*) mng_get_userdata(mng); - return MNG_TRUE; -} - -static mng_bool MNGPLG_CALLBACK callback_closestream (mng_handle mng) -{ - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - This->loadstate = STATE_LOADED; // this is probably redundant - - return MNG_TRUE; -} - - -static mng_bool MNGPLG_CALLBACK callback_readdata (mng_handle mng,mng_ptr pBuf, - mng_uint32 Buflen,mng_uint32 *pRead) -{ - int n; - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"readdata callback buflen=%d loadstate=%d bytesloaded=%d libmngpos=%d\n", - Buflen,This->loadstate,This->bytesloaded, This->libmngpos); -#endif - - - // do we have enough data available? - if(This->bytesloaded - This->libmngpos >= Buflen) { - CopyMemory(pBuf,&This->mngdata[This->libmngpos],Buflen); - (*pRead)= Buflen; - This->libmngpos += Buflen; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returning full: %d\n",Buflen); -#endif - This->byteswanted=0; - return MNG_TRUE; - } - else if(This->loadstate>=STATE_LOADED) { - // We don't have the data it asked for, but we're at the end - // of file, so send it anyway...? - - n=This->bytesloaded-This->libmngpos; - - if(n>0) { - CopyMemory(pBuf,&This->mngdata[This->libmngpos],n); - This->libmngpos+=n; - } - (*pRead)=n; - // so what do we return? -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returning partial: %d\n",n); -#endif - This->byteswanted=0; - return MNG_TRUE; - } - - // else we don't yet have the data it's requesting -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returning 0\n"); -#endif - (*pRead)=0; - This->byteswanted=Buflen; - return MNG_TRUE; -} - - -static mng_bool MNGPLG_CALLBACK callback_processheader(mng_handle mng,mng_uint32 iWidth,mng_uint32 iHeight) -{ - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - - This->diblinesize = (((iWidth * 24)+31)/32)*4; - This->dibsize = sizeof(BITMAPINFOHEADER) + This->diblinesize*iHeight; - This->lpdib = calloc(This->dibsize,1); - This->lpdibinfo = (LPBITMAPINFOHEADER)This->lpdib; - This->lpdibbits = &This->lpdib[sizeof(BITMAPINFOHEADER)]; - ZeroMemory((void*)This->lpdib,sizeof(BITMAPINFOHEADER)); - This->lpdibinfo->biSize = sizeof(BITMAPINFOHEADER); - This->lpdibinfo->biWidth = iWidth; - This->lpdibinfo->biHeight = iHeight; - This->lpdibinfo->biPlanes = 1; - This->lpdibinfo->biBitCount = 24; - - mng_set_canvasstyle (mng, MNG_CANVAS_BGR8); - -/* if(This->fhWnd) { - if((int)iWidth > This->windowwidth || (int)iHeight > This->windowheight) { - This->scrolling=1; - } - } */ - - set_scrollbars(This); - return MNG_TRUE; -} - - -static mng_ptr MNGPLG_CALLBACK callback_getcanvasline (mng_handle mng, mng_uint32 iLinenr) -{ - unsigned char *pp; - - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - pp = (&This->lpdibbits[(This->lpdibinfo->biHeight-1-iLinenr)*This->diblinesize]); - return (mng_ptr) pp; -} - -static mng_bool MNGPLG_CALLBACK callback_refresh (mng_handle mng, mng_uint32 iLeft, mng_uint32 iTop, - mng_uint32 iRight, mng_uint32 iBottom) -{ - PluginInstance *This; - RECT rect; - - This = (PluginInstance*) mng_get_userdata(mng); - - if(This->loadstateloadstate=STATE_VALIDFRAME; - } - - if(This->fhWnd) { - if(This->paintedyet) { - rect.left= iLeft - This->xscrollpos; - rect.top= iTop - This->yscrollpos; - rect.right= iLeft+iRight; - rect.bottom= iTop+iBottom; - - InvalidateRect(This->fhWnd,&rect,FALSE); - } - else { - // Make sure the first paint clears the whole plugin window - InvalidateRect(This->fhWnd,NULL,TRUE); - This->paintedyet=1; - } - UpdateWindow(This->fhWnd); - } - return MNG_TRUE; -} - -static mng_uint32 MNGPLG_CALLBACK callback_gettickcount (mng_handle mng) -{ - return GetTickCount(); -} - - -static mng_bool MNGPLG_CALLBACK callback_settimer (mng_handle mng,mng_uint32 iMsecs) -{ - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - - if(This->fhWnd) { - if(!SetTimer(This->fhWnd,1,(UINT)iMsecs,NULL)) { - warn(This,"Unable to create a timer for animation"); - This->frozen=1; - //return MNG_FALSE; - return MNG_TRUE; - } - This->timer_set=1; - } - return MNG_TRUE; -} - -static mng_bool MNGPLG_CALLBACK callback_processtext(mng_handle mng, - mng_uint8 iType, mng_pchar zKeyword, mng_pchar zText, - mng_pchar zLanguage, mng_pchar zTranslation) -{ - PluginInstance *This; - int pos,i; - - This = (PluginInstance*) mng_get_userdata(mng); - - if(!This->textdata) { - This->textdata=(char*)malloc(MAXLEN_TEXT+10); - if(!This->textdata) return MNG_TRUE; - lstrcpy(This->textdata,""); - } - - pos=lstrlen(This->textdata); - if(pos>=(MAXLEN_TEXT-10)) return MNG_TRUE; - - if(pos>0) { /* separate items with a blank line */ - This->textdata[pos++]='\r'; - This->textdata[pos++]='\n'; - This->textdata[pos++]='\r'; - This->textdata[pos++]='\n'; - } - - for(i=0;zKeyword[i];i++) { - if(postextdata[pos++]=zKeyword[i]; - } - This->textdata[pos++]=':'; - This->textdata[pos++]=' '; - - for(i=0;zText[i];i++) { - if(postextdata[pos++]='\r'; - } - This->textdata[pos++]=zText[i]; - } - } - This->textdata[pos++]='\0'; - - return MNG_TRUE; -} - -#ifdef MNGPLG_TRACE -static mng_bool MNGPLG_CALLBACK callback_traceproc (mng_handle mng, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname) -{ - if(tracefile) { - fprintf(tracefile,"%d\t%d\t%d\t%s\n",(int)mng,iFuncnr,iFuncseq,zFuncname); - } - return MNG_TRUE; -} -#endif - -/* ----------------------------------------------------------------------- */ -static int file_exists(const char *fn) -{ - HANDLE h; - - // try to open with no access - h=CreateFile(fn,0,FILE_SHARE_READ,NULL,OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL,NULL); - if(h == INVALID_HANDLE_VALUE) { return 0; } - CloseHandle(h); - return 1; -} - -static void handle_read_error(PluginInstance *This, mng_retcode rv) -{ - mng_int8 iSeverity; - mng_chunkid iChunkname; - mng_uint32 iChunkseq; - mng_int32 iExtra1; - mng_int32 iExtra2; - mng_pchar zErrortext; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returned: %d\n",rv); -#endif - - switch(rv) { - case MNG_NOERROR: case MNG_NEEDTIMERWAIT: - break; - - case MNG_NEEDMOREDATA: - if(This->loadstate>=STATE_LOADED) { - set_error(This,"Unexpected end of file"); - } - else { - This->needresume=1; - } - break; - - case MNG_INVALIDSIG: - set_error(This,"Invalid or missing MNG file (maybe a 404 Not Found error)"); - break; - - default: - - mng_getlasterror(This->mng, &iSeverity,&iChunkname,&iChunkseq,&iExtra1, - &iExtra2,&zErrortext); - - if(zErrortext) { - set_error(This,"Error reported by libmng (%d)\r\n\r\n%s",(int)rv,zErrortext); - } - else { - set_error(This,"Error %d reported by libmng",(int)rv); - } - } -} - -#ifdef MNGPLG_CMS - -static int init_color_management(PluginInstance *This) -{ - mng_set_outputsrgb(This->mng); - return 1; -} - -#endif - -// return 1 if okay -static int my_init_mng(PluginInstance *This) -{ - mng_retcode rv; - int err; - - This->mng = mng_initialize((mng_ptr)This,memallocfunc,memfreefunc,NULL); - //(mng_memalloc) (mng_memfree) - -#ifdef MNGPLG_CMS - init_color_management(This); -#endif - - err=0; - rv=mng_setcb_openstream (This->mng, callback_openstream ); if(rv) err++; - rv=mng_setcb_closestream (This->mng, callback_closestream ); if(rv) err++; - rv=mng_setcb_readdata (This->mng, callback_readdata ); if(rv) err++; - rv=mng_setcb_processheader (This->mng, callback_processheader); if(rv) err++; - rv=mng_setcb_getcanvasline (This->mng, callback_getcanvasline); if(rv) err++; - rv=mng_setcb_refresh (This->mng, callback_refresh ); if(rv) err++; - rv=mng_setcb_gettickcount (This->mng, callback_gettickcount ); if(rv) err++; - rv=mng_setcb_settimer (This->mng, callback_settimer ); if(rv) err++; - rv=mng_setcb_processtext (This->mng, callback_processtext ); if(rv) err++; - -#ifdef MNGPLG_TRACE - rv=mng_setcb_traceproc (This->mng, callback_traceproc ); if(rv) err++; -#endif - if(err) { - warn(This,"Error setting libmng callback functions"); - return 0; - } - - rv= mng_set_suspensionmode (This->mng,MNG_TRUE); - if(rv) { - warn(This,"Error setting suspension mode"); - return 0; - } - - // if the web page author provided a bgcolor, use it - if(This->force_bgcolor) { - rv=mng_set_bgcolor (This->mng, This->bg_r, This->bg_g, This->bg_b); - } - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"initial readdisplay\n"); -#endif - - handle_read_error(This, mng_readdisplay(This->mng) ); - return 1; -} - -/* Global initialization */ -static NPError NPP_Initialize(void) -{ - if(!g_hInst) { - warn(NULL,"MNG plugin error: Cannot load resources"); - } - -#ifdef MNGPLG_TRACE - tracefile=fopen("c:\\temp\\mngtrace.txt","w"); -#endif - -#ifndef IDC_HAND -#define IDC_HAND MAKEINTRESOURCE(32649) -#endif - hcurHandNS = LoadCursor(NULL,IDC_HAND); - if(!hcurHandNS) { - hcurHandNS=LoadCursor(g_hInst,"CURHAND_NS"); - } - - hfontMsg=CreateFont(-12,0,0,0,FW_DONTCARE,TRUE,0,0,ANSI_CHARSET, - OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DRAFT_QUALITY, - VARIABLE_PITCH|FF_SWISS,"Arial"); - return NPERR_NO_ERROR; -} - -/* Global shutdown */ -static void NPP_Shutdown(void) -{ -#ifdef MNGPLG_TRACE - if(tracefile) { - fclose(tracefile); - tracefile=NULL; - } -#endif - if(hfontMsg) DeleteObject((HGDIOBJ)hfontMsg); - return; -} - - -static unsigned char gethex(const char *s) -{ - int v[2]; - int i; - - v[0]=v[1]=0; - for(i=0;i<2;i++) { - if(s[i]>='a' && s[i]<='f') v[i]=s[i]-87; - if(s[i]>='A' && s[i]<='F') v[i]=s[i]-55; - if(s[i]>='0' && s[i]<='9') v[i]=s[i]-48; - } - return (unsigned char)(v[0]*16+v[1]); -} - -static void hexcolor2rgb(const char *s, mng_uint16 *r, mng_uint16 *g, mng_uint16 *b) -{ - if(lstrlen(s)!=7) return; - if(s[0]!='#') return; - (*r)= gethex(&s[1]); (*r)= ((*r)<<8)|(*r); - (*g)= gethex(&s[3]); (*g)= ((*g)<<8)|(*g); - (*b)= gethex(&s[5]); (*b)= ((*b)<<8)|(*b); -} - -static void find_window_size(PluginInstance *This) -{ - RECT r; - if(This->scrolling) { // make sure scrollbars exist if needed - ShowScrollBar(This->fhWnd,SB_BOTH,TRUE); - } - GetClientRect(This->fhWnd, &r); - This->windowwidth=r.right; - This->windowheight=r.bottom; -} - -static void set_scrollbars(PluginInstance *This) -{ - SCROLLINFO si; - int maxpos; - - if(!This->scrolling) return; - if(!This->fhWnd) return; - - ZeroMemory(&si,sizeof(SCROLLINFO)); - si.cbSize = sizeof(SCROLLINFO); - - // horizontal - if(This->lpdib) { - maxpos=This->lpdibinfo->biWidth-This->windowwidth; - if(maxpos<0) maxpos=0; - if(This->xscrollpos>maxpos) This->xscrollpos=maxpos; - if(This->xscrollpos<0) This->xscrollpos=0; - - si.fMask = SIF_ALL|SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = This->lpdibinfo->biWidth -1; - si.nPage = This->windowwidth; - si.nPos = This->xscrollpos; - } - else { // no image to display - si.fMask = SIF_ALL|SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = 0; - si.nPage = 1; - si.nPos = 0; - } - SetScrollInfo(This->fhWnd,SB_HORZ,&si,TRUE); - - // vertical - if(This->lpdib) { - maxpos=This->lpdibinfo->biHeight-This->windowheight; - if(maxpos<0) maxpos=0; - if(This->yscrollpos>maxpos) This->yscrollpos=maxpos; - if(This->yscrollpos<0) This->yscrollpos=0; - - si.fMask = SIF_ALL|SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = This->lpdibinfo->biHeight -1; - si.nPage = This->windowheight; - si.nPos = This->yscrollpos; - } - SetScrollInfo(This->fhWnd,SB_VERT,&si,TRUE); -} - - -#define SCROLLLINE 40 - -static void scrollmsg(PluginInstance *This, UINT msg,int code, short int pos) -{ - int page; - int dx, dy; // amount of scrolling - int x_orig, y_orig; - - if(!This->scrolling) return; - if(!This->lpdib) return; - - x_orig=This->xscrollpos; - y_orig=This->yscrollpos; - - if(msg==WM_HSCROLL) { - page=This->windowwidth-15; - if(pagexscrollpos-=SCROLLLINE; break; - case SB_LINERIGHT: This->xscrollpos+=SCROLLLINE; break; - case SB_PAGELEFT: This->xscrollpos-=page; break; - case SB_PAGERIGHT: This->xscrollpos+=page; break; - case SB_LEFT: This->xscrollpos=0; break; - case SB_RIGHT: This->xscrollpos=This->lpdibinfo->biWidth; break; - case SB_THUMBTRACK: This->xscrollpos=pos; break; - default: return; - } - set_scrollbars(This); - } - else if(msg==WM_VSCROLL) { - page=This->windowheight-15; - if(pageyscrollpos-=SCROLLLINE; break; - case SB_LINEDOWN: This->yscrollpos+=SCROLLLINE; break; - case SB_PAGEUP: This->yscrollpos-=page; break; - case SB_PAGEDOWN: This->yscrollpos+=page; break; - case SB_TOP: This->yscrollpos=0; break; - case SB_BOTTOM: This->yscrollpos=This->lpdibinfo->biHeight; break; - case SB_THUMBTRACK: This->yscrollpos=pos; break; - default: return; - } - set_scrollbars(This); - } - - dx= x_orig - This->xscrollpos; - dy= y_orig - This->yscrollpos; - - if(dx || dy) { // if any change - // GetClientRect(This->fhWnd,&cliprect); - ScrollWindowEx(This->fhWnd,dx,dy,NULL,NULL /*&cliprect*/,NULL,NULL,SW_INVALIDATE); - } -} - -/* Once-per-instance initialization */ -static NPError NPP_New(NPMIMEType pluginType,NPP instance,uint16 mode, - int16 argc,char* argn[],char* argv[],NPSavedData* saved) -{ - PluginInstance* This; - int i; - - if (instance == NULL) { - return NPERR_INVALID_INSTANCE_ERROR; - } - instance->pdata = calloc(sizeof(PluginInstance),1); - - - This = (PluginInstance*) instance->pdata; - if (This == NULL) { - return NPERR_OUT_OF_MEMORY_ERROR; - } - - This->force_bgcolor=1; - This->bg_r = This->bg_g = This->bg_b = 0xffff; - - /* record some info for later lookup */ - This->fWindow = NULL; - This->fMode = mode; - - This->fhWnd = NULL; - This->fDefaultWindowProc = NULL; - This->instance = instance; /* save the instance id for reverse lookups */ - This->scrolling = (mode==NP_FULL); - This->xscrollpos = This->yscrollpos = 0; - This->windowwidth = This->windowheight = 0; - - This->loadstate = STATE_INIT; - This->paintedyet = 0; - This->mng=0; - This->lpdib=NULL; - lstrcpy(This->url,""); - This->frozen=0; - This->needresume=0; - This->errorflag=0; - lstrcpy(This->errormsg,""); - - This->dibsize = This->filesize = 0; - - lstrcpy(This->linkurl,""); - lstrcpy(This->linktarget,"_self"); - This->islink=0; - - This->timer_set=0; - This->timer2_set=0; - This->dynamicmng= -1; - This->mouse_over_mng=0; - This->mouse_captured=0; - - This->linkcursor = hcurHandNS; - - // examine the tag arguments - for(i=0;iforce_bgcolor=1; - hexcolor2rgb(argv[i],&This->bg_r,&This->bg_g,&This->bg_b); - } - else if(!_stricmp(argn[i],"href")) { - lstrcpyn(This->linkurl,argv[i],MAXLEN_URL); - This->islink=1; - } - else if(!_stricmp(argn[i],"target")) { - lstrcpyn(This->linktarget,argv[i],MAXLEN_TARGET); - } - } - - This->bkgdbrush=NULL; - if(This->force_bgcolor) - This->bkgdbrush=CreateSolidBrush(RGB(This->bg_r,This->bg_g,This->bg_b)); - - return NPERR_NO_ERROR; -} - -static void BeforeDestroyWindow(PluginInstance *This) -{ - if(This->timer_set) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - } - if(This->timer2_set) { - KillTimer(This->fhWnd,2); - This->timer2_set=0; - } - if(This->mouse_captured) { - ReleaseCapture(); - This->mouse_captured=0; - } - - SetWindowLong( This->fhWnd, GWL_WNDPROC, (LONG)This->fDefaultWindowProc); // unsubclass - This->fDefaultWindowProc = NULL; - This->fhWnd = NULL; -} - -static NPError NPP_Destroy(NPP instance, NPSavedData** save) -{ - PluginInstance* This; - - if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; - This = (PluginInstance*) instance->pdata; - - if(!This) return NPERR_INVALID_INSTANCE_ERROR; - - if(This->mng) { - This->dynamicmng=0; - mng_cleanup(&This->mng); - This->mng=0; - } - if(This->lpdib) { - free(This->lpdib); - This->lpdib=NULL; - } - if(This->mngdata) { - free(This->mngdata); - This->mngdata=NULL; - This->bytesalloc=0; - } - if(This->textdata) { - free(This->textdata); - This->textdata=NULL; - } - - if( This->fhWnd ) { // un-subclass the plugin window - BeforeDestroyWindow(This); - } - - if(This->bkgdbrush) DeleteObject((HGDIOBJ)This->bkgdbrush); - - if(This) { - if(instance->pdata) free(instance->pdata); - instance->pdata = NULL; - } - - return NPERR_NO_ERROR; -} - -/* Browser is providing us with a window */ -static NPError NPP_SetWindow(NPP instance, NPWindow* window) -{ - NPError result = NPERR_NO_ERROR; - PluginInstance* This; - - if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - - if( This->fhWnd != NULL ) { /* If we already have a window... */ - - if( (window == NULL) || ( window->window == NULL ) ) { - /* There is now no window to use. get rid of the old - * one and exit. */ - BeforeDestroyWindow(This); - This->fWindow=window; - return NPERR_NO_ERROR; - } - - else if ( This->fhWnd == (HWND) window->window ) { - /* The new window is the same as the old one. Redraw and get out. */ - This->fWindow=window; - - InvalidateRect( This->fhWnd, NULL, FALSE ); - /* UpdateWindow( This->fhWnd ); */ - return NPERR_NO_ERROR; - } - else { - /* Unsubclass the old window, so that we can subclass the new - * one later. */ - BeforeDestroyWindow(This); - } - } - else if( (window == NULL) || ( window->window == NULL ) ) { - /* We can just get out of here if there is no current - * window and there is no new window to use. */ - This->fWindow=window; - - return NPERR_NO_ERROR; - } - - /* Subclass the new window so that we can begin drawing and - * receiving window messages. */ - This->fDefaultWindowProc = (WNDPROC)SetWindowLong( (HWND)window->window, GWL_WNDPROC, (LONG)PluginWindowProc); - This->fhWnd = (HWND) window->window; - SetProp( This->fhWnd, gInstanceLookupString, (HANDLE)This); - - This->fWindow = window; - find_window_size(This); - - set_scrollbars(This); - - InvalidateRect( This->fhWnd, NULL, TRUE ); - UpdateWindow( This->fhWnd ); - - return result; -} - -// browser is announcing its intent to send data to us -static NPError NPP_NewStream(NPP instance,NPMIMEType type,NPStream *stream, - NPBool seekable,uint16 *stype) { - PluginInstance* This; - - if(instance==NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - if(!This) - return NPERR_GENERIC_ERROR; - - /* save the URL for later */ - lstrcpyn(This->url,stream->url,MAX_PATH); - - - This->libmngpos=0; - This->bytesloaded=0; - This->bytesalloc=0; - This->byteswanted=0; - This->mngdata=NULL; - This->textdata=NULL; - - // if we know the total length of the stream in advance - // (most of the time we will, hopefully), allocate that amount. - if(stream->end > 0) { - This->mngdata = malloc(stream->end); - This->bytesalloc= stream->end; - } - - my_init_mng(This); - - This->loadstate=STATE_LOADING; - - (*stype)=NP_NORMAL; - - return NPERR_NO_ERROR; -} - -static int32 NPP_WriteReady(NPP instance, NPStream *stream) -{ - /* Number of bytes ready to accept in NPP_Write() */ - /* We can handle any amount, so just return some really big number. */ - return (int32)0X0FFFFFFF; -} - -#define ALLOC_CHUNK_SIZE 131072 - -static int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) -{ - PluginInstance* This; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"NPP_Write offs=%d len=%d\n",offset,len); -#endif - - - if(!instance) return -1; - This = (PluginInstance*) instance->pdata; - if(!This) return -1; - if(len<1) return len; - - if(offset+len > (int)This->bytesalloc) { // oops, overflowed our memory buffer - This->bytesalloc += ALLOC_CHUNK_SIZE; - if(This->mngdata) { - This->mngdata=realloc(This->mngdata, This->bytesalloc); - } - else { // first time - This->mngdata=malloc(This->bytesalloc); - } - if(!This->mngdata) { - warn(This,"Cannot allocate memory for image (%d,%d,%p",offset,len,buffer); - return -1; - } - } - - // now we should have enough room to copy the data to memory - - CopyMemory(&This->mngdata[offset],buffer,len); - - This->bytesloaded = offset+len; - - // now, check if it's time to call mng_read_resume - if(This->needresume && - (This->bytesloaded >= (This->libmngpos + This->byteswanted)) ) - { - This->needresume=0; -// handle_read_error(This, mng_read_resume(This->mng) ); - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"NPP_Write display_resume bytesloaded=%d libmngpos=%d byteswanted=%d\n", - This->bytesloaded,This->libmngpos,This->byteswanted); -#endif - - handle_read_error(This, mng_display_resume(This->mng) ); - } - - - return len; // The number of bytes accepted -- we always accept them all. -} - -/* DestroyStream gets called after the file has finished loading, - */ -static NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) -{ - PluginInstance* This; - if(!instance) return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; -// if(reason==NPRES_DONE) { - This->filesize = This->bytesloaded; - This->loadstate = STATE_LOADED; -// } - - if(reason!=NPRES_DONE) { - set_error(This,"Image load failed or was canceled (%d)",(int)reason); - This->needresume=0; - if(This->timer_set) { KillTimer(This->fhWnd,1); This->timer_set=0; } - return NPERR_NO_ERROR; - } - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"NPP_DestroyStream reason=%d needresume=%d\n",reason,This->needresume); -#endif - - if(This->needresume) { - This->needresume=0; -// handle_read_error(This, mng_read_resume(This->mng) ); - handle_read_error(This, mng_display_resume(This->mng) ); -// This->needresume=0; - } - - return NPERR_NO_ERROR; -} - - -static void NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) -{ - return; -} - -// Print embedded plug-in (via the browser's Print command) -static void NPP_Print(NPP instance, NPPrint* printInfo) -{ - PluginInstance* This; - if (instance == NULL) return; - This = (PluginInstance*) instance->pdata; - - if(printInfo == NULL) { - // Some browsers (Netscape) set printInfo to NULL to tell the plugin - // to print in full page mode (this may be a bug). - // PrintFullPage(); -- full page printing not implemented - return; - } - - if (printInfo->mode == NP_FULL) { - /* the plugin is full-page, and the browser is giving it a chance - * to print in the manner of its choosing */ - void* platformPrint = printInfo->print.fullPrint.platformPrint; - NPBool printOne = printInfo->print.fullPrint.printOne; - - /* Setting this to FALSE and returning *should* cause the browser to - * call NPP_Print again, this time with mode=NP_EMBED. - * However, that doesn't happen with any browser I've ever seen :-(. - * Instead of the following line, you will probably need to implement - * printing yourself. You also might as well set pluginPrinted to TRUE, - * though every browser I've tested ignores it. */ - printInfo->print.fullPrint.pluginPrinted = FALSE; - /* or */ - /* PrintFullPage(); - * printInfo->print.fullPrint.pluginPrinted = TRUE; */ - } - else { // we are embedded, and the browser had provided a printer context - HDC pdc; - int prevstretchmode; - NPWindow* printWindow; - - if(This->loadstate < STATE_VALIDFRAME) return; - - printWindow= &(printInfo->print.embedPrint.window); - - /* embedPrint.platformPrint is a Windows device context in disguise */ - - /* The definition of NPWindow changed between API verion 0.9 and 0.11, - * increasing in size from 28 to 32 bytes. This normally makes it - * impossible for version 0.9 browsers to print version 0.11 plugins - * (because the platformPrint field ends up at the wrong offset) -- - * unless the plugin takes special care to detect this situation. - * To work around it, if we are compiled with API 0.11 or higher, - * and the browser is version 0.9 or earlier, we look for the HDC - * 4 bytes earlier, at offset 28 instead of 32 (of the embedPrint - * sub-structure). - */ - - if(sizeof(NPWindow)>28 && /* i.e. is plugin API >= 0.11? */ - HIBYTE(g_pNavigatorFuncs->version)==0 && - LOBYTE(g_pNavigatorFuncs->version)<=9) { - char *tmpc; - HDC *tmph; - - tmpc= (char*)&(printInfo->print.embedPrint); - tmph= (HDC*)&tmpc[28]; - pdc= *tmph; - } - else { - pdc= (HDC) (printInfo->print.embedPrint.platformPrint); - } - - if(!This->lpdib) return; - - prevstretchmode=SetStretchBltMode(pdc,COLORONCOLOR); - StretchDIBits(pdc, - printWindow->x,printWindow->y, - printWindow->width,printWindow->height, /* dest coords */ - 0,0,This->lpdibinfo->biWidth, This->lpdibinfo->biHeight, /* source coords */ - This->lpdibbits, (LPBITMAPINFO)This->lpdib, - DIB_RGB_COLORS,SRCCOPY); - if(prevstretchmode) SetStretchBltMode(pdc,prevstretchmode); - } - return; -} - - -/*+++++++++++++++++++++++++++++++++++++++++++++++++ - * NPP_URLNotify: - * Notifies the instance of the completion of a URL request. - +++++++++++++++++++++++++++++++++++++++++++++++++*/ -static void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData) -{ - return; -} - - -/**********************************************************************/ - -/* Try to make a filename from the url. Caller must provide fn[MAX_PATH] buffer. - * This function attempts to extract a bitmap filename from a URL, - * but if it doesn't look like it contains an appropriate name, - * it leaves it blank. */ -static void url2filename(char *fn, char *url) -{ - int title,ext,i; - - lstrcpy(fn,""); - ext=0; /* position of the file extention */ - title=0; /* position of the base filename */ - for(i=0;url[i];i++) { - if(url[i]=='.') ext=i+1; - if(url[i]=='/') title=i+1; - if(url[i]=='\\') title=i+1; // handle Microsoft's bogus file: "URLs" - if(url[i]==':') title=i+1; - if(url[i]=='=') title=i+1; - } - - if (!_stricmp(&url[ext],"mng") || - !_stricmp(&url[ext],"jng") || - !_stricmp(&url[ext],"png") ) - { - lstrcpyn(fn,&url[title],MAX_PATH); - } -} - -// sanitize string and escape '&'s for use in a menu -static void escapeformenu(unsigned char *s1) -{ - int f, t, len; - unsigned char s2[200]; - - t=0; - len=lstrlen(s1); if(len>50) len=50; - for(f=0;fmng || This->loadstatebytesloaded != This->filesize) - { - warn(This,"Image not loaded -- can't save"); - return; - } - - if(lstrlen(This->url)) { - url2filename(fn,This->url); - } - else { - lstrcpy(fn,""); - } - - ZeroMemory(&ofn,sizeof(OPENFILENAME)); - ofn.lStructSize=sizeof(OPENFILENAME); - ofn.hwndOwner=This->fhWnd; - ofn.nFilterIndex=1; - ofn.lpstrTitle="Save Image As..."; - ofn.lpstrFile=fn; - ofn.nMaxFile=MAX_PATH; - ofn.Flags=OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT; - - t=mng_get_sigtype(This->mng); - if(t==mng_it_png) { - ofn.lpstrDefExt="png"; // FIXME also give an option of MNG - ofn.lpstrFilter="PNG (*.png)\0*.png\0\0"; - } - else if(t==mng_it_jng) { - ofn.lpstrDefExt="jng"; // FIXME also give an option of MNG - ofn.lpstrFilter="JNG (*.jng)\0*.jng\0\0"; - } - else { - ofn.lpstrFilter="MNG (*.mng)\0*.mng\0\0"; - ofn.lpstrDefExt="mng"; - } - - if(GetSaveFileName(&ofn)) { - // save to filename: ofn.lpstrFile - hfile=CreateFile(ofn.lpstrFile,GENERIC_WRITE,FILE_SHARE_READ, - NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - if(hfile==INVALID_HANDLE_VALUE) { - warn(This,"Unable to write file"); - } - else { - b=WriteFile(hfile, This->mngdata, This->filesize, - &byteswritten,NULL); - if(!b || byteswritten != This->filesize) { - warn(This,"Error writing file"); - } - CloseHandle(hfile); - } - } -} - - -static void CopyToClipboard(PluginInstance *This,unsigned char *mem,int size,UINT format) -{ - HGLOBAL hClip; - LPVOID lpClip; - - if(!mem) return; - - if(!OpenClipboard(NULL)) { - warn(This,"Can't open the clipboard"); - return; - } - - if(EmptyClipboard()) { - hClip=GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE,size); - lpClip=GlobalLock(hClip); - if(lpClip) { - CopyMemory(lpClip,mem,size); - GlobalUnlock(hClip); - if(!SetClipboardData(format,hClip)) { - warn(This,"Can't set clipboard data"); - } - } - else { - warn(This,"Can't allocate memory for clipboard"); - } - } - else { - warn(This,"Can't clear the clipboard"); - } - CloseClipboard(); -} - -static void AboutDialog(PluginInstance *This) -{ - DialogBoxParam(g_hInst,"ABOUTDLG",This->fhWnd,(DLGPROC)DlgProcAbout,(LPARAM)This); -} - -static void PropDialog(PluginInstance *This) -{ - //if(This->textdata) - DialogBoxParam(g_hInst,"PROPDLG",This->fhWnd,(DLGPROC)DlgProcProp,(LPARAM)This); -} - -static void display_last_error(PluginInstance *This) -{ - if(This->errorflag) { - warn(This,"%s",This->errormsg); - } -} - -static void DynamicMNG_FireEvent(PluginInstance *This, mng_uint8 eventtype, POINTS pos) -{ - mng_retcode r; - if(!This->mng) return; - if(This->dynamicmng == 0) return; - if(This->dynamicmng == -1) { - r=mng_status_dynamic(This->mng); - if(r==MNG_FALSE) { - return; - } - else { - This->dynamicmng=1; - } - } - mng_trapevent(This->mng, eventtype, pos.x+This->xscrollpos, pos.y+This->yscrollpos); -} - - -static void ContextMenu(PluginInstance *This, HWND hwnd) -{ - int cmd; - HMENU menu; - POINT pt; - unsigned char buf[MAX_PATH], buf2[200]; - - pt.x=0; pt.y=0; - GetCursorPos(&pt); - - // create context menu dynamically - menu=CreatePopupMenu(); - if(This->errorflag) { - AppendMenu(menu,MF_ENABLED,ID_SHOWERROR,"SHOW ERROR MESSAGE"); - AppendMenu(menu,MF_SEPARATOR,0,NULL); - } - - AppendMenu(menu,(This->loadstate>=STATE_LOADED?MF_ENABLED:MF_GRAYED),ID_SAVEAS,"Save Image &As..."); - AppendMenu(menu,(This->lpdib?MF_ENABLED:MF_GRAYED),ID_COPYIMAGE,"&Copy Image"); - AppendMenu(menu,MF_ENABLED,ID_COPYURL,"Cop&y Image Location"); - if(This->islink) { - AppendMenu(menu,MF_ENABLED,ID_COPYLINKLOC,"Copy Link Location"); - } - - url2filename(buf,This->url); - escapeformenu(buf); - if(lstrlen(buf)) { - wsprintf(buf2,"View Image (%s)",buf); - } - else { - wsprintf(buf2,"View Image"); - } - AppendMenu(menu,MF_ENABLED,ID_VIEWIMAGE,buf2); - - - AppendMenu(menu,MF_SEPARATOR,0,NULL); - // AppendMenu(menu,(This->mng?MF_ENABLED:MF_GRAYED),ID_STOPANIM,"Stop Animation"); - - - AppendMenu(menu,(This->mng?MF_ENABLED:MF_GRAYED)| - (This->frozen?MF_CHECKED:MF_UNCHECKED),ID_FREEZE,"&Freeze Animation"); - - // AppendMenu(menu,(This->mng?MF_ENABLED:MF_GRAYED),ID_RESTARTANIM,"Restart Animation"); - - AppendMenu(menu,MF_SEPARATOR,0,NULL); - - AppendMenu(menu,MF_ENABLED,ID_PROPERTIES,"Properties..."); - - AppendMenu(menu,MF_ENABLED,ID_ABOUT,"About MNG Plug-in..."); - - cmd=TrackPopupMenuEx(menu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_NONOTIFY|TPM_RETURNCMD| - TPM_RIGHTBUTTON,pt.x,pt.y,hwnd,NULL); - - DestroyMenu(menu); - - switch(cmd) { - - case ID_STOPANIM: - if(This->mng) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - mng_display_freeze(This->mng); - } - break; - - case ID_FREEZE: - This->frozen = !This->frozen; - if(This->frozen) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - mng_display_freeze(This->mng); - } - else { - handle_read_error(This, mng_display_resume(This->mng) ); - - } - break; - - case ID_RESTARTANIM: - if(!This->frozen) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - mng_display_freeze(This->mng); - } - This->frozen=1; - mng_display_reset(This->mng); - This->frozen=0; - handle_read_error(This, mng_display_resume(This->mng) ); - break; - - case ID_SAVEAS: - SaveImage(This); - break; - case ID_COPYIMAGE: - if(This->lpdib) { - CopyToClipboard(This,(unsigned char*)This->lpdib,This->dibsize,CF_DIB); - } - else { - warn(This,"No image to copy"); - } - break; - case ID_COPYURL: - CopyToClipboard(This,This->url,lstrlen(This->url)+1,CF_TEXT); - break; - case ID_COPYLINKLOC: - if(This->islink) { - CopyToClipboard(This,This->linkurl,lstrlen(This->linkurl)+1,CF_TEXT); - } - break; - case ID_VIEWIMAGE: - if(lstrlen(This->url)) - NPN_GetURL(This->instance,This->url,"_self"); - break; - case ID_PROPERTIES: - PropDialog(This); - break; - case ID_ABOUT: - AboutDialog(This); - break; - case ID_SHOWERROR: - display_last_error(This); - break; - } -} - -/*+++++++++++++++++++++++++++++++++++++++++++++++++ - * PluginWindowProc - * Handle the Windows window-event loop. - +++++++++++++++++++++++++++++++++++++++++++++++++*/ -static LRESULT CALLBACK PluginWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - PluginInstance* This; - HDC hdc; - RECT rect; - - This = (PluginInstance*) GetProp(hWnd, gInstanceLookupString); - - if(!This) return DefWindowProc( hWnd, Msg, wParam, lParam); - - switch(Msg) { - - case WM_ERASEBKGND: - { - HBRUSH br; - hdc= (HDC)wParam; - - if(This->bkgdbrush) - br=This->bkgdbrush; - else - br=GetStockObject(GRAY_BRUSH); - - GetClientRect(hWnd,&rect); - FillRect(hdc,&rect,br); - return 1; - } - - case WM_HSCROLL: - case WM_VSCROLL: - scrollmsg(This,Msg,(int)(LOWORD(wParam)),(short int)(HIWORD(wParam))); - return 0; - - case WM_SIZE: - find_window_size(This); - set_scrollbars(This); - return 0; - - - case WM_CONTEXTMENU: case WM_RBUTTONUP: - ContextMenu(This, hWnd); - return 0; - - - case WM_SETCURSOR: - if(LOWORD(lParam)==HTCLIENT) { - if(This->islink) { - SetCursor(This->linkcursor); - return 1; - } - } - break; - - case WM_LBUTTONDOWN: - SetCapture(This->fhWnd); - This->mouse_captured=1; - - if(This->dynamicmng && This->mng && !This->errorflag) { - DynamicMNG_FireEvent(This,4,MAKEPOINTS(lParam)); - } - return 0; - - case WM_LBUTTONUP: - { - RECT rc; - POINT pt; - - if(This->mouse_captured) { - ReleaseCapture(); - This->mouse_captured=0; - } - if(This->dynamicmng && This->mng && !This->errorflag) { - DynamicMNG_FireEvent(This,5,MAKEPOINTS(lParam)); - } - - // if mouse is not over image, don't follow links, etc. - GetWindowRect(This->fhWnd,&rc); - GetCursorPos(&pt); - if(!PtInRect(&rc,pt)) return 0; - - if(This->islink) { - NPN_GetURL(This->instance,This->linkurl,This->linktarget); - return 0; - } - else if(This->errorflag) { - display_last_error(This); - } - } - return 0; - - case WM_MOUSEMOVE: - - if(This->dynamicmng && This->mng && This->lpdib && !This->errorflag) { - POINTS pos; - int overimage; - - pos=MAKEPOINTS(lParam); - overimage=0; - if(pos.x>=0 && pos.xlpdibinfo->biWidth && pos.y>=0 && pos.ylpdibinfo->biHeight) { - overimage=1; - } - - if(overimage) { - if(This->mouse_over_mng) { - // mouse is still over image: mouse move event - DynamicMNG_FireEvent(This,2,pos); // 2=mouse move - } - else { - // mouse wasn't over the image but now it is: mouse-enter event - DynamicMNG_FireEvent(This,1,pos); // mouse enter - } - } - else { // mouse not now over image - if(This->mouse_over_mng) { // ... but it used to be - pos.x=0; pos.y=0; - DynamicMNG_FireEvent(This,3,pos); // 3=mouse leave - } - } - - This->mouse_over_mng=overimage; // remember for next time - - if(This->mouse_over_mng && (This->dynamicmng==1) ) { -#define MOUSE_POLL_INTERVAL 100 // milliseconds - SetTimer(This->fhWnd,2,MOUSE_POLL_INTERVAL,NULL); - This->timer2_set=0; - } - } - return 0; - - case WM_PAINT: - { - PAINTSTRUCT paintStruct; - HDC hdc; - RECT rect2; - - hdc = BeginPaint( hWnd, &paintStruct ); - SetWindowOrgEx(hdc,This->xscrollpos,This->yscrollpos,NULL); - - GetClientRect(hWnd,&rect); - if(This) { - if(This->errorflag || !This->lpdib) { - SelectObject(hdc,hfontMsg); - Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom); - rect2.left=rect.left+2; - rect2.top=rect.top+2; - rect2.right=rect.right-2; - rect2.bottom=rect.bottom-2; - if(This->errorflag) { - DrawText(hdc,"MNG PLUG-IN ERROR!",-1,&rect2,DT_LEFT|DT_WORDBREAK); - } - else { - if(This->loadstate>=STATE_LOADING) { - DrawText(hdc,"MNG image loading...",-1,&rect2,DT_LEFT|DT_WORDBREAK); - } - else { - DrawText(hdc,"MNG plug-in",-1,&rect2,DT_LEFT|DT_WORDBREAK); - } - } - } - else if(This->lpdib) { - StretchDIBits(hdc, - 0,0,This->lpdibinfo->biWidth,This->lpdibinfo->biHeight, - 0,0,This->lpdibinfo->biWidth,This->lpdibinfo->biHeight, - &((BYTE*)(This->lpdib))[sizeof(BITMAPINFOHEADER)], - (LPBITMAPINFO)This->lpdib,DIB_RGB_COLORS,SRCCOPY); - } - } - - - EndPaint( hWnd, &paintStruct ); - } - return 0; - - case WM_TIMER: - switch(wParam) { - case 1: // the main animation timer - KillTimer(hWnd,1); - This->timer_set=0; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"WM_TIMER display_resume bytesloaded=%d\n",This->bytesloaded); -#endif - - if(This->mng) { - if(!This->needresume) { - handle_read_error(This, mng_display_resume(This->mng) ); - } - } - return 0; - - case 2: // timer for polling mouse position - { - RECT rc; - POINT pt; - POINTS pos; - - GetWindowRect(hWnd,&rc); - GetCursorPos(&pt); - if(!PtInRect(&rc,pt)) { - KillTimer(hWnd,2); - pos.x=0; pos.y=0; - DynamicMNG_FireEvent(This,3,pos); // 3=mouse leave - This->mouse_over_mng=0; - } - } - return 0; - } - break; - - } - - /* Forward unprocessed messages on to their original destination - * (the window proc we replaced) */ - return This->fDefaultWindowProc(hWnd, Msg, wParam, lParam); -} - -static LRESULT CALLBACK DlgProcProp(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - char buf[4096],buf2[1024]; - - switch(Msg) { - case WM_INITDIALOG: - { - DWORD tabs[1]; - - PluginInstance *This=(PluginInstance*)lParam; - - tabs[0]= 60; - SendDlgItemMessage(hWnd,IDC_IMGINFO,EM_SETTABSTOPS,(WPARAM)1,(LPARAM)tabs); - - wsprintf(buf,"URL:\t%s\r\n",This->url); - - if(This->lpdib) { - wsprintf(buf2,"Dimensions:\t%d x %d\r\n",This->lpdibinfo->biWidth, - This->lpdibinfo->biHeight); - lstrcat(buf,buf2); - } - - if(This->lpdib && This->fMode==NP_EMBED) { - wsprintf(buf2,"Window:\t%d x %d\r\n",This->windowwidth, - This->windowheight); - lstrcat(buf,buf2); - } - - if(This->filesize) { - wsprintf(buf2,"File size:\t%u bytes\r\n",This->filesize); - lstrcat(buf,buf2); - } - -#ifdef _DEBUG - if(This->mngdata && This->lpdib && This->bytesalloc && This->dibsize) { - // note this doesn't include memory used by libmng - wsprintf(buf2,"Memory used:\t%u bytes\r\n", - This->bytesalloc + This->dibsize); - lstrcat(buf,buf2); - } -#endif - - if(This->islink) { - wsprintf(buf2,"Link to:\t%s\r\n",This->linkurl); - lstrcat(buf,buf2); - if(strcmp(This->linktarget,"_self")) { - wsprintf(buf2,"Link target:\t%s\r\n",This->linktarget); - lstrcat(buf,buf2); - } - } - - if(This->loadstate >= STATE_VALIDFRAME) { - wsprintf(buf2,"Signature:\t%s\r\n",get_imagetype_name(mng_get_sigtype(This->mng))); - lstrcat(buf,buf2); - wsprintf(buf2,"Image type:\t%s\r\n",get_imagetype_name(mng_get_imagetype(This->mng))); - lstrcat(buf,buf2); - wsprintf(buf2,"Simplicity:\t0x%08x\r\n",mng_get_simplicity(This->mng)); - lstrcat(buf,buf2); - wsprintf(buf2,"Frame count:\t%u\r\n",mng_get_framecount(This->mng)); - lstrcat(buf,buf2); - wsprintf(buf2,"Layer count:\t%u\r\n",mng_get_layercount(This->mng)); - lstrcat(buf,buf2); - wsprintf(buf2,"Play time:\t%u\r\n",mng_get_playtime(This->mng)); - lstrcat(buf,buf2); - } - - SetDlgItemText(hWnd,IDC_IMGINFO,buf); - - if(This->textdata) - SetDlgItemText(hWnd,IDC_MNGTEXT,This->textdata); - } - return(TRUE); - case WM_CLOSE: - EndDialog(hWnd,0); - return(TRUE); - case WM_COMMAND: - switch(wParam) { - case IDOK: - case IDCANCEL: - EndDialog(hWnd,0); - return(TRUE); - } - } - return(FALSE); -} - -static LRESULT CALLBACK DlgProcAbout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - char buf[4096],buf2[1024],buf3[300]; - - switch(Msg) { - case WM_INITDIALOG: - { - //DWORD tabs[1]; - - PluginInstance *This=(PluginInstance*)lParam; - - //tabs[0]= 60; - //SendDlgItemMessage(hWnd,IDC_IMGINFO,EM_SETTABSTOPS,(WPARAM)1,(LPARAM)tabs); - - wsprintf(buf,"MNGPLG Plug-in, Version %s\r\n%s" -#ifdef _DEBUG - " DEBUG BUILD" -#endif - "\r\nCopyright (C) 2000-2002 by Jason Summers\r\n\r\n",MNGPLGVERS,__DATE__); - - wsprintf(buf2,"Based on libmng by Gerard Juyn.\r\n"); - lstrcat(buf,buf2); - - wsprintf(buf2,"libmng version: %s\r\n\r\n",mng_version_text()); - lstrcat(buf,buf2); - - wsprintf(buf2,"Uses the zlib compression library.\r\n"); - lstrcat(buf,buf2); - wsprintf(buf2,"zlib version: %s\r\n\r\n",zlibVersion()); - lstrcat(buf,buf2); - - wsprintf(buf2,"This software is based in part on the work of the " - "Independent JPEG Group.\r\n"); - lstrcat(buf,buf2); - // This really only gives the version of the libjpeg header used when - // compiling this plugin, but I don't know how to query libjpeg for its - // version. - wsprintf(buf2,"IJG JPEG library version: %s\r\n%s\r\n\r\n",JVERSION,JCOPYRIGHT); - lstrcat(buf,buf2); - -#ifdef MNGPLG_CMS - wsprintf(buf2,"Uses the lcms color management library by Martí Maria. " - "lcms is distributed under the terms of the GNU LESSER GENERAL PUBLIC LICENSE. " - "See the file COPYING-LCMS.\r\n\r\n"); - lstrcat(buf,buf2); -#endif - - if(GetModuleFileName(g_hInst,buf3,260)) { - wsprintf(buf2,"MNGPLG location: %s\r\n",buf3); - lstrcat(buf,buf2); - } - - SetDlgItemText(hWnd,IDC_PRGINFO,buf); - - } - return(TRUE); - case WM_CLOSE: - EndDialog(hWnd,0); - return(TRUE); - case WM_COMMAND: - switch(wParam) { - case IDOK: - case IDCANCEL: - EndDialog(hWnd,0); - return(TRUE); - } - } - return(FALSE); -} - - -///////////////////// -///////////////////// low-level plug-in NPAPI functions - -static JRIGlobalRef Private_GetJavaClass(void) -{ - return NULL; -} - -NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs) -{ - if(!pFuncs) return NPERR_INVALID_FUNCTABLE_ERROR; - - pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; - pFuncs->newp = NPP_New; - pFuncs->destroy = NPP_Destroy; - pFuncs->setwindow = NPP_SetWindow; - pFuncs->newstream = NPP_NewStream; - pFuncs->destroystream = NPP_DestroyStream; - pFuncs->asfile = NPP_StreamAsFile; - pFuncs->writeready = NPP_WriteReady; - pFuncs->write = NPP_Write; - pFuncs->print = NPP_Print; - pFuncs->event = NULL; - - g_pluginFuncs = pFuncs; - - return NPERR_NO_ERROR; -} - -NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs) -{ - int navMinorVers; - - if(!pFuncs) return NPERR_INVALID_FUNCTABLE_ERROR; - - g_pNavigatorFuncs = pFuncs; // save it for future reference - - if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - navMinorVers = g_pNavigatorFuncs->version & 0xFF; - if(navMinorVers>=NPVERS_HAS_NOTIFICATION) - g_pluginFuncs->urlnotify = NPP_URLNotify; - if( navMinorVers>=NPVERS_HAS_LIVECONNECT) - g_pluginFuncs->javaClass = Private_GetJavaClass(); - - return NPP_Initialize(); -} - -NPError WINAPI NP_Shutdown() -{ - NPP_Shutdown(); - - g_pNavigatorFuncs = NULL; - return NPERR_NO_ERROR; -} diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.def b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.def deleted file mode 100644 index 9dcd7dc5f..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.def +++ /dev/null @@ -1,6 +0,0 @@ -LIBRARY npmngplg - -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep deleted file mode 100644 index c7a306e5c..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep +++ /dev/null @@ -1,22 +0,0 @@ -# Microsoft Developer Studio Generated Dependency File, included by npmngplg.mak - -.\npmngplg.c : \ - "..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - "..\jpgsrc6b\jconfig.h"\ - "..\jpgsrc6b\jmorecfg.h"\ - "..\jpgsrc6b\jpeglib.h"\ - "..\jpgsrc6b\jversion.h"\ - "..\lcms-1.08a\include\icc34.h"\ - "..\lcms-1.08a\include\lcms.h"\ - "..\libmng-1.0.4\libmng.h"\ - "..\libmng-1.0.4\libmng_conf.h"\ - "..\libmng-1.0.4\libmng_types.h"\ - "..\zlib-1.1.4\zconf.h"\ - "..\zlib-1.1.4\zlib.h"\ - ".\npapidefs.h"\ - - -.\npmngplg.rc : \ - ".\cur_ie.cur"\ - ".\cur_ns.cur"\ - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp deleted file mode 100644 index 5bd4698ff..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp +++ /dev/null @@ -1,123 +0,0 @@ -# Microsoft Developer Studio Project File - Name="npmngplg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=npmngplg - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "npmngplg.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "npmngplg.mak" CFG="npmngplg - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "npmngplg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "npmngplg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\libmng-1.0.5\Release\libmng.lib ..\zlib-1.1.4\Release\zlib.lib ..\jpgsrc6b\Release\libjpeg.lib ..\lcms-1.09b\src\Release\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /machine:I386 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\libmng-1.0.5\Debug\libmng.lib ..\zlib-1.1.4\Debug\zlib.lib ..\jpgsrc6b\Debug\libjpeg.lib ..\lcms-1.09b\src\Debug\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"c:\program files\opera\program\plugins\npmngplg.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "npmngplg - Win32 Release" -# Name "npmngplg - Win32 Debug" -# Begin Source File - -SOURCE=.\cur_ns.cur -# End Source File -# Begin Source File - -SOURCE=.\npapidefs.h -# End Source File -# Begin Source File - -SOURCE=.\npmngplg.c - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -# SUBTRACT CPP /YX - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -# SUBTRACT CPP /Fr /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\npmngplg.def -# End Source File -# Begin Source File - -SOURCE=.\npmngplg.rc -# End Source File -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw deleted file mode 100644 index a52c8b0c2..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "npmngplg"=.\npmngplg.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak deleted file mode 100644 index 6ed10b619..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak +++ /dev/null @@ -1,225 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on npmngplg.dsp -!IF "$(CFG)" == "" -CFG=npmngplg - Win32 Debug -!MESSAGE No configuration specified. Defaulting to npmngplg - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "npmngplg - Win32 Release" && "$(CFG)" != "npmngplg - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "npmngplg.mak" CFG="npmngplg - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "npmngplg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "npmngplg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -ALL : "$(OUTDIR)\npmngplg.dll" - - -CLEAN : - -@erase "$(INTDIR)\npmngplg.obj" - -@erase "$(INTDIR)\npmngplg.res" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\npmngplg.dll" - -@erase "$(OUTDIR)\npmngplg.exp" - -@erase "$(OUTDIR)\npmngplg.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\npmngplg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\npmngplg.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\npmngplg.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=..\libmng-1.0.5\Release\libmng.lib ..\zlib-1.1.4\Release\zlib.lib ..\jpgsrc6b\Release\libjpeg.lib ..\lcms-1.09b\src\Release\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\npmngplg.pdb" /machine:I386 /def:".\npmngplg.def" /out:"$(OUTDIR)\npmngplg.dll" /implib:"$(OUTDIR)\npmngplg.lib" -DEF_FILE= \ - ".\npmngplg.def" -LINK32_OBJS= \ - "$(INTDIR)\npmngplg.obj" \ - "$(INTDIR)\npmngplg.res" - -"$(OUTDIR)\npmngplg.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug - -ALL : "..\..\program files\opera\program\plugins\npmngplg.dll" - - -CLEAN : - -@erase "$(INTDIR)\npmngplg.obj" - -@erase "$(INTDIR)\npmngplg.res" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\npmngplg.exp" - -@erase "$(OUTDIR)\npmngplg.lib" - -@erase "$(OUTDIR)\npmngplg.pdb" - -@erase "..\..\program files\opera\program\plugins\npmngplg.dll" - -@erase "..\..\program files\opera\program\plugins\npmngplg.ilk" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\npmngplg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\npmngplg.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\npmngplg.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=..\libmng-1.0.5\Debug\libmng.lib ..\zlib-1.1.4\Debug\zlib.lib ..\jpgsrc6b\Debug\libjpeg.lib ..\lcms-1.09b\src\Debug\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\npmngplg.pdb" /debug /machine:I386 /def:".\npmngplg.def" /out:"c:\program files\opera\program\plugins\npmngplg.dll" /implib:"$(OUTDIR)\npmngplg.lib" /pdbtype:sept -DEF_FILE= \ - ".\npmngplg.def" -LINK32_OBJS= \ - "$(INTDIR)\npmngplg.obj" \ - "$(INTDIR)\npmngplg.res" - -"..\..\program files\opera\program\plugins\npmngplg.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("npmngplg.dep") -!INCLUDE "npmngplg.dep" -!ELSE -!MESSAGE Warning: cannot find "npmngplg.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "npmngplg - Win32 Release" || "$(CFG)" == "npmngplg - Win32 Debug" -SOURCE=.\npmngplg.c - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -CPP_SWITCHES=/nologo /MT /W3 /GX /O2 /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -"$(INTDIR)\npmngplg.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) @<< - $(CPP_SWITCHES) $(SOURCE) -<< - - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -CPP_SWITCHES=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -"$(INTDIR)\npmngplg.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) @<< - $(CPP_SWITCHES) $(SOURCE) -<< - - -!ENDIF - -SOURCE=.\npmngplg.rc - -"$(INTDIR)\npmngplg.res" : $(SOURCE) "$(INTDIR)" - $(RSC) $(RSC_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc deleted file mode 100644 index c0dee930d..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc +++ /dev/null @@ -1,175 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,1,1 - PRODUCTVERSION 1,0,1,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "Comments", "\0" - VALUE "CompanyName", "Jason Summers\0" - VALUE "FileDescription", "MNG Plug-in 1.0.1\0" - VALUE "FileExtents", "mng|mng|jng|jng\0" - VALUE "FileOpenName", "MNG Animation (*.mng)|MNG Animation (*.mng)|JNG Image (*.jng)|JNG Image (*.jng)\0" - VALUE "FileVersion", "1.0.1\0" - VALUE "InternalName", "npmngplg\0" - VALUE "LegalCopyright", "Copyright © 2000-2002\0" - VALUE "LegalTrademarks", "\0" - VALUE "MIMEType", "video/mng|video/x-mng|image/jng|image/x-jng\0" - VALUE "OriginalFilename", "npmngplg.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "MNG Plug-in 1.0.1\0" - VALUE "ProductVersion", "1.0.1\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -ABOUTDLG DIALOG DISCARDABLE 0, 0, 282, 137 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "MNGPLG" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,225,7,50,14,WS_GROUP - EDITTEXT IDC_PRGINFO,7,7,213,123,ES_MULTILINE | ES_AUTOVSCROLL | - ES_READONLY | NOT WS_BORDER | WS_VSCROLL | WS_GROUP -END - -PROPDLG DIALOG DISCARDABLE 0, 0, 344, 186 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Image properties" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,287,7,50,14,WS_GROUP - EDITTEXT IDC_IMGINFO,7,7,275,97,ES_MULTILINE | ES_AUTOVSCROLL | - ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_GROUP - LTEXT "Image comments:",IDC_STATIC,7,108,56,8 - EDITTEXT IDC_MNGTEXT,7,119,275,60,ES_MULTILINE | ES_READONLY | - WS_VSCROLL | WS_GROUP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - "ABOUTDLG", DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 275 - TOPMARGIN, 7 - BOTTOMMARGIN, 130 - END - - "PROPDLG", DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 337 - TOPMARGIN, 7 - BOTTOMMARGIN, 179 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Cursor -// - -CURHAND_NS CURSOR DISCARDABLE "cur_ns.cur" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/resource.h b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/resource.h deleted file mode 100644 index 878c604fa..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/resource.h +++ /dev/null @@ -1,19 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by npmngplg.rc -// -#define IDR_DATA1 106 -#define IDC_PRGINFO 1000 -#define IDC_IMGINFO 1001 -#define IDC_MNGTEXT 1002 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 110 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/readme.txt b/Engine/lib/lmng/contrib/msvc/mngplg/readme.txt deleted file mode 100644 index 002c4f13a..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/readme.txt +++ /dev/null @@ -1,211 +0,0 @@ -MNGPLG -A simple browser plug-in for the MNG image/animation file format. - -By Jason Summers -Version 1.0.1 2 Oct 2002 -Web site: - - -COPYRIGHT NOTICE - -Copyright (c) 2000-2002 by Jason Summers - -THIS SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT -ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE -THIS SOFTWARE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING -ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THIS SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THIS SOFTWARE TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this source code must not be misrepresented; - you must not claim that you wrote the original software. - 2. Altered source versions must be plainly marked as such, and must not - be misrepresented as being the original source. - 3. Altered binary versions must not be misrepresented as being the - original. - 4. This Copyright notice may not be removed or altered from any source - or altered source distribution, although you may add a Copyright - notice for yourself for any code that you have written. - - -This software uses several third-party libraries (listed below), some of -which are optional. If you redistribute MNGPLG, it is your responsibility to -comply with the licenses of any libraries used. - -This package includes a compiled executable plug-in file, npmngplg.dll. This -file includes code from lcms, which is distributed under the LGPL. To the -best of my understanding, that basically means that anyone distributing that -file must (1) make it possible for the recipient to modify the plug-in to -use a new or modified version of lcms, and (2) make available the lcms -source code. Requirement (1) is satisfied by the inclusion of the source -code. For requirement (2), you can find out how to get the lcms source code -at the web site listed at the beginning of this document, if necessary. - - ---------- - -Based on libmng. - Copyright (c) 2000,2002 Gerard Juyn (gerard@libmng.com) - - -Uses the zlib compression library. - (C) 1995-2002 Jean-loup Gailly and Mark Adler - -This software is based in part on the work of the Independent JPEG Group. - Copyright (C) 1991-1998, Thomas G. Lane - -Uses the lcms color management library by Martí Maria Saguer. - (distributed under the GNU LESSER GENERAL PUBLIC LICENSE) - ---------- - -SECURITY NOTICE - -Although I've tried to write it carefully, MNGPLG has not had any sort of -security audit. Due to the nature of plug-ins, it is possible for certain -types of bugs to exist which may allow remote web sites to take control of -your computer or do harm to it by sending a carefully constructed data file -to the plug-in. If you are paranoid about security, you may not wish to -leave MNGPLG enabled in your browser for an extended period of time. - ---------- - -INTRODUCTION - -MNGPLG is a Netscape-style browser plug-in which displays the MNG -image/animation format. It is configured to claim the following MIME types: - - video/x-mng - video/mng - image/x-jng - image/jng - -It claims the file extensions ".mng" and ".jng", but file extensions should -only apply when no MIME type is available (e.g. on an FTP site, or on your -local hard disk). - -It can also display PNG image files, but it would cause too many problems -for it to try to claim the PNG data type. - -If you are configuring a web server to support MNG and JNG, the correct -MIME types to use are "video/x-mng" and "image/x-jng", since the MIME types -have not, as of this writing, been officially registered. - - -REQUIREMENTS - -MNG requires a 32-bit Windows operating system, and a 32-bit web browser -that supports Netscape-style plug-ins. For example, it works in Netscape 3 -and higher, Opera 3.51 and higher, and Microsoft Internet Explorer from -about version 3 to 5.0. (It does not readily work in IE 5.5sp2 and -higher.) Netscape 6 and higher (and related browsers) include native -support for MNG, so it should not be necessary to use this plug-in. - - -INSTALLATION - -There's no install program. To install it, copy the included "npmngplg.dll" -file to your browser's "Plugins" folder, then restart your browser. - -For Netscape 4.x, the Plugins folder is typically located somewhere like: -C:\Program Files\Netscape\Communicator\Program\Plugins - -Note: Windows Explorer, by default, is configured to hide files that end in -".dll". You should probably change that setting. I'd tell you how, but it's -different in almost every version of Windows. - -In Netscape 4.x, you can verify that the plug-in is installed by choosing -Help|About Plug-ins from the main menu (with JavaScript enabled). - -To uninstall, delete the npmngplg.dll file. It does not create any other -files. It currently does not write anything to the Windows registry. - - -HOW TO USE (FOR END USERS) - -Right-click on an MNG image as it is being displayed to get a menu with some -of the usual features. - -Right-click and choose "Properties" to display some internal information -about the image. Some images have embedded text information that will be -shown in the "Image comments" area. For technical reasons, some or all of -the comments may not be available until the animation completes a full loop. - - -HOW TO USE (FOR WEB DEVELOPERS) - -First, if at all possible, configure your web server (not browser) to -assign the MIME type "video/x-mng" to files that end in ".mng", and -assign type "image/x-jng" to files that end in ".jng". - -The most reliable way to embed MNG files in a web page is (unfortunately) -to use the nonstandard tag. For example: - - - -The src, width, and height attributes are required. Width and height should -match the actual width and height of the image. - -Transparency is not supported, and probably never will be. However, you can -supply a background color to use in transparent areas by using the BGCOLOR -attribute in the EMBED tag, i.e.: - - - -You cannot use color names like "red"; you must use the hexadecimal format -as in the example. - -An image can be made into a "hotlink" by including an HREF and optionally a -TARGET attribute in the EMBED tag. For example: - - - - -SOURCE CODE - -The C source code is included. I've only tested it with libmng 1.0.5, -but it's probably also compatible with other versions, maybe with -minor changes. - -To compile it, you'll need: - -- libmng MNG library . - -libmng in turn uses some other libraries: - - - zlib compression library - - - IJG JPEG library - - - [optional] lcms "Little Color Management System" library. - -If you include lcms, turn on the MNG_FULL_CMS option in libmng_conf.h -before compiling. Note that lcms is distributed under the LGPL -- be sure -you understand the implications of that before distributing any resulting -executable files. - -If you don't include lcms, comment out the "#define MNGPLG_CMS" line in -npmngplg.c. - -I also recommend turning on the MNG_ERROR_TELLTALE and -MNG_SUPPORT_DYNAMICMNG options in libmng_conf.h. - -The files from the Netscape plug-in SDK are no longer needed as of MNGPNG -0.9.4. - -Make sure to include the npmngplg.def file in your project, or declare the -necessary DLL entry points in some other way. diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsp b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsp deleted file mode 100644 index b2c114e8c..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsp +++ /dev/null @@ -1,126 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MNGView" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=MNGView - Win32 Debug -!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE -!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl -!MESSAGE -!MESSAGE NMAKE /f "MNGView.mak". -!MESSAGE -!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben -!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: -!MESSAGE -!MESSAGE NMAKE /f "MNGView.mak" CFG="MNGView - Win32 Debug" -!MESSAGE -!MESSAGE Für die Konfiguration stehen zur Auswahl: -!MESSAGE -!MESSAGE "MNGView - Win32 Release" (basierend auf "Win32 (x86) Application") -!MESSAGE "MNGView - Win32 Debug" (basierend auf "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "MNGView - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "NDEBUG" -# ADD RSC /l 0xc07 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"MNGView.exe" - -!ELSEIF "$(CFG)" == "MNGView - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "_DEBUG" -# ADD RSC /l 0xc07 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "MNGView - Win32 Release" -# Name "MNGView - Win32 Debug" -# Begin Group "Quellcodedateien" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# Begin Source File - -SOURCE=.\Main.rc -# End Source File -# Begin Source File - -SOURCE=.\mng.cpp -# End Source File -# End Group -# Begin Group "Header-Dateien" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\Main.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# End Group -# Begin Group "Ressourcendateien" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\Mng.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsw b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsw deleted file mode 100644 index 54bc89302..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! - -############################################################################### - -Project: "MNGView"=.\MNGView.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.opt b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.opt deleted file mode 100644 index 1106e85eb..000000000 Binary files a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.opt and /dev/null differ diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.plg b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.plg deleted file mode 100644 index c950d9e5d..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.plg +++ /dev/null @@ -1,34 +0,0 @@ - - -
-

Erstellungsprotokoll

-

---------------------Konfiguration: MNGView - Win32 Release-------------------- -

-

Befehlszeilen

-Erstellen der temporären Datei "C:\WINDOWS\TEMP\RSPF386.TMP" mit Inhalten -[ -/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Release/MNGView.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c -"F:\Nikgames\Libmng\contrib\MNGView\Main.cpp" -] -Creating command line "cl.exe @C:\WINDOWS\TEMP\RSPF386.TMP" -Erstellen der temporären Datei "C:\WINDOWS\TEMP\RSPF387.TMP" mit Inhalten -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/MNGView.pdb" /machine:I386 /out:"MNGView.exe" -.\Release\Main.obj -.\Release\mng.obj -.\Release\Main.res -] -Erstellen der Befehlzeile "link.exe @C:\WINDOWS\TEMP\RSPF387.TMP" -

Ausgabefenster

-Kompilierung läuft... -Main.cpp -Linker-Vorgang läuft... - - - -

Ergebnisse

-MNGView.exe - 0 Fehler, 0 Warnung(en) -
- - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Main.cpp b/Engine/lib/lmng/contrib/msvc/mngview/Main.cpp deleted file mode 100644 index bf1f98d6b..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/Main.cpp +++ /dev/null @@ -1,334 +0,0 @@ -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// -// MNGView Sample Application for VC6: -// Loads all MNG/JNG/PNG Files LibMNG can do -// Can save a single Frame to PNG Format. -// -// This code is public domain. -// Created by Nikolaus Brennig, November 14th, 2000. -// virtualnik@nol.at -// http://cust.nol.at/ppee -// -// Tab: 4 -// -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- - -#define WIN32_LEAN_AND_MEAN -#include "Main.h" - - -//--------------------------------------------------------------------------------------------- -// Libs (its up to you to make VC find the libs; set the paths in the options): -//--------------------------------------------------------------------------------------------- -#pragma comment(lib,"comctl32.lib") -#pragma comment(lib,"libmng.lib") -#pragma comment(lib,"libjpeg.lib") -#pragma comment(lib,"libz.lib") -#pragma comment(lib,"lcmsstat.lib") - - -//--------------------------------------------------------------------------------------------- -// Vars: -//--------------------------------------------------------------------------------------------- -HWND hPicWin; -HINSTANCE hinst; -HMENU hMenu; -HDC MemDC, hdc; -HBITMAP MemImage, DefaultMemImage; -ANIMFILE AnimFile; -RECT rcRect; -OPENFILENAME ofn, sfn; -int W, H, Bits; -int dx, dy; -char OFNFile[1024]; -char CurDir[1024]; - - -//--------------------------------------------------------------------------------------------- -// Loads a file: -//--------------------------------------------------------------------------------------------- -VOID LoadOFN( HWND hwnd ) -{ - GetCurrentDirectory( sizeof(CurDir), CurDir ); - - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwnd; - ofn.lpstrFile = OFNFile; - ofn.nMaxFile = sizeof(OFNFile); - ofn.lpstrFilter = "Network Graphics (*.mng;*.jng:*.png)\0*.mng;*.jng;*.png\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = NULL; - ofn.lpstrInitialDir = CurDir; - ofn.lpstrTitle = "Load:"; - ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | - OFN_HIDEREADONLY | OFN_NONETWORKBUTTON; - - // Display the Open dialog box. - if( GetOpenFileName(&ofn) ) - { - dx = dy = W = H = 0; - if( AnimFile.isAnimation == 1 ) CleanUpMNG(); - LoadMNG( OFNFile, hwnd, hdc ); - } -} - - -//--------------------------------------------------------------------------------------------- -// Saves a file: -//--------------------------------------------------------------------------------------------- -VOID SaveSFN( HWND hwnd ) -{ - GetCurrentDirectory( sizeof(CurDir), CurDir ); - - // Initialize OPENFILENAME - sfn.lStructSize = sizeof(OPENFILENAME); - sfn.hwndOwner = hwnd; - sfn.lpstrFile = OFNFile; - sfn.nMaxFile = sizeof(OFNFile); - sfn.lpstrFilter = "PNG\0*.png\0"; - sfn.nFilterIndex = 1; - sfn.lpstrFileTitle = 0; - sfn.nMaxFileTitle = 0; - sfn.lpstrInitialDir = CurDir; - sfn.lpstrTitle = "Save an Image"; - sfn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_NONETWORKBUTTON; - - // Display the Open dialog box. - if( GetSaveFileName(&sfn) ) - { - SaveMNG( OFNFile, MemDC, MemImage ); - } -} - - -//--------------------------------------------------------------------------------------------- -// For stringhandling... -//--------------------------------------------------------------------------------------------- -VOID catpath( char *dst, const char *src ) -{ - int len = lstrlen(dst); - if( len > 0 && (dst[len-1] != '\\' && dst[len-1] != '/') ) lstrcat( dst, "\\" ); - lstrcat( dst, src ); -} - - -//--------------------------------------------------------------------------------------------- -// MainWindow WindowProc -//--------------------------------------------------------------------------------------------- -long WINAPI WindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) -{ - switch( message ) - { - case WM_TIMER: - { - int wTimerID = wParam; - if( AnimFile.isAnimation == 1 && wTimerID == 2 ) - { - UpdateMNG(); - SendMessage( hPicWin, WM_PAINT, 0, 0 ); - } - } - break; - - case WM_COMMAND: - switch( LOWORD(wParam) ) - { - case FILE_OPEN: - LoadOFN(hwnd); - break; - - case FILE_SAVE: - SaveSFN(hwnd); - break; - - case FILE_EXIT: - DestroyWindow( hPicWin ); - break; - - case HELP_ABOUT: - Warning( - "MNGView Sample Application for VC6.\n" \ - "This Code is Public Domain.\n" \ - "Created by Nikolaus Brennig." - ); - break; - } - break; - - case WM_ERASEBKGND: - return 0L; - - case WM_PAINT: - // GetDC: - GetClientRect( hPicWin, &rcRect ); - hdc = GetDC( hPicWin ); - - if( MemDC == 0 ) - { - BitBlt( hdc, 0, 0, rcRect.right, rcRect.bottom, MemDC, 0, 0, BLACKNESS ); - ReleaseDC( hPicWin, hdc ); - break; - } - - // Erase: - // Upper area... - BitBlt( hdc, 0, 0, rcRect.right, (0+dy), MemDC, 0, 0, BLACKNESS ); - // Lower area... - BitBlt( hdc, 0, (0+dy)+H, rcRect.right, rcRect.bottom - ((0+dy)+H), MemDC, 0, 0, BLACKNESS ); - // Left area... - BitBlt( hdc, 0, 0, (0+dx), rcRect.bottom, MemDC, 0, 0, BLACKNESS ); - // Right area... - BitBlt( hdc, (0+dx)+W, 0, rcRect.right, rcRect.bottom, MemDC, 0, 0, BLACKNESS ); - - // Show Imageframe: - BitBlt( hdc, dx, dy, W, H, MemDC, 0, 0, SRCCOPY ); - - // Release DC... - ReleaseDC( hPicWin, hdc ); - break; - - case WM_HSCROLL: - { - int nScrollCode = (int) LOWORD(wParam); // scroll bar value - if( nScrollCode == SB_LINELEFT ) dx += 10; - if( nScrollCode == SB_LINERIGHT ) dx -= 10; - SendMessage( hwnd, WM_PAINT, 0, 0 ); - } - break; - - case WM_VSCROLL: - { - int nScrollCode = (int) LOWORD(wParam); // scroll bar value - if( nScrollCode == SB_LINEUP ) dy += 10; - if( nScrollCode == SB_LINEDOWN ) dy -= 10; - SendMessage( hwnd, WM_PAINT, 0, 0 ); - } - break; - - case WM_GETMINMAXINFO: - ((MINMAXINFO*)lParam)->ptMinTrackSize.x = 550; - ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 450; - return 0L; - - case WM_DESTROY: - if( AnimFile.isAnimation == 1 ) - CleanUpMNG(); - if( hMenu ) DestroyMenu( hMenu ); - PostQuitMessage(0); - return 0L; - } - - return DefWindowProc( hwnd, message, wParam, lParam ); -} - - -//--------------------------------------------------------------------------------------------- -// ok, initen wir mal das Window mit den Styleparametern... -//--------------------------------------------------------------------------------------------- -BOOL InitApplication( HINSTANCE hInstance, int nCmdShow, LPSTR lpCommandLine ) -{ - WNDCLASSEX wcex; - - ZeroMemory( &wcex, sizeof(wcex) ); - wcex.cbSize = sizeof(wcex); - wcex.style = 0; - wcex.lpfnWndProc = WindowProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(APPICON)); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = HBRUSH(GetStockObject(BLACK_BRUSH)); - wcex.lpszMenuName = 0; - wcex.lpszClassName = "MNGViewClass"; - wcex.hIconSm = 0; - - if( !RegisterClassEx(&wcex) ) - return Error( "RegisterClass failed!" ); - - // Init: - W = 0; - H = 0; - AnimFile.isAnimation = 0; - MemDC = 0; - MemImage = 0; - DefaultMemImage = 0; - - // Create the Window: - hPicWin = CreateWindowEx( - 0, - "MNGViewClass", - TITLE, - WS_OVERLAPPEDWINDOW|WS_SYSMENU|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_HSCROLL|WS_VSCROLL, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, NULL, - hInstance, - NULL - ); - if( !hPicWin ) - return Error( "Couldn't create Window!" ); - - // Load our menu... - hMenu = LoadMenu( GetModuleHandle(NULL), MAKEINTRESOURCE(THEMENU) ); - if( hMenu == 0 ) Warning( "Unable to load Menu!" ); - SetMenu( hPicWin, hMenu ); - - InitCommonControls(); - - UpdateWindow(hPicWin); - ShowWindow(hPicWin, SW_NORMAL); - - return true; -} - - -//--------------------------------------------------------------------------------------------- -// Ok. Das ist die Startfunktion, die wird als erstes von Windows augerufen... -//--------------------------------------------------------------------------------------------- -int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) -{ - MSG msg; - - hinst = hInstance; - - if( !InitApplication(hInstance, nCmdShow, lpCmdLine) ) - return -1; - - while( GetMessage(&msg, NULL, 0, 0) ) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - - -//--------------------------------------------------------------------------------------------- -// Error -//--------------------------------------------------------------------------------------------- -BOOL Error( const char *err ) -{ - MessageBox( hPicWin, err, TITLE, MB_ICONHAND+MB_OK ); - DestroyWindow( hPicWin ); - - return FALSE; -} - - -//--------------------------------------------------------------------------------------------- -// Warning -//--------------------------------------------------------------------------------------------- -BOOL Warning( const char *err ) -{ - MessageBox( hPicWin, err, TITLE, MB_ICONHAND+MB_OK ); - - return FALSE; -} - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Main.h b/Engine/lib/lmng/contrib/msvc/mngview/Main.h deleted file mode 100644 index 9d9743f4d..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/Main.h +++ /dev/null @@ -1,75 +0,0 @@ -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// -// MNGView Sample Application for VC6: -// Loads all MNG/JNG/PNG Files LibMNG can do -// Can save a single Frame to PNG Format. -// -// This code is public domain. -// Created by Nikolaus Brennig, November 14th, 2000. -// virtualnik@nol.at -// http://cust.nol.at/ppee -// -// Tab: 4 -// -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- - -#ifndef _MAIN_H -#define _MAIN_H - - -//--------------------------------------------------------------------------------------------- -// Includes: -//--------------------------------------------------------------------------------------------- -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include "Resource.h" - - -//--------------------------------------------------------------------------------------------- -// Defines: -//--------------------------------------------------------------------------------------------- -#define TITLE "MNGView Sample Application 1.0" - - -//--------------------------------------------------------------------------------------------- -// global Vars: -//--------------------------------------------------------------------------------------------- -extern HWND hPicWin; -extern HINSTANCE hinst; -extern HDC MemDC, hdc; -extern HBITMAP MemImage, DefaultMemImage; -extern int W, H, Bits; - - -typedef struct -{ - int MaxFrame; - int CurFrame; - int Delay; - int isAnimation; -} ANIMFILE; -extern ANIMFILE AnimFile; - - -//--------------------------------------------------------------------------------------------- -// Function prototypes: -//--------------------------------------------------------------------------------------------- -BOOL Error( const char *err ); -BOOL Warning( const char *err ); -VOID catpath( char *dst, const char *src ); - - -// MNG.cpp specific: -VOID LoadMNG( LPSTR Filename, HWND hwnd, HDC hdc ); -VOID SaveMNG( LPSTR Filename, HDC hdc, HBITMAP hBmp ); - -VOID UpdateMNG(); -VOID CleanUpMNG(); - - -#endif \ No newline at end of file diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Main.rc b/Engine/lib/lmng/contrib/msvc/mngview/Main.rc deleted file mode 100644 index dc4df8de1..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/Main.rc +++ /dev/null @@ -1,105 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "Windows.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Englisch (USA) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -THEMENU MENU DISCARDABLE -BEGIN - POPUP "File" - BEGIN - MENUITEM "Open", FILE_OPEN - MENUITEM "Save", FILE_SAVE - MENUITEM SEPARATOR - MENUITEM "Exit", FILE_EXIT - END - POPUP "Help" - BEGIN - MENUITEM "About", HELP_ABOUT - END -END - -#endif // Englisch (USA) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Deutsch (Österreich) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -APPICON ICON DISCARDABLE "MNG.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""Windows.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Deutsch (Österreich) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Mng.ico b/Engine/lib/lmng/contrib/msvc/mngview/Mng.ico deleted file mode 100644 index 9016eafbb..000000000 Binary files a/Engine/lib/lmng/contrib/msvc/mngview/Mng.ico and /dev/null differ diff --git a/Engine/lib/lmng/contrib/msvc/mngview/mng.cpp b/Engine/lib/lmng/contrib/msvc/mngview/mng.cpp deleted file mode 100644 index dbfc56a01..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/mng.cpp +++ /dev/null @@ -1,615 +0,0 @@ -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// -// MNGView Sample Application for VC6: -// Loads all MNG/JNG/PNG Files LibMNG can do -// Can save a single Frame to PNG Format. -// -// This code is public domain. -// Created by Nikolaus Brennig, November 14th, 2000. -// virtualnik@nol.at -// http://cust.nol.at/ppee -// -// Tab: 4 -// -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -#define WIN32_LEAN_AND_MEAN -#include "Main.h" -#include - - -//--------------------------------------------------------------------------------------------- -// VARS: -//--------------------------------------------------------------------------------------------- -typedef struct -{ - FILE *file; - LPSTR filename; - mng_uint32 delay; -} mngstuff; - -int lineWidth; -BYTE *mngdestbuffer; -mngstuff *mymngstuff; -mng_handle Curmng; - - - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -//--------------------------------------------------------------------------------------------- -// callbacks for the mng decoder: -//--------------------------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// - -//--------------------------------------------------------------------------------------------- -// memory allocation; data must be zeroed -//--------------------------------------------------------------------------------------------- -mng_ptr mymngalloc( mng_uint32 size ) -{ - return (mng_ptr)calloc(1, size); -} - - -//--------------------------------------------------------------------------------------------- -// memory deallocation -//--------------------------------------------------------------------------------------------- -void mymngfree(mng_ptr p, mng_uint32 size) -{ - free(p); -} - - -//--------------------------------------------------------------------------------------------- -// Stream open: -//--------------------------------------------------------------------------------------------- -mng_bool mymngopenstream(mng_handle mng) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // open the file - mymng->file = fopen( mymng->filename, "rb" ); - if( mymng->file == NULL ) - { - char temp[100]; - sprintf( temp, "Unable to open File: %s", mymng->filename ); - Warning( temp ); - return MNG_FALSE; - } - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// Stream open for Writing: -//--------------------------------------------------------------------------------------------- -mng_bool mymngopenstreamwrite(mng_handle mng) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // open the file - mymng->file = fopen( mymng->filename, "wb" ); - if( mymng->file == NULL ) - { - Warning( "unable to open file!" ); - return MNG_FALSE; - } - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// Stream close: -//--------------------------------------------------------------------------------------------- -mng_bool mymngclosestream(mng_handle mng) -{ - return MNG_TRUE; // We close the file ourself, mng_cleanup doesnt seem to do it... -} - - -//--------------------------------------------------------------------------------------------- -// feed data to the decoder -//--------------------------------------------------------------------------------------------- -mng_bool mymngreadstream( mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32 *bytesread ) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // read the requested amount of data from the file - *bytesread = fread( buffer, sizeof(BYTE), size, mymng->file ); - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// the header's been read. set up the display stuff -//--------------------------------------------------------------------------------------------- -mng_bool mymngprocessheader( mng_handle mng, mng_uint32 width, mng_uint32 height ) -{ - // Store values: - W = width; H = height; - Bits = 24; - lineWidth = ((((W * Bits) + 31) >> 5) << 2); - - // Create decoderbuffer: - mngdestbuffer = new BYTE[lineWidth*H]; - if( mngdestbuffer == 0 ) Warning( "Out of Memory!" ); - - // Create the MemoryBitmap now, we store there the image... - if( DefaultMemImage ) SelectObject( MemDC, DefaultMemImage ); - if( MemDC ) DeleteDC( MemDC ); - if( MemImage ) DeleteObject( MemImage ); - hdc = GetDC( hPicWin ); - MemDC = CreateCompatibleDC( 0 ); - MemImage = CreateCompatibleBitmap( hdc, W, H ); - DefaultMemImage = (HBITMAP)SelectObject( MemDC, MemImage ); - ReleaseDC( hPicWin, hdc ); - - // Set output style: - mng_set_canvasstyle( mng, MNG_CANVAS_BGR8 ); - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// return a row pointer for the decoder to fill -//--------------------------------------------------------------------------------------------- -mng_ptr mymnggetcanvasline( mng_handle mng, mng_uint32 line ) -{ - return (mng_ptr)(mngdestbuffer + (lineWidth*(H-1-line))); -} - - -//--------------------------------------------------------------------------------------------- -// timer -//--------------------------------------------------------------------------------------------- -mng_uint32 mymnggetticks(mng_handle mng) -{ - return (mng_uint32)GetTickCount(); -} - - -//--------------------------------------------------------------------------------------------- -// Refresh: -//--------------------------------------------------------------------------------------------- -mng_bool mymngrefresh( mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h ) -{ - PBITMAPINFO bmpi = (PBITMAPINFO)LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER)); - bmpi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmpi->bmiHeader.biWidth = W; - bmpi->bmiHeader.biHeight = H; - bmpi->bmiHeader.biPlanes = 1; - bmpi->bmiHeader.biCompression = BI_RGB; - bmpi->bmiHeader.biBitCount = Bits; - bmpi->bmiHeader.biSizeImage = 0; - bmpi->bmiHeader.biClrUsed = 0; - bmpi->bmiHeader.biClrImportant = 0; - - // Now blt the Image onto our MemDC... - StretchDIBits( MemDC, 0, 0, W, H, 0, 0, W, H, mngdestbuffer, bmpi, 0, SRCCOPY ); - LocalFree((PBITMAPINFO)bmpi); - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// interframe delay callback -//--------------------------------------------------------------------------------------------- -mng_bool mymngsettimer(mng_handle mng, mng_uint32 msecs) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // set the timer for when the decoder wants to be woken - mymng->delay = msecs; - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// Error Callback; -//--------------------------------------------------------------------------------------------- -mng_bool mymngerror( - mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text - ) -{ - char chunk[5]; - - // pull out the chuck type as a string - // FIXME: does this assume unsigned char? - chunk[0] = (char)((chunktype >> 24) & 0xFF); - chunk[1] = (char)((chunktype >> 16) & 0xFF); - chunk[2] = (char)((chunktype >> 8) & 0xFF); - chunk[3] = (char)((chunktype ) & 0xFF); - chunk[4] = '\0'; - - // output the error: - char temp[1000]; - sprintf( temp, "error playing chunk %s (%d)", chunk, chunkseq ); - Warning( temp ); - - // No need for anymore decoding: - KillTimer( hPicWin, 2 ); - - // error occured; - return MNG_FALSE; -} - - -//--------------------------------------------------------------------------------------------- -// Load a MNG/JNG/PNG file: -//--------------------------------------------------------------------------------------------- -VOID LoadMNG( LPSTR Filename, HWND hwnd, HDC hdc ) -{ - // allocate our stream data structure - mymngstuff = (mngstuff*)calloc(1, sizeof(*mymngstuff)); - if( mymngstuff == NULL ) - { - Warning( "Unable to allocate MNG struct!" ); - return; - } - - // pass the name of the file we want to play - mymngstuff->filename = Filename; - - // set up the mng decoder for our stream - Curmng = mng_initialize(mymngstuff, mymngalloc, mymngfree, MNG_NULL); - if(Curmng == MNG_NULL) - { - free(mymngstuff); - Warning( "MNG Init Error!" ); - return; - } - - // No need to store chunks: - mng_set_storechunks(Curmng, MNG_FALSE); - - // Set the colorprofile, lcms uses this: - mng_set_srgb( Curmng, MNG_TRUE ); - char DestDir[2048]; - SearchPath( NULL, "MNGVIEW.EXE", NULL, sizeof(DestDir), DestDir, NULL ); - lstrcpyn( DestDir, DestDir, lstrlen(DestDir)-lstrlen("MNGVIEW.EXE") ); - catpath( DestDir, "sRGB.icm" ); - FILE *RGBfile = fopen( DestDir, "rb" ); - if( RGBfile == 0 ) - { - mng_cleanup(&Curmng); - free(mymngstuff); - Warning( "Need file \"sRGB.icm\" !" ); - return; - } - fclose(RGBfile); - mng_set_outputprofile(Curmng, DestDir); - - // Set white as background color: - WORD Red = (255 << 8) + 255; - WORD Green = (255 << 8) + 255; - WORD Blue = (255 << 8) + 255; - mng_set_bgcolor( Curmng, Red, Green, Blue ); - - // If PNG Background is available, use it: - mng_set_usebkgd( Curmng, MNG_TRUE ); - - // set the callbacks - mng_setcb_errorproc(Curmng, mymngerror); - mng_setcb_openstream(Curmng, mymngopenstream); - mng_setcb_closestream(Curmng, mymngclosestream); - mng_setcb_readdata(Curmng, mymngreadstream); - mng_setcb_gettickcount(Curmng, mymnggetticks); - mng_setcb_settimer(Curmng, mymngsettimer); - mng_setcb_processheader(Curmng, mymngprocessheader); - mng_setcb_getcanvasline(Curmng, mymnggetcanvasline); - mng_setcb_refresh(Curmng, mymngrefresh); - - // Read the stuff: - mng_readdisplay(Curmng); - - AnimFile.CurFrame = mng_get_layercount( Curmng ); - AnimFile.MaxFrame = mng_get_framecount( Curmng ); - AnimFile.isAnimation = 1; - AnimFile.Delay = mymngstuff->delay; - - // Start the whole thing: - SetTimer( hPicWin, 2, mymngstuff->delay, 0 ); -} - - -//--------------------------------------------------------------------------------------------- -// Called when loading a new file or Appquit: -//--------------------------------------------------------------------------------------------- -void CleanUpMNG() -{ - KillTimer( hPicWin, 2 ); - mng_cleanup(&Curmng); - fclose( mymngstuff->file ); - free(mymngstuff); - delete [] mngdestbuffer; -} - - -//--------------------------------------------------------------------------------------------- -// Called when timer says next frame/layer/update is needed: -//--------------------------------------------------------------------------------------------- -void UpdateMNG() -{ - mymngstuff->delay = 0; - if( MNG_NEEDTIMERWAIT == mng_display_resume(Curmng) ) - { - KillTimer( hPicWin, 2 ); - SetTimer( hPicWin, 2, mymngstuff->delay, 0 ); - } - else - { - CleanUpMNG(); - AnimFile.CurFrame = -1; - AnimFile.MaxFrame = -1; - AnimFile.isAnimation = -1; - AnimFile.Delay = -1; - } -} - - - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -//--------------------------------------------------------------------------------------------- -// MNG WRITING STUFF: -//--------------------------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -int OffsetX=0,OffsetY=0,OffsetW=0,OffsetH=0; -BYTE *srcbuffer=0, *tmpbuffer; - - -//--------------------------------------------------------------------------------------------- -// Callback for writing data: -//--------------------------------------------------------------------------------------------- -mng_bool mymngwritedata( mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize, mng_uint32 *iWritten ) -{ - mngstuff *pMydata = (mngstuff*)mng_get_userdata(hMNG); - - *iWritten = fwrite( pBuf, sizeof(BYTE), iSize, pMydata->file ); - - if( *iWritten < iSize ) - { - Warning( "write error" ); - return MNG_FALSE; - } - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// swap Rs and Bs... -//--------------------------------------------------------------------------------------------- -BOOL RGBFromBGR( BYTE *buf, UINT widthPix, UINT height ) -{ - UINT col, row; - LPBYTE pRed, pBlu; - BYTE tmp; - - if (buf==NULL)return FALSE; - - INT TmpRow = 0; - INT WidthBytes = widthPix*3; - if(WidthBytes & 0x003) WidthBytes = (WidthBytes | 3) + 1; - INT OurCol = 0; - for( row=0; rowbmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biWidth = bmp.bmWidth; - pbmi->bmiHeader.biHeight = -bmp.bmHeight; - pbmi->bmiHeader.biPlanes = bmp.bmPlanes; - pbmi->bmiHeader.biBitCount = 24; - pbmi->bmiHeader.biCompression = BI_RGB; - pbmi->bmiHeader.biSizeImage = LineWidth * H * FrameCount; - pbmi->bmiHeader.biClrImportant = 0; - - // Alloc Memory... - srcbuffer = 0; - srcbuffer = new BYTE[LineWidth*H*FrameCount]; - if( srcbuffer == 0 ) - Warning( "srcbuffer == 0!" ); - - // get the buffer and modify the format: - if( 0 == GetDIBits( MemDC, hBmp2, 0, (WORD) (H*FrameCount), srcbuffer, pbmi, 0 ) ) - Warning( "no GetDIBits!!!" ); - RGBFromBGR( srcbuffer, W, H*FrameCount ); - if( srcbuffer == 0 ) - Warning( "srcbuffer == 0!" ); - - // Freee. - LocalFree((PBITMAPINFO)pbmi); -} - - -//--------------------------------------------------------------------------------------------- -// Writes a single PNG datastream -//--------------------------------------------------------------------------------------------- -VOID WritePNG( mng_handle hMNG, int Frame, int FrameCount ) -{ - BYTE *dstbuffer; - INT LineWidth; - INT WidthBytes; - - OffsetX=0; OffsetY=0; OffsetW=W; OffsetH=H; - - // Get WidthBytes... - WidthBytes = W*3; - LineWidth = W*3; - if(LineWidth & 0x003) LineWidth = (LineWidth | 3) + 1; - - tmpbuffer = new BYTE[(WidthBytes+1)*OffsetH]; - if( tmpbuffer == 0 ) Warning( "Out of Memory!" ); - - // Write DEFI chunk. - mng_putchunk_defi( hMNG, 0, 0, 0, MNG_TRUE, OffsetX, OffsetY, MNG_FALSE, 0, 0, 0, 0 ); - - // Write Header: - mng_putchunk_ihdr( - hMNG, - OffsetW, OffsetH, - MNG_BITDEPTH_8/*iBitdepth*/, - MNG_COLORTYPE_RGB/*iColortype*/, - MNG_COMPRESSION_DEFLATE/*iCompression*/, - MNG_FILTER_ADAPTIVE/*iFilter*/, - MNG_INTERLACE_NONE /*iInterlace*/ - ); - - // transfer data, add Filterbyte: - for( int Row=0; Row No Filter. - tmpbuffer[Row*(WidthBytes+1)]=0; - - // Copy the scanline: - memcpy( - tmpbuffer+Row*(WidthBytes+1)+1, - srcbuffer+((OffsetY+Row)*(LineWidth))+OffsetX, - WidthBytes - ); - } - - // Free srcbuffer if not animated GIF: - delete [] srcbuffer; - - // Compress data with ZLib (Deflate): - dstbuffer = new BYTE[(WidthBytes+1)*OffsetH]; - if( dstbuffer == 0 ) Warning( "Out of Memory!" ); - DWORD dstbufferSize=(WidthBytes+1)*OffsetH; - - // Compress data: - if( Z_OK != compress2( - (Bytef *)dstbuffer, (ULONG *)&dstbufferSize, - (const Bytef*)tmpbuffer, (ULONG) (WidthBytes+1)*OffsetH, - 9 - )) Warning( "Unable to compress imagedata!" ); - - // Write Data into MNG File: - mng_putchunk_idat( hMNG, dstbufferSize, (mng_ptr*)dstbuffer); - mng_putchunk_iend(hMNG); - - // Free the stuff: - delete [] tmpbuffer; - delete [] dstbuffer; -} - - -//--------------------------------------------------------------------------------------------- -// Writes a MNG (24bit) -//--------------------------------------------------------------------------------------------- -VOID SaveMNG( LPSTR Filename, HDC hdc, HBITMAP hBmp ) -{ - mng_handle hMNG; - - // check if currently a MNG file is loaded: - if( AnimFile.isAnimation == 1 ) - CleanUpMNG(); - - // Creates the srcbuffer for imagedata: - CreateSrcBuffer( 0, 1, hBmp ); - - // allocate our stream data structure - mymngstuff = (mngstuff*)calloc(1, sizeof(*mymngstuff)); - if( mymngstuff == NULL ) - { - Warning( "Cannot allocate data buffer." ); - return; - } - - // pass the name of the file we want to play - mymngstuff->filename = Filename; - - // init the lib: - hMNG = mng_initialize((mng_ptr)mymngstuff, mymngalloc, mymngfree, MNG_NULL); - if( !hMNG ) - { - Warning( "Cannot initialize libmng." ); - return; - } - else - { - mng_setcb_openstream(hMNG, mymngopenstreamwrite ); - mng_setcb_closestream(hMNG, mymngclosestream); - mng_setcb_writedata(hMNG, mymngwritedata); - - // Write File: - mng_create(hMNG); - - // Just a single Frame (save a normal PNG): - WritePNG( hMNG, 0, 1 ); - - // Now write file: - mng_write(hMNG); - - // Free the stuff: - fclose( mymngstuff->file ); - mng_cleanup(&hMNG); - } - - free( mymngstuff ); -} - - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/resource.h b/Engine/lib/lmng/contrib/msvc/mngview/resource.h deleted file mode 100644 index 281352369..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/resource.h +++ /dev/null @@ -1,22 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Main.rc -// -#define THEMENU 102 -#define APPICON 200 -#define FILE_OPEN 40002 -#define FILE_EXIT 40003 -#define HELP_ABOUT 40004 -#define FILE_SAVE 40005 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40006 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Engine/lib/lmng/contrib/msvc/mngview/sRGB.icm b/Engine/lib/lmng/contrib/msvc/mngview/sRGB.icm deleted file mode 100644 index 7f9d18d09..000000000 Binary files a/Engine/lib/lmng/contrib/msvc/mngview/sRGB.icm and /dev/null differ diff --git a/Engine/lib/lmng/contrib/msvc/win32dll/README.txt b/Engine/lib/lmng/contrib/msvc/win32dll/README.txt deleted file mode 100644 index d0c079a64..000000000 --- a/Engine/lib/lmng/contrib/msvc/win32dll/README.txt +++ /dev/null @@ -1,23 +0,0 @@ -MSVC project files for libmng.dll ---------------------------------- - -Contribution by Chad Austin -(This README by Gerard Juyn) - -These project files were kindly donated by Chad. Please note that it -requires jpeglib, zlib and lcms to be in a directory which is at the -same level as the libmng directory. - -I'm not sure how things work, since I don't have access to MSVC, so -it could be this needs a little tweaking, considering the location -where I put contributions. - -As to the DLL itself. If you want to distribute libmng.dll with your -Application and store it in the standard Windows system-directory, you -*must* use the libmng.dll provided in this distribution. *Not* a dll -you have compiled yourself, unless you place this dll in the same -directory as your own Application!!! - -Thanks, - -Gerard diff --git a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsp b/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsp deleted file mode 100644 index 70fb028d8..000000000 --- a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsp +++ /dev/null @@ -1,465 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libmng" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libmng - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libmng.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libmng.mak" CFG="libmng - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libmng - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libmng - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libmng - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W2 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /D "MNG_BUILD_DLL" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "libmng - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W2 /Gm /GX /ZI /Od /I "zlib" /I "jpeg" /I "lcms/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /D "MNG_BUILD_DLL" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "libmng - Win32 Release" -# Name "libmng - Win32 Debug" -# Begin Group "mng" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\libmng_callback_xs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_chunk_io.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_chunk_prc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_chunk_xs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_cms.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_display.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_dither.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_error.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_hlapi.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_jpeg.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_object_prc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_pixels.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_prop_xs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_read.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_trace.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_write.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_zlib.c -# End Source File -# End Group -# Begin Group "jpeg" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcapimin.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcapistd.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jccoefct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jccolor.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcdctmgr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jchuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcinit.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcmainct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcmarker.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcmaster.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcomapi.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcparam.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcphuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcprepct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcsample.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jctrans.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdapimin.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdapistd.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdatadst.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdatasrc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdcoefct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdcolor.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jddctmgr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdhuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdinput.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmainct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmarker.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmaster.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmerge.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdphuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdpostct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdsample.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdtrans.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jerror.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jfdctflt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jfdctfst.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jfdctint.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctflt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctfst.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctint.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctred.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jmemmgr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jmemnobs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jquant1.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jquant2.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jutils.c -# End Source File -# End Group -# Begin Group "lcms" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSCNVRT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSERR.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSGAMMA.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSGMT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsintrp.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsio1.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSLUT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSMATSH.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsmtrx.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSPACK.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmspcs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSWTPNT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsxform.c -# End Source File -# End Group -# Begin Group "zlib" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\..\zlib\adler32.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\compress.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\crc32.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\deflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\infblock.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\infcodes.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\inffast.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\inflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\inftrees.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\infutil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\trees.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\uncompr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\zutil.c -# End Source File -# End Group -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsw b/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsw deleted file mode 100644 index 40148e03b..000000000 --- a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "libmng"=".\libmng.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/doc/Plan1.png b/Engine/lib/lmng/doc/Plan1.png deleted file mode 100644 index ced551727..000000000 Binary files a/Engine/lib/lmng/doc/Plan1.png and /dev/null differ diff --git a/Engine/lib/lmng/doc/Plan2.png b/Engine/lib/lmng/doc/Plan2.png deleted file mode 100644 index 3619ea663..000000000 Binary files a/Engine/lib/lmng/doc/Plan2.png and /dev/null differ diff --git a/Engine/lib/lmng/doc/doc.readme b/Engine/lib/lmng/doc/doc.readme deleted file mode 100644 index e92e93cb5..000000000 --- a/Engine/lib/lmng/doc/doc.readme +++ /dev/null @@ -1,19 +0,0 @@ -This directory hosts the documentation for libmng. - -You will find a lot of useful info on the web-site: -http://www.libmng.com - -Man-pages are in the man sub-directory - -RPM specification files are in the RPM sub-directory - -Files in this directory: - -- libmng.txt - -Description of the library proper and its usage - -- Plan1.png & Plan2.png - -Visual representation of the functional and technical -design of the library (in PNG format of course!) diff --git a/Engine/lib/lmng/doc/libmng.txt b/Engine/lib/lmng/doc/libmng.txt deleted file mode 100644 index b9e9bc4b8..000000000 --- a/Engine/lib/lmng/doc/libmng.txt +++ /dev/null @@ -1,1107 +0,0 @@ -libmng - Multiple-image Network Graphics (MNG) Reference Library 1.0.9 - -DESCRIPTION -The libmng library supports decoding, displaying, encoding, and various -other manipulations of the Multiple-image Network Graphics (MNG) format -image files. It uses the zlib compression library, and optionally the -JPEG library by the Independant JPEG Group (IJG) and/or -lcms (little cms), a color-management library by Marti Maria Saguer. - - -I. Introduction - -This file describes how to use and modify the MNG reference library -(known as libmng) for your own use. There are seven sections to this -file: introduction, callbacks, housekeeping, reading, displaying, -writing, and modification and configuration notes for various special -platforms. We assume that libmng is already installed; see the -INSTALL.README file for instructions on how to install libmng. - -Libmng was written to support and promote the MNG specification. - -The latest MNG specification (currently 1.0) is available at - http://www.libpng.org/pub/mng/ - -Other information about MNG can be found at the MNG home page at - http://www.libpng.org/pub/mng/ - -The latest version of libmng can be found at its own homepage at - http://www.libmng.com/ - -In most cases the library will not need to be changed. -For standardization purposes the library contains both a Windows DLL -and a makefile for building a shared library (SO). The library is -written in C, but an interface for Borland Delphi is also available. - -Libmng has been designed to handle multiple sessions at one time, -to be easily modifiable, to be portable to the vast majority of -machines (ANSI, K&R, 32-, and 64-bit) available, and to be easy -to use. - -Libmng uses zlib for its compression and decompression of MNG files. -Further information about zlib, and the latest version of zlib, can be -found at the zlib home page, . -The zlib compression utility is a general purpose utility that is -useful for more than MNG/PNG files, and can be used without libmng. -See the documentation delivered with zlib for more details. - -Libmng optionally uses the JPEG library by the Independant JPEG Group -(IJG). This library is used for the JNG sub-format, which is part of -the MNG specification, and allows for inclusion of JPEG decoded and -thus highly compressed (photographic) images. -Further information about the IJG JPEG library and the latest sources -can be found at . - -Libmng can also optionally use the lcms (little CMS) library by -Marti Maria Saguer. This library provides an excellent color-management -system (CMS), which gives libmng the ability to provide full -color-correction for images with the proper color-information encoded. -Further information and the latest sources can be found at -. - -Libmng is thread safe, provided the threads are using different -handles as returned by the initialization call. -Each thread should have its own handle and thus its own image. -Libmng does not protect itself against two threads using the -same instance of a handle. - -The libmng.h header file is the single reference needed for programming -with libmng: - -#include - - -II. Callbacks - -Libmng makes extensive use of callback functions. This is meant to -keep the library as platform-independant and flexible as possible. -Actually, the first call you will make to the library, already contains -three parameters you can use to provide callback entry-points. - -Most functions must return a mng_bool (boolean). Returning MNG_FALSE -indicates the library the callback failed in some way and the library -will immediately return from whatever it was doing back to the -application. Returning MNG_TRUE indicates there were no problems and -processing can continue. - -Let's step through each of the possible callbacks. The sections on -reading, displaying and writing will also explain which callbacks are -needed when and where. - -- mng_ptr mng_memalloc (mng_size_t iLen) - -A very basic function which the library uses to allocate a memory-block -with the given size. A typical implementation would be: - - mng_ptr my_alloc (mng_size_t iLen) { - return calloc (1, iSize); - } - -Note that the library requires you to zero-out the memory-block!!! - -- void mng_memfree (mng_ptr pPtr, - mng_size_t iLen) - -Counterpart of the previous function. Typically: - - void my_free (mng_ptr pPtr, mng_size_t iLen) { - free (pPtr); - } - -- mng_bool mng_openstream (mng_handle hHandle) -- mng_bool mng_closestream (mng_handle hHandle) - -These are called by the library just before it starts to process -(either read or write) a file and just after the processing stops. -This is the recommended place to do I/O initialization & finalization. -Whether you do or not, is up to you. The library does not put any -meaning into the calls. They are simply provided for your convenience. - -- mng_bool mng_readdata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) - -This function is called when the library needs some more input while -reading an image. The reading process supports two modes: -Suspension-mode (SMOD) and non-suspension-mode (NSMOD). -See mng_set_suspensionmode() for a more detailed description. - -In NSMOD, the library requires you to return exactly the amount of bytes -requested (= iBuflen). Any lesser amount indicates the input file -is exhausted and the library will return a MNG_UNEXPECTEDEOF errorcode. - -In SMOD, you may return a smaller amount of bytes than requested. -This tells the library it should temporarily wait for more input to -arrive. The lib will return with MNG_NEEDMOREDATA, and will expect a -call to mng_read_resume() or mng_display_resume() next, as soon as -more input-data has arrived. - -For NSMOD this function could be as simple as: - - mng_bool my_read (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) { - *pRead = fread (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -- mng_bool mng_writedata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) - -This function is called during the mng_write() function to actually -output data to the file. There is no suspension-mode during write, -so the application must return the exact number of bytes the library -requests to be written. - -A typical implementation could be: - - mng_bool my_write (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) { - *pWritten = fwrite (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -- mng_bool mng_errorproc (mng_handle hHandle, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext) - -This function is called whenever an error is detected inside the -library. This may be caused by invalid input, callbacks indicating -failure, or wrongfully calling functions out of place. - -If you do not provide this callback the library will still return -an errorcode from the called function, and the mng_getlasterror() -function can be used to retrieve the other parameters. - -This function is currently only provided for convenience, but may -at some point be used to indicate certain errors may be acceptable, -and processing should continue. - -- mng_bool mng_traceproc (mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname) - -This function is provided to allow a functional analysis of the -library. This may be useful if you encounter certain errors and -cannot determine what the problem is. - -Almost all functions inside the library will activate this -callback with an appropriate function-name at the start and end -of the function. Please note that large images may generate an -enormous amount of calls. - -- mng_bool mng_processheader (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This function is called once the header information of an input- -image has been processed. At this point the image dimensions are -available and also some other properties depending on the type -of the image. Eg. for a MNG the frame-/layercount, playtime & -simplicity fields are known. - -The primary purpose of this callback is to inform the application -of the size of the image, and for the application to initialize -the drawing canvas to be used by the library. This is also a good -point to set the canvas-style. Eg. mng_set_canvasstyle(). - -- mng_bool mng_processtext (mng_handle hHandle, - mng_uint8 iType, - mng_pchar zKeyword, - mng_pchar zText, - mng_pchar zLanguage, - mng_pchar zTranslation) - -This callback is activated for each textual chunk in the input- -image. These are tEXt, zTXt & iTXt. It may be used to retain -specific comments for presentation to the user. - -- mng_bool mng_processsave (mng_handle hHandle) -- mng_bool mng_processseek (mng_handle hHandle, - mng_pchar zName) - -The purpose of these callbacks is to signal the processing of the -SAVE & SEEK chunks in a MNG input-file. This may be used in the -future to specify some special processing. At the moment these -functions are only provided as a signal. - -- mng_ptr mng_getcanvasline (mng_handle hHandle, - mng_uint32 iLinenr) -- mng_ptr mng_getbkgdline (mng_handle hHandle, - mng_uint32 iLinenr) -- mng_ptr mng_getalphaline (mng_handle hHandle, - mng_uint32 iLinenr) - -These callbacks are used to access the drawing canvas, background -canvas and an optional separate alpha-channel canvas. The latter is -used only with the MNG_CANVAS_RGB8_A8 canvas-style. - -If the getbkgdline() callback is not supplied the library will -composite full or partially transparent pixels in the image against -a specified background color. See mng_set_bgcolor() for more details. -If a chosen canvas-style includes an alpha-channel, this callback -is very likely not needed. - -The application is responsible for returning a pointer to a line of -pixels, which should be in the exact format as defined by the call -to mng_set_canvasstyle() and mng_set_bkgdstyle(), without gaps between -the representation of each pixel. - -- mng_bool mng_refresh (mng_handle hHandle, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This callback is called when the library has drawn a complete frame -onto the drawing canvas, and it is ready to be displayed. -The application is responsible for transferring the drawing canvas -from memory onto the actual output device. - -- mng_uint32 mng_gettickcount (mng_handle hHandle) - -This function should return the number of milliseconds on some internal -clock. The entire animation timing depends heavily on this function, -1and the number returned should be as accurate as possible. - -- mng_bool mng_settimer (mng_handle hHandle, - mng_uint32 iMsecs) - -This callback is activated every time the library requires a "pause". -Note that the function itself should NOT execute the wait. It should -simply store the time-field and allow the library to return. Libmng -will return with the MNG_NEEDTIMERWAIT code, indicating the callback -was called and it is now time to execute the pause. - -After the indicated number of milliseconds have elapsed, the application -should call mng_display_resume(), to resume the animation as planned. - -This method allows for both a real timer or a simple wait command in the -application. Whichever method you select, both the gettickcount() and -settimer() callbacks are crucial for proper animation timing. - -- mng_bool mng_processgamma (mng_handle hHandle, - mng_uint32 iGamma) -- mng_bool mng_processchroma (mng_handle hHandle, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) -- mng_bool mng_processsrgb (mng_handle hHandle, - mng_uint8 iRenderingintent) -- mng_bool mng_processiccp (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) -- mng_bool mng_processarow (mng_handle hHandle, - mng_uint32 iRowsamples, - mng_bool bIsRGBA16, - mng_ptr pRow) - -These callbacks are only required when you selected the MNG_APP_CMS -directive during compilation of the library. See the configuration -section for more details. - -- mng_bool mng_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) - -This callback is only used for the mng_iterate_chunks() function. -It is called exactly once for each chunk stored. - - -III. Housekeeping - - -> Memory management - -The library can use internal memory allocation/deallocation or use -provided callbacks for its memory management. The choice is made at -compilation time. See the section on customization for details. - -If internal management has been selected, the memory callback functions -need not be supplied. Even if you do supply them they will not be used. -The actual code used is similar to the code discussed in the callback -section: - - pPtr = calloc (1, iSize); - - free (pPtr); - -If your compiler does not support these functions, or you wish to monitor -the library's use of memory for certain reasons, you can choose to -compile the library with external memory management. In this case the -memory callback functions MUST be supplied, and should function as if the -above code was used. - - -> Initialization - -The basic initialization of the library is short and swift: - - myhandle = mng_initialize (myuserdata, my_alloc, - my_free, MNG_NULL); - if (myhandle == MNG_NULL) - /* process error */; - -The first field is an application-only parameter. It is saved in -libmng's internal structures and available at all times through the -mng_get_userdata() function. This is especially handy in callback functions -if your program may be handling multiple files at the same time. - -The second and third field supply the library with the memory callback -1function entry-points. These are described in more detail in the callback -section and the previous paragraph. - -The fourth and last field may be used to supply the library with the -entry-point of a trace callback function. For regular use you will not -need this! - -The function returns a handle which will be your ticket to MNG-heaven. -All other functions rely on this handle. It is the single fixed unique -reference-point between your application and the library. - -You should call the initialization function for each image you wish to -process simultaneously. If you are processing images consecutively, you can -reset the internal status of the library with the mng_reset() function. -This function will clear all internal state variables, free any stored -chunks and/or objects, etc, etc. Your callbacks and other external parameters -will be retained. - -After you successfully received the handle it is time to set the required -callbacks. The sections on reading, displaying & writing indicate which -callbacks are required and which are optional. -To set the callbacks simply do: - - myretcode = mng_setcb_xxxxxx (myhandle, my_xxxxxx); - if (myretcode != MNG_NOERROR) - /* process error */; - -Naturally you'd replace the x's with the name of the callback. - - -> Cleanup - -Once you've gotten hold of that precious mng_handle, you should always, -and I mean always, call the cleanup function when you're done. -Just do: - - mng_cleanup (myhandle); - -And you're done. There shouldn't be an ounce of memory spilled after -that call. - -Note that if you would like to process multiple files consecutively -you do not need to do mng_cleanup() / mng_initialize() between each file -but simply - - myretcode = mng_reset (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -will suffice. Saves some time and effort, that. - - -> Error handling - -From the examples in the previous paragraphs you may have noticed a -meticulous scheme for error handling. And yes, that's exactly what it is. -Practically each call simply returns an errorcode, indicating success, -eg. MNG_NOERROR or failure, anything else but MNG_NEEDMOREDATA and -MNG_NEEDTIMERWAIT. These latter two will be discussed in more detail in -their respective fields of interest: the reading section and displaying -section respectively. - -It is the application's responsibility to check the returncode after -each call. You can call mng_getlasterror() to receive the details of -the last detected error. This even includes a discriptive error-message -if you enabled that option during compilation of the library. - -Note that after receiving an error it is still possible to call the -library, but it's also very likely that any following call will fail. -The only functions deemed to work will be mng_reset() and mng_cleanup(). -Yes, if you abort your program after an error, you should still call -mng_cleanup(). - - -IV. Reading - -Reading a MNG, JNG or PNG is fairly easy. It depends slightly on your -ultimate goal how certain specifics are to be handled, but the basics -are similar in all cases. - -For the read functioins to work you must have compiled the library with -the MNG_READ_SUPPRT directive. The standard DLL and Shared Library -have this on by default! - - -> Setup - -Naturally you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_readdata, mng_closestream - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -The reading bit will also fail if you are already creating or -displaying a file. Seems a bit obvious, but I thought I'd mention it, -just in case. - - -> To suspend or not to suspend - -There is one choice you need to make before calling the read function. -Are you in need of suspension-mode or not? - -If you're reading from a disk you most certainly do not need -suspension-mode. Even the oldest and slowest of disks will be fast -enough for straight reading. - -However, if your input comes from a really slow device, such as a -dialup-line or the likes, you may opt for suspension-mode. This is done -by calling - - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - -Suspension-mode will force the library to use special buffering on the -input. This allows your application to receive data of arbitrarily length -and return this in the mng_readdata() callback, without disturbing the -chunk processing routines of the library. - -Suspension-mode does require a little extra care in the main logic of the -1application. The read function may return with MNG_NEEDMOREDATA when the -mng_readdata() callback returns less data then it needs to process the -next chunk. This indicates the application to wait for more data to arrive -and then resume processing by calling mng_read_resume(). - - -> The read HLAPI - -The actual reading is just plain simple. Since all I/O is done -1outside the library through the callbacks, the library can focus on -its real task. Understanding, checking and labelling the input data! - -All you really need to do is this: - - myretcode = mng_read (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -Of course, if you're on suspension-mode the code is a little more -complicated: - - myretcode = mng_read (myhandle); - - while (myretcode == MNG_NEEDMOREDATA) { - /* wait for input-data to arrive */ - myretcode = mng_read_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -This is rather crude and more sophisticated programming methods may -dictate another approach. Whatever method you decide on, it should -act as if the above code was in its place. - -There is also the mng_readdisplay() function, but this is discussed -in the displaying section. It functions pretty much as the mng_read() -function, but also immediately starts displaying the image. -mng_read_resume() should be replaced by mng_display_resume() in that -case! - - -> What happens inside - -What actually happens inside the library depends on the configuration -options set during the compilation of the library. - -Basically the library will first read the 8-byte file header, to determine -its validity and the type of image it is about to process. Then it will -repeatedly read a 4-byte chunk-length and then the remainder of the chunk -until it either reaches EOF (indicated by the mng_readdata() callback) or -implicitly decides EOF as it processed the logically last chunk of the -image. - -Applications that require strict conformity and do not allow superfluous -data after the ending chunk, will need to perform this check in their -mng_closestream() callback. - -Each chunk is then checked on CRC, after which it is handed over to the -appropriate chunk processing routine. These routines will disect the -chunk, check the validity of its contents, check its position with respect -to other chunks, etc, etc. - -If everything checks out, the chunk is further processed as follows: - -If display support has been selected during compilation, certain pre-display -initialization will take place. - -If chunk-storage support has been selected during compilation, the chunks -data may be stored in a special internal structure and held for future -reference. - - -> Storing and accessing chunks - -One of the compilation options activates support for chunk storage. -This option may be useful if you want to examine an image. The directive -is MNG_STORE_CHUNKS. You must also turn on the MNG_ACCESS_CHUNKS -directive. - -The actual storage facility can be turned on or off with the -mng_set_storechunks() function. If set to MNG_TRUE, chunks will be -stored as they are read. - -At any point you can then call the mng_iterate_chunks() function -to iterate through the current list of chunks. This function requires -a callback which is called for each chunk and receives a specific -chunk-handle. This chunk-handle can be used to call the appropriate -mng_getchunk_xxxx() function, to access the chunks properties. - -A typical implementation may look like this: - - mng_bool my_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) { - switch (iChunkid) { - case MNG_UINT_MHDR : { /* process MHDR */; - break; } - case MNG_UINT_FRAM : { /* process FRAM */; - break; } - - ...etc... - - case MNG_UINT_HUH : { /* unknown chunk */; - break; } - default : { /* duh; forgot one */; } - } - - return MNG_TRUE; /* keep'm coming */ - } - -To get to the actual chunk fields of lets say a SHOW chunk you would do: - - mng_bool isempty; - mng_uint16 firstid, lastid; - mng_uint8 showmode; - - myretcode mng_getchunk_show (hHandle, hChunk, - isempty, firstid, - lastid, showmode); - if (myretcode != MNG_NOERROR) - /* process error */; - - -V. Displaying - - -> Setup - -Assuming you have initialized the library and are the owner of -a mng_handle. The following callbacks are essential: - - mng_getcanvasline, mng_refresh - mng_gettickcount, mng_settimer - -If you wish to use an application supplied background you must supply: - - mng_getbkgdline - -If you wish to use the MNG_CANVAS_RGB8_A8 canvas style you must supply: - - mng_getalphaline - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -Note that the mng_processheader() callback is optional but will -be quite significant for proper operation! - -Displaying an image will fail if you are creating a file or already -displaying one. Yes, you can't display it twice! - - -> A word on canvas styles - -The canvas style describes how your drawing canvas is made up. -You must set this before the library actually starts drawing, so -the mng_processheader() callback is a pretty good place for it. - -Currently only 8-bit RGB canvas styles are supported, either with -or without an alpha channel. - -If you like to do alpha composition yourself you can select one of -the canvas styles that include an alpha channel. You can even have -a separate alpha canvas by selecting the MNG_CANVAS_RGB8_A8 style. - -All styles require a compact model. Eg. MNG_CANVAS_BGR8 requires -your canvas lines in bgrbgrbgr... storage, where each letter -represents an 8-bit value of the corresponding color, and each -threesome makes up the values of one(1) pixel. - -The library processes a line at a time, so the canvas lines do not -actually need to be consecutive in memory. - - -> Alpha composition and application backgrounds - -All Network Graphics can be partially transparent. This requires -special processing if you need to display an image against some -background. Note that the MNG header (MHDR chunk) contains a -simplicity field indicating whether transparency information in -the file is critical or not. This only applies to embedded images, -which means the full image-frame of the MNG may still contain fully -transparent pixels! - -Depending on your needs you can supply a single background color, -a background canvas or tell the library to return the alpha-channel -and do alpha composition yourself. - -This is different from the BACK chunk in a MNG, or the bKGD chunk -in an (embedded) PNG or JNG. The BACK chunk indicates an optional or -mandatory background color and/or image. The bKGD chunk only indicates -an optional background color. These chunks indicate the Authors -preferences. They may be absent in which case you need to supply -some sort of background yourself. - -> Composing against a background color - -This is the easiest method. Call the mng_set_bgcolor() function to -set the values of the red, green and blue component of your preferred -background color. - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. - -> Composing against a background canvas - -This is somewhat more complicated. You will need to set the -mng_getbkgdline() callback. This will be called whenever the library -needs to compose a partially transparent line. - -This canvas must hold the background against which the image should -be composed. Its size must match exactly with the image dimensions -and thus the drawing canvas! - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. The canvas style of the -background canvas may even differ from the drawing canvas. The library's -composing will still function properly. - -> Composing within the application - -If you have the option in your application to draw a (partially) -transparent canvas to the output device, this option is preferred. - -Select one of the canvas styles that do have an alpha-channel. -The library will now supply the appropriate alpha information, -allowing the application to compose the image as it sees fit. - - -> Color information and CMS - -Network Graphics may, and usually will, contain color-correction -information. This information is intended to compensate for the -difference in recording and display devices used. - -This document does not address the specifics of color-management. -See the PNG specification for a more detailed description. - -> Using little cms by Marti Maria Saguer - -This is the easiest method, providing you can compile the lcms package. -Select the MNG_FULL_CMS directive during compilation, and sit back and -relax. The library will take care of all color-correction for you. - -> Using an OS- or application-supplied CMS - -If you are so lucky to have access to CMS functionality from within -your application, you may instruct the library to leave color-correction -to you. - -Select the MNG_APP_CMS directive during compilation of the library. -You MUST also set the following callbacks: - - mng_processgamma, mng_processchroma, - mng_processsrgb, mng_processiccp and - mng_processarow - -The last callback is called when the library needs you to correct -an arbitrary line of pixels. The other callbacks are called when -the corresponding color-information is encountered in the file. -You must store this information somewhere for use in the -mng_processarow() callback. - -> Using gamma-only correction - -This isn't a preferred method, but it's better than no correction -at all. Gamma-only correction will at least compensate for -gamma-differences between the original recorder and your output device. - -Select the MNG_GAMMA_ONLY directive during compilation -of the library. Your compiler MUST support fp operations. - -> No color correction - -Ouch. This is really bad. This is the least preferred method, -but may be necessary if your system cannot use lcms, doesn't -have its own CMS, and does not allow fp operations, ruling out -the gamma-only option. - -Select the MNG_NO_CMS directive during compilation. -Images will definitely not be displayed as seen by the Author!!! - - -> Animations and timing - -Animations require some form of timing support. The library relies -on two callbacks for this purpose. The mng_gettickcount() and -mng_settimer() callbacks. mng_gettickcount() is used to determine -the passing of time in milliseconds since the beginning of the -animation. This is also used to compensate during suspension-mode -if you are using the mng_readdisplay() function to read & display -the file simultaneously. - -The callback may return an arbitrary number of milliseconds, but -this number must increase proportionaly between calls. Most modern -systems will have some tickcount() function which derives its -input from an internal clock. The value returned from this function -is more than adequate for libmng. - -The mng_settimer() callback is called when the library determines -a little "pause" is required before rendering another frame of the -animation. The pause interval is also expressed in milliseconds. -Your application should store this value and return immediately. -The library will then make appropriate arrangements to store its -internal state and returns to your application with the -MNG_NEEDTIMERWAIT code. - -At that point you should suspend processing and wait the given -interval. Please use your OS features for this. Do not engage some -sort of loop. That is real bad programming practice. Most modern -systems will have some timing functions. A simple wait() function -may suffice, but this may prevent your applications main-task from -running, and possibly prevent the actual update of your output device. - - -> The mng_refresh() callback - -The mng_refresh() callback is called whenever the library has -"finished" drawing a new frame onto your canvas, and just before it -will call the mng_settimer() callback. - -This allows you to perform some actions necessary to "refresh" the -canvas onto your output device. Please do NOT suspend processing -inside this callback. This must be handled after the mng_settimer() -callback! - - -> Displaying while reading - -This method is preferred if you are reading from a slow input device -(such as a dialup-line) and you wish to start displaying something -as quickly as possible. This functionality is provided mainly for -browser-type applications but may be appropriate for other -applications as well. - -The method is usually used in unison with the suspension-mode of -the read module. A typical implementation would look like this: - - /* initiale library and set required callbacks */ - - /* activate suspension-mode */ - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - - myretcode = mng_readdisplay (myhandle); - - while ((myretcode == MNG_NEEDMOREDATA) || - (myretcode == MNG_NEEDTIMERWAIT)) { - if (myretcode == MNG_NEEDMOREDATA) - /* wait for more input-data */; - else - /* wait for timer interval */; - - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -More advanced programming methods may require a different approach, -but the final result should function as in the code above. - - -> Displaying after reading - -This method is used to display a file that was previously read. -It is primarily meant for viewers with direct file access, such as -1a local harddisk. - -Once you have successfully read the file, all you need to do is: - - myretcode = mng_display (myhandle); - - while (myretcode == MNG_NEEDTIMERWAIT) { - /* wait for timer interval */; - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -Again, more advanced programming methods may require a different -approach, but the final result should function as in the code above. - - -> Display manipulation - -Several HLAPI functions are provided to allow a user to manipulate -the normal flow of an animation. - -- mng_display_freeze (mng_handle hHandle) - -This will "freeze" the animation in place. - -- mng_display_resume (mng_handle hHandle) - -This function can be used to resume a frozen animation, or to force -the library to advance the animation to the next frame. - -- mng_display_reset (mng_handle hHandle) - -This function will "reset" the animation into its pristine state. -Calling mng_display() afterwards will re-display the animation -from the first frame. - -- mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayer) -- mng_display_goframe (mng_handle hHandle, - mng_uint32 iFrame) -- mng_display_goplaytime (mng_handle hHandle, - mng_uint32 iPlaytime) - -These three functions can be used to "jump" to a specific layer, frame -or timeslot in the animation. You must "freeze" the animation before -using any of these functions. - -All above functions may only be called during a timer interval! -It is the applications responsibility to cleanup any resources with -respect to the timer wait. - - -VI. Writing - -The main focus of the library lies in its displaying capabilites. -But it does offer writing support as well. -You can create and write a file, or you can write a file you -have previously read, providing the storage of chunks was enabled -and active. - -For this to work you must have compiled the library with the -MNG_WRITE_SUPPO1RT and MNG_ACCESS_CHUNKS directives. The standard DLL and -Shared Library have this on by default! - - -> Setup - -As always you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_writedata, mng_closestream - -You can optionally define: - - mng_errorproc, mng_traceproc - -The creation and writing functions will fail if you are in the middle -of reading, creating or writing a file. - - -> Creating a new file - -To start a new file the library must be in its initial state. -First you need to tell the library your intentions: - - myretcode = mng_create (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -After that you start adding the appropriate chunks: - - myretcode = mng_putchunk_mhdr (myhandle, ...); - if (myretcode != MNG_NOERROR) - /* process error */; - -And so on, and so forth. Note that the library will automatically signal -the logical end of the file by the ending chunk. Also the first chunk -will indicate the library the filetype (eg. PNG, JNG or MNG) and force -the proper signature when writing the file. - -The code above can be simplified, as you can always get the last errorcode -by using the mng_getlasterror() function: - - if ( (mng_putchunk_xxxx (myhandle, ...)) or - (mng_putchunk_xxxx (myhandle, ...)) or - ...etc... ) - /* process error */; - -Please note that you must have a pretty good understanding of the chunk -specification. Unlike the read functions, there are virtually no checks, -so it is quite possible to write completely wrong files. -It is a good practice to read back your file into the library to verify -its integrity. - -Once you've got all the chunks added, all you do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -And presto. You're done. The real work is of course carried out in -your callbacks. Note that this is a single operation as opposed to -the read & display functions that may return with MNG_NEEDMOREDATA -and/or MNG_NEEDTIMERWAIT. The write function just does the job, and -only returns after it's finished or if it encounters some -unrecoverable error. - - -> Writing a previously read file - -If you have already successfully read a file, you can use the library to -write it out as a copy or something. You MUST have compiled the library -with the MNG_STORE_CHUNKS directive, and you must have done -mng_set_storechunks (myhandle, MNG_TRUE). - -This doesn't require the MNG_ACCESS_CHUNKS directive, unless you want -to fiddle with the chunks as well. - -Again all you need to do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - - -VII. Modifying/Customizing libmng: - -to do - -> Compilation directives - -to do - -> Platform dependant modification - -to do - - -References : - -libmng : - http://www.libmng.com/ - -zlib : - http://www.info-zip.org/pub/infozip/zlib/ - -IJG JPEG library : - http://www.ijg.org/ - -lcms (little CMS) by Marti Maria Saguer : - http://www.littlecms.com/ - -MNG specification: - http://www.libpng.org/pub/mng - - -In the case of any inconsistency between the MNG specification -and this library, the specification takes precedence. - - -The contributing authors would like to thank all those who helped -with testing, bug fixes, and patience. This wouldn't have been -possible without all of you!!! - - -COPYRIGHT NOTICE: - -Copyright (c) 2000,2001 Gerard Juyn - -For the purposes of this copyright and license, "Contributing Authors" -is defined as the following set of individuals: - - Gerard Juyn - -The MNG Library is supplied "AS IS". The Contributing Authors -disclaim all warranties, expressed or implied, including, without -limitation, the warranties of merchantability and of fitness for any -purpose. The Contributing Authors assume no liability for direct, -indirect, incidental, special, exemplary, or consequential damages, -which may result from the use of the MNG Library, even if advised of -the possibility of such damage. - -Permission is hereby granted to use, copy, modify, and distribute this -source code, or portions hereof, for any purpose, without fee, subject -to the following restrictions: - -1. The origin of this source code must not be misrepresented; -you must not claim that you wrote the original software. - -2. Altered versions must be plainly marked as such and must not be -misrepresented as being the original source. - -3. This Copyright notice may not be removed or altered from any source -or altered source distribution. - -The Contributing Authors specifically permit, without fee, and -encourage the use of this source code as a component to supporting -the MNG and JNG file format in commercial products. If you use this -source code in a product, acknowledgment would be highly appreciated. - - -Remarks : - -Parts of this software have been adapted from the libpng library. -Although this library supports all features from the PNG specification -(as MNG descends from it) it does not require the libpng library. -It does require the zlib library and optionally the IJG JPEG library, -and/or the "little-cms" library by Marti Maria Saguer (depending on the -inclusion of support for JNG and Full-Color-Management respectively. - -This library's function is primarily to read and display MNG -animations. It is not meant as a full-featured image-editing -component! It does however offer creation and editing functionality -at the chunk level. (future modifications may include some more -support for creation and or editing) - diff --git a/Engine/lib/lmng/doc/man/jng.5 b/Engine/lib/lmng/doc/man/jng.5 deleted file mode 100644 index 0e371ad0e..000000000 --- a/Engine/lib/lmng/doc/man/jng.5 +++ /dev/null @@ -1,37 +0,0 @@ -.TH JNG 5 "July 26, 2000" -.SH NAME -jng \- JPEG Network Graphics (JNG) sub-format -.SH DESCRIPTION -JNG (JPEG Network Graphics) is a sub-format of the MNG (Multiple-image -Network Graphics) format. As with MNG it extends on the features of the -popular PNG (Portable Network Graphics) image-format. -.br - -This sub-format was designed to support a lossy compression-method. -It is based completely on the JPEG specification. It adds the high-compression -ratios of JPEG for photographic images. - -As a member of the Network Graphics family, JNG was deemed adequate as a -stand-alone format as it extends the JPEG format with color-correction and -transparency features. - -.SH "SEE ALSO" -.IR png(5) ", " mng(5) ", " libmng(3) -.LP -MNG 1.00, February 9, 2001: -.IP -http://www.libpng.org/pub/mng - -.SH AUTHORS -This man page: Gerard Juyn -.LP -Multiple-image Network Graphics (MNG) Specification Version 1.00 (Februari 9, 2001): -Glenn Randers-Pehrson and others (png-list@ccrc.wustl.edu). -.LP - -.SH COPYRIGHT NOTICE -The MNG-1.00 specification is copyright (c) 1998-2001 Glenn Randers-Pehrson. -See the specification for conditions of use and distribution. -.LP -.\" end of man page - diff --git a/Engine/lib/lmng/doc/man/libmng.3 b/Engine/lib/lmng/doc/man/libmng.3 deleted file mode 100644 index 5321faaa1..000000000 --- a/Engine/lib/lmng/doc/man/libmng.3 +++ /dev/null @@ -1,1146 +0,0 @@ -.TH LIBMNG 3 "January 30th, 2005" -.SH NAME -libmng \- Multiple-image Network Graphics (MNG) Reference Library 1.0.9 -.SH SYNOPSIS -\fI\fB - -\fB#include \fP - - -.SH DESCRIPTION -The -.I libmng -library supports decoding, displaying, encoding, and various other -manipulations of the Multiple-image Network Graphics (MNG) format -image files. It uses the -.IR zlib(3) -compression library, and optionally the JPEG library by the Independant -JPEG Group (IJG) and/or lcms (little cms), a color-management library -by Marti Maria Saguer. - - -.SH I. Introduction - -This file describes how to use and modify the MNG reference library -(known as libmng) for your own use. There are seven sections to this -file: introduction, callbacks, housekeeping, reading, displaying, -writing, and modification and configuration notes for various special -platforms. We assume that libmng is already installed; see the -INSTALL.README file for instructions on how to install libmng. - -Libmng was written to support and promote the MNG specification. - -The MNG-1.0 specification is available at -. - -Other information about MNG can be found at the MNG home page, -. -The latest version of libmng can be found at its own homepage at -. - -In most cases the library will not need to be changed. -For standardization purposes the library contains both a Windows DLL -and a makefile for building a shared library (SO). The library is -written in C, but an interface for Borland Delphi is also available. - -Libmng has been designed to handle multiple sessions at one time, -to be easily modifiable, to be portable to the vast majority of -machines (ANSI, K&R, 32-, and 64-bit) available, and to be easy -to use. - -Libmng uses zlib for its compression and decompression of MNG files. -Further information about zlib, and the latest version of zlib, can be -found at the zlib home page, . -The zlib compression utility is a general purpose utility that is -useful for more than MNG/PNG files, and can be used without libmng. -See the documentation delivered with zlib for more details. - -Libmng optionally uses the JPEG library by the Independant JPEG Group -(IJG). This library is used for the JNG sub-format, which is part of -the MNG specification, and allows for inclusion of JPEG decoded and -thus highly compressed (photographic) images. -Further information about the IJG JPEG library and the latest sources -can be found at . - -Libmng can also optionally use the lcms (little CMS) library by -Marti Maria Saguer. This library provides an excellent color-management -system (CMS), which gives libmng the ability to provide full -color-correction for images with the proper color-information encoded. -Further information and the latest sources can be found at -. - -Libmng is thread safe, provided the threads are using different -handles as returned by the initialization call. -Each thread should have its own handle and thus its own image. -Libmng does not protect itself against two threads using the -same instance of a handle. - -The libmng.h header file is the single reference needed for programming -with libmng: - -#include - - -.SH II. Callbacks - -Libmng makes extensive use of callback functions. This is meant to -keep the library as platform-independant and flexible as possible. -Actually, the first call you will make to the library, already contains -three parameters you can use to provide callback entry-points. - -Most functions must return a mng_bool (boolean). Returning MNG_FALSE -indicates the library the callback failed in some way and the library -will immediately return from whatever it was doing back to the -application. Returning MNG_TRUE indicates there were no problems and -processing can continue. - -Let's step through each of the possible callbacks. The sections on -reading, displaying and writing will also explain which callbacks are -needed when and where. - -\- mng_ptr mng_memalloc (mng_size_t iLen) - -A very basic function which the library uses to allocate a memory-block -with the given size. A typical implementation would be: - - mng_ptr my_alloc (mng_size_t iLen) { - return calloc (1, iLen); - } - -Note that the library requires you to zero-out the memory-block!!! - -\- void mng_memfree (mng_ptr pPtr, - mng_size_t iLen) - -Counterpart of the previous function. Typically: - - void my_free (mng_ptr pPtr, mng_size_t iLen) { - free (pPtr); - } - -\- mng_bool mng_openstream (mng_handle hHandle) - -\- mng_bool mng_closestream (mng_handle hHandle) - -These are called by the library just before it starts to process -(either read or write) a file and just after the processing stops. -This is the recommended place to do I/O initialization & finalization. -Whether you do or not, is up to you. The library does not put any -meaning into the calls. They are simply provided for your convenience. - -\- mng_bool mng_readdata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) - -This function is called when the library needs some more input while -reading an image. The reading process supports two modes: -Suspension-mode (SMOD) and non-suspension-mode (NSMOD). -See mng_set_suspensionmode() for a more detailed description. - -In NSMOD, the library requires you to return exactly the amount of bytes -requested (= iBuflen). Any lesser amount indicates the input file -is exhausted and the library will return a MNG_UNEXPECTEDEOF errorcode. - -In SMOD, you may return a smaller amount of bytes than requested. -This tells the library it should temporarily wait for more input to -arrive. The lib will return with MNG_NEEDMOREDATA, and will expect a -call to mng_read_resume() or mng_display_resume() next, as soon as -more input-data has arrived. - -For NSMOD this function could be as simple as: - - mng_bool my_read (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) { - *pRead = fread (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -\- mng_bool mng_writedata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) - -This function is called during the mng_write() function to actually -output data to the file. There is no suspension-mode during write, -so the application must return the exact number of bytes the library -requests to be written. - -A typical implementation could be: - - mng_bool my_write (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) { - *pWritten = fwrite (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -\- mng_bool mng_errorproc (mng_handle hHandle, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext) - -This function is called whenever an error is detected inside the -library. This may be caused by invalid input, callbacks indicating -failure, or wrongfully calling functions out of place. - -If you do not provide this callback the library will still return -an errorcode from the called function, and the mng_getlasterror() -function can be used to retrieve the other parameters. - -This function is currently only provided for convenience, but may -at some point be used to indicate certain errors may be acceptable, -and processing should continue. - -\- mng_bool mng_traceproc (mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname) - -This function is provided to allow a functional analysis of the -library. This may be useful if you encounter certain errors and -cannot determine what the problem is. - -Almost all functions inside the library will activate this -callback with an appropriate function-name at the start and end -of the function. Please note that large images may generate an -enormous amount of calls. - -\- mng_bool mng_processheader (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This function is called once the header information of an input- -image has been processed. At this point the image dimensions are -available and also some other properties depending on the type -of the image. Eg. for a MNG the frame-/layercount, playtime & -simplicity fields are known. - -The primary purpose of this callback is to inform the application -of the size of the image, and for the application to initialize -the drawing canvas to be used by the library. This is also a good -point to set the canvas-style. Eg. mng_set_canvasstyle(). - -\- mng_bool mng_processtext (mng_handle hHandle, - mng_uint8 iType, - mng_pchar zKeyword, - mng_pchar zText, - mng_pchar zLanguage, - mng_pchar zTranslation) - -This callback is activated for each textual chunk in the input- -image. These are tEXt, zTXt & iTXt. It may be used to retain -specific comments for presentation to the user. - -\- mng_bool mng_processsave (mng_handle hHandle) - -\- mng_bool mng_processseek (mng_handle hHandle, - mng_pchar zName) - -The purpose of these callbacks is to signal the processing of the -SAVE & SEEK chunks in a MNG input-file. This may be used in the -future to specify some special processing. At the moment these -functions are only provided as a signal. - -\- mng_ptr mng_getcanvasline (mng_handle hHandle, - mng_uint32 iLinenr) - -\- mng_ptr mng_getbkgdline (mng_handle hHandle, - mng_uint32 iLinenr) - -\- mng_ptr mng_getalphaline (mng_handle hHandle, - mng_uint32 iLinenr) - -These callbacks are used to access the drawing canvas, background -canvas and an optional separate alpha-channel canvas. The latter is -used only with the MNG_CANVAS_RGB8_A8 canvas-style. - -If the getbkgdline() callback is not supplied the library will -composite fully or partially transparent pixels in the image against -a specified background color. See mng_set_bgcolor() for more details. -If a chosen canvas-style includes an alpha-channel, this callback -is very likely not needed. - -The application is responsible for returning a pointer to a line of -pixels, which should be in the exact format as defined by the call -to mng_set_canvasstyle() and mng_set_bkgdstyle(), without gaps between -the representation of each pixel, unless specified by the canvas-style. - -\- mng_bool mng_refresh (mng_handle hHandle, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This callback is called when the library has drawn a complete frame -onto the drawing canvas, and it is ready to be displayed. -The application is responsible for transferring the drawing canvas -from memory onto the actual output device. - -\- mng_uint32 mng_gettickcount (mng_handle hHandle) - -This function should return the number of milliseconds on some internal -clock. The entire animation timing depends heavily on this function, -and the number returned should be as accurate as possible. - -\- mng_bool mng_settimer (mng_handle hHandle, - mng_uint32 iMsecs) - -This callback is activated every time the library requires a "pause". -Note that the function itself should NOT execute the wait. It should -simply store the time-field and allow the library to return. Libmng -will return with the MNG_NEEDTIMERWAIT code, indicating the callback -was called and it is now time to execute the pause. - -After the indicated number of milliseconds have elapsed, the application -should call mng_display_resume(), to resume the animation as planned. - -This method allows for both a real timer or a simple wait command in the -application. Whichever method you select, both the gettickcount() and -settimer() callbacks are crucial for proper animation timing. - -\- mng_bool mng_processgamma (mng_handle hHandle, - mng_uint32 iGamma) - -\- mng_bool mng_processchroma (mng_handle hHandle, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) - -\- mng_bool mng_processsrgb (mng_handle hHandle, - mng_uint8 iRenderingintent) - -\- mng_bool mng_processiccp (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) - -\- mng_bool mng_processarow (mng_handle hHandle, - mng_uint32 iRowsamples, - mng_bool bIsRGBA16, - mng_ptr pRow) - -These callbacks are only required when you selected the MNG_APP_CMS -directive during compilation of the library. See the configuration -section for more details. - -\- mng_bool mng_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) - -This callback is only used for the mng_iterate_chunks() function. -It is called exactly once for each chunk stored. - - -.SH III. Housekeeping - - -.SS Memory management - -The library can use internal memory allocation/deallocation or use -provided callbacks for its memory management. The choice is made at -compilation time. See the section on customization for details. - -If internal management has been selected, the memory callback functions -need not be supplied. Even if you do supply them they will not be used. -The actual code used is similar to the code discussed in the callback -section: - - pPtr = calloc (1, iLen); - - free (pPtr); - -If your compiler does not support these functions, or you wish to monitor -the library's use of memory for certain reasons, you can choose to -compile the library with external memory management. In this case the -memory callback functions MUST be supplied, and should function as if the -above code was used. - - -.SS Initialization - -The basic initialization of the library is short and swift: - - myhandle = mng_initialize (myuserdata, my_alloc, - my_free, MNG_NULL); - if (myhandle == MNG_NULL) - /* process error */; - -The first field is an application-only parameter. It is saved in -libmng's internal structures and available at all times through the -mng_get_userdata() function. This is especially handy in callback functions -if your program may be handling multiple files at the same time. - -The second and third field supply the library with the memory callback -function entry-points. These are described in more detail in the callback -section and the previous paragraph. - -The fourth and last field may be used to supply the library with the -entry-point of a trace callback function. For regular use you will not -need this! - -The function returns a handle which will be your ticket to MNG-heaven. -All other functions rely on this handle. It is the single fixed unique -reference-point between your application and the library. - -You should call the initialization function for each image you wish to -process simultaneously. If you are processing images consecutively, you can -reset the internal status of the library with the mng_reset() function. -This function will clear all internal state variables, free any stored -chunks and/or objects, etc, etc. Your callbacks and other external parameters -will be retained. - -After you successfully received the handle it is time to set the required -callbacks. The sections on reading, displaying & writing indicate which -callbacks are required and which are optional. -To set the callbacks simply do: - - myretcode = mng_setcb_xxxxxx (myhandle, my_xxxxxx); - if (myretcode != MNG_NOERROR) - /* process error */; - -Naturally you'd replace the x's with the name of the callback. - - -.SS Cleanup - -Once you've gotten hold of that precious mng_handle, you should always, -and I mean always, call the cleanup function when you're done. -Just do: - - mng_cleanup (myhandle); - -And you're done. There shouldn't be an ounce of memory spilled after -that call. - -Note that if you would like to process multiple files consecutively -you do not need to do mng_cleanup() / mng_initialize() between each file -but simply - - myretcode = mng_reset (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -will suffice. Saves some time and effort, that. - - -.SS Error handling - -From the examples in the previous paragraphs you may have noticed a -meticulous scheme for error handling. And yes, that's exactly what it is. -Practically each call simply returns an errorcode, indicating success, -eg. MNG_NOERROR or failure, anything else but MNG_NEEDMOREDATA and -MNG_NEEDTIMERWAIT. These latter two will be discussed in more detail in -their respective fields of interest: the reading section and displaying -section respectively. - -It is the application's responsibility to check the returncode after -each call. You can call mng_getlasterror() to receive the details of -the last detected error. This even includes a discriptive error-message -if you enabled that option during compilation of the library. - -Note that after receiving an error it is still possible to call the -library, but it's also very likely that any following call will fail. -The only functions deemed to work will be mng_reset() and mng_cleanup(). -Yes, if you abort your program after an error, you should still call -mng_cleanup(). - - -.SH IV. Reading - -Reading a MNG, JNG or PNG is fairly easy. It depends slightly on your -ultimate goal how certain specifics are to be handled, but the basics -are similar in all cases. - -For the read functioins to work you must have compiled the library with -the MNG_READ_SUPPRT directive. The standard DLL and Shared Library -have this on by default! - - -.SS Setup - -Naturally you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_readdata, mng_closestream - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -The reading bit will also fail if you are already creating or -displaying a file. Seems a bit obvious, but I thought I'd mention it, -just in case. - - -.SS To suspend or not to suspend - -There is one choice you need to make before calling the read function. -Are you in need of suspension-mode or not? - -If you're reading from a disk you most certainly do not need -suspension-mode. Even the oldest and slowest of disks will be fast -enough for straight reading. - -However, if your input comes from a really slow device, such as a -dialup-line or the likes, you may opt for suspension-mode. This is done -by calling - - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - -Suspension-mode will force the library to use special buffering on the -input. This allows your application to receive data of arbitrarily length -and return this in the mng_readdata() callback, without disturbing the -chunk processing routines of the library. - -Suspension-mode does require a little extra care in the main logic of the -application. The read function may return with MNG_NEEDMOREDATA when the -mng_readdata() callback returns less data then it needs to process the -next chunk. This indicates the application to wait for more data to arrive -and then resume processing by calling mng_read_resume(). - - -.SS The read HLAPI - -The actual reading is just plain simple. Since all I/O is done -outside the library through the callbacks, the library can focus on -its real task. Understanding, checking and labelling the input data! - -All you really need to do is this: - - myretcode = mng_read (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -Of course, if you're on suspension-mode the code is a little more -complicated: - - myretcode = mng_read (myhandle); - - while (myretcode == MNG_NEEDMOREDATA) { - /* wait for input-data to arrive */ - myretcode = mng_read_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -This is rather crude and more sophisticated programming methods may -dictate another approach. Whatever method you decide on, it should -act as if the above code was in its place. - -There is also the mng_readdisplay() function, but this is discussed -in the displaying section. It functions pretty much as the mng_read() -function, but also immediately starts displaying the image. -mng_read_resume() should be replaced by mng_display_resume() in that -case! - - -.SS What happens inside - -What actually happens inside the library depends on the configuration -options set during the compilation of the library. - -Basically the library will first read the 8-byte file header, to determine -its validity and the type of image it is about to process. Then it will -repeatedly read a 4-byte chunk-length and then the remainder of the chunk -until it either reaches EOF (indicated by the mng_readdata() callback) or -implicitly decides EOF as it processed the logically last chunk of the -image. - -Applications that require strict conformity and do not allow superfluous -data after the ending chunk, will need to perform this check in their -mng_closestream() callback. - -Each chunk is then checked on CRC, after which it is handed over to the -appropriate chunk processing routine. These routines will disect the -chunk, check the validity of its contents, check its position with respect -to other chunks, etc, etc. - -If everything checks out, the chunk is further processed as follows: - -If display support has been selected during compilation, certain pre-display -initialization will take place. - -If chunk-storage support has been selected during compilation, the chunks -data may be stored in a special internal structure and held for future -reference. - - -.SS Storing and accessing chunks - -One of the compilation options activates support for chunk storage. -This option may be useful if you want to examine an image. The directive -is MNG_STORE_CHUNKS. You must also turn on the MNG_ACCESS_CHUNKS -directive. - -The actual storage facility can be turned on or off with the -mng_set_storechunks() function. If set to MNG_TRUE, chunks will be -stored as they are read. - -At any point you can then call the mng_iterate_chunks() function -to iterate through the current list of chunks. This function requires -a callback which is called for each chunk and receives a specific -chunk-handle. This chunk-handle can be used to call the appropriate -mng_getchunk_xxxx() function, to access the chunks properties. - -A typical implementation may look like this: - - mng_bool my_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) { - switch (iChunkid) { - case MNG_UINT_MHDR : { /* process MHDR */; - break; } - case MNG_UINT_FRAM : { /* process FRAM */; - break; } - - ...etc... - - case MNG_UINT_HUH : { /* unknown chunk */; - break; } - default : { /* duh; forgot one */; } - } - - return MNG_TRUE; /* keep'm coming */ - } - -To get to the actual chunk fields of lets say a SHOW chunk you would do: - - mng_bool isempty; - mng_uint16 firstid, lastid; - mng_uint8 showmode; - - myretcode mng_getchunk_show (hHandle, hChunk, - isempty, firstid, - lastid, showmode); - if (myretcode != MNG_NOERROR) - /* process error */; - - -.SH V. Displaying - - -.SS Setup - -Assuming you have initialized the library and are the owner of -a mng_handle. The following callbacks are essential: - - mng_getcanvasline, mng_refresh - mng_gettickcount, mng_settimer - -If you wish to use an application supplied background you must supply: - - mng_getbkgdline - -If you wish to use the MNG_CANVAS_RGB8_A8 canvas style you must supply: - - mng_getalphaline - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -Note that the mng_processheader() callback is optional but will -be quite significant for proper operation! - -Displaying an image will fail if you are creating a file or already -displaying one. Yes, you can't display it twice! - - -.SS A word on canvas styles - -The canvas style describes how your drawing canvas is made up. -You must set this before the library actually starts drawing, so -the mng_processheader() callback is a pretty good place for it. - -Currently only 8-bit RGB canvas styles are supported, either with -or without an alpha channel. - -If you like to do alpha composition yourself you can select one of -the canvas styles that include an alpha channel. You can even have -a separate alpha canvas by selecting the MNG_CANVAS_RGB8_A8 style. - -All styles require a compact model. Eg. MNG_CANVAS_BGR8 requires -your canvas lines in bgrbgrbgr... storage, where each letter -represents an 8-bit value of the corresponding color, and each -threesome makes up the values of one(1) pixel. - -The library processes a line at a time, so the canvas lines do not -actually need to be consecutive in memory. - - -.SS Alpha composition and application backgrounds - -All Network Graphics can be partially transparent. This requires -special processing if you need to display an image against some -background. Note that the MNG header (MHDR chunk) contains a -simplicity field indicating whether transparency information in -the file is critical or not. This only applies to embedded images, -which means the full image-frame of the MNG may still contain fully -transparent pixels! - -Depending on your needs you can supply a single background color, -a background canvas or tell the library to return the alpha-channel -and do alpha composition yourself. - -This is different from the BACK chunk in a MNG, or the bKGD chunk -in an (embedded) PNG or JNG. The BACK chunk indicates an optional or -mandatory background color and/or image. The bKGD chunk only indicates -an optional background color. These chunks indicate the Authors -preferences. They may be absent in which case you need to supply -some sort of background yourself. - -.SS Composing against a background color - -This is the easiest method. Call the mng_set_bgcolor() function to -set the values of the red, green and blue component of your preferred -background color. - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. - -.SS Composing against a background canvas - -This is somewhat more complicated. You will need to set the -mng_getbkgdline() callback. This will be called whenever the library -needs to compose a partially transparent line. - -This canvas must hold the background against which the image should -be composed. Its size must match exactly with the image dimensions -and thus the drawing canvas! - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. The canvas style of the -background canvas may even differ from the drawing canvas. The library's -composing will still function properly. - -.SS Composing within the application - -If you have the option in your application to draw a (partially) -transparent canvas to the output device, this option is preferred. - -Select one of the canvas styles that do have an alpha-channel. -The library will now supply the appropriate alpha information, -allowing the application to compose the image as it sees fit. - - -.SS Color information and CMS - -Network Graphics may, and usually will, contain color-correction -information. This information is intended to compensate for the -difference in recording and display devices used. - -This document does not address the specifics of color-management. -See the PNG specification for a more detailed description. - -.SS Using little cms by Marti Maria Saguer - -This is the easiest method, providing you can compile the lcms package. -Select the MNG_FULL_CMS directive during compilation, and sit back and -relax. The library will take care of all color-correction for you. - -.SS Using an OS- or application-supplied CMS - -If you are so lucky to have access to CMS functionality from within -your application, you may instruct the library to leave color-correction -to you. - -Select the MNG_APP_CMS directive during compilation of the library. -You MUST also set the following callbacks: - - mng_processgamma, mng_processchroma, - mng_processsrgb, mng_processiccp and - mng_processarow - -The last callback is called when the library needs you to correct -an arbitrary line of pixels. The other callbacks are called when -the corresponding color-information is encountered in the file. -You must store this information somewhere for use in the -mng_processarow() callback. - -.SS Using gamma-only correction - -This isn't a preferred method, but it's better than no correction -at all. Gamma-only correction will at least compensate for -gamma-differences between the original recorder and your output device. - -Select the MNG_GAMMA_ONLY directive during compilation -of the library. Your compiler MUST support fp operations. - -.SS No color correction - -Ouch. This is really bad. This is the least preferred method, -but may be necessary if your system cannot use lcms, doesn't -have its own CMS, and does not allow fp operations, ruling out -the gamma-only option. - -Select the MNG_NO_CMS directive during compilation. -Images will definitely not be displayed as seen by the Author!!! - - -.SS Animations and timing - -Animations require some form of timing support. The library relies -on two callbacks for this purpose. The mng_gettickcount() and -mng_settimer() callbacks. mng_gettickcount() is used to determine -the passing of time in milliseconds since the beginning of the -animation. This is also used to compensate during suspension-mode -if you are using the mng_readdisplay() function to read & display -the file simultaneously. - -The callback may return an arbitrary number of milliseconds, but -this number must increase proportionaly between calls. Most modern -systems will have some tickcount() function which derives its -input from an internal clock. The value returned from this function -is more than adequate for libmng. - -The mng_settimer() callback is called when the library determines -a little "pause" is required before rendering another frame of the -animation. The pause interval is also expressed in milliseconds. -Your application should store this value and return immediately. -The library will then make appropriate arrangements to store its -internal state and returns to your application with the -MNG_NEEDTIMERWAIT code. - -At that point you should suspend processing and wait the given -interval. Please use your OS features for this. Do not engage some -sort of loop. That is real bad programming practice. Most modern -systems will have some timing functions. A simple wait() function -may suffice, but this may prevent your applications main-task from -running, and possibly prevent the actual update of your output device. - - -.SS The mng_refresh() callback - -The mng_refresh() callback is called whenever the library has -"finished" drawing a new frame onto your canvas, and just before it -will call the mng_settimer() callback. - -This allows you to perform some actions necessary to "refresh" the -canvas onto your output device. Please do NOT suspend processing -inside this callback. This must be handled after the mng_settimer() -callback! - - -.SS Displaying while reading - -This method is preferred if you are reading from a slow input device -(such as a dialup-line) and you wish to start displaying something -as quickly as possible. This functionality is provided mainly for -browser-type applications but may be appropriate for other -applications as well. - -The method is usually used in unison with the suspension-mode of -the read module. A typical implementation would look like this: - - /* initiale library and set required callbacks */ - - /* activate suspension-mode */ - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - - myretcode = mng_readdisplay (myhandle); - - while ((myretcode == MNG_NEEDMOREDATA) || - (myretcode == MNG_NEEDTIMERWAIT)) { - if (myretcode == MNG_NEEDMOREDATA) - /* wait for more input-data */; - else - /* wait for timer interval */; - - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -More advanced programming methods may require a different approach, -but the final result should function as in the code above. - - -.SS Displaying after reading - -This method is used to display a file that was previously read. -It is primarily meant for viewers with direct file access, such as -1a local harddisk. - -Once you have successfully read the file, all you need to do is: - - myretcode = mng_display (myhandle); - - while (myretcode == MNG_NEEDTIMERWAIT) { - /* wait for timer interval */; - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -Again, more advanced programming methods may require a different -approach, but the final result should function as in the code above. - - -.SS Display manipulation - -Several HLAPI functions are provided to allow a user to manipulate -the normal flow of an animation. - -\- mng_display_freeze (mng_handle hHandle) - -This will "freeze" the animation in place. - -\- mng_display_resume (mng_handle hHandle) - -This function can be used to resume a frozen animation, or to force -the library to advance the animation to the next frame. - -\- mng_display_reset (mng_handle hHandle) - -This function will "reset" the animation into its pristine state. -Calling mng_display() afterwards will re-display the animation -from the first frame. - -\- mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayer) - -\- mng_display_goframe (mng_handle hHandle, - mng_uint32 iFrame) - -\- mng_display_gotime (mng_handle hHandle, - mng_uint32 iPlaytime) - -These three functions can be used to "jump" to a specific layer, frame -or timeslot in the animation. You must "freeze" the animation before -using any of these functions. - -All above functions may only be called during a timer interval! -It is the applications responsibility to cleanup any resources with -respect to the timer wait. - - -.SH VI. Writing - -The main focus of the library lies in its displaying capabilites. -But it does offer writing support as well. -You can create and write a file, or you can write a file you -have previously read, providing the storage of chunks was enabled -and active. - -For this to work you must have compiled the library with the -MNG_WRITE_SUPPO1RT and MNG_ACCESS_CHUNKS directives. The standard DLL and -Shared Library have this on by default! - - -.SS Setup - -As always you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_writedata, mng_closestream - -You can optionally define: - - mng_errorproc, mng_traceproc - -The creation and writing functions will fail if you are in the middle -of reading, creating or writing a file. - - -.SS Creating a new file - -To start a new file the library must be in its initial state. -First you need to tell the library your intentions: - - myretcode = mng_create (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -After that you start adding the appropriate chunks: - - myretcode = mng_put1chunk_mhdr (myhandle, ...); - if (myretcode != MNG_NOERROR) - /* process error */; - -And so on, and so forth. Note that the library will automatically signal -the logical end of the file by the ending chunk. Also the first chunk -will indicate the library the filetype (eg. PNG, JNG or MNG) and force -the proper signature when writing the file. - -The code above can be simplified, as you can always get the last errorcode -by using the mng_getlasterror() function: - - if ( (mng_putchunk_xxxx (myhandle, ...)) or - (mng_putchunk_xxxx (myhandle, ...)) or - ...etc... ) - /* process error */; - -Please note that you must have a pretty good understanding of the chunk -specification. Unlike the read functions, there are virtually no checks, -so it is quite possible to write completely wrong files. -It is a good practice to read back your file into the library to verify -its integrity. - -Once you've got all the chunks added, all you do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -And presto. You're done. The real work is of course carried out in -your callbacks. Note that this is a single operation as opposed to -the read & display functions that may return with MNG_NEEDMOREDATA -and/or MNG_NEEDTIMERWAIT. The write function just does the job, and -only returns after it's finished or if it encounters some -unrecoverable error. - - -.SS Writing a previously read file - -If you have already successfully read a file, you can use the library to -write it out as a copy or something. You MUST have compiled the library -with the MNG_STORE_CHUNKS directive, and you must have done -mng_set_storechunks (myhandle, MNG_TRUE). - -This doesn't require the MNG_ACCESS_CHUNKS directive, unless you want -to fiddle with the chunks as well. - -Again all you need to do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - - -.SH VII. Modifying/Customizing libmng: - -not finished yet - -.SS Compilation directives - -not finished yet - -.SS Platform dependant modification - -not finished yet - -.SH "SEE ALSO" -.IR mng(5), jng(5), png(5), libpng(3) - -.LP -libmng : -.IP -.br -http://www.libmng.com - -.LP -zlib : -.IP -.br -http://www.info-zip.org/pub/infozip/zlib/ - -.LP -IJG JPEG library : -.IP -.br -http://www.ijg.org - -.LP -lcms (little CMS) by Marti Maria Saguer : -.IP -.br -http://www.littlecms.com/ - -.LP -MNG specification: -.IP -.br -http://www.libpng.org/pub/mng - -.LP -In the case of any inconsistency between the MNG specification -and this library, the specification takes precedence. - - -.SH AUTHORS -This man page: Gerard Juyn - - -The contributing authors would like to thank all those who helped -with testing, bug fixes, and patience. This wouldn't have been -possible without all of you!!! - - -.SH COPYRIGHT NOTICE: - -Copyright (c) 2000-2002 Gerard Juyn - -For the purposes of this copyright and license, "Contributing Authors" -is defined as the following set of individuals: - - Gerard Juyn - -The MNG Library is supplied "AS IS". The Contributing Authors -disclaim all warranties, expressed or implied, including, without -limitation, the warranties of merchantability and of fitness for any -purpose. The Contributing Authors assume no liability for direct, -indirect, incidental, special, exemplary, or consequential damages, -which may result from the use of the MNG Library, even if advised of -the possibility of such damage. - -Permission is hereby granted to use, copy, modify, and distribute this -source code, or portions hereof, for any purpose, without fee, subject -to the following restrictions: - -1. The origin of this source code must not be misrepresented; -you must not claim that you wrote the original software. - -2. Altered versions must be plainly marked as such and must not be -misrepresented as being the original source. - -3. This Copyright notice may not be removed or altered from any source -or altered source distribution. - -The Contributing Authors specifically permit, without fee, and -encourage the use of this source code as a component to supporting -the MNG and JNG file format in commercial products. If you use this -source code in a product, acknowledgment would be highly appreciated. - -.SH Remarks - -Parts of this software have been adapted from the libpng library. -Although this library supports all features from the PNG specification -(as MNG descends from it) it does not require the libpng library. -It does require the zlib library and optionally the IJG JPEG library, -and/or the "little-cms" library by Marti Maria Saguer (depending on the -inclusion of support for JNG and Full-Color-Management respectively. - -This library's function is primarily to read and display MNG -animations. It is not meant as a full-featured image-editing -component! It does however offer creation and editing functionality -at the chunk level. (future modifications may include some more -support for creation and or editing) - -.\" end of man page diff --git a/Engine/lib/lmng/doc/man/mng.5 b/Engine/lib/lmng/doc/man/mng.5 deleted file mode 100644 index e40c24910..000000000 --- a/Engine/lib/lmng/doc/man/mng.5 +++ /dev/null @@ -1,42 +0,0 @@ -.TH MNG 5 "July 25, 2000" -.SH NAME -mng \- Multiple-image Network Graphics (MNG) format -.SH DESCRIPTION -MNG (Multiple-image Network Graphics) is the animation extension of the -popular PNG image-format. PNG (Portable Network Graphics) is an -extensible file format for the lossless, portable, well-compressed -storage of raster images. -.br - -MNG has advanced animation features which make it very useful as a full -replacement for GIF animations. These features allow animations that -are impossible with GIF or result in much smaller files as GIF. - -As MNG builds on the same structure as PNG, it is robust, extensible and -free of patents. It retains the same clever file integrity checks as in PNG. - -MNG also embraces the lossy JPEG image-format in a sub-format named JNG, -which allows for alpha-transparency and color-correction on highly -compressed (photographic) images. - -.SH "SEE ALSO" -.IR png(5) ", " jng(5) ", " libmng(3) ", " libpng(3) ", " zlib(3) ", " -deflate(5) ", " zlib(5) ", " jpeg(5) -.LP -MNG 1.00, Februari 9, 2001: -.IP -.br -http://www.libpng.org/pub/mng -.SH AUTHORS -This man page: Gerard Juyn -.LP -Multiple-image Network Graphics (MNG) Specification Version 1.00 (Februari 9, 2001): -Glenn Randers-Pehrson and others (png-list@ccrc.wustl.edu). -.LP - -.SH COPYRIGHT NOTICE -The MNG-1.00 specification is copyright (c) 1998-2001 Glenn Randers-Pehrson. -See the specification for conditions of use and distribution. -.LP -.\" end of man page - diff --git a/Engine/lib/lmng/doc/misc/magic.dif b/Engine/lib/lmng/doc/misc/magic.dif deleted file mode 100644 index 005ad5a74..000000000 --- a/Engine/lib/lmng/doc/misc/magic.dif +++ /dev/null @@ -1,30 +0,0 @@ ---- magic.orig Wed Aug 14 16:48:56 2002 -+++ magic Wed Aug 14 16:50:09 2002 -@@ -2544,6 +2544,27 @@ - >>28 byte 1 interlaced - 1 string PNG PNG image data, CORRUPTED - -+#MNG -+# 0x8a M N G 0x0d 0x0a 0x1a 0x0a [4-byte pad] -+# M H D R [4-byte width][4-byte height][4-byte ticks][4-byte layers] -+# [4-byte frame][4-byte time] -+# -+0 string \x8aMNG MNG image data, -+>4 belong !0x0d0a1a0a CORRUPTED -+>4 belong 0x0d0a1a0a -+>>16 belong x %ld x -+>>20 belong x %ld -+ -+#JNG -+# 0x8b J N G 0x0d 0x0a 0x1a 0x0a [4-byte pad] -+# J H D R [4-byte width][4-byte height] -+# -+0 string \x8bJNG JNG image data, -+>4 belong !0x0d0a1a0a CORRUPTED -+>4 belong 0x0d0a1a0a -+>>16 belong x %ld x -+>>20 belong x %ld -+ - # GIF - 0 string GIF8 GIF image data - >4 string 7a \b, version 8%s, diff --git a/Engine/lib/lmng/doc/rpm/libmng-1.0.10-rhconf.patch b/Engine/lib/lmng/doc/rpm/libmng-1.0.10-rhconf.patch deleted file mode 100644 index a73b79dbe..000000000 --- a/Engine/lib/lmng/doc/rpm/libmng-1.0.10-rhconf.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- libmng/makefiles/makefile.linux.orig Sat Jul 1 15:10:35 2000 -+++ libmng/makefiles/makefile.linux Sat Jul 1 15:14:52 2000 -@@ -13,19 +13,19 @@ - OPTIONS = -DMNG_BUILD_SO - - # where "make install" puts libmng.a,libmng.so*,libmng.h,libmng_conf.h,libmng_types.h --prefix=/usr/local -+prefix=/usr - - # Where the zlib library and include files are located --ZLIBLIB=../zlib --ZLIBINC=../zlib -+ZLIBLIB=/usr/lib -+ZLIBINC=/usr/include - - # Where the jpeg library and include files are located --JPEGLIB=../jpgsrc --JPEGINC=../jpgsrc -+JPEGLIB=/usr/lib -+JPEGINC=/usr/include - - # Where the lcms library and include files are located --LCMSLIB=../lcms/lib --LCMSINC=../lcms/source -+LCMSLIB=/usr/lib -+LCMSINC=/usr/include - - ALIGN= - # for i386: -@@ -37,7 +37,7 @@ - - # for pgcc version 2.95.1, -O3 is buggy; don't use it. - --CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -funroll-loops \ -+CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall $(RPM_OPT_FLAGS) \ - $(OPTIONS) $(ALIGN) # $(WARNMORE) -g - LDFLAGS=-L. -Wl,-rpath,. \ - -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ diff --git a/Engine/lib/lmng/doc/rpm/libmng.spec b/Engine/lib/lmng/doc/rpm/libmng.spec deleted file mode 100644 index 89908d7a9..000000000 --- a/Engine/lib/lmng/doc/rpm/libmng.spec +++ /dev/null @@ -1,116 +0,0 @@ -Summary: A library of functions for manipulating MNG format files. -Name: libmng -Version: 1.0.10 -Release: 2.1 -Copyright: AS IS -Group: System Environment/Libraries -Source0: libmng-%{PACKAGE_VERSION}.tar.gz -Patch: libmng-%{PACKAGE_VERSION}-rhconf.patch -URL: http://www.libmng.com/ -BuildRoot: /var/tmp/libmng-root -BuildPrereq: libjpeg-devel, zlib-devel, lcms-devel - -%description -libmng - library for reading, writing, displaying and examing -Multiple-Image Network Graphics. MNG is the animation extension to the -popular PNG image-format. - -%package devel -Summary: Development tools for programs to manipulate MNG format files. -Group: Development/Libraries -Requires: libmng = %{PACKAGE_VERSION} -%description devel -The libmng-devel package contains the header files and static -libraries necessary for developing programs using the MNG -(Multiple-Image Network Graphics) library. - -If you want to develop programs which will manipulate MNG image format -files, you should install libmng-devel. You'll also need to install -the libmng package. - -%changelog -* Fri Jul 13 2007 Glenn Randers-Pehrson -- updated to 1.0.10 - -* Thu Aug 5 2004 Gerard Juyn -* Sun Jan 30 2005 Gerard Juyn -- updated to 1.0.9 - -* Thu Aug 5 2004 Gerard Juyn -- updated to 1.0.8 - -* Sun Mar 21 2004 Gerard Juyn -- updated to 1.0.7 - -* Sun Oct 19 2003 Gerard Juyn -- updated to 1.0.6 - -* Tue Sep 24 2002 Gerard Juyn -- updated to 1.0.5 - -* Sun Jun 23 2002 Gerard Juyn -- updated to 1.0.4 - -* Mon Sep 18 2001 Gerard Juyn -- updated to 1.0.3 - -* Sat Jul 7 2001 Gerard Juyn -- updated to 1.0.2 - -* Wed May 2 2001 Gerard Juyn -- updated to 1.0.1 - -* Mon Feb 5 2001 Gerard Juyn -- updated to 1.0.0 - -* Fri Jan 19 2001 Gerard Juyn -- updated to 0.9.4 - -* Sat Oct 28 2000 Gerard Juyn -- updated to 0.9.3 - -* Tue Aug 15 2000 MATSUURA Takanori -- based on libmng-0.9.2/doc/rpm/libmng.spec -- use %%configure and %%makeinstall - -* Sat Aug 5 2000 Gerard Juyn -- updated to 0.9.2 - -* Wed Jul 26 2000 Gerard Juyn -- updated to 0.9.1 - -* Sat Jul 1 2000 MATSUURA Takanori -- updated to 0.9.0 - -* Sat Jun 24 2000 MATSUURA Takanori -- 1st release for RPM - -%prep -%setup -%configure - -%build -make - -%install -rm -rf $RPM_BUILD_ROOT -%makeinstall - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root) -%doc CHANGES LICENSE README doc -/usr/lib/libmng.so.* - -%files devel -%defattr(-,root,root) -/usr/include/* -/usr/lib/libmng.a -/usr/lib/libmng.so - diff --git a/Engine/lib/lmng/libmng.h b/Engine/lib/lmng/libmng.h deleted file mode 100644 index b3b1ab141..000000000 --- a/Engine/lib/lmng/libmng.h +++ /dev/null @@ -1,2932 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2007 Gerard Juyn * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn - gjuyn :at: users.sourceforge.net * */ -/* * Glenn Randers-Pehrson - glennrp :at: users.sourceforge.net * */ -/* * Raphael Assenat - raph :at: raphnet.net * */ -/* * John Stiles - * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * Parts of this software have been adapted from the libpng package. * */ -/* * Although this library supports all features from the PNG specification * */ -/* * (as MNG descends from it) it does not require the libpng package. * */ -/* * It does require the zlib library and optionally the IJG jpeg library, * */ -/* * and/or the "little-cms" library by Marti Maria (depending on the * */ -/* * inclusion of support for JNG and Full-Color-Management respectively. * */ -/* * * */ -/* * This library's function is primarily to read and display MNG * */ -/* * animations. It is not meant as a full-featured image-editing * */ -/* * component! It does however offer creation and editing functionality * */ -/* * at the chunk level. * */ -/* * (future modifications may include some more support for creation * */ -/* * and or editing) * */ -/* * * */ -/* ************************************************************************** */ - -/* ************************************************************************** */ -/* * * */ -/* * Version numbering * */ -/* * * */ -/* * X.Y.Z : X = release (0 = initial build) * */ -/* * Y = major version (uneven = test; even = production) * */ -/* * Z = minor version (bugfixes; 2 is older than 10) * */ -/* * * */ -/* * production versions only appear when a test-version is extensively * */ -/* * tested and found stable or for intermediate bug-fixes (recognized by * */ -/* * a change in the Z number) * */ -/* * * */ -/* * x.1.x = test version * */ -/* * x.2.x = production version * */ -/* * x.3.x = test version * */ -/* * x.4.x = production version * */ -/* * etc. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * Identifier naming conventions throughout this library * */ -/* * * */ -/* * iXxxx = an integer * */ -/* * dXxxx = a float * */ -/* * pXxxx = a pointer * */ -/* * bXxxx = a boolean * */ -/* * eXxxx = an enumeration * */ -/* * hXxxx = a handle * */ -/* * zXxxx = a zero-terminated string (pchar) * */ -/* * fXxxx = a pointer to a function (callback) * */ -/* * aXxxx = an array * */ -/* * sXxxx = a structure * */ -/* * * */ -/* * Macros & defines are in all uppercase. * */ -/* * Functions & typedefs in all lowercase. * */ -/* * Exported stuff is prefixed with MNG_ or mng_ respectively. * */ -/* * * */ -/* * (I may have missed a couple; don't hesitate to let me know!) * */ -/* * * */ -/* ************************************************************************** */ - -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : main application interface * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : The main application interface. An application should not * */ -/* * need access to any of the other modules! * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - changed chunk iteration function * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added chunk access functions * */ -/* * - added version control constants & functions * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added set_outputprofile2 & set_srgbprofile2 * */ -/* * - added empty-chunk put-routines * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - added version_dll & VERSION_DLL (for consistency) * */ -/* * - added version control explanatory text & samples * */ -/* * 0.5.1 - 05/15/2000 - G.Juyn * */ -/* * - added getimgdata & putimgdata functions * */ -/* * * */ -/* * 0.5.2 - 05/16/2000 - G.Juyn * */ -/* * - changed the version parameters (obviously) * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - complimented constants for chunk-property values * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - fixed MNG_UINT_pHYg value * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for get/set default zlib/IJG parms * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added MNG_BIGENDIAN_SUPPORT (contributed by Tim Rowley) * */ -/* * - separated configuration-options into "mng_conf.h" * */ -/* * - added RGB8_A8 canvasstyle * */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - moved errorcodes from "mng_error.h" * */ -/* * - added mng_read_resume function to support * */ -/* * read-suspension * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed the version parameters (obviously) * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added get/set for speedtype to facilitate testing * */ -/* * - added get for imagelevel during processtext callback * */ -/* * 0.5.3 - 06/24/2000 - G.Juyn * */ -/* * - fixed inclusion of IJG read/write code * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * * */ -/* * 0.9.0 - 06/30/2000 - G.Juyn * */ -/* * - changed refresh parameters to 'x,y,width,height' * */ -/* * * */ -/* * 0.9.1 - 07/06/2000 - G.Juyn * */ -/* * - added MNG_NEEDTIMERWAIT errorcode * */ -/* * - changed comments to indicate modified behavior for * */ -/* * timer & suspension breaks * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added get routines for internal display variables * */ -/* * - added get/set routines for suspensionmode variable * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * - added get/set routines for sectionbreak variable * */ -/* * - added NEEDSECTIONWAIT errorcode * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added function to set frame-/layer-count & playtime * */ -/* * - added errorcode for updatemngheader if not a MNG * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - fixed problem with trace-functions improperly wrapped * */ -/* * - added status_xxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added function to set simplicity field * */ -/* * * */ -/* * 0.9.3 - 08/09/2000 - G.Juyn * */ -/* * - added check for simplicity-bits in MHDR * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - fixed processing of unknown critical chunks * */ -/* * - removed test-MaGN * */ -/* * - added PNG/MNG spec version indicators * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * - added JDAA chunk * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added errocode for delayed delta-processing * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 0.9.4 - 01/18/2001 - G.Juyn * */ -/* * - added errorcode for MAGN methods * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * * */ -/* * 1.0.0 - 02/05/2001 - G.Juyn * */ -/* * - version numbers (obviously) * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added late binding errorcode (not used internally) * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.5 - 07/04/2002 - G.Juyn * */ -/* * - added errorcode for extreme chunk-sizes * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * - added 'supports' call to check function availability * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added check for TERM placement during create/write * */ -/* * - added beta version function & constant * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G. Randers-Pehrson * */ -/* * - added support for reducing the footprint of libmng * */ -/* * by macros that optionally skip unused chunks, remove * */ -/* * 16-bit sample support, remove Delta support, and * */ -/* * remove JNG support, to accomodate Mozilla/Firebird. * */ -/* * 1.0.6 - 07/14/2003 - G. Randers-Pehrson * */ -/* * - further optional removal of unused functions * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */ -/* * - put gamma, cms-related declarations inside #ifdef * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/12/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 06/05/2004 - G.R-P * */ -/* * - define MNG_INCLUDE_ZLIB when MNG_USE_ZLIB_CRC is defined * */ -/* * * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 10/17/2004 - G.Juyn * */ -/* * - fixed PPLT getchunk/putchunk routines * */ -/* * * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_h_ -#define _libmng_h_ - -/* ************************************************************************** */ - -#include "libmng_conf.h" /* user-specific configuration options */ - -/* ************************************************************************** */ - -#define MNG_CHECK_BAD_ICCP /* let's catch that sucker !!! */ - -#ifdef MNG_SUPPORT_READ /* dependencies based on user-configuration */ -#define MNG_INCLUDE_READ_PROCS -#endif - -#ifdef MNG_SUPPORT_WRITE -#define MNG_INCLUDE_WRITE_PROCS -#endif - -#ifdef MNG_USE_ZLIB_CRC -#define MNG_INCLUDE_ZLIB -#endif - -#ifdef MNG_SUPPORT_DISPLAY -#define MNG_INCLUDE_FILTERS -#define MNG_INCLUDE_INTERLACE -#define MNG_INCLUDE_OBJECTS -#define MNG_INCLUDE_DISPLAY_PROCS -#define MNG_INCLUDE_TIMING_PROCS -#define MNG_INCLUDE_ZLIB -#endif - -#ifdef MNG_STORE_CHUNKS -#define MNG_INCLUDE_ZLIB -#endif - -#ifdef MNG_SUPPORT_IJG6B -#define MNG_INCLUDE_JNG -#define MNG_INCLUDE_IJG6B -#define MNG_USE_SETJMP -#endif - -#ifdef MNG_INCLUDE_JNG -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_ACCESS_CHUNKS) -#define MNG_INCLUDE_JNG_READ -#endif -#if defined(MNG_SUPPORT_WRITE) || defined(MNG_ACCESS_CHUNKS) -#define MNG_INCLUDE_JNG_WRITE -#endif -#endif - -#ifdef MNG_FULL_CMS -#define MNG_INCLUDE_LCMS -#endif - -#ifdef MNG_AUTO_DITHER -#define MNG_INCLUDE_DITHERING -#endif - -#ifdef MNG_SUPPORT_TRACE -#define MNG_INCLUDE_TRACE_PROCS -#ifdef MNG_TRACE_TELLTALE -#define MNG_INCLUDE_TRACE_STRINGS -#endif -#endif - -#ifdef MNG_ERROR_TELLTALE -#define MNG_INCLUDE_ERROR_STRINGS -#endif - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_OPTIMIZE_CHUNKACCESS -#define MNG_OPTIMIZE_CHUNKACCESS -#endif -#else -#ifdef MNG_OPTIMIZE_CHUNKACCESS -#undef MNG_OPTIMIZE_CHUNKACCESS -#endif -#endif - -/* ************************************************************************** */ - -#include "libmng_types.h" /* platform-specific definitions - and other assorted stuff */ - -/* ************************************************************************** */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Versioning control * */ -/* * * */ -/* * version_so and version_dll will NOT reflect version_major; * */ -/* * these will only change for binary incompatible changes (which will * */ -/* * hopefully never occur) * */ -/* * note: they will be set to 1 on the first public release !!! * */ -/* * * */ -/* * first public release: * */ -/* * #define MNG_VERSION_TEXT "1.0.0" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 1 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * bug fix & cosmetics : * */ -/* * #define MNG_VERSION_TEXT "1.0.1" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 1 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 1 * */ -/* * * */ -/* * feature change : * */ -/* * #define MNG_VERSION_TEXT "1.2.0" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 1 * */ -/* * #define MNG_VERSION_MINOR 2 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * major rewrite (still binary compatible) : * */ -/* * #define MNG_VERSION_TEXT "2.0.0" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 2 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * binary incompatible change: * */ -/* * #define MNG_VERSION_TEXT "13.0.0" * */ -/* * #define MNG_VERSION_SO 2 eg. libmng.so.2 * */ -/* * #define MNG_VERSION_DLL 2 eg. libmng2.dll * */ -/* * #define MNG_VERSION_MAJOR 13 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * note that version_so & version_dll will always remain equal so it * */ -/* * doesn't matter which one is called to do version-checking; they are * */ -/* * just provided for their target platform * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_VERSION_TEXT "1.0.10" -#define MNG_VERSION_SO 1 /* eg. libmng.so.1 */ -#define MNG_VERSION_DLL 1 /* but: libmng.dll (!) */ -#define MNG_VERSION_MAJOR 1 -#define MNG_VERSION_MINOR 0 -#define MNG_VERSION_RELEASE 10 -#define MNG_VERSION_BETA MNG_FALSE - -MNG_EXT mng_pchar MNG_DECL mng_version_text (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_so (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_dll (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_major (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_minor (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_release (void); -MNG_EXT mng_bool MNG_DECL mng_version_beta (void); - -/* use the following call to check wether the version of libmng your app - is using supports the given function; this is useful in apps that dynamically - load the library to make sure a certain function will work; the result will - be MNG_TRUE if the given function is implemented in this version of the library; - Major/Minor/Version indicate the version the function became available; - (if these fields are zero the function is not yet implemented!) */ -#ifdef MNG_SUPPORT_FUNCQUERY -MNG_EXT mng_bool MNG_DECL mng_supports_func (mng_pchar zFunction, - mng_uint8* iMajor, - mng_uint8* iMinor, - mng_uint8* iRelease); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * MNG/PNG specification level conformance * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_PNG_VERSION "1.2" -#define MNG_PNG_VERSION_MAJ 1 -#define MNG_PNG_VERSION_MIN 2 - -#define MNG_MNG_VERSION "1.1" -#define MNG_MNG_VERSION_MAJ 1 -#define MNG_MNG_VERSION_MIN 1 -#define MNG_MNG_DRAFT 99 /* deprecated; - only used for nEED "MNG DRAFT nn" */ - -/* ************************************************************************** */ -/* * * */ -/* * High-level application functions * */ -/* * * */ -/* ************************************************************************** */ - -/* library initialization function */ -/* must be the first called before anything can be done at all */ -/* initializes internal datastructure(s) */ -MNG_EXT mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata, - mng_memalloc fMemalloc, - mng_memfree fMemfree, - mng_traceproc fTraceproc); - -/* library reset function */ -/* can be used to re-initialize the library, so another image can be - processed. there's absolutely no harm in calling it, even when it's not - really necessary */ -MNG_EXT mng_retcode MNG_DECL mng_reset (mng_handle hHandle); - -/* library cleanup function */ -/* must be the last called to clean up internal datastructure(s) */ -MNG_EXT mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle); - -/* high-level read functions */ -/* use mng_read if you simply want to read a Network Graphic */ -/* mng_read_resume is used in I/O-read-suspension scenarios, where the - "readdata" callback may return FALSE & length=0 indicating its buffer is - depleted or too short to supply the required bytes, and the buffer needs - to be refilled; libmng will return the errorcode MNG_NEEDMOREDATA telling - the app to refill its read-buffer after which it must call mng_read_resume - (or mng_display_resume if it also displaying the image simultaneously) */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_read (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_read_resume (mng_handle hHandle); -#endif - -/* high-level "data push" functions */ -/* these functions can be used in situations where data is streaming into the - application and needs to be buffered by libmng before it is actually - requested by libmng itself. the pushing complements the normal reading - mechanism, but applications can decide to always return "0 bytes read" to - make libmng go into suspension mode with the returncode MNG_NEEDMOREDATA */ -/* mng_read_pushdata can be used to push blobs of data of arbitrary size; - mng_read_pushsig and mng_read_pushchunk can be used if the application - has already done some low-level decoding (eg. at the chunk level) */ -/* the data being pushed into libmng with mng_read_pushdata *must* contain - the regular 4-byte chunklength, but *must not* contain it with - mng_read_pushchunk!!! */ -/* mng_read_pushsig is used to prevent libmng from trying to parse the regular - PNG/JNG/MNG signature bytes; the application must have done this itself - and *must* indicate the proper type in the function call or things will - go amiss!! - also you *must* call this first, so pretty much right after mng_initialize - and certainly before any call to mng_read or mng_readdisplay !!!! */ -/* IMPORTANT!!! data can only be safely pushed when libmng is in a - "wait" state; eg. during MNG_NEEDTIMERWAIT, MNG_NEEDSECTIONWAIT or - MNG_NEEDMOREDATA !!! this just means you can't have one thread displaying - and another thread pushing data !!! */ -/* if bOwnership = MNG_TRUE, libmng will retain the supplied pointer and - *will* expect the buffer to remain available until libmng is finished - with it; what happens then depends on whether or not you have set the - releasedata() callback; if this is set than the supplied buffer will - be returned through this callback and your application can take care of - cleaning it up, otherwise libmng will use its internal freeing mechanism - (which, depending on compile-options, will be the standard C free() call, - or the memfree() callback */ -/* if bOwnership = MNG_FALSE, libmng will just copy the data into its own - buffers and dispose of it in the normal way */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_read_pushdata (mng_handle hHandle, - mng_ptr pData, - mng_size_t iLength, - mng_bool bTakeownership); -MNG_EXT mng_retcode MNG_DECL mng_read_pushsig (mng_handle hHandle, - mng_imgtype eSigtype); -MNG_EXT mng_retcode MNG_DECL mng_read_pushchunk (mng_handle hHandle, - mng_ptr pChunk, - mng_size_t iLength, - mng_bool bTakeownership); -#endif - -/* high-level write & create functions */ -/* use this if you want to write a previously read Network Graphic or - if you want to create a new graphic and write it */ -/* to write a previously read graphic you must have defined MNG_STORE_CHUNKS */ -/* to create a new graphic you'll also need access to the chunks - (eg. #define MNG_ACCESS_CHUNKS !) */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_retcode MNG_DECL mng_write (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_create (mng_handle hHandle); -#endif - -/* high-level display functions */ -/* use these to display a previously read or created graphic or - to read & display a graphic simultaneously */ -/* mng_display_resume should be called after a timer-interval - expires that was set through the settimer-callback, after a - read suspension-break, or, to resume an animation after a call - to mng_display_freeze/mng_display_reset */ -/* mng_display_freeze thru mng_display_gotime can be used to influence - the display of an image, BUT ONLY if it has been completely read! */ -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_readdisplay (mng_handle hHandle); -#endif -MNG_EXT mng_retcode MNG_DECL mng_display (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_display_freeze (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_display_reset (mng_handle hHandle); -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -MNG_EXT mng_retcode MNG_DECL mng_display_goframe (mng_handle hHandle, - mng_uint32 iFramenr); -MNG_EXT mng_retcode MNG_DECL mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayernr); -MNG_EXT mng_retcode MNG_DECL mng_display_gotime (mng_handle hHandle, - mng_uint32 iPlaytime); -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* event processing function */ -/* this needs to be called by the app when dynamic MNG is enabled and - a specific event occurs in the user-interface */ -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) -MNG_EXT mng_retcode MNG_DECL mng_trapevent (mng_handle hHandle, - mng_uint8 iEventtype, - mng_int32 iX, - mng_int32 iY); -#endif - -/* error reporting function */ -/* use this if you need more detailed info on the last error */ -/* iExtra1 & iExtra2 may contain errorcodes from zlib, jpeg, etc... */ -/* zErrortext will only be filled if you #define MNG_ERROR_TELLTALE */ -MNG_EXT mng_retcode MNG_DECL mng_getlasterror (mng_handle hHandle, - mng_int8* iSeverity, - mng_chunkid* iChunkname, - mng_uint32* iChunkseq, - mng_int32* iExtra1, - mng_int32* iExtra2, - mng_pchar* zErrortext); - -/* ************************************************************************** */ -/* * * */ -/* * Callback set functions * */ -/* * * */ -/* ************************************************************************** */ - -/* memory callbacks */ -/* called to allocate and release internal datastructures */ -#ifndef MNG_INTERNAL_MEMMNGMT -MNG_EXT mng_retcode MNG_DECL mng_setcb_memalloc (mng_handle hHandle, - mng_memalloc fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_memfree (mng_handle hHandle, - mng_memfree fProc); -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* open- & close-stream callbacks */ -/* called to open & close streams for input or output */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -MNG_EXT mng_retcode MNG_DECL mng_setcb_openstream (mng_handle hHandle, - mng_openstream fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_closestream (mng_handle hHandle, - mng_closestream fProc); -#endif -#endif - -/* read callback */ -/* called to get data from the inputstream */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_setcb_readdata (mng_handle hHandle, - mng_readdata fProc); -#endif - -/* write callback */ -/* called to put data into the outputstream */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_retcode MNG_DECL mng_setcb_writedata (mng_handle hHandle, - mng_writedata fProc); -#endif - -/* error callback */ -/* called when an error occurs */ -/* the application can determine if the error is recoverable, - and may inform the library by setting specific returncodes */ -MNG_EXT mng_retcode MNG_DECL mng_setcb_errorproc (mng_handle hHandle, - mng_errorproc fProc); - -/* trace callback */ -/* called to show the currently executing function */ -#ifdef MNG_SUPPORT_TRACE -MNG_EXT mng_retcode MNG_DECL mng_setcb_traceproc (mng_handle hHandle, - mng_traceproc fProc); -#endif - -/* callbacks for read processing */ -/* processheader is called when all header information has been gathered - from the inputstream */ -/* processtext is called for every tEXt, zTXt and iTXt chunk in the - inputstream (iType=0 for tEXt, 1 for zTXt and 2 for iTXt); - you can call get_imagelevel to check at what nesting-level the chunk is - encountered (eg. tEXt inside an embedded image inside a MNG -> level == 2; - in most other case -> level == 1) */ -/* processsave & processseek are called for SAVE/SEEK chunks */ -/* processneed is called for the nEED chunk; you should specify a callback - for this as the default behavior will be to abort processing, unless - the requirement is one of: - - a supported chunk - - the text "draft nn" where nn is a numeric value - - the text "MNG-1.0" or "MNG-1.1" - - the text "CACHEOFF" */ -/* processmend is called at the very end of the animation-stream; - note that this may not be the end of the animation though! */ -/* processterm is called when a TERM chunk is encountered; there can be only - 1 in the stream (or none) */ -/* processunknown is called after reading each non-critical unknown chunk */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_setcb_processheader (mng_handle hHandle, - mng_processheader fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processtext (mng_handle hHandle, - mng_processtext fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processsave (mng_handle hHandle, - mng_processsave fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processseek (mng_handle hHandle, - mng_processseek fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle, - mng_processneed fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processmend (mng_handle hHandle, - mng_processmend fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processterm (mng_handle hHandle, - mng_processterm fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processunknown(mng_handle hHandle, - mng_processunknown fProc); -#endif - -/* callbacks for display processing */ -/* getcanvasline is called to get an access-pointer to a line on the - drawing-canvas */ -/* getbkgdline is called to get an access-pointer to a line from the - background-canvas */ -/* refresh is called to inform the GUI to redraw the current canvas onto - its output device (eg. in Win32 this would mean sending an - invalidate message for the specified region */ -/* NOTE that the update-region is specified as x,y,width,height; eg. the - invalidate message for Windows requires left,top,right,bottom parameters - where the bottom-right is exclusive of the region!! - to get these correctly is as simple as: - left = x; - top = y; - right = x + width; - bottom = y + height; - if your implementation requires inclusive points, simply subtract 1 from - both the right & bottom values calculated above. - */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_retcode MNG_DECL mng_setcb_getcanvasline (mng_handle hHandle, - mng_getcanvasline fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_getbkgdline (mng_handle hHandle, - mng_getbkgdline fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_getalphaline (mng_handle hHandle, - mng_getalphaline fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_refresh (mng_handle hHandle, - mng_refresh fProc); - -/* timing callbacks */ -/* gettickcount is called to get the system tickcount (milliseconds); - this is used to determine the remaining interval between frames */ -/* settimer is called to inform the application that it should set a timer; - when the timer is triggered the app must call mng_display_resume */ -MNG_EXT mng_retcode MNG_DECL mng_setcb_gettickcount (mng_handle hHandle, - mng_gettickcount fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_settimer (mng_handle hHandle, - mng_settimer fProc); - -/* color management callbacks */ -/* called to transmit color management information to the application */ -/* these are only used when you #define MNG_APP_CMS */ -#ifdef MNG_APP_CMS -MNG_EXT mng_retcode MNG_DECL mng_setcb_processgamma (mng_handle hHandle, - mng_processgamma fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processchroma (mng_handle hHandle, - mng_processchroma fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processsrgb (mng_handle hHandle, - mng_processsrgb fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processiccp (mng_handle hHandle, - mng_processiccp fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processarow (mng_handle hHandle, - mng_processarow fProc); -#endif /* MNG_APP_CMS */ -#endif /* MNG_SUPPORT_DISPLAY */ - -/* release push data callback */ -/* used when the app pushes data into libmng (as opposed to libmng pulling it) - and relinquishes ownership of the pushed data-buffer, but *does* want to - release (free) the buffer itself once libmng has finished processing it */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_setcb_releasedata (mng_handle hHandle, - mng_releasedata fProc); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Callback get functions * */ -/* * * */ -/* ************************************************************************** */ - -/* see _setcb_ */ -#ifndef MNG_INTERNAL_MEMMNGMT -MNG_EXT mng_memalloc MNG_DECL mng_getcb_memalloc (mng_handle hHandle); -MNG_EXT mng_memfree MNG_DECL mng_getcb_memfree (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_releasedata MNG_DECL mng_getcb_releasedata (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_WRITE_SUPPORT) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -MNG_EXT mng_openstream MNG_DECL mng_getcb_openstream (mng_handle hHandle); -MNG_EXT mng_closestream MNG_DECL mng_getcb_closestream (mng_handle hHandle); -#endif -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_readdata MNG_DECL mng_getcb_readdata (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_writedata MNG_DECL mng_getcb_writedata (mng_handle hHandle); -#endif - -/* see _setcb_ */ -MNG_EXT mng_errorproc MNG_DECL mng_getcb_errorproc (mng_handle hHandle); - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_TRACE -MNG_EXT mng_traceproc MNG_DECL mng_getcb_traceproc (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_processheader MNG_DECL mng_getcb_processheader (mng_handle hHandle); -MNG_EXT mng_processtext MNG_DECL mng_getcb_processtext (mng_handle hHandle); -MNG_EXT mng_processsave MNG_DECL mng_getcb_processsave (mng_handle hHandle); -MNG_EXT mng_processseek MNG_DECL mng_getcb_processseek (mng_handle hHandle); -MNG_EXT mng_processneed MNG_DECL mng_getcb_processneed (mng_handle hHandle); -MNG_EXT mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle); -MNG_EXT mng_processterm MNG_DECL mng_getcb_processterm (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_getcanvasline MNG_DECL mng_getcb_getcanvasline (mng_handle hHandle); -MNG_EXT mng_getbkgdline MNG_DECL mng_getcb_getbkgdline (mng_handle hHandle); -MNG_EXT mng_getalphaline MNG_DECL mng_getcb_getalphaline (mng_handle hHandle); -MNG_EXT mng_refresh MNG_DECL mng_getcb_refresh (mng_handle hHandle); - -/* see _setcb_ */ -MNG_EXT mng_gettickcount MNG_DECL mng_getcb_gettickcount (mng_handle hHandle); -MNG_EXT mng_settimer MNG_DECL mng_getcb_settimer (mng_handle hHandle); - -/* see _setcb_ */ -#ifdef MNG_APP_CMS -MNG_EXT mng_processgamma MNG_DECL mng_getcb_processgamma (mng_handle hHandle); -MNG_EXT mng_processchroma MNG_DECL mng_getcb_processchroma (mng_handle hHandle); -MNG_EXT mng_processsrgb MNG_DECL mng_getcb_processsrgb (mng_handle hHandle); -MNG_EXT mng_processiccp MNG_DECL mng_getcb_processiccp (mng_handle hHandle); -MNG_EXT mng_processarow MNG_DECL mng_getcb_processarow (mng_handle hHandle); -#endif /* MNG_APP_CMS */ -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ -/* * * */ -/* * Property set functions * */ -/* * * */ -/* ************************************************************************** */ - -/* Application data pointer */ -/* provided for application use; not used by the library */ -MNG_EXT mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle, - mng_ptr pUserdata); - -/* The style of the drawing- & background-canvas */ -/* only used for displaying images */ -/* both are initially set to 24-bit RGB (eg. 8-bit per channel) */ -MNG_EXT mng_retcode MNG_DECL mng_set_canvasstyle (mng_handle hHandle, - mng_uint32 iStyle); -MNG_EXT mng_retcode MNG_DECL mng_set_bkgdstyle (mng_handle hHandle, - mng_uint32 iStyle); - -/* The default background color */ -/* only used if the getbkgdline callback is not defined */ -/* for initially painting the canvas and restoring (part of) the background */ -MNG_EXT mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue); - -/* Indicates preferred use of the bKGD chunk for PNG images */ -MNG_EXT mng_retcode MNG_DECL mng_set_usebkgd (mng_handle hHandle, - mng_bool bUseBKGD); - -/* Indicates storage of read chunks */ -/* only useful if you #define mng_store_chunks */ -/* can be used to dynamically change storage management */ -MNG_EXT mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle, - mng_bool bStorechunks); - -/* Indicates breaks requested when processing SAVE/SEEK */ -/* set this to let the app handle section breaks; the library will return - MNG_NEEDSECTIONWAIT return-codes for each SEEK chunk */ -MNG_EXT mng_retcode MNG_DECL mng_set_sectionbreaks (mng_handle hHandle, - mng_bool bSectionbreaks); - -/* Indicates storage of playback info (ON by default!) */ -/* can be used to turn off caching of playback info; this is useful to - specifically optimize MNG-video playback; note that if caching is turned off - LOOP chunks will be flagged as errors! TERM chunks will be ignored and only - passed to the processterm() callback if it is defined by the app; also, this - feature can only be used with mng_readdisplay(); mng_read(), - mng_display_reset() and mng_display_goxxxx() will return an error; - once this option is turned off it can't be turned on for the same stream!!! */ -MNG_EXT mng_retcode MNG_DECL mng_set_cacheplayback (mng_handle hHandle, - mng_bool bCacheplayback); - -/* Indicates automatic progressive refreshes for large images (ON by default!) */ -/* turn this off if you do not want intermittent painting while a large image - is being read. useful if the input-stream comes from a fast medium, such - as a local harddisk */ -MNG_EXT mng_retcode MNG_DECL mng_set_doprogressive (mng_handle hHandle, - mng_bool bDoProgressive); - -/* Indicates existence and required checking of the CRC in input streams, - and generation in output streams */ -/* !!!! Use this ONLY if you know what you are doing !!!! */ -/* The value is a combination of the following flags: - 0x0000001 = CRC is present in the input stream - 0x0000002 = CRC must be generated in the output stream - 0x0000010 = CRC should be checked for ancillary chunks - 0x0000020 = a faulty CRC for ancillary chunks generates a warning only - 0x0000040 = a faulty CRC for ancillary chunks generates an error - 0x0000100 = CRC should be checked for critical chunks - 0x0000200 = a faulty CRC for critical chunks generates a warning only - 0x0000400 = a faulty CRC for critical chunks generates an error - - The default is 0x00000533 = CRC present in input streams; should be checked; - warning for ancillary chunks; error for critical - chunks; generate CRC for output streams - - Note that some combinations are meaningless; eg. if the CRC is not present - it won't do any good to turn the checking flags on; if a checking flag - is off, it doesn't do any good to ask for generation of warnings or errors. - Also libmng will generate either an error or a warning, not both, - so if you specify both the default will be to generate an error! - The only useful combinations for input are 331, 551, 351, 531, 0, 301, 501 - and optionally 031 and 051, but only checking ancillary chunks and not - critical chunks is generally not a very good idea!!! - If you've also writing these values should be combined with 0x02 if - CRC's are required in the output stream - */ -MNG_EXT mng_retcode MNG_DECL mng_set_crcmode (mng_handle hHandle, - mng_uint32 iCrcmode); - -/* Color-management necessaries */ -/* - ************************************************************************* - !!!!!!!! THIS NEXT BIT IS IMPORTANT !!!!!!!!! - ************************************************************************* - - If you have defined MNG_FULL_CMS (and are using lcms), you will have to - think hard about the following routines. - - lcms requires 2 profiles to work off the differences in the input-image - and the output-device. The ICC profile for the input-image will be - embedded within it to reflect its color-characteristics, but the output - profile depends on the output-device, which is something only *YOU* know - about. sRGB (standard RGB) is common for x86 compatible environments - (eg. Windows, Linux and some others) - - If you are compiling for a sRGB compliant system you probably won't have - to do anything special. (unless you want to of course) - - If you are compiling for a non-sRGB compliant system - (eg. SGI, Mac, Next, others...) - you *MUST* define a proper ICC profile for the generic output-device - associated with that platform. - - In either event, you may also want to offer an option to your users to - set the profile manually, or, if you know how, set it from a - system-defined default. - - TO RECAP: for sRGB systems (Windows, Linux) no action required! - for non-sRGB systems (SGI, Mac, Next) ACTION REQUIRED! - - Please visit http://www.srgb.com, http://www.color.org and - http://www.littlecms.com for more info. - - ************************************************************************* - !!!!!!!! THE BIT ABOVE IS IMPORTANT !!!!!!!!! - ************************************************************************* -*/ -/* mng_set_srgb tells libmng if it's running on a sRGB compliant system or not - the default is already set to MNG_TRUE */ -/* mng_set_outputprofile, mng_set_outputprofile2, mng_set_outputsrgb - are used to set the default profile describing the output-device - by default it is already initialized with an sRGB profile */ -/* mng_set_srgbprofile, mng_set_srgbprofile2, mng_set_srgbimplicit - are used to set the default profile describing a standard sRGB device - this is used when the input-image is tagged only as being sRGB, but the - output-device is defined as not being sRGB compliant - by default it is already initialized with a standard sRGB profile */ -#if defined(MNG_SUPPORT_DISPLAY) -MNG_EXT mng_retcode MNG_DECL mng_set_srgb (mng_handle hHandle, - mng_bool bIssRGB); -MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile (mng_handle hHandle, - mng_pchar zFilename); -MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile); -MNG_EXT mng_retcode MNG_DECL mng_set_outputsrgb (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle, - mng_pchar zFilename); -MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile); -MNG_EXT mng_retcode MNG_DECL mng_set_srgbimplicit (mng_handle hHandle); -#endif - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -/* Gamma settings */ -/* ... blabla (explain gamma processing a little; eg. formula & stuff) ... */ -MNG_EXT mng_retcode MNG_DECL mng_set_viewgamma (mng_handle hHandle, - mng_float dGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_displaygamma (mng_handle hHandle, - mng_float dGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggamma (mng_handle hHandle, - mng_float dGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_viewgammaint (mng_handle hHandle, - mng_uint32 iGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_displaygammaint (mng_handle hHandle, - mng_uint32 iGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggammaint (mng_handle hHandle, - mng_uint32 iGamma); -#endif - -#ifndef MNG_SKIP_MAXCANVAS -/* Ultimate clipping size */ -/* used to limit extreme graphics from overloading the system */ -/* if a graphic exceeds these limits a warning is issued, which can - be ignored by the app (using the errorproc callback). in that case - the library will use these settings to clip the input graphic, and - the app's canvas must account for this */ -MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvaswidth (mng_handle hHandle, - mng_uint32 iMaxwidth); -MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvasheight (mng_handle hHandle, - mng_uint32 iMaxheight); -MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvassize (mng_handle hHandle, - mng_uint32 iMaxwidth, - mng_uint32 iMaxheight); -#endif - -/* ZLIB default compression parameters */ -/* these are used when writing out chunks */ -/* they are also used when compressing PNG image-data or JNG alpha-data; - in this case you can set them just before calling mng_putimgdata_ihdr */ -/* set to your liking; usually the defaults will suffice though! */ -/* check the documentation for ZLIB for details on these parameters */ -#ifdef MNG_INCLUDE_ZLIB -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_level (mng_handle hHandle, - mng_int32 iZlevel); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_method (mng_handle hHandle, - mng_int32 iZmethod); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_windowbits (mng_handle hHandle, - mng_int32 iZwindowbits); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_memlevel (mng_handle hHandle, - mng_int32 iZmemlevel); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_strategy (mng_handle hHandle, - mng_int32 iZstrategy); - -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_maxidat (mng_handle hHandle, - mng_uint32 iMaxIDAT); -#endif /* MNG_INCLUDE_ZLIB */ - -/* JNG default compression parameters (based on IJG code) */ -/* these are used when compressing JNG image-data; so you can set them - just before calling mng_putimgdata_jhdr */ -/* set to your liking; usually the defaults will suffice though! */ -/* check the documentation for IJGSRC6B for details on these parameters */ -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_INCLUDE_IJG6B -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_dctmethod (mng_handle hHandle, - mngjpeg_dctmethod eJPEGdctmethod); -#endif -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_quality (mng_handle hHandle, - mng_int32 iJPEGquality); -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_smoothing (mng_handle hHandle, - mng_int32 iJPEGsmoothing); -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_progressive(mng_handle hHandle, - mng_bool bJPEGprogressive); -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_optimized (mng_handle hHandle, - mng_bool bJPEGoptimized); - -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_maxjdat (mng_handle hHandle, - mng_uint32 iMaxJDAT); -#endif /* MNG_INCLUDE_JNG */ - -/* Suspension-mode setting */ -/* use this to activate the internal suspension-buffer to improve - read-suspension processing */ -/* TODO: write-suspension ??? */ -#if defined(MNG_SUPPORT_READ) -MNG_EXT mng_retcode MNG_DECL mng_set_suspensionmode (mng_handle hHandle, - mng_bool bSuspensionmode); -#endif - -/* Speed setting */ -/* use this to influence the display-speed of animations */ -#if defined(MNG_SUPPORT_DISPLAY) -MNG_EXT mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle, - mng_speedtype iSpeed); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Property get functions * */ -/* * * */ -/* ************************************************************************** */ - -/* see _set_ */ -MNG_EXT mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle); - -/* Network Graphic header details */ -/* these get filled once the graphics header is processed, - so they are available in the processheader callback; before that - they are zeroed out and imagetype is set to it_unknown */ -/* this might be a good point for the app to initialize the drawing-canvas! */ -/* note that some fields are only set for the first(!) header-chunk: - MNG/MHDR (imagetype = mng_it_mng) - ticks thru simplicity - PNG/IHDR (imagetype = mng_it_png) - bitdepth thru interlace - JNG/JHDR (imagetype = mng_it_jng) - bitdepth thru compression & - interlace thru alphainterlace */ -MNG_EXT mng_imgtype MNG_DECL mng_get_sigtype (mng_handle hHandle); -MNG_EXT mng_imgtype MNG_DECL mng_get_imagetype (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_imagewidth (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_imageheight (mng_handle hHandle); - -MNG_EXT mng_uint32 MNG_DECL mng_get_ticks (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_framecount (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_layercount (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_playtime (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_simplicity (mng_handle hHandle); - -MNG_EXT mng_uint8 MNG_DECL mng_get_bitdepth (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_colortype (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_compression (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_filter (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_interlace (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphabitdepth (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphacompression(mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphafilter (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphainterlace (mng_handle hHandle); - -/* indicates the predicted alpha-depth required to properly display the image */ -/* gets set once the graphics header is processed and is available in the - processheader callback for any type of input-image (PNG, JNG or MNG) */ -/* possible values are 0,1,2,4,8,16 - 0 = no transparency required - 1 = on/off transparency required (alpha-values are 0 or 2^bit_depth-1) - 2+ = semi-transparency required (values will be scaled to the bitdepth of the - canvasstyle supplied by the application) */ -MNG_EXT mng_uint8 MNG_DECL mng_get_alphadepth (mng_handle hHandle); - -/* defines whether a refresh() callback is called for an interlace pass (PNG) - or progressive scan (JNG) */ -/* returns the interlace pass number for PNG or a fabricated pass number for JNG; - returns 0 in all other cases */ -/* only useful if the image_type = mng_it_png or mng_it_jng and if the image - is actually interlaced (PNG) or progressive (JNG) */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_uint8 MNG_DECL mng_get_refreshpass (mng_handle hHandle); -#endif - -/* see _set_ */ -MNG_EXT mng_uint32 MNG_DECL mng_get_canvasstyle (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_bkgdstyle (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_retcode MNG_DECL mng_get_bgcolor (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_usebkgd (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_storechunks (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_sectionbreaks (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_cacheplayback (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_doprogressive (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_uint32 MNG_DECL mng_get_crcmode (mng_handle hHandle); - -/* see _set_ */ -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS) -MNG_EXT mng_bool MNG_DECL mng_get_srgb (mng_handle hHandle); -#endif - -/* see _set_ */ -MNG_EXT mng_float MNG_DECL mng_get_viewgamma (mng_handle hHandle); -MNG_EXT mng_float MNG_DECL mng_get_displaygamma (mng_handle hHandle); -MNG_EXT mng_float MNG_DECL mng_get_dfltimggamma (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_viewgammaint (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_displaygammaint (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_dfltimggammaint (mng_handle hHandle); - -#ifndef MNG_SKIP_MAXCANVAS -/* see _set_ */ -MNG_EXT mng_uint32 MNG_DECL mng_get_maxcanvaswidth (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_maxcanvasheight (mng_handle hHandle); -#endif - -/* see _set_ */ -#ifdef MNG_INCLUDE_ZLIB -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_level (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_method (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_windowbits (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_memlevel (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_strategy (mng_handle hHandle); - -MNG_EXT mng_uint32 MNG_DECL mng_get_zlib_maxidat (mng_handle hHandle); -#endif /* MNG_INCLUDE_ZLIB */ - -/* see _set_ */ -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_INCLUDE_IJG6B -MNG_EXT mngjpeg_dctmethod - MNG_DECL mng_get_jpeg_dctmethod (mng_handle hHandle); -#endif -MNG_EXT mng_int32 MNG_DECL mng_get_jpeg_quality (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_jpeg_smoothing (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_get_jpeg_progressive(mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_get_jpeg_optimized (mng_handle hHandle); - -MNG_EXT mng_uint32 MNG_DECL mng_get_jpeg_maxjdat (mng_handle hHandle); -#endif /* MNG_INCLUDE_JNG */ - -/* see _set_ */ -#if defined(MNG_SUPPORT_READ) -MNG_EXT mng_bool MNG_DECL mng_get_suspensionmode (mng_handle hHandle); -#endif - -/* see _set_ */ -#if defined(MNG_SUPPORT_DISPLAY) -MNG_EXT mng_speedtype - MNG_DECL mng_get_speed (mng_handle hHandle); -#endif - -/* Image-level */ -/* this can be used inside the processtext callback to determine the level of - text of the image being processed; the value 1 is returned for top-level - texts, and the value 2 for a text inside an embedded image inside a MNG */ -MNG_EXT mng_uint32 MNG_DECL mng_get_imagelevel (mng_handle hHandle); - -/* BACK info */ -/* can be used to retrieve the color & mandatory values for the last processed - BACK chunk of a MNG (will fail for other image-types); - if no BACK chunk was processed yet, it will return all zeroes */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_retcode MNG_DECL mng_get_lastbackchunk (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue, - mng_uint8* iMandatory); -#endif - -/* SEEK info */ -/* can be used to retrieve the segmentname of the last processed SEEK chunk; - if no SEEK chunk was processed or its segmentname was empty, the function - will return an empty string; the provided buffer must be at least 80 bytes!! */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_retcode MNG_DECL mng_get_lastseekname (mng_handle hHandle, - mng_pchar zSegmentname); -#endif - -/* FRAM info */ -/* can be used to retrieve the current FRAM delay; this may be useful when - retrieving a stream of frames with their corresponding delays by "fake" - reading and displaying the file */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_uint32 MNG_DECL mng_get_currframdelay (mng_handle hHandle); -#endif - -/* Display status variables */ -/* these get filled & updated during display processing */ -/* starttime is the tickcount at the start of displaying the animation */ -/* runtime is the actual number of millisecs since the start of the animation */ -/* currentframe, currentlayer & currentplaytime indicate the current - frame/layer/playtime(msecs) in the animation (these keep increasing; - even after the animation loops back to the TERM chunk) */ -/* totalframes, totallayers & totalplaytime are filled after a complete run - of an animation (eg. at MEND); they are also valid after just reading the MNG */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_uint32 MNG_DECL mng_get_starttime (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_runtime (mng_handle hHandle); -#ifndef MNG_NO_CURRENT_INFO -MNG_EXT mng_uint32 MNG_DECL mng_get_currentframe (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_currentlayer (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_currentplaytime (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_totalframes (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_totallayers (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_totalplaytime (mng_handle hHandle); -#endif -#endif - -/* Status variables */ -/* these indicate the internal state of the library */ -/* most indicate exactly what you would expect - - status_error: true if the last function call returned an errorcode - status_reading: true if the library is (still) reading an image - status_suspendbreak: true if the library has suspended for "I/O" - status_creating: true if the library is in the middle of creating an image - status_writing: true if the library is in the middle of writing an image - status_displaying: true if the library is displaying an image - status_running: true if display processing is active (eg. not frozen or reset) - status_timerbreak: true if the library has suspended for a "timer-break" - status_dynamic: true if the library encountered an evNT chunk in the MNG - status_runningevent: true if the library is processing an external event */ -/* eg. mng_readdisplay() will turn the reading, displaying and running status on; - when EOF is reached the reading status will be turned off */ -MNG_EXT mng_bool MNG_DECL mng_status_error (mng_handle hHandle); -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_bool MNG_DECL mng_status_reading (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_suspendbreak (mng_handle hHandle); -#endif -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_bool MNG_DECL mng_status_creating (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_writing (mng_handle hHandle); -#endif -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_bool MNG_DECL mng_status_displaying (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_running (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_timerbreak (mng_handle hHandle); -#endif -#ifdef MNG_SUPPORT_DYNAMICMNG -MNG_EXT mng_bool MNG_DECL mng_status_dynamic (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_runningevent (mng_handle hHandle); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Chunk access functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_ACCESS_CHUNKS - -/* ************************************************************************** */ - -/* use this to iterate the stored chunks */ -/* requires MNG_ACCESS_CHUNKS & MNG_STORE_CHUNKS */ -/* starts from the supplied chunk-index-nr; the first chunk has index 0!! */ -MNG_EXT mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle, - mng_uint32 iChunkseq, - mng_iteratechunk fProc); - -/* use the next function inside your 'iteratechunk' callback to copy - the given chunk to a new mng you are creating */ -/* the 'out' handle should be in 'create' status! */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_retcode MNG_DECL mng_copy_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_handle hHandleOut); -#endif - -/* ************************************************************************** */ - -/* use these to get chunk data from within the callback in iterate_chunks */ -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_palette8 *aPalette); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_bool *bGlobal, - mng_uint8 *iType, - mng_uint32 *iCount, - mng_uint8arr *aAlphas, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint32 *iRawlen, - mng_uint8arr *aRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iGamma); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iWhitepointx, - mng_uint32 *iWhitepointy, - mng_uint32 *iRedx, - mng_uint32 *iRedy, - mng_uint32 *iGreenx, - mng_uint32 *iGreeny, - mng_uint32 *iBluex, - mng_uint32 *iBluey); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iRenderingintent); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iCompression, - mng_uint32 *iProfilesize, - mng_ptr *pProfile); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint32 *iTextsize, - mng_pchar *zText); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompression, - mng_uint32 *iTextsize, - mng_pchar *zText); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompressionflag, - mng_uint8 *iCompressionmethod, - mng_uint32 *iLanguagesize, - mng_pchar *zLanguage, - mng_uint32 *iTranslationsize, - mng_pchar *zTranslation, - mng_uint32 *iTextsize, - mng_pchar *zText); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8 *iIndex, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8arr4 *aBits); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iSampledepth, - mng_uint32 *iEntrycount, - mng_ptr *pEntries); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iEntrycount, - mng_uint16arr *aEntries); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iYear, - mng_uint8 *iMonth, - mng_uint8 *iDay, - mng_uint8 *iHour, - mng_uint8 *iMinute, - mng_uint8 *iSecond); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint32 *iTicks, - mng_uint32 *iLayercount, - mng_uint32 *iFramecount, - mng_uint32 *iPlaytime, - mng_uint32 *iSimplicity); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel, - mng_uint32 *iRepeat, - mng_uint8 *iTermination, - mng_uint32 *iItermin, - mng_uint32 *iItermax, - mng_uint32 *iCount, - mng_uint32p *pSignals); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_int32 *iXlocation, - mng_int32 *iYlocation, - mng_bool *bHasclip, - mng_int32 *iLeftcb, - mng_int32 *iRightcb, - mng_int32 *iTopcb, - mng_int32 *iBottomcb); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_uint8 *iViewable); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSourceid, - mng_uint16 *iCloneid, - mng_uint8 *iClonetype, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_uint8 *iLocationtype, - mng_int32 *iLocationx, - mng_int32 *iLocationy); - -#ifndef MNG_SKIPCHUNK_PAST -MNG_EXT mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iDestid, - mng_uint8 *iTargettype, - mng_int32 *iTargetx, - mng_int32 *iTargety, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iSourceid, - mng_uint8 *iComposition, - mng_uint8 *iOrientation, - mng_uint8 *iOffsettype, - mng_int32 *iOffsetx, - mng_int32 *iOffsety, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_uint16p *pObjectids); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint8 *iMandatory, - mng_uint16 *iImageid, - mng_uint8 *iTile); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iMode, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iChangedelay, - mng_uint8 *iChangetimeout, - mng_uint8 *iChangeclipping, - mng_uint8 *iChangesyncid, - mng_uint32 *iDelay, - mng_uint32 *iTimeout, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb, - mng_uint32 *iCount, - mng_uint32p *pSyncids); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMovetype, - mng_int32 *iMovex, - mng_int32 *iMovey); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iCliptype, - mng_int32 *iClipl, - mng_int32 *iClipr, - mng_int32 *iClipt, - mng_int32 *iClipb); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMode); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iTermaction, - mng_uint8 *iIteraction, - mng_uint32 *iDelay, - mng_uint32 *iItermax); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iOffsettype, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEntrytype, - mng_uint32arr2 *iOffset, - mng_uint32arr2 *iStarttime, - mng_uint32 *iLayernr, - mng_uint32 *iFramenr, - mng_uint32 *iNamesize, - mng_pchar *zName); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iNamesize, - mng_pchar *zName); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSnapshotid, - mng_uint32 *iNamesize, - mng_pchar *zName); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint8 *iPriority); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iColortype, - mng_uint8 *iImagesampledepth, - mng_uint8 *iImagecompression, - mng_uint8 *iImageinterlace, - mng_uint8 *iAlphasampledepth, - mng_uint8 *iAlphacompression, - mng_uint8 *iAlphafilter, - mng_uint8 *iAlphainterlace); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdaa (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iImagetype, - mng_uint8 *iDeltatype, - mng_uint32 *iBlockwidth, - mng_uint32 *iBlockheight, - mng_uint32 *iBlockx, - mng_uint32 *iBlocky); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iColortype, - mng_uint8 *iSampledepth, - mng_uint8 *iFilltype); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_bool *bUsed); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_chunkidp *pChunknames); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint8 *iPolarity, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_chunkid *iChunkname, - mng_uint8 *iOrdertype); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint16 *iMethodX, - mng_uint16 *iMX, - mng_uint16 *iMY, - mng_uint16 *iML, - mng_uint16 *iMR, - mng_uint16 *iMT, - mng_uint16 *iMB, - mng_uint16 *iMethodY); - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iFramewidth, - mng_uint32 *iFrameheight, - mng_uint16 *iNumplays, - mng_uint16 *iTickspersec, - mng_uint8 *iCompressionmethod, - mng_uint32 *iCount); -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng_frame (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint32 *iX, - mng_uint32 *iY, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_int32 *iXoffset, - mng_int32 *iYoffset, - mng_uint16 *iTicks); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_evnt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_evnt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEventtype, - mng_uint8 *iMasktype, - mng_int32 *iLeft, - mng_int32 *iRight, - mng_int32 *iTop, - mng_int32 *iBottom, - mng_uint16 *iObjectid, - mng_uint8 *iIndex, - mng_uint32 *iSegmentnamesize, - mng_pchar *zSegmentname); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* use these to create new chunks at the end of the chunk-list */ -/* requires at least MNG_ACCESS_CHUNKS (MNG_SUPPORT_WRITE may be nice too) */ -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle, - mng_uint32 iCount, - mng_palette8 aPalette); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle, - mng_bool bEmpty, - mng_bool bGlobal, - mng_uint8 iType, - mng_uint32 iCount, - mng_uint8arr aAlphas, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint32 iRawlen, - mng_uint8arr aRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iGamma); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iRenderingintent); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iCompression, - mng_uint32 iProfilesize, - mng_ptr pProfile); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint32 iTextsize, - mng_pchar zText); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompression, - mng_uint32 iTextsize, - mng_pchar zText); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompressionflag, - mng_uint8 iCompressionmethod, - mng_uint32 iLanguagesize, - mng_pchar zLanguage, - mng_uint32 iTranslationsize, - mng_pchar zTranslation, - mng_uint32 iTextsize, - mng_pchar zText); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8 iIndex, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8arr4 aBits); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iSampledepth, - mng_uint32 iEntrycount, - mng_ptr pEntries); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle, - mng_uint32 iEntrycount, - mng_uint16arr aEntries); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle, - mng_uint16 iYear, - mng_uint8 iMonth, - mng_uint8 iDay, - mng_uint8 iHour, - mng_uint8 iMinute, - mng_uint8 iSecond); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint32 iTicks, - mng_uint32 iLayercount, - mng_uint32 iFramecount, - mng_uint32 iPlaytime, - mng_uint32 iSimplicity); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle, - mng_uint8 iLevel, - mng_uint32 iRepeat, - mng_uint8 iTermination, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle, - mng_uint8 iLevel); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_int32 iXlocation, - mng_int32 iYlocation, - mng_bool bHasclip, - mng_int32 iLeftcb, - mng_int32 iRightcb, - mng_int32 iTopcb, - mng_int32 iBottomcb); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha, - mng_uint8 iViewable); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy); - -#ifndef MNG_SKIPCHUNK_PAST -MNG_EXT mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle, - mng_uint16 iDestid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iSourceid, - mng_uint8 iComposition, - mng_uint8 iOrientation, - mng_uint8 iOffsettype, - mng_int32 iOffsetx, - mng_int32 iOffsety, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle, - mng_uint32 iCount, - mng_uint16p pObjectids); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iMode, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iChangedelay, - mng_uint8 iChangetimeout, - mng_uint8 iChangeclipping, - mng_uint8 iChangesyncid, - mng_uint32 iDelay, - mng_uint32 iTimeout, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb, - mng_uint32 iCount, - mng_uint32p pSyncids); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle, - mng_bool bEmpty, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iOffsettype, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEntrytype, - mng_uint32arr2 iOffset, - mng_uint32arr2 iStarttime, - mng_uint32 iLayernr, - mng_uint32 iFramenr, - mng_uint32 iNamesize, - mng_pchar zName); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle, - mng_uint32 iNamesize, - mng_pchar zName); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle, - mng_uint16 iSnapshotid, - mng_uint32 iNamesize, - mng_pchar zName); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint8 iPriority); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle, - mng_uint32 iKeywordssize, - mng_pchar zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iImagesampledepth, - mng_uint8 iImagecompression, - mng_uint8 iImageinterlace, - mng_uint8 iAlphasampledepth, - mng_uint8 iAlphacompression, - mng_uint8 iAlphafilter, - mng_uint8 iAlphainterlace); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdaa (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle, - mng_uint8 iColortype, - mng_uint8 iSampledepth, - mng_uint8 iFilltype); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jpng (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle, - mng_uint32 iCount, - mng_chunkidp pChunknames); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint8 iPolarity, - mng_uint32 iKeywordssize, - mng_pchar zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_chunkid iChunkname, - mng_uint8 iOrdertype); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint16 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint16 iMethodY); - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng (mng_handle hHandle, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint8 iCompressionmethod, - mng_uint32 iCount); -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng_frame (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_int32 iXoffset, - mng_int32 iYoffset, - mng_uint16 iTicks); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_evnt (mng_handle hHandle, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_evnt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -/* use these functions to access the actual image-data in stored chunks, - as opposed to the IDAT/JDAT data */ -/* to get accurate pixel-data the canvasstyle should seriously reflect the - bitdepth/colortype combination of the preceding IHDR/JHDR/BASI/DHDR; - all input can be converted to rgb(a)8 (rgb(a)16 for 16-bit images), but - there are only limited conversions back (see below for putimgdata) */ - -/* call this function if you want to extract the nth image from the list; - the first image is designated seqnr 0! */ -/* this function finds the IHDR/JHDR/BASI/DHDR with the appropriate seqnr, - starting from the beginning of the chunk-list; this may tend to get a little - slow for animations with a large number of chunks for images near the end */ -/* supplying a seqnr past the last image in the animation will return with - an errorcode */ -MNG_EXT mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* both the following functions will search forward to find the first IDAT/JDAT, - and then traverse back to find the start of the image (IHDR,JHDR,DHDR,BASI); - note that this is very fast compared to decoding the IDAT/JDAT, so there's - not really a need for optimization; either can be called from the - iterate_chunks callback when a IHDR/JHDR is encountered; for BASI/DHDR there - may not be real image-data so it's wisest to keep iterating till the IEND, - and then call either of these functions if necessary (remember the correct seqnr!) */ - -/* call this function if you want to extract the image starting at or after the nth - position in the chunk-list; this number is returned in the iterate_chunks callback */ -MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* call this function if you want to extract the image starting at or after the - indicated chunk; the handle of a chunk is returned in the iterate_chunks callback */ -MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* use the following functions to add image-data to the list of stored chunks */ -/* note that this only adds the IDAT or JDAT chunks and no others; you must call - one of these functions after you 'put' the initial chunks of the image and - before you 'put' the closing chunks */ -/* the canvasstyle should seriously reflect the bitdepth/colortype combination; - eg. bitdepth=16 would expect a 16-bit canvasstyle, - colortype=g or ga would expect a gray or gray+alpha style respectively - and so on, and so forth ... - (nb. the number of conversions will be extremely limited for the moment!) */ - -MNG_EXT mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -MNG_EXT mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iInterlace, - mng_uint8 iAlphaBitdepth, - mng_uint8 iAlphaCompression, - mng_uint8 iAlphaFilter, - mng_uint8 iAlphaInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* ************************************************************************** */ - -/* use the following functions to set the framecount/layercount/playtime or - simplicity of an animation you are creating; this may be useful if these - variables are calculated during the creation-process */ - -MNG_EXT mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle, - mng_uint32 iFramecount, - mng_uint32 iLayercount, - mng_uint32 iPlaytime); - -MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle, - mng_uint32 iSimplicity); - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -#endif /* MNG_ACCESS_CHUNKS */ - -/* ************************************************************************** */ -/* * * */ -/* * Error-code structure * */ -/* * * */ -/* * 0b0000 00xx xxxx xxxx - basic errors; severity 9 (environment) * */ -/* * 0b0000 01xx xxxx xxxx - chunk errors; severity 9 (image induced) * */ -/* * 0b0000 10xx xxxx xxxx - severity 5 errors (application induced) * */ -/* * 0b0001 00xx xxxx xxxx - severity 2 warnings (recoverable) * */ -/* * 0b0010 00xx xxxx xxxx - severity 1 warnings (recoverable) * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_NOERROR (mng_retcode)0 /* er.. indicates all's well */ - -#define MNG_OUTOFMEMORY (mng_retcode)1 /* oops, buy some megabytes! */ -#define MNG_INVALIDHANDLE (mng_retcode)2 /* call mng_initialize first */ -#define MNG_NOCALLBACK (mng_retcode)3 /* set the callbacks please */ -#define MNG_UNEXPECTEDEOF (mng_retcode)4 /* what'd ya do with the data? */ -#define MNG_ZLIBERROR (mng_retcode)5 /* zlib burped */ -#define MNG_JPEGERROR (mng_retcode)6 /* jpglib complained */ -#define MNG_LCMSERROR (mng_retcode)7 /* little cms stressed out */ -#define MNG_NOOUTPUTPROFILE (mng_retcode)8 /* no output-profile defined */ -#define MNG_NOSRGBPROFILE (mng_retcode)9 /* no sRGB-profile defined */ -#define MNG_BUFOVERFLOW (mng_retcode)10 /* zlib output-buffer overflow */ -#define MNG_FUNCTIONINVALID (mng_retcode)11 /* ay, totally inappropriate */ -#define MNG_OUTPUTERROR (mng_retcode)12 /* disk full ? */ -#define MNG_JPEGBUFTOOSMALL (mng_retcode)13 /* can't handle buffer overflow*/ -#define MNG_NEEDMOREDATA (mng_retcode)14 /* I'm hungry, give me more */ -#define MNG_NEEDTIMERWAIT (mng_retcode)15 /* Sleep a while then wake me */ -#define MNG_NEEDSECTIONWAIT (mng_retcode)16 /* just processed a SEEK */ -#define MNG_LOOPWITHCACHEOFF (mng_retcode)17 /* LOOP when playback info off */ - -#define MNG_DLLNOTLOADED (mng_retcode)99 /* late binding failed */ - -#define MNG_APPIOERROR (mng_retcode)901 /* application I/O error */ -#define MNG_APPTIMERERROR (mng_retcode)902 /* application timing error */ -#define MNG_APPCMSERROR (mng_retcode)903 /* application CMS error */ -#define MNG_APPMISCERROR (mng_retcode)904 /* application other error */ -#define MNG_APPTRACEABORT (mng_retcode)905 /* application aborts on trace */ - -#define MNG_INTERNALERROR (mng_retcode)999 /* internal inconsistancy */ - -#define MNG_INVALIDSIG (mng_retcode)1025 /* invalid graphics file */ -#define MNG_INVALIDCRC (mng_retcode)1027 /* crc check failed */ -#define MNG_INVALIDLENGTH (mng_retcode)1028 /* chunklength mystifies me */ -#define MNG_SEQUENCEERROR (mng_retcode)1029 /* invalid chunk sequence */ -#define MNG_CHUNKNOTALLOWED (mng_retcode)1030 /* completely out-of-place */ -#define MNG_MULTIPLEERROR (mng_retcode)1031 /* only one occurence allowed */ -#define MNG_PLTEMISSING (mng_retcode)1032 /* indexed-color requires PLTE */ -#define MNG_IDATMISSING (mng_retcode)1033 /* IHDR-block requires IDAT */ -#define MNG_CANNOTBEEMPTY (mng_retcode)1034 /* must contain some data */ -#define MNG_GLOBALLENGTHERR (mng_retcode)1035 /* global data incorrect */ -#define MNG_INVALIDBITDEPTH (mng_retcode)1036 /* bitdepth out-of-range */ -#define MNG_INVALIDCOLORTYPE (mng_retcode)1037 /* colortype out-of-range */ -#define MNG_INVALIDCOMPRESS (mng_retcode)1038 /* compression method invalid */ -#define MNG_INVALIDFILTER (mng_retcode)1039 /* filter method invalid */ -#define MNG_INVALIDINTERLACE (mng_retcode)1040 /* interlace method invalid */ -#define MNG_NOTENOUGHIDAT (mng_retcode)1041 /* ran out of compressed data */ -#define MNG_PLTEINDEXERROR (mng_retcode)1042 /* palette-index out-of-range */ -#define MNG_NULLNOTFOUND (mng_retcode)1043 /* couldn't find null-separator*/ -#define MNG_KEYWORDNULL (mng_retcode)1044 /* keyword cannot be empty */ -#define MNG_OBJECTUNKNOWN (mng_retcode)1045 /* the object can't be found */ -#define MNG_OBJECTEXISTS (mng_retcode)1046 /* the object already exists */ -#define MNG_TOOMUCHIDAT (mng_retcode)1047 /* got too much compressed data*/ -#define MNG_INVSAMPLEDEPTH (mng_retcode)1048 /* sampledepth out-of-range */ -#define MNG_INVOFFSETSIZE (mng_retcode)1049 /* invalid offset-size */ -#define MNG_INVENTRYTYPE (mng_retcode)1050 /* invalid entry-type */ -#define MNG_ENDWITHNULL (mng_retcode)1051 /* may not end with NULL */ -#define MNG_INVIMAGETYPE (mng_retcode)1052 /* invalid image_type */ -#define MNG_INVDELTATYPE (mng_retcode)1053 /* invalid delta_type */ -#define MNG_INVALIDINDEX (mng_retcode)1054 /* index-value invalid */ -#define MNG_TOOMUCHJDAT (mng_retcode)1055 /* got too much compressed data*/ -#define MNG_JPEGPARMSERR (mng_retcode)1056 /* JHDR/JPEG parms do not match*/ -#define MNG_INVFILLMETHOD (mng_retcode)1057 /* invalid fill_method */ -#define MNG_OBJNOTCONCRETE (mng_retcode)1058 /* object must be concrete */ -#define MNG_TARGETNOALPHA (mng_retcode)1059 /* object has no alpha-channel */ -#define MNG_MNGTOOCOMPLEX (mng_retcode)1060 /* can't handle complexity */ -#define MNG_UNKNOWNCRITICAL (mng_retcode)1061 /* unknown critical chunk found*/ -#define MNG_UNSUPPORTEDNEED (mng_retcode)1062 /* nEED requirement unsupported*/ -#define MNG_INVALIDDELTA (mng_retcode)1063 /* Delta operation illegal */ -#define MNG_INVALIDMETHOD (mng_retcode)1064 /* invalid MAGN method */ -#define MNG_IMPROBABLELENGTH (mng_retcode)1065 /* impropable chunk length */ -#define MNG_INVALIDBLOCK (mng_retcode)1066 /* invalid delta block */ -#define MNG_INVALIDEVENT (mng_retcode)1067 /* invalid event_type */ -#define MNG_INVALIDMASK (mng_retcode)1068 /* invalid mask_type */ -#define MNG_NOMATCHINGLOOP (mng_retcode)1069 /* ENDL without matching LOOP */ -#define MNG_SEEKNOTFOUND (mng_retcode)1070 /* EvNT points to unknown SEEK */ -#define MNG_OBJNOTABSTRACT (mng_retcode)1071 /* object must be abstract */ -#define MNG_TERMSEQERROR (mng_retcode)1072 /* TERM in wrong place */ -#define MNG_INVALIDFIELDVAL (mng_retcode)1073 /* invalid fieldvalue (generic)*/ -#define MNG_INVALIDWIDTH (mng_retcode)1074 /* invalid frame/image width */ -#define MNG_INVALIDHEIGHT (mng_retcode)1075 /* invalid frame/image height */ - -#define MNG_INVALIDCNVSTYLE (mng_retcode)2049 /* can't make anything of this */ -#define MNG_WRONGCHUNK (mng_retcode)2050 /* accessing the wrong chunk */ -#define MNG_INVALIDENTRYIX (mng_retcode)2051 /* accessing the wrong entry */ -#define MNG_NOHEADER (mng_retcode)2052 /* must have had header first */ -#define MNG_NOCORRCHUNK (mng_retcode)2053 /* can't find parent chunk */ -#define MNG_NOMHDR (mng_retcode)2054 /* no MNG header available */ - -#define MNG_IMAGETOOLARGE (mng_retcode)4097 /* input-image way too big */ -#define MNG_NOTANANIMATION (mng_retcode)4098 /* file not a MNG */ -#define MNG_FRAMENRTOOHIGH (mng_retcode)4099 /* frame-nr out-of-range */ -#define MNG_LAYERNRTOOHIGH (mng_retcode)4100 /* layer-nr out-of-range */ -#define MNG_PLAYTIMETOOHIGH (mng_retcode)4101 /* playtime out-of-range */ -#define MNG_FNNOTIMPLEMENTED (mng_retcode)4102 /* function not yet available */ - -#define MNG_IMAGEFROZEN (mng_retcode)8193 /* stopped displaying */ - -#define MNG_LCMS_NOHANDLE 1 /* LCMS returned NULL handle */ -#define MNG_LCMS_NOMEM 2 /* LCMS returned NULL gammatab */ -#define MNG_LCMS_NOTRANS 3 /* LCMS returned NULL transform*/ - -/* ************************************************************************** */ -/* * * */ -/* * Canvas styles * */ -/* * * */ -/* * Note that the intentions are pretty darn good, but that the focus * */ -/* * is currently on 8-bit color support * */ -/* * * */ -/* * The RGB8_A8 style is defined for apps that require a separate * */ -/* * canvas for the color-planes and the alpha-plane (eg. mozilla) * */ -/* * This requires for the app to supply the "getalphaline" callback!!! * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_CANVAS_RGB8 0x00000000L -#define MNG_CANVAS_RGBA8 0x00001000L -#define MNG_CANVAS_RGBA8_PM 0x00009000L -#define MNG_CANVAS_ARGB8 0x00003000L -#define MNG_CANVAS_ARGB8_PM 0x0000B000L -#define MNG_CANVAS_RGB8_A8 0x00005000L -#define MNG_CANVAS_BGR8 0x00000001L -#define MNG_CANVAS_BGRX8 0x00010001L -#define MNG_CANVAS_BGRA8 0x00001001L -#define MNG_CANVAS_BGRA8PM 0x00009001L /* backward compatibility */ -#define MNG_CANVAS_BGRA8_PM 0x00009001L -#define MNG_CANVAS_ABGR8 0x00003001L -#define MNG_CANVAS_ABGR8_PM 0x0000B001L -#define MNG_CANVAS_RGB16 0x00000100L /* not supported yet */ -#define MNG_CANVAS_RGBA16 0x00001100L /* not supported yet */ -#define MNG_CANVAS_ARGB16 0x00003100L /* not supported yet */ -#define MNG_CANVAS_BGR16 0x00000101L /* not supported yet */ -#define MNG_CANVAS_BGRA16 0x00001101L /* not supported yet */ -#define MNG_CANVAS_ABGR16 0x00003101L /* not supported yet */ -#define MNG_CANVAS_GRAY8 0x00000002L /* not supported yet */ -#define MNG_CANVAS_GRAY16 0x00000102L /* not supported yet */ -#define MNG_CANVAS_GRAYA8 0x00001002L /* not supported yet */ -#define MNG_CANVAS_GRAYA16 0x00001102L /* not supported yet */ -#define MNG_CANVAS_AGRAY8 0x00003002L /* not supported yet */ -#define MNG_CANVAS_AGRAY16 0x00003102L /* not supported yet */ -#define MNG_CANVAS_DX15 0x00000003L /* not supported yet */ -#define MNG_CANVAS_DX16 0x00000004L /* not supported yet */ - -#define MNG_CANVAS_RGB565 0x00000005L -#define MNG_CANVAS_RGBA565 0x00001005L -#define MNG_CANVAS_BGR565 0x00000006L -#define MNG_CANVAS_BGRA565 0x00001006L -#define MNG_CANVAS_BGR565_A8 0x00004006L - -#define MNG_CANVAS_RGB555 0x00000007L -#define MNG_CANVAS_BGR555 0x00000008L - -#define MNG_CANVAS_PIXELTYPE(C) (C & 0x000000FFL) -#define MNG_CANVAS_BITDEPTH(C) (C & 0x00000100L) -#define MNG_CANVAS_HASALPHA(C) (C & 0x00001000L) -#define MNG_CANVAS_ALPHAFIRST(C) (C & 0x00002000L) -#define MNG_CANVAS_ALPHASEPD(C) (C & 0x00004000L) -#define MNG_CANVAS_ALPHAPM(C) (C & 0x00008000L) -#define MNG_CANVAS_HASFILLER(C) (C & 0x00010000L) - -#define MNG_CANVAS_RGB(C) (MNG_CANVAS_PIXELTYPE (C) == 0) -#define MNG_CANVAS_BGR(C) (MNG_CANVAS_PIXELTYPE (C) == 1) -#define MNG_CANVAS_GRAY(C) (MNG_CANVAS_PIXELTYPE (C) == 2) -#define MNG_CANVAS_DIRECTX15(C) (MNG_CANVAS_PIXELTYPE (C) == 3) -#define MNG_CANVAS_DIRECTX16(C) (MNG_CANVAS_PIXELTYPE (C) == 4) -#define MNG_CANVAS_RGB_565(C) (MNG_CANVAS_PIXELTYPE (C) == 5) -#define MNG_CANVAS_BGR_565(C) (MNG_CANVAS_PIXELTYPE (C) == 6) -#define MNG_CANVAS_8BIT(C) (!MNG_CANVAS_BITDEPTH (C)) -#define MNG_CANVAS_16BIT(C) (MNG_CANVAS_BITDEPTH (C)) -#define MNG_CANVAS_PIXELFIRST(C) (!MNG_CANVAS_ALPHAFIRST (C)) - -/* ************************************************************************** */ -/* * * */ -/* * Chunk names (idea adapted from libpng 1.1.0 - png.h) * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_UINT_HUH 0x40404040L - -#define MNG_UINT_BACK 0x4241434bL -#define MNG_UINT_BASI 0x42415349L -#define MNG_UINT_CLIP 0x434c4950L -#define MNG_UINT_CLON 0x434c4f4eL -#define MNG_UINT_DBYK 0x4442594bL -#define MNG_UINT_DEFI 0x44454649L -#define MNG_UINT_DHDR 0x44484452L -#define MNG_UINT_DISC 0x44495343L -#define MNG_UINT_DROP 0x44524f50L -#define MNG_UINT_ENDL 0x454e444cL -#define MNG_UINT_FRAM 0x4652414dL -#define MNG_UINT_IDAT 0x49444154L -#define MNG_UINT_IEND 0x49454e44L -#define MNG_UINT_IHDR 0x49484452L -#define MNG_UINT_IJNG 0x494a4e47L -#define MNG_UINT_IPNG 0x49504e47L -#define MNG_UINT_JDAA 0x4a444141L -#define MNG_UINT_JDAT 0x4a444154L -#define MNG_UINT_JHDR 0x4a484452L -#define MNG_UINT_JSEP 0x4a534550L -#define MNG_UINT_JdAA 0x4a644141L -#define MNG_UINT_LOOP 0x4c4f4f50L -#define MNG_UINT_MAGN 0x4d41474eL -#define MNG_UINT_MEND 0x4d454e44L -#define MNG_UINT_MHDR 0x4d484452L -#define MNG_UINT_MOVE 0x4d4f5645L -#define MNG_UINT_ORDR 0x4f524452L -#define MNG_UINT_PAST 0x50415354L -#define MNG_UINT_PLTE 0x504c5445L -#define MNG_UINT_PPLT 0x50504c54L -#define MNG_UINT_PROM 0x50524f4dL -#define MNG_UINT_SAVE 0x53415645L -#define MNG_UINT_SEEK 0x5345454bL -#define MNG_UINT_SHOW 0x53484f57L -#define MNG_UINT_TERM 0x5445524dL -#define MNG_UINT_adAT 0x61644154L -#define MNG_UINT_ahDR 0x61684452L -#define MNG_UINT_bKGD 0x624b4744L -#define MNG_UINT_cHRM 0x6348524dL -#define MNG_UINT_eXPI 0x65585049L -#define MNG_UINT_evNT 0x65764e54L -#define MNG_UINT_fPRI 0x66505249L -#define MNG_UINT_gAMA 0x67414d41L -#define MNG_UINT_hIST 0x68495354L -#define MNG_UINT_iCCP 0x69434350L -#define MNG_UINT_iTXt 0x69545874L -#define MNG_UINT_mpNG 0x6d704e47L -#define MNG_UINT_nEED 0x6e454544L -#define MNG_UINT_oFFs 0x6f464673L -#define MNG_UINT_pCAL 0x7043414cL -#define MNG_UINT_pHYg 0x70444167L -#define MNG_UINT_pHYs 0x70485973L -#define MNG_UINT_sBIT 0x73424954L -#define MNG_UINT_sCAL 0x7343414cL -#define MNG_UINT_sPLT 0x73504c54L -#define MNG_UINT_sRGB 0x73524742L -#define MNG_UINT_tEXt 0x74455874L -#define MNG_UINT_tIME 0x74494d45L -#define MNG_UINT_tRNS 0x74524e53L -#define MNG_UINT_zTXt 0x7a545874L - -/* ************************************************************************** */ -/* * * */ -/* * Chunk property values * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_BITDEPTH_1 1 /* IHDR, BASI, JHDR, PROM */ -#define MNG_BITDEPTH_2 2 -#define MNG_BITDEPTH_4 4 -#define MNG_BITDEPTH_8 8 /* sPLT */ -#define MNG_BITDEPTH_16 16 - -#define MNG_COLORTYPE_GRAY 0 /* IHDR, BASI, PROM */ -#define MNG_COLORTYPE_RGB 2 -#define MNG_COLORTYPE_INDEXED 3 -#define MNG_COLORTYPE_GRAYA 4 -#define MNG_COLORTYPE_RGBA 6 - -#define MNG_COMPRESSION_DEFLATE 0 /* IHDR, zTXt, iTXt, iCCP, - BASI, JHDR */ - -#define MNG_FILTER_ADAPTIVE 0 /* IHDR, BASI, JHDR */ -/* #define MNG_FILTER_NO_ADAPTIVE 1 -#define MNG_FILTER_NO_DIFFERING 0 -#define MNG_FILTER_DIFFERING 0x40 -#define MNG_FILTER_MASK (MNG_FILTER_NO_ADAPTIVE | MNG_FILTER_DIFFERING) */ -#ifdef FILTER192 -#define MNG_FILTER_DIFFERING 0xC0 -#endif -#ifdef FILTER193 -#define MNG_FILTER_NOFILTER 0xC1 -#endif - -#define MNG_INTERLACE_NONE 0 /* IHDR, BASI, JHDR */ -#define MNG_INTERLACE_ADAM7 1 - -#define MNG_FILTER_NONE 0 /* IDAT */ -#define MNG_FILTER_SUB 1 -#define MNG_FILTER_UP 2 -#define MNG_FILTER_AVERAGE 3 -#define MNG_FILTER_PAETH 4 - -#define MNG_INTENT_PERCEPTUAL 0 /* sRGB */ -#define MNG_INTENT_RELATIVECOLORIMETRIC 1 -#define MNG_INTENT_SATURATION 2 -#define MNG_INTENT_ABSOLUTECOLORIMETRIC 3 - /* tEXt, zTXt, iTXt */ -#define MNG_TEXT_TITLE "Title" -#define MNG_TEXT_AUTHOR "Author" -#define MNG_TEXT_DESCRIPTION "Description" -#define MNG_TEXT_COPYRIGHT "Copyright" -#define MNG_TEXT_CREATIONTIME "Creation Time" -#define MNG_TEXT_SOFTWARE "Software" -#define MNG_TEXT_DISCLAIMER "Disclaimer" -#define MNG_TEXT_WARNING "Warning" -#define MNG_TEXT_SOURCE "Source" -#define MNG_TEXT_COMMENT "Comment" - -#define MNG_FLAG_UNCOMPRESSED 0 /* iTXt */ -#define MNG_FLAG_COMPRESSED 1 - -#define MNG_UNIT_UNKNOWN 0 /* pHYs, pHYg */ -#define MNG_UNIT_METER 1 - /* MHDR */ -#define MNG_SIMPLICITY_VALID 0x00000001 -#define MNG_SIMPLICITY_SIMPLEFEATURES 0x00000002 -#define MNG_SIMPLICITY_COMPLEXFEATURES 0x00000004 -#define MNG_SIMPLICITY_TRANSPARENCY 0x00000008 -#define MNG_SIMPLICITY_JNG 0x00000010 -#define MNG_SIMPLICITY_DELTAPNG 0x00000020 - -#define MNG_TERMINATION_DECODER_NC 0 /* LOOP */ -#define MNG_TERMINATION_USER_NC 1 -#define MNG_TERMINATION_EXTERNAL_NC 2 -#define MNG_TERMINATION_DETERMINISTIC_NC 3 -#define MNG_TERMINATION_DECODER_C 4 -#define MNG_TERMINATION_USER_C 5 -#define MNG_TERMINATION_EXTERNAL_C 6 -#define MNG_TERMINATION_DETERMINISTIC_C 7 - -#define MNG_DONOTSHOW_VISIBLE 0 /* DEFI */ -#define MNG_DONOTSHOW_NOTVISIBLE 1 - -#define MNG_ABSTRACT 0 /* DEFI */ -#define MNG_CONCRETE 1 - -#define MNG_NOTVIEWABLE 0 /* BASI */ -#define MNG_VIEWABLE 1 - -#define MNG_FULL_CLONE 0 /* CLON */ -#define MNG_PARTIAL_CLONE 1 -#define MNG_RENUMBER 2 - -#define MNG_CONCRETE_ASPARENT 0 /* CLON */ -#define MNG_CONCRETE_MAKEABSTRACT 1 - -#define MNG_LOCATION_ABSOLUTE 0 /* CLON, MOVE */ -#define MNG_LOCATION_RELATIVE 1 - -#ifndef MNG_SKIPCHUNK_PAST -#define MNG_TARGET_ABSOLUTE 0 /* PAST */ -#define MNG_TARGET_RELATIVE_SAMEPAST 1 -#define MNG_TARGET_RELATIVE_PREVPAST 2 - -#define MNG_COMPOSITE_OVER 0 /* PAST */ -#define MNG_COMPOSITE_REPLACE 1 -#define MNG_COMPOSITE_UNDER 2 - -#define MNG_ORIENTATION_SAME 0 /* PAST */ -#define MNG_ORIENTATION_180DEG 2 -#define MNG_ORIENTATION_FLIPHORZ 4 -#define MNG_ORIENTATION_FLIPVERT 6 -#define MNG_ORIENTATION_TILED 8 - -#define MNG_OFFSET_ABSOLUTE 0 /* PAST */ -#define MNG_OFFSET_RELATIVE 1 -#endif - -#define MNG_BOUNDARY_ABSOLUTE 0 /* PAST, FRAM */ -#define MNG_BOUNDARY_RELATIVE 1 - -#define MNG_BACKGROUNDCOLOR_MANDATORY 0x01 /* BACK */ -#define MNG_BACKGROUNDIMAGE_MANDATORY 0x02 /* BACK */ - -#define MNG_BACKGROUNDIMAGE_NOTILE 0 /* BACK */ -#define MNG_BACKGROUNDIMAGE_TILE 1 - -#define MNG_FRAMINGMODE_NOCHANGE 0 /* FRAM */ -#define MNG_FRAMINGMODE_1 1 -#define MNG_FRAMINGMODE_2 2 -#define MNG_FRAMINGMODE_3 3 -#define MNG_FRAMINGMODE_4 4 - -#define MNG_CHANGEDELAY_NO 0 /* FRAM */ -#define MNG_CHANGEDELAY_NEXTSUBFRAME 1 -#define MNG_CHANGEDELAY_DEFAULT 2 - -#define MNG_CHANGETIMOUT_NO 0 /* FRAM */ -#define MNG_CHANGETIMOUT_DETERMINISTIC_1 1 -#define MNG_CHANGETIMOUT_DETERMINISTIC_2 2 -#define MNG_CHANGETIMOUT_DECODER_1 3 -#define MNG_CHANGETIMOUT_DECODER_2 4 -#define MNG_CHANGETIMOUT_USER_1 5 -#define MNG_CHANGETIMOUT_USER_2 6 -#define MNG_CHANGETIMOUT_EXTERNAL_1 7 -#define MNG_CHANGETIMOUT_EXTERNAL_2 8 - -#define MNG_CHANGECLIPPING_NO 0 /* FRAM */ -#define MNG_CHANGECLIPPING_NEXTSUBFRAME 1 -#define MNG_CHANGECLIPPING_DEFAULT 2 - -#define MNG_CHANGESYNCID_NO 0 /* FRAM */ -#define MNG_CHANGESYNCID_NEXTSUBFRAME 1 -#define MNG_CHANGESYNCID_DEFAULT 2 - -#define MNG_CLIPPING_ABSOLUTE 0 /* CLIP */ -#define MNG_CLIPPING_RELATIVE 1 - -#define MNG_SHOWMODE_0 0 /* SHOW */ -#define MNG_SHOWMODE_1 1 -#define MNG_SHOWMODE_2 2 -#define MNG_SHOWMODE_3 3 -#define MNG_SHOWMODE_4 4 -#define MNG_SHOWMODE_5 5 -#define MNG_SHOWMODE_6 6 -#define MNG_SHOWMODE_7 7 - -#define MNG_TERMACTION_LASTFRAME 0 /* TERM */ -#define MNG_TERMACTION_CLEAR 1 -#define MNG_TERMACTION_FIRSTFRAME 2 -#define MNG_TERMACTION_REPEAT 3 - -#define MNG_ITERACTION_LASTFRAME 0 /* TERM */ -#define MNG_ITERACTION_CLEAR 1 -#define MNG_ITERACTION_FIRSTFRAME 2 - -#define MNG_SAVEOFFSET_4BYTE 4 /* SAVE */ -#define MNG_SAVEOFFSET_8BYTE 8 - -#define MNG_SAVEENTRY_SEGMENTFULL 0 /* SAVE */ -#define MNG_SAVEENTRY_SEGMENT 1 -#define MNG_SAVEENTRY_SUBFRAME 2 -#define MNG_SAVEENTRY_EXPORTEDIMAGE 3 - -#define MNG_PRIORITY_ABSOLUTE 0 /* fPRI */ -#define MNG_PRIORITY_RELATIVE 1 - -#ifdef MNG_INCLUDE_JNG -#define MNG_COLORTYPE_JPEGGRAY 8 /* JHDR */ -#define MNG_COLORTYPE_JPEGCOLOR 10 -#define MNG_COLORTYPE_JPEGGRAYA 12 -#define MNG_COLORTYPE_JPEGCOLORA 14 - -#define MNG_BITDEPTH_JPEG8 8 /* JHDR */ -#define MNG_BITDEPTH_JPEG12 12 -#define MNG_BITDEPTH_JPEG8AND12 20 - -#define MNG_COMPRESSION_BASELINEJPEG 8 /* JHDR */ - -#define MNG_INTERLACE_SEQUENTIAL 0 /* JHDR */ -#define MNG_INTERLACE_PROGRESSIVE 8 -#endif /* MNG_INCLUDE_JNG */ - -#define MNG_IMAGETYPE_UNKNOWN 0 /* DHDR */ -#define MNG_IMAGETYPE_PNG 1 -#define MNG_IMAGETYPE_JNG 2 - -#define MNG_DELTATYPE_REPLACE 0 /* DHDR */ -#define MNG_DELTATYPE_BLOCKPIXELADD 1 -#define MNG_DELTATYPE_BLOCKALPHAADD 2 -#define MNG_DELTATYPE_BLOCKCOLORADD 3 -#define MNG_DELTATYPE_BLOCKPIXELREPLACE 4 -#define MNG_DELTATYPE_BLOCKALPHAREPLACE 5 -#define MNG_DELTATYPE_BLOCKCOLORREPLACE 6 -#define MNG_DELTATYPE_NOCHANGE 7 - -#define MNG_FILLMETHOD_LEFTBITREPLICATE 0 /* PROM */ -#define MNG_FILLMETHOD_ZEROFILL 1 - -#define MNG_DELTATYPE_REPLACERGB 0 /* PPLT */ -#define MNG_DELTATYPE_DELTARGB 1 -#define MNG_DELTATYPE_REPLACEALPHA 2 -#define MNG_DELTATYPE_DELTAALPHA 3 -#define MNG_DELTATYPE_REPLACERGBA 4 -#define MNG_DELTATYPE_DELTARGBA 5 - -#define MNG_POLARITY_ONLY 0 /* DBYK */ -#define MNG_POLARITY_ALLBUT 1 - -#define MNG_EVENT_NONE 0 /* evNT */ -#define MNG_EVENT_MOUSEENTER 1 -#define MNG_EVENT_MOUSEMOVE 2 -#define MNG_EVENT_MOUSEEXIT 3 -#define MNG_EVENT_MOUSEDOWN 4 -#define MNG_EVENT_MOUSEUP 5 - -#define MNG_MASK_NONE 0 /* evNT */ -#define MNG_MASK_BOX 1 -#define MNG_MASK_OBJECT 2 -#define MNG_MASK_OBJECTIX 3 -#define MNG_MASK_BOXOBJECT 4 -#define MNG_MASK_BOXOBJECTIX 5 - -/* ************************************************************************** */ -/* * * */ -/* * Processtext callback types * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_TYPE_TEXT 0 -#define MNG_TYPE_ZTXT 1 -#define MNG_TYPE_ITXT 2 - -/* ************************************************************************** */ -/* * * */ -/* * CRC processing masks * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_CRC_INPUT 0x0000000f -#define MNG_CRC_INPUT_NONE 0x00000000 -#define MNG_CRC_INPUT_PRESENT 0x00000001 -#define MNG_CRC_OUTPUT 0x000000f0 -#define MNG_CRC_OUTPUT_NONE 0x00000000 -#define MNG_CRC_OUTPUT_GENERATE 0x00000020 -#define MNG_CRC_OUTPUT_DUMMY 0x00000040 -#define MNG_CRC_ANCILLARY 0x00000f00 -#define MNG_CRC_ANCILLARY_IGNORE 0x00000000 -#define MNG_CRC_ANCILLARY_DISCARD 0x00000100 -#define MNG_CRC_ANCILLARY_WARNING 0x00000200 -#define MNG_CRC_ANCILLARY_ERROR 0x00000300 -#define MNG_CRC_CRITICAL 0x0000f000 -#define MNG_CRC_CRITICAL_IGNORE 0x00000000 -#define MNG_CRC_CRITICAL_WARNING 0x00002000 -#define MNG_CRC_CRITICAL_ERROR 0x00003000 -#define MNG_CRC_DEFAULT 0x00002121 - -/* ************************************************************************** */ - -#ifdef __cplusplus -} -#endif - -#endif /* _libmng_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_callback_xs.c b/Engine/lib/lmng/libmng_callback_xs.c deleted file mode 100644 index ff1a22a70..000000000 --- a/Engine/lib/lmng/libmng_callback_xs.c +++ /dev/null @@ -1,1239 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_callback_xs.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : callback get/set interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the callback get/set functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - fixed calling convention * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contribution by Tim Rowley) * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added processterm callback * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - added SKIPCHUNK feature * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * 1.0.7 - 03/19/2004 - G.R-P * */ -/* * - fixed typo (MNG_SKIPCHUNK_SAVE -> MNG_SKIPCHUNK_nEED * */ -/* * * */ -/* * 1.0.8 - 04/10/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 09/18/2004 - G.R-P. * */ -/* * - added two SKIPCHUNK_TERM conditionals * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Callback set functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_retcode MNG_DECL mng_setcb_memalloc (mng_handle hHandle, - mng_memalloc fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMALLOC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fMemalloc = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMALLOC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_retcode MNG_DECL mng_setcb_memfree (mng_handle hHandle, - mng_memfree fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMFREE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fMemfree = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_releasedata (mng_handle hHandle, - mng_releasedata fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_RELEASEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fReleasedata = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_RELEASEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_retcode MNG_DECL mng_setcb_openstream (mng_handle hHandle, - mng_openstream fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_OPENSTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fOpenstream = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_OPENSTREAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_retcode MNG_DECL mng_setcb_closestream (mng_handle hHandle, - mng_closestream fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_CLOSESTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fClosestream = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_CLOSESTREAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_readdata (mng_handle hHandle, - mng_readdata fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_READDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fReaddata = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_READDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_setcb_writedata (mng_handle hHandle, - mng_writedata fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_WRITEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fWritedata = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_WRITEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_setcb_errorproc (mng_handle hHandle, - mng_errorproc fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_ERRORPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fErrorproc = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_ERRORPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_TRACE -mng_retcode MNG_DECL mng_setcb_traceproc (mng_handle hHandle, - mng_traceproc fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_TRACEPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fTraceproc = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_TRACEPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_TRACE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_processheader (mng_handle hHandle, - mng_processheader fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSHEADER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessheader = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSHEADER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_tEXt -mng_retcode MNG_DECL mng_setcb_processtext (mng_handle hHandle, - mng_processtext fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesstext = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode MNG_DECL mng_setcb_processsave (mng_handle hHandle, - mng_processsave fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesssave = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode MNG_DECL mng_setcb_processseek (mng_handle hHandle, - mng_processseek fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessseek = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_nEED -mng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle, - mng_processneed fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessneed = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_processmend (mng_handle hHandle, - mng_processmend fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessmend = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_processunknown (mng_handle hHandle, - mng_processunknown fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessunknown = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_TERM -mng_retcode MNG_DECL mng_setcb_processterm (mng_handle hHandle, - mng_processterm fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessterm = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_getcanvasline (mng_handle hHandle, - mng_getcanvasline fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETCANVASLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGetcanvasline = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETCANVASLINE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_getbkgdline (mng_handle hHandle, - mng_getbkgdline fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETBKGDLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGetbkgdline = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETBKGDLINE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_getalphaline (mng_handle hHandle, - mng_getalphaline fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETALPHALINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGetalphaline = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETALPHALINE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_refresh (mng_handle hHandle, - mng_refresh fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_REFRESH, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fRefresh = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_REFRESH, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_gettickcount (mng_handle hHandle, - mng_gettickcount fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETTICKCOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGettickcount = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETTICKCOUNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_settimer (mng_handle hHandle, - mng_settimer fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_SETTIMER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fSettimer = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_SETTIMER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_setcb_processgamma (mng_handle hHandle, - mng_processgamma fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSGAMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessgamma = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSGAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode MNG_DECL mng_setcb_processchroma (mng_handle hHandle, - mng_processchroma fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSCHROMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesschroma = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSCHROMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_setcb_processsrgb (mng_handle hHandle, - mng_processsrgb fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesssrgb = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_setcb_processiccp (mng_handle hHandle, - mng_processiccp fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessiccp = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_setcb_processarow (mng_handle hHandle, - mng_processarow fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSAROW, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessarow = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSAROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ -/* * * */ -/* * Callback get functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_memalloc MNG_DECL mng_getcb_memalloc (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMALLOC, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMALLOC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fMemalloc; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_memfree MNG_DECL mng_getcb_memfree (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMFREE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMFREE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fMemfree; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_releasedata MNG_DECL mng_getcb_releasedata (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_RELEASEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_RELEASEDATA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fReleasedata; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_readdata MNG_DECL mng_getcb_readdata (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_READDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_READDATA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fReaddata; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_openstream MNG_DECL mng_getcb_openstream (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_OPENSTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_OPENSTREAM, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fOpenstream; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_closestream MNG_DECL mng_getcb_closestream (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_CLOSESTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_CLOSESTREAM, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fClosestream; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_writedata MNG_DECL mng_getcb_writedata (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_WRITEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_WRITEDATA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fWritedata; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -mng_errorproc MNG_DECL mng_getcb_errorproc (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_ERRORPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_ERRORPROC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fErrorproc; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_TRACE -mng_traceproc MNG_DECL mng_getcb_traceproc (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_TRACEPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_TRACEPROC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fTraceproc; -} -#endif /* MNG_SUPPORT_TRACE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_processheader MNG_DECL mng_getcb_processheader (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSHEADER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSHEADER, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessheader; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_tEXt -mng_processtext MNG_DECL mng_getcb_processtext (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTEXT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesstext; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SAVE -mng_processsave MNG_DECL mng_getcb_processsave (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSAVE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesssave; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SEEK -mng_processseek MNG_DECL mng_getcb_processseek (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSEEK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessseek; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_nEED -mng_processneed MNG_DECL mng_getcb_processneed (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSNEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSNEED, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessneed; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_processmend MNG_DECL mng_getcb_processmend (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSMEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSMEND, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessmend; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSUNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSUNKNOWN, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessunknown; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_TERM -mng_processterm MNG_DECL mng_getcb_processterm (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTERM, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessterm; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_getcanvasline MNG_DECL mng_getcb_getcanvasline (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETCANVASLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETCANVASLINE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGetcanvasline; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_getbkgdline MNG_DECL mng_getcb_getbkgdline (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETBKGDLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETBKGDLINE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGetbkgdline; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_getalphaline MNG_DECL mng_getcb_getalphaline (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETALPHALINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETALPHALINE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGetalphaline; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_refresh MNG_DECL mng_getcb_refresh (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_REFRESH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_REFRESH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fRefresh; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_gettickcount MNG_DECL mng_getcb_gettickcount (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETTICKCOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETTICKCOUNT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGettickcount; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_settimer MNG_DECL mng_getcb_settimer (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_SETTIMER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_SETTIMER, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fSettimer; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_processgamma MNG_DECL mng_getcb_processgamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessgamma; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_cHRM -mng_processchroma MNG_DECL mng_getcb_processchroma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSCHROMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSCHROMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesschroma; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_processsrgb MNG_DECL mng_getcb_processsrgb (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSRGB, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesssrgb; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_iCCP -mng_processiccp MNG_DECL mng_getcb_processiccp (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSICCP, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessiccp; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_processarow MNG_DECL mng_getcb_processarow (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSAROW, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSAROW, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessarow; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_chunk_descr.c b/Engine/lib/lmng/libmng_chunk_descr.c deleted file mode 100644 index e1004a540..000000000 --- a/Engine/lib/lmng/libmng_chunk_descr.c +++ /dev/null @@ -1,6090 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_descr.c copyright (c) 2005-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk descriptor functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the chunk- anf field-descriptor * */ -/* * routines * */ -/* * * */ -/* * changes : 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - made all constants 'static' * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * 1.0.9 - 01/17/2005 - G.Juyn * */ -/* * - fixed problem with global PLTE/tRNS * */ -/* * * */ -/* * 1.0.10 - 01/17/2005 - G.R-P. * */ -/* * - added typecast to appease the compiler * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include /* needed for offsetof() */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_objects.h" -#include "libmng_chunks.h" -#include "libmng_chunk_descr.h" -#include "libmng_object_prc.h" -#include "libmng_chunk_prc.h" -#include "libmng_chunk_io.h" -#include "libmng_display.h" - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -#include "libmng_pixels.h" -#include "libmng_filter.h" -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER -#if defined(MNG_INCLUDE_READ_PROCS) || defined(MNG_INCLUDE_WRITE_PROCS) - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* PNG chunks */ - -MNG_LOCAL mng_field_descriptor mng_fields_ihdr [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_ihdr, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_ihdr, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 16, 1, 1, - offsetof(mng_ihdr, iBitdepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 6, 1, 1, - offsetof(mng_ihdr, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_ihdr, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_ihdr, iFilter), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_ihdr, iInterlace), MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_plte [] = - { - {mng_debunk_plte, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_idat [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 0, 0, - offsetof(mng_idat, pData), MNG_NULL, offsetof(mng_idat, iDatasize)} - }; - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_trns [] = - { - {mng_debunk_trns, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -MNG_LOCAL mng_field_descriptor mng_fields_gama [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_gama, iGamma), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -MNG_LOCAL mng_field_descriptor mng_fields_chrm [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iWhitepointx), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iWhitepointy), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iRedx), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iRedy), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iGreeny), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iGreeny), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iBluex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iBluey), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -MNG_LOCAL mng_field_descriptor mng_fields_srgb [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 4, 1, 1, - offsetof(mng_srgb, iRenderingintent), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -MNG_LOCAL mng_field_descriptor mng_fields_iccp [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_iccp, zName), MNG_NULL, offsetof(mng_iccp, iNamesize)}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_iccp, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_DEFLATED, - 0, 0, 0, 0, - offsetof(mng_iccp, pProfile), MNG_NULL, offsetof(mng_iccp, iProfilesize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -MNG_LOCAL mng_field_descriptor mng_fields_text [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_text, zKeyword), MNG_NULL, offsetof(mng_text, iKeywordsize)}, - {MNG_NULL, - MNG_NULL, - 0, 0, 0, 0, - offsetof(mng_text, zText), MNG_NULL, offsetof(mng_text, iTextsize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -MNG_LOCAL mng_field_descriptor mng_fields_ztxt [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_ztxt, zKeyword), MNG_NULL, offsetof(mng_ztxt, iKeywordsize)}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_ztxt, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_DEFLATED, - 0, 0, 0, 0, - offsetof(mng_ztxt, zText), MNG_NULL, offsetof(mng_ztxt, iTextsize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_LOCAL mng_field_descriptor mng_fields_itxt [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_itxt, zKeyword), MNG_NULL, offsetof(mng_itxt, iKeywordsize)}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_itxt, iCompressionflag), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_itxt, iCompressionmethod), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 0, 0, - offsetof(mng_itxt, zLanguage), MNG_NULL, offsetof(mng_itxt, iLanguagesize)}, - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 0, 0, - offsetof(mng_itxt, zTranslation), MNG_NULL, offsetof(mng_itxt, iTranslationsize)}, - {mng_deflate_itxt, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -MNG_LOCAL mng_field_descriptor mng_fields_bkgd [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_PUTIMGTYPE, - 0, 0, 0, 0, - offsetof(mng_bkgd, iType), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE3, - 0, 0xFF, 1, 1, - offsetof(mng_bkgd, iIndex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE0 | MNG_FIELD_IFIMGTYPE4, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iGray), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iRed), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iGreen), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iBlue), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -MNG_LOCAL mng_field_descriptor mng_fields_phys [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_phys, iSizex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_phys, iSizey), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_phys, iUnit), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -MNG_LOCAL mng_field_descriptor mng_fields_sbit [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_PUTIMGTYPE, - 0, 0, 0, 0, - offsetof(mng_sbit, iType), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPES, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[0]), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE3 | MNG_FIELD_IFIMGTYPE4 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[1]), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE3 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[2]), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE6, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[3]), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_LOCAL mng_field_descriptor mng_fields_splt [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 79, - offsetof(mng_splt, zName), MNG_NULL, offsetof(mng_splt, iNamesize)}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 16, 1, 1, - offsetof(mng_splt, iSampledepth), MNG_NULL, MNG_NULL}, - {mng_splt_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -MNG_LOCAL mng_field_descriptor mng_fields_hist [] = - { - {mng_hist_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -MNG_LOCAL mng_field_descriptor mng_fields_time [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_time, iYear), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 12, 1, 1, - offsetof(mng_time, iMonth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 31, 1, 1, - offsetof(mng_time, iDay), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 24, 1, 1, - offsetof(mng_time, iHour), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 60, 1, 1, - offsetof(mng_time, iMinute), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 60, 1, 1, - offsetof(mng_time, iSecond), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* JNG chunks */ - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_field_descriptor mng_fields_jhdr [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_jhdr, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_jhdr, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 16, 1, 1, - offsetof(mng_jhdr, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 20, 1, 1, - offsetof(mng_jhdr, iImagesampledepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 8, 1, 1, - offsetof(mng_jhdr, iImagecompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 8, 1, 1, - offsetof(mng_jhdr, iImageinterlace), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 16, 1, 1, - offsetof(mng_jhdr, iAlphasampledepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 8, 1, 1, - offsetof(mng_jhdr, iAlphacompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_jhdr, iAlphafilter), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_jhdr, iAlphainterlace), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#define mng_fields_jdaa mng_fields_idat -#define mng_fields_jdat mng_fields_idat -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* MNG chunks */ - -MNG_LOCAL mng_field_descriptor mng_fields_mhdr [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iTicks), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iLayercount), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iFramecount), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iPlaytime), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iSimplicity), MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_LOCAL mng_field_descriptor mng_fields_loop [] = - { - {mng_debunk_loop, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_LOCAL mng_field_descriptor mng_fields_endl [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFF, 1, 1, - offsetof(mng_endl, iLevel), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -MNG_LOCAL mng_field_descriptor mng_fields_defi [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_defi, iObjectid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFF, 1, 1, - offsetof(mng_defi, iDonotshow), offsetof(mng_defi, bHasdonotshow), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFF, 1, 1, - offsetof(mng_defi, iConcrete), offsetof(mng_defi, bHasconcrete), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_defi, iXlocation), offsetof(mng_defi, bHasloca), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_defi, iYlocation), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iLeftcb), offsetof(mng_defi, bHasclip), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iRightcb), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iTopcb), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iBottomcb), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -MNG_LOCAL mng_field_descriptor mng_fields_basi [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_basi, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_basi, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 16, 1, 1, - offsetof(mng_basi, iBitdepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 6, 1, 1, - offsetof(mng_basi, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_basi, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_basi, iFilter), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_basi, iInterlace), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iRed), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iGreen), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iBlue), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iAlpha), offsetof(mng_basi, bHasalpha), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_basi, iViewable), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -MNG_LOCAL mng_field_descriptor mng_fields_clon [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clon, iSourceid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clon, iCloneid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 2, 1, 1, - offsetof(mng_clon, iClonetype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_clon, iDonotshow), offsetof(mng_clon, bHasdonotshow), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_clon, iConcrete), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 2, 1, 1, - offsetof(mng_clon, iLocationtype), offsetof(mng_clon, bHasloca), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_clon, iLocationx), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_clon, iLocationy), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -MNG_LOCAL mng_field_descriptor mng_fields_past [] = - { - {mng_debunk_past, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -MNG_LOCAL mng_field_descriptor mng_fields_disc [] = - { - {mng_disc_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -MNG_LOCAL mng_field_descriptor mng_fields_back [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iRed), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iGreen), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iBlue), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 3, 1, 1, - offsetof(mng_back, iMandatory), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iImageid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_back, iTile), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_LOCAL mng_field_descriptor mng_fields_fram [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 4, 1, 1, - offsetof(mng_fram, iMode), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_TERMINATOR | MNG_FIELD_OPTIONAL, - 0, 0, 1, 79, - offsetof(mng_fram, zName), MNG_NULL, offsetof(mng_fram, iNamesize)}, - {mng_fram_remainder, - MNG_FIELD_OPTIONAL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -MNG_LOCAL mng_field_descriptor mng_fields_move [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_move, iFirstid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_move, iLastid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_move, iMovetype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_move, iMovex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_move, iMovey), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -MNG_LOCAL mng_field_descriptor mng_fields_clip [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clip, iFirstid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clip, iLastid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_clip, iCliptype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipl), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipr), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipt), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipb), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -MNG_LOCAL mng_field_descriptor mng_fields_show [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 1, 0xFFFF, 2, 2, - offsetof(mng_show, iFirstid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 1, 0xFFFF, 2, 2, - offsetof(mng_show, iLastid), offsetof(mng_show, bHaslastid), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 7, 1, 1, - offsetof(mng_show, iMode), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -MNG_LOCAL mng_field_descriptor mng_fields_term [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 3, 1, 1, - offsetof(mng_term, iTermaction), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 2, 1, 1, - offsetof(mng_term, iIteraction), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_term, iDelay), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_term, iItermax), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_field_descriptor mng_fields_save [] = - { - {mng_save_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -MNG_LOCAL mng_field_descriptor mng_fields_seek [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 79, - offsetof(mng_seek, zName), MNG_NULL, offsetof(mng_seek, iNamesize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -MNG_LOCAL mng_field_descriptor mng_fields_expi [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_expi, iSnapshotid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 79, - offsetof(mng_expi, zName), MNG_NULL, offsetof(mng_expi, iNamesize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -MNG_LOCAL mng_field_descriptor mng_fields_fpri [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_fpri, iDeltatype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFF, 1, 1, - offsetof(mng_fpri, iPriority), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_field_descriptor mng_fields_need [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 0, - offsetof(mng_need, zKeywords), MNG_NULL, offsetof(mng_need, iKeywordssize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -#define mng_fields_phyg mng_fields_phys -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_dhdr [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_dhdr, iObjectid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 2, 1, 1, - offsetof(mng_dhdr, iImagetype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 7, 1, 1, - offsetof(mng_dhdr, iDeltatype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlockwidth), offsetof(mng_dhdr, bHasblocksize), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlockheight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlockx), offsetof(mng_dhdr, bHasblockloc), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlocky), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_prom [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 14, 1, 1, - offsetof(mng_prom, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 16, 1, 1, - offsetof(mng_prom, iSampledepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_prom, iFilltype), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_pplt [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 5, 1, 1, - offsetof(mng_pplt, iDeltatype), MNG_NULL, MNG_NULL}, - {mng_pplt_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_drop [] = - { - {mng_drop_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -MNG_LOCAL mng_field_descriptor mng_fields_dbyk [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_dbyk, iChunkname), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_dbyk, iPolarity), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 0, - offsetof(mng_dbyk, zKeywords), MNG_NULL, offsetof(mng_dbyk, iKeywordssize)} - }; -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_LOCAL mng_field_descriptor mng_fields_ordr [] = - { - {mng_drop_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_LOCAL mng_field_descriptor mng_fields_magn [] = - { - {mng_debunk_magn, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_LOCAL mng_field_descriptor mng_fields_mpng [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_mpng, iFramewidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_mpng, iFrameheight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_mpng, iNumplays), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0xFFFF, 2, 2, - offsetof(mng_mpng, iTickspersec), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_mpng, iCompressionmethod), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_DEFLATED, - 0, 0, 1, 0, - offsetof(mng_mpng, pFrames), MNG_NULL, offsetof(mng_mpng, iFramessize)} - }; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_LOCAL mng_field_descriptor mng_fields_ahdr [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_ahdr, iNumframes), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_ahdr, iTickspersec), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_ahdr, iNumplays), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_ahdr, iTilewidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_ahdr, iTileheight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_ahdr, iInterlace), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_ahdr, iStillused), MNG_NULL, MNG_NULL} - }; - -MNG_LOCAL mng_field_descriptor mng_fields_adat [] = - { - {mng_adat_tiles, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -MNG_LOCAL mng_field_descriptor mng_fields_evnt [] = - { - {mng_evnt_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_unknown [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 0, - offsetof(mng_unknown_chunk, pData), MNG_NULL, offsetof(mng_unknown_chunk, iDatasize)} - }; - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* PNG chunks */ - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ihdr = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ihdr, - mng_fields_ihdr, (sizeof(mng_fields_ihdr) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_NULL, - MNG_DESCR_NOIHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOBASI | MNG_DESCR_NOIDAT | MNG_DESCR_NOPLTE}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_plte = - {mng_it_png, mng_create_none, 0, offsetof(mng_plte, bEmpty), - MNG_NULL, MNG_NULL, mng_special_plte, - mng_fields_plte, (sizeof(mng_fields_plte) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_idat = - {mng_it_png, mng_create_none, 0, offsetof(mng_idat, bEmpty), - MNG_NULL, MNG_NULL, mng_special_idat, - mng_fields_idat, (sizeof(mng_fields_idat) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_DESCR_NOJSEP}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_iend = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_iend, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_NULL}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_trns = - {mng_it_png, mng_create_none, 0, offsetof(mng_trns, bEmpty), - MNG_NULL, MNG_NULL, mng_special_trns, - mng_fields_trns, (sizeof(mng_fields_trns) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; - -#ifndef MNG_SKIPCHUNK_gAMA -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_gama = - {mng_it_png, mng_create_none, 0, offsetof(mng_gama, bEmpty), - MNG_NULL, MNG_NULL, mng_special_gama, - mng_fields_gama, (sizeof(mng_fields_gama) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_cHRM -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_chrm = - {mng_it_png, mng_create_none, 0, offsetof(mng_chrm, bEmpty), - MNG_NULL, MNG_NULL, mng_special_chrm, - mng_fields_chrm, (sizeof(mng_fields_chrm) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_sRGB -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_srgb = - {mng_it_png, mng_create_none, 0, offsetof(mng_srgb, bEmpty), - MNG_NULL, MNG_NULL, mng_special_srgb, - mng_fields_srgb, (sizeof(mng_fields_srgb) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_iCCP -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_iccp = - {mng_it_png, mng_create_none, 0, offsetof(mng_iccp, bEmpty), - MNG_NULL, MNG_NULL, mng_special_iccp, - mng_fields_iccp, (sizeof(mng_fields_iccp) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_tEXt -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_text = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_text, - mng_fields_text, (sizeof(mng_fields_text) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -#ifndef MNG_SKIPCHUNK_zTXt -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ztxt = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ztxt, - mng_fields_ztxt, (sizeof(mng_fields_ztxt) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_itxt = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_itxt, - mng_fields_itxt, (sizeof(mng_fields_itxt) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_bkgd = - {mng_it_png, mng_create_none, 0, offsetof(mng_bkgd, bEmpty), - MNG_NULL, MNG_NULL, mng_special_bkgd, - mng_fields_bkgd, (sizeof(mng_fields_bkgd) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_pHYs -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_phys = - {mng_it_png, mng_create_none, 0, offsetof(mng_phys, bEmpty), - MNG_NULL, MNG_NULL, mng_special_phys, - mng_fields_phys, (sizeof(mng_fields_phys) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_sBIT -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_sbit = - {mng_it_png, mng_create_none, 0, offsetof(mng_sbit, bEmpty), - MNG_NULL, MNG_NULL, mng_special_sbit, - mng_fields_sbit, (sizeof(mng_fields_sbit) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_splt = - {mng_it_png, mng_create_none, 0, offsetof(mng_splt, bEmpty), - MNG_NULL, MNG_NULL, mng_special_splt, - mng_fields_splt, (sizeof(mng_fields_splt) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_hIST -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_hist = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_hist, - mng_fields_hist, (sizeof(mng_fields_hist) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_GenHDR | MNG_DESCR_PLTE, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_tIME -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_time = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_time, - mng_fields_time, (sizeof(mng_fields_time) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -/* ************************************************************************** */ -/* JNG chunks */ - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jhdr = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jhdr, - mng_fields_jhdr, (sizeof(mng_fields_jhdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_NULL, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jdaa = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jdaa, - mng_fields_jdaa, (sizeof(mng_fields_jdaa) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_JngHDR, - MNG_DESCR_NOJSEP}; -#endif - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jdat = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jdat, - mng_fields_jdat, (sizeof(mng_fields_jdat) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTYEMBED, - MNG_DESCR_JngHDR, - MNG_NULL}; -#endif - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jsep = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jsep, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_JngHDR, - MNG_DESCR_NOJSEP}; -#endif - -/* ************************************************************************** */ -/* MNG chunks */ - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mhdr = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_mhdr, - mng_fields_mhdr, (sizeof(mng_fields_mhdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_NULL, - MNG_DESCR_NOMHDR | MNG_DESCR_NOIHDR | MNG_DESCR_NOJHDR}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mend = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_mend, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_NULL}; - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_loop = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_loop, - mng_fields_loop, (sizeof(mng_fields_loop) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_endl = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_endl, - mng_fields_endl, (sizeof(mng_fields_endl) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_DEFI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_defi = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_defi, - mng_fields_defi, (sizeof(mng_fields_defi) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_BASI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_basi = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_basi, - mng_fields_basi, (sizeof(mng_fields_basi) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_CLON -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_clon = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_clon, - mng_fields_clon, (sizeof(mng_fields_clon) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_PAST -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_past = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_past, - mng_fields_past, (sizeof(mng_fields_past) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_DISC -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_disc = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_disc, - mng_fields_disc, (sizeof(mng_fields_disc) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_BACK -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_back = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_back, - mng_fields_back, (sizeof(mng_fields_back) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_fram = - {mng_it_mng, mng_create_none, 0, offsetof(mng_fram, bEmpty), - MNG_NULL, MNG_NULL, mng_special_fram, - mng_fields_fram, (sizeof(mng_fields_fram) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_MOVE -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_move = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_move, - mng_fields_move, (sizeof(mng_fields_move) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_CLIP -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_clip = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_clip, - mng_fields_clip, (sizeof(mng_fields_clip) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_SHOW -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_show = - {mng_it_mng, mng_create_none, 0, offsetof(mng_show, bEmpty), - MNG_NULL, MNG_NULL, mng_special_show, - mng_fields_show, (sizeof(mng_fields_show) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_TERM -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_term = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_term, - mng_fields_term, (sizeof(mng_fields_term) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOTERM | MNG_DESCR_NOLOOP}; -#endif - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_save = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_save, - mng_fields_save, (sizeof(mng_fields_save) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_DESCR_NOSAVE | MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_SEEK -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_seek = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_seek, - mng_fields_seek, (sizeof(mng_fields_seek) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR | MNG_DESCR_SAVE, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_eXPI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_expi = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_expi, - mng_fields_expi, (sizeof(mng_fields_expi) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_fPRI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_fpri = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_fpri, - mng_fields_fpri, (sizeof(mng_fields_fpri) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_need = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_need, - mng_fields_need, (sizeof(mng_fields_need) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_pHYg -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_phyg = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_phyg, - mng_fields_phyg, (sizeof(mng_fields_phyg) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_dhdr = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_dhdr, - mng_fields_dhdr, (sizeof(mng_fields_dhdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_prom = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_prom, - mng_fields_prom, (sizeof(mng_fields_prom) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ipng = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ipng, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_pplt = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_pplt, - mng_fields_pplt, (sizeof(mng_fields_pplt) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ijng = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ijng, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_drop = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_drop, - mng_fields_drop, (sizeof(mng_fields_drop) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_dbyk = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_dbyk, - mng_fields_dbyk, (sizeof(mng_fields_dbyk) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif -#endif - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ordr = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ordr, - mng_fields_ordr, (sizeof(mng_fields_ordr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_magn = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_magn, - mng_fields_magn, (sizeof(mng_fields_magn) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_evNT -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_evnt = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_evnt, - mng_fields_evnt, (sizeof(mng_fields_evnt) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOSAVE}; -#endif - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mpng = - {mng_it_mpng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_mpng, - mng_fields_mpng, (sizeof(mng_fields_mpng) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_NULL, - MNG_DESCR_NOMHDR | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT}; -#endif - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ahdr = - {mng_it_ang, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ahdr, - mng_fields_ahdr, (sizeof(mng_fields_ahdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_IHDR, - MNG_DESCR_NOMHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOIDAT}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_adat = - {mng_it_ang, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_adat, - mng_fields_adat, (sizeof(mng_fields_adat) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_IHDR, - MNG_DESCR_NOMHDR | MNG_DESCR_NOJHDR}; -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* the good ol' unknown babe */ - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_unknown = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_unknown, - mng_fields_unknown, (sizeof(mng_fields_unknown) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_NULL, - MNG_NULL}; - -/* ************************************************************************** */ -/* ************************************************************************** */ - -MNG_LOCAL mng_chunk_header mng_chunk_unknown = - {MNG_UINT_HUH, mng_init_general, mng_free_unknown, - mng_read_general, mng_write_unknown, mng_assign_unknown, - 0, 0, sizeof(mng_unknown_chunk), &mng_chunk_descr_unknown}; - -/* ************************************************************************** */ - - /* the table-idea & binary search code was adapted from - libpng 1.1.0 (pngread.c) */ - /* NOTE1: the table must remain sorted by chunkname, otherwise the binary - search will break !!! (ps. watch upper-/lower-case chunknames !!) */ - /* NOTE2: the layout must remain equal to the header part of all the - chunk-structures (yes, that means even the pNext and pPrev fields; - it's wasting a bit of space, but hey, the code is a lot easier) */ - -MNG_LOCAL mng_chunk_header mng_chunk_table [] = - { -#ifndef MNG_SKIPCHUNK_BACK - {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_general, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back), &mng_chunk_descr_back}, -#endif -#ifndef MNG_SKIPCHUNK_BASI - {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_general, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi), &mng_chunk_descr_basi}, -#endif -#ifndef MNG_SKIPCHUNK_CLIP - {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_general, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip), &mng_chunk_descr_clip}, -#endif -#ifndef MNG_SKIPCHUNK_CLON - {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_general, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon), &mng_chunk_descr_clon}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_general, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk), &mng_chunk_descr_dbyk}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_DEFI - {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_general, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi), &mng_chunk_descr_defi}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr), &mng_chunk_descr_dhdr}, -#endif -#ifndef MNG_SKIPCHUNK_DISC - {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_general, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc), &mng_chunk_descr_disc}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DROP - {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_general, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop), &mng_chunk_descr_drop}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_general, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl), &mng_chunk_descr_endl}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_general, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram), &mng_chunk_descr_fram}, -#endif - {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_general, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat), &mng_chunk_descr_idat}, /* 12-th element! */ - {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_general, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend), &mng_chunk_descr_iend}, - {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr), &mng_chunk_descr_ihdr}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_general, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng), &mng_chunk_descr_ijng}, -#endif - {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_general, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng), &mng_chunk_descr_ipng}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_general, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa), &mng_chunk_descr_jdaa}, - {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_general, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat), &mng_chunk_descr_jdat}, - {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr), &mng_chunk_descr_jhdr}, - {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_general, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep), &mng_chunk_descr_jsep}, - {MNG_UINT_JdAA, mng_init_general, mng_free_jdaa, mng_read_general, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa), &mng_chunk_descr_jdaa}, -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_general, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop), &mng_chunk_descr_loop}, -#endif -#ifndef MNG_SKIPCHUNK_MAGN - {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_general, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn), &mng_chunk_descr_magn}, -#endif - {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_general, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend), &mng_chunk_descr_mend}, - {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr), &mng_chunk_descr_mhdr}, -#ifndef MNG_SKIPCHUNK_MOVE - {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_general, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move), &mng_chunk_descr_move}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_general, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr), &mng_chunk_descr_ordr}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_general, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past), &mng_chunk_descr_past}, -#endif - {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_general, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte), &mng_chunk_descr_plte}, -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_general, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt), &mng_chunk_descr_pplt}, - {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_general, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom), &mng_chunk_descr_prom}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_general, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save), &mng_chunk_descr_save}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_general, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek), &mng_chunk_descr_seek}, -#endif -#ifndef MNG_SKIPCHUNK_SHOW - {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_general, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show), &mng_chunk_descr_show}, -#endif -#ifndef MNG_SKIPCHUNK_TERM - {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_general, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term), &mng_chunk_descr_term}, -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - {MNG_UINT_adAT, mng_init_general, mng_free_adat, mng_read_general, mng_write_adat, mng_assign_adat, 0, 0, sizeof(mng_adat), &mng_chunk_descr_adat}, - {MNG_UINT_ahDR, mng_init_general, mng_free_general, mng_read_general, mng_write_ahdr, mng_assign_ahdr, 0, 0, sizeof(mng_ahdr), &mng_chunk_descr_ahdr}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_general, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd), &mng_chunk_descr_bkgd}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_general, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm), &mng_chunk_descr_chrm}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_general, mng_write_expi, mng_assign_expi, 0, 0, sizeof(mng_expi), &mng_chunk_descr_expi}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_general, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt), &mng_chunk_descr_evnt}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_general, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri), &mng_chunk_descr_fpri}, -#endif -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_general, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama), &mng_chunk_descr_gama}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_general, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist), &mng_chunk_descr_hist}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_general, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp), &mng_chunk_descr_iccp}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_general, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt), &mng_chunk_descr_itxt}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_general, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng), &mng_chunk_descr_mpng}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_general, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need), &mng_chunk_descr_need}, -#endif -/* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */ -/* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_general, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg), &mng_chunk_descr_phyg}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_general, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys), &mng_chunk_descr_phys}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_general, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit), &mng_chunk_descr_sbit}, -#endif -/* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_general, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt), &mng_chunk_descr_splt}, -#endif - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_general, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb), &mng_chunk_descr_srgb}, -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_general, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text), &mng_chunk_descr_text}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_general, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time), &mng_chunk_descr_time}, -#endif - {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_general, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns), &mng_chunk_descr_trns}, -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_general, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt), &mng_chunk_descr_ztxt}, -#endif - }; - -/* ************************************************************************** */ -/* ************************************************************************** */ - -void mng_get_chunkheader (mng_chunkid iChunkname, - mng_chunk_headerp pResult) -{ - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_chunk_headerp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (mng_chunk_table) / sizeof (mng_chunk_table [0])) - 1; - - /* binary search; with 54 chunks, worst-case is 7 comparisons */ - iLower = 0; -#ifndef MNG_NO_DELTA_PNG - iMiddle = 11; /* start with the IDAT entry */ -#else - iMiddle = 8; -#endif - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (mng_chunk_table [iMiddle].iChunkname < iChunkname) - iLower = iMiddle + 1; - else if (mng_chunk_table [iMiddle].iChunkname > iChunkname) - iUpper = iMiddle - 1; - else - { - pEntry = &mng_chunk_table [iMiddle]; - break; - } - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (!pEntry) /* unknown chunk ? */ - pEntry = &mng_chunk_unknown; /* make it so! */ - - MNG_COPY (pResult, pEntry, sizeof(mng_chunk_header)); - - return; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* PNG chunks */ - -MNG_C_SPECIALFUNC (mng_special_ihdr) -{ - pData->bHasIHDR = MNG_TRUE; /* indicate IHDR is present */ - /* and store interesting fields */ - if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_NOCHANGE)) - { - pData->iDatawidth = ((mng_ihdrp)pChunk)->iWidth; - pData->iDataheight = ((mng_ihdrp)pChunk)->iHeight; - } - - pData->iBitdepth = ((mng_ihdrp)pChunk)->iBitdepth; - pData->iColortype = ((mng_ihdrp)pChunk)->iColortype; - pData->iCompression = ((mng_ihdrp)pChunk)->iCompression; - pData->iFilter = ((mng_ihdrp)pChunk)->iFilter; - pData->iInterlace = ((mng_ihdrp)pChunk)->iInterlace; - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iCompression != MNG_COMPRESSION_DEFLATE) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iInterlace != MNG_INTERLACE_NONE ) && - (pData->iInterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* check the colortype for delta-images ! */ - { - mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - - if (pData->iColortype != pBuf->iColortype) - { - if ( ( (pData->iColortype != MNG_COLORTYPE_INDEXED) || - (pBuf->iColortype == MNG_COLORTYPE_GRAY ) ) && - ( (pData->iColortype != MNG_COLORTYPE_GRAY ) || - (pBuf->iColortype == MNG_COLORTYPE_INDEXED) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - } - } -#endif -#endif - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_png; /* then this must be a PNG */ - pData->iWidth = pData->iDatawidth; - pData->iHeight = pData->iDataheight; - /* predict alpha-depth ! */ - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) - pData->iAlphadepth = pData->iBitdepth; - else - if (pData->iColortype == MNG_COLORTYPE_INDEXED) - pData->iAlphadepth = 8; /* worst case scenario */ - else - pData->iAlphadepth = 1; /* Possible tRNS cheap binary transparency */ - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - -#if !defined(MNG_INCLUDE_MPNG_PROPOSAL) || !defined(MNG_SUPPORT_DISPLAY) - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); -#endif - } - - if (!pData->bHasDHDR) - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - return mng_process_display_ihdr (pData); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} - -/* ************************************************************************** */ - -MNG_F_SPECIALFUNC (mng_debunk_plte) -{ - mng_pltep pPLTE = (mng_pltep)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - /* length must be multiple of 3 */ - if (((iRawlen % 3) != 0) || (iRawlen > 768)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* this is the exact length */ - pPLTE->iEntrycount = iRawlen / 3; - - MNG_COPY (pPLTE->aEntries, pRawdata, iRawlen); - - *piRawlen = 0; - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_plte) -{ /* multiple PLTE only inside BASI */ - if ((pData->bHasPLTE) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* only allowed for indexed-color or - rgb(a)-color! */ - if ((pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* empty only allowed if global present */ - if ((((mng_pltep)pChunk)->bEmpty) && (!pData->bHasglobalPLTE)) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - else - { - if (((mng_pltep)pChunk)->bEmpty) /* cannot be empty as global! */ - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasPLTE = MNG_TRUE; /* got it! */ - else - pData->bHasglobalPLTE = MNG_TRUE; - - pData->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; - pBuf->bHasPLTE = MNG_TRUE; /* it's definitely got a PLTE now */ - pBuf->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - MNG_COPY (pBuf->aPLTEentries, ((mng_pltep)pChunk)->aEntries, - sizeof (pBuf->aPLTEentries)); - } - else -#endif - { /* get the current object */ - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address the object buffer */ - pBuf->bHasPLTE = MNG_TRUE; /* and tell it it's got a PLTE now */ - - if (((mng_pltep)pChunk)->bEmpty) /* if empty, inherit from global */ - { - pBuf->iPLTEcount = pData->iGlobalPLTEcount; - MNG_COPY (pBuf->aPLTEentries, pData->aGlobalPLTEentries, - sizeof (pBuf->aPLTEentries)); - - if (pData->bHasglobalTRNS) /* also copy global tRNS ? */ - { - mng_uint32 iRawlen2 = pData->iGlobalTRNSrawlen; - mng_uint8p pRawdata2 = (mng_uint8p)(pData->aGlobalTRNSrawdata); - /* indicate tRNS available */ - pBuf->bHasTRNS = MNG_TRUE; - /* global length oke ? */ - if ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - /* copy it */ - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - } - } - else - { /* store fields for future reference */ - pBuf->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - MNG_COPY (pBuf->aPLTEentries, ((mng_pltep)pChunk)->aEntries, - sizeof (pBuf->aPLTEentries)); - } - } - } - else /* store as global */ - { - pData->iGlobalPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - MNG_COPY (pData->aGlobalPLTEentries, ((mng_pltep)pChunk)->aEntries, - sizeof (pData->aGlobalPLTEentries)); - /* create an animation object */ - return mng_create_ani_plte (pData); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_idat) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasJHDR) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); -#endif - /* not allowed for deltatype NO_CHANGE */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && ((pData->iDeltatype == MNG_DELTATYPE_NOCHANGE))) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); -#endif - /* can only be empty in BASI-block! */ - if ((((mng_idatp)pChunk)->bEmpty) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* indexed-color requires PLTE */ - if ((pData->bHasIHDR) && (pData->iColortype == 3) && (!pData->bHasPLTE)) - MNG_ERROR (pData, MNG_PLTEMISSING); - - pData->bHasIDAT = MNG_TRUE; /* got some IDAT now, don't we */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_iend) -{ /* IHDR-block requires IDAT */ - if ((pData->bHasIHDR) && (!pData->bHasIDAT)) - MNG_ERROR (pData, MNG_IDATMISSING); - - pData->iImagelevel--; /* one level up */ - -#ifdef MNG_SUPPORT_DISPLAY - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_image (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* display processing */ - iRetcode = mng_process_display_iend (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_SUPPORT_DISPLAY - if (!pData->bTimerset) /* reset only if not broken !!! */ - { -#endif - /* IEND signals the end for most ... */ - pData->bHasIHDR = MNG_FALSE; - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; -#ifdef MNG_SUPPORT_DISPLAY - } -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_F_SPECIALFUNC (mng_debunk_trns) -{ - mng_trnsp pTRNS = (mng_trnsp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not global! */ - pTRNS->bGlobal = MNG_FALSE; - pTRNS->iType = pData->iColortype; - - if (iRawlen != 0) - { - switch (pData->iColortype) /* store fields */ - { - case 0: { /* gray */ - if (iRawlen != 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->iGray = mng_get_uint16 (pRawdata); - break; - } - case 2: { /* rgb */ - if (iRawlen != 6) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->iRed = mng_get_uint16 (pRawdata); - pTRNS->iGreen = mng_get_uint16 (pRawdata+2); - pTRNS->iBlue = mng_get_uint16 (pRawdata+4); - break; - } - case 3: { /* indexed */ - if (iRawlen > 256) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->iCount = iRawlen; - MNG_COPY (pTRNS->aEntries, pRawdata, iRawlen); - break; - } - } - } - } - else /* it's global! */ - { - if (iRawlen == 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->bGlobal = MNG_TRUE; - pTRNS->iType = 0; - pTRNS->iRawlen = iRawlen; - MNG_COPY (pTRNS->aRawdata, pRawdata, iRawlen); - - pData->iGlobalTRNSrawlen = iRawlen; - MNG_COPY (pData->aGlobalTRNSrawdata, pRawdata, iRawlen); - } - - *piRawlen = 0; - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_trns) -{ /* multiple tRNS only inside BASI */ - if ((pData->bHasTRNS) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not allowed with full alpha-channel */ - if ((pData->iColortype == 4) || (pData->iColortype == 6)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if (!((mng_trnsp)pChunk)->bEmpty) /* filled ? */ - { -#ifdef MNG_SUPPORT_DISPLAY - if (pData->iColortype == 3) - { - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; - - if (!pImage) /* no object then check obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - - if (((mng_trnsp)pChunk)->iCount > pBuf->iPLTEcount) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } -#endif - } - else /* if empty there must be global stuff! */ - { - if (!pData->bHasglobalTRNS) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasTRNS = MNG_TRUE; /* indicate tRNS available */ - else - pData->bHasglobalTRNS = MNG_TRUE; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - mng_uint8p pRawdata2; - mng_uint32 iRawlen2; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1,0,0,0,0,0,0,0,1}; -#endif - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = ((mng_trnsp)pChunk)->iGray; -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - pBuf->iTRNSgray *= multiplier[pData->iPNGdepth]; -#endif -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSred = ((mng_trnsp)pChunk)->iRed; - pBuf->iTRNSgreen = ((mng_trnsp)pChunk)->iGreen; - pBuf->iTRNSblue = ((mng_trnsp)pChunk)->iBlue; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNScount = ((mng_trnsp)pChunk)->iCount; - MNG_COPY (pBuf->aTRNSentries, - ((mng_trnsp)pChunk)->aEntries, - ((mng_trnsp)pChunk)->iCount); - break; - } - } - } - else -#endif - { /* address current object */ - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasTRNS = MNG_TRUE; /* and tell it it's got a tRNS now */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; - - if (((mng_trnsp)pChunk)->bEmpty) /* if empty, inherit from global */ - { - iRawlen2 = pData->iGlobalTRNSrawlen; - pRawdata2 = (mng_ptr)(pData->aGlobalTRNSrawdata); - /* global length oke ? */ - if ((pData->iColortype == 0) && (iRawlen2 != 2)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 2) && (iRawlen2 != 6)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 3) && ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount))) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = mng_get_uint16 (pRawdata2); -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSred = mng_get_uint16 (pRawdata2); - pBuf->iTRNSgreen = mng_get_uint16 (pRawdata2+2); - pBuf->iTRNSblue = mng_get_uint16 (pRawdata2+4); -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - break; - } - } - } - else - { - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = ((mng_trnsp)pChunk)->iGray; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSred = ((mng_trnsp)pChunk)->iRed; - pBuf->iTRNSgreen = ((mng_trnsp)pChunk)->iGreen; - pBuf->iTRNSblue = ((mng_trnsp)pChunk)->iBlue; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNScount = ((mng_trnsp)pChunk)->iCount; - MNG_COPY (pBuf->aTRNSentries, - ((mng_trnsp)pChunk)->aEntries, - ((mng_trnsp)pChunk)->iCount); - break; - } - } - } - } - } - else - { /* create an animation object */ - return mng_create_ani_trns (pData); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_gama) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasGAMA = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalGAMA = (mng_bool)!((mng_gamap)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - pImage = (mng_imagep)pData->pObjzero; - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - /* store for color-processing routines */ - pImage->pImgbuf->iGamma = ((mng_gamap)pChunk)->iGamma; - pImage->pImgbuf->bHasGAMA = MNG_TRUE; - } - else - { /* store as global */ - if (!((mng_gamap)pChunk)->bEmpty) - pData->iGlobalGamma = ((mng_gamap)pChunk)->iGamma; - /* create an animation object */ - return mng_create_ani_gama (pData, pChunk); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -MNG_C_SPECIALFUNC (mng_special_chrm) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasCHRM = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalCHRM = (mng_bool)!((mng_chrmp)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY - { -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - pImage = (mng_imagep)pData->pObjzero; - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */ - /* store for color-processing routines */ - pBuf->iWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; - pBuf->iWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; - pBuf->iPrimaryredx = ((mng_chrmp)pChunk)->iRedx; - pBuf->iPrimaryredy = ((mng_chrmp)pChunk)->iRedy; - pBuf->iPrimarygreenx = ((mng_chrmp)pChunk)->iGreenx; - pBuf->iPrimarygreeny = ((mng_chrmp)pChunk)->iGreeny; - pBuf->iPrimarybluex = ((mng_chrmp)pChunk)->iBluex; - pBuf->iPrimarybluey = ((mng_chrmp)pChunk)->iBluey; - } - else - { /* store as global */ - if (!((mng_chrmp)pChunk)->bEmpty) - { - pData->iGlobalWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; - pData->iGlobalWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; - pData->iGlobalPrimaryredx = ((mng_chrmp)pChunk)->iRedx; - pData->iGlobalPrimaryredy = ((mng_chrmp)pChunk)->iRedy; - pData->iGlobalPrimarygreenx = ((mng_chrmp)pChunk)->iGreenx; - pData->iGlobalPrimarygreeny = ((mng_chrmp)pChunk)->iGreeny; - pData->iGlobalPrimarybluex = ((mng_chrmp)pChunk)->iBluex; - pData->iGlobalPrimarybluey = ((mng_chrmp)pChunk)->iBluey; - } - /* create an animation object */ - return mng_create_ani_chrm (pData, pChunk); - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_srgb) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasSRGB = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalSRGB = (mng_bool)!((mng_srgbp)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - pImage = (mng_imagep)pData->pObjzero; - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - /* store for color-processing routines */ - pImage->pImgbuf->iRenderingintent = ((mng_srgbp)pChunk)->iRenderingintent; - pImage->pImgbuf->bHasSRGB = MNG_TRUE; - } - else - { /* store as global */ - if (!((mng_srgbp)pChunk)->bEmpty) - pData->iGlobalRendintent = ((mng_srgbp)pChunk)->iRenderingintent; - /* create an animation object */ - return mng_create_ani_srgb (pData, pChunk); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -MNG_C_SPECIALFUNC (mng_special_iccp) -{ - mng_retcode iRetcode; - mng_chunk_headerp pDummy; - -#ifdef MNG_CHECK_BAD_ICCP /* Check for bad iCCP chunk */ - if (!strncmp (((mng_iccpp)pChunk)->zName, "Photoshop ICC profile", 21)) - { - if (((mng_iccpp)pChunk)->iProfilesize == 2615) /* is it the sRGB profile ? */ - { - mng_chunk_header chunk_srgb; - mng_get_chunkheader (MNG_UINT_sRGB, &chunk_srgb); - /* pretend it's an sRGB chunk then ! */ - iRetcode = mng_read_general (pData, &chunk_srgb, 1, (mng_ptr)"0", &pDummy); - if (iRetcode) /* on error bail out */ - return iRetcode; - - pDummy->fCleanup (pData, pDummy); - } - } - else - { -#endif /* MNG_CHECK_BAD_ICCP */ - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasICCP = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalICCP = (mng_bool)!((mng_iccpp)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - } - else - { /* store as global */ - if (pData->pGlobalProfile) /* did we have a global profile ? */ - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - if (((mng_iccpp)pChunk)->bEmpty) /* empty chunk ? */ - { - pData->iGlobalProfilesize = 0; /* reset to null */ - pData->pGlobalProfile = MNG_NULL; - } - else - { /* allocate a global buffer & copy it */ - MNG_ALLOC (pData, pData->pGlobalProfile, ((mng_iccpp)pChunk)->iProfilesize); - MNG_COPY (pData->pGlobalProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - /* store its length as well */ - pData->iGlobalProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - } - /* create an animation object */ - return mng_create_ani_iccp (pData, pChunk); - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_CHECK_BAD_ICCP - } -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -MNG_C_SPECIALFUNC (mng_special_text) -{ - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_TEXT, - ((mng_textp)pChunk)->zKeyword, - ((mng_textp)pChunk)->zText, 0, 0); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -MNG_C_SPECIALFUNC (mng_special_ztxt) -{ - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ZTXT, - ((mng_ztxtp)pChunk)->zKeyword, - ((mng_ztxtp)pChunk)->zText, 0, 0); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_F_SPECIALFUNC (mng_deflate_itxt) -{ - mng_itxtp pITXT = (mng_itxtp)pChunk; - mng_uint32 iBufsize = 0; - mng_uint8p pBuf = 0; - mng_uint32 iTextlen = 0; - - if (pITXT->iCompressionflag) /* decompress the text ? */ - { - mng_retcode iRetcode = mng_inflate_buffer (pData, *ppRawdata, *piRawlen, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - MNG_ALLOC (pData, pITXT->zText, iTextlen+1); - MNG_COPY (pITXT->zText, pBuf, iTextlen); - - pITXT->iTextsize = iTextlen; - - MNG_FREEX (pData, pBuf, iBufsize); - - } else { - - MNG_ALLOC (pData, pITXT->zText, (*piRawlen)+1); - MNG_COPY (pITXT->zText, *ppRawdata, *piRawlen); - - pITXT->iTextsize = *piRawlen; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_C_SPECIALFUNC (mng_special_itxt) -{ - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ITXT, - ((mng_itxtp)pChunk)->zKeyword, - ((mng_itxtp)pChunk)->zText, - ((mng_itxtp)pChunk)->zLanguage, - ((mng_itxtp)pChunk)->zTranslation); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -MNG_C_SPECIALFUNC (mng_special_bkgd) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; -#endif - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasBKGD = MNG_TRUE; /* indicate bKGD available */ - else - pData->bHasglobalBKGD = (mng_bool)!(((mng_bkgdp)pChunk)->bEmpty); - -#ifdef MNG_SUPPORT_DISPLAY - if (!pImage) /* if no object dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; /* address object buffer */ - -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iJHDRcolortype) /* store fields for future reference */ - { - case 8 : ; /* gray */ - case 12 : { /* graya */ - pBuf->iBKGDgray = ((mng_bkgdp)pChunk)->iGray; - break; - } - case 10 : ; /* rgb */ - case 14 : { /* rgba */ - pBuf->iBKGDred = ((mng_bkgdp)pChunk)->iRed; - pBuf->iBKGDgreen = ((mng_bkgdp)pChunk)->iGreen; - pBuf->iBKGDblue = ((mng_bkgdp)pChunk)->iBlue; - break; - } - } - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0 : ; /* gray */ - case 4 : { /* graya */ - pBuf->iBKGDgray = ((mng_bkgdp)pChunk)->iGray; - break; - } - case 2 : ; /* rgb */ - case 6 : { /* rgba */ - pBuf->iBKGDred = ((mng_bkgdp)pChunk)->iRed; - pBuf->iBKGDgreen = ((mng_bkgdp)pChunk)->iGreen; - pBuf->iBKGDblue = ((mng_bkgdp)pChunk)->iBlue; - break; - } - case 3 : { /* indexed */ - pBuf->iBKGDindex = ((mng_bkgdp)pChunk)->iIndex; - break; - } - } - } - else /* store as global */ - { - if (!(((mng_bkgdp)pChunk)->bEmpty)) - { - pData->iGlobalBKGDred = ((mng_bkgdp)pChunk)->iRed; - pData->iGlobalBKGDgreen = ((mng_bkgdp)pChunk)->iGreen; - pData->iGlobalBKGDblue = ((mng_bkgdp)pChunk)->iBlue; - } - /* create an animation object */ - return mng_create_ani_bkgd (pData); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -MNG_C_SPECIALFUNC (mng_special_phys) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -MNG_C_SPECIALFUNC (mng_special_sbit) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_F_SPECIALFUNC (mng_splt_entries) -{ - mng_spltp pSPLT = (mng_spltp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if ((pSPLT->iSampledepth != MNG_BITDEPTH_8 ) && - (pSPLT->iSampledepth != MNG_BITDEPTH_16) ) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - /* check remaining length */ - if ( ((pSPLT->iSampledepth == MNG_BITDEPTH_8 ) && (iRawlen % 6 != 0)) || - ((pSPLT->iSampledepth == MNG_BITDEPTH_16) && (iRawlen % 10 != 0)) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (pSPLT->iSampledepth == MNG_BITDEPTH_8) - pSPLT->iEntrycount = iRawlen / 6; - else - pSPLT->iEntrycount = iRawlen / 10; - - if (iRawlen) - { - MNG_ALLOC (pData, pSPLT->pEntries, iRawlen); - MNG_COPY (pSPLT->pEntries, pRawdata, iRawlen); - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_C_SPECIALFUNC (mng_special_splt) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -MNG_F_SPECIALFUNC (mng_hist_entries) -{ - mng_histp pHIST = (mng_histp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iX; - - if ( ((iRawlen & 0x01) != 0) || ((iRawlen >> 1) != pData->iPLTEcount) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pHIST->iEntrycount = iRawlen >> 1; - - for (iX = 0; iX < pHIST->iEntrycount; iX++) - { - pHIST->aEntries[iX] = mng_get_uint16 (pRawdata); - pRawdata += 2; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -MNG_C_SPECIALFUNC (mng_special_hist) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -MNG_C_SPECIALFUNC (mng_special_time) -{ -/* if (pData->fProcesstime) */ /* inform the application ? */ -/* { - - pData->fProcesstime ((mng_handle)pData, ); - } */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* JNG chunks */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jhdr) -{ - if ((pData->eSigtype == mng_it_jng) && (pData->iChunkseq > 1)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* inside a JHDR-IEND block now */ - pData->bHasJHDR = MNG_TRUE; - /* and store interesting fields */ - pData->iDatawidth = ((mng_jhdrp)pChunk)->iWidth; - pData->iDataheight = ((mng_jhdrp)pChunk)->iHeight; - pData->iJHDRcolortype = ((mng_jhdrp)pChunk)->iColortype; - pData->iJHDRimgbitdepth = ((mng_jhdrp)pChunk)->iImagesampledepth; - pData->iJHDRimgcompression = ((mng_jhdrp)pChunk)->iImagecompression; - pData->iJHDRimginterlace = ((mng_jhdrp)pChunk)->iImageinterlace; - pData->iJHDRalphabitdepth = ((mng_jhdrp)pChunk)->iAlphasampledepth; - pData->iJHDRalphacompression = ((mng_jhdrp)pChunk)->iAlphacompression; - pData->iJHDRalphafilter = ((mng_jhdrp)pChunk)->iAlphafilter; - pData->iJHDRalphainterlace = ((mng_jhdrp)pChunk)->iAlphainterlace; - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iJHDRalphabitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iJHDRalphabitdepth < 8) - pData->iJHDRalphabitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iJHDRalphabitdepth > 8) - { - pData->iPNGmult = 2; - pData->iJHDRalphabitdepth = 8; - } -#endif - /* parameter validity checks */ - if ((pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAY ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLORA) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG12 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8AND12) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - if ((pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_1 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_2 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_4 ) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE ) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) ) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if ((pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iJHDRalphafilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) && - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - } - else - { - if (pData->iJHDRalphabitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - if (pData->iJHDRalphacompression) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); - if (pData->iJHDRalphainterlace) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - } - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_jng; /* then this must be a JNG */ - pData->iWidth = ((mng_jhdrp)pChunk)->iWidth; - pData->iHeight = ((mng_jhdrp)pChunk)->iHeight; - /* predict alpha-depth ! */ - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - pData->iAlphadepth = pData->iJHDRalphabitdepth; - else - pData->iAlphadepth = 0; - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - } - - pData->iColortype = 0; /* fake grayscale for other routines */ - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_process_display_jhdr (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_NO_16BIT_SUPPORT - if (((mng_jhdrp)pChunk)->iAlphasampledepth > 8) - ((mng_jhdrp)pChunk)->iAlphasampledepth = 8; -#endif - - return MNG_NOERROR; /* done */ -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jdaa) -{ - if (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasJDAA = MNG_TRUE; /* got some JDAA now, don't we */ - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jdat) -{ - pData->bHasJDAT = MNG_TRUE; /* got some JDAT now, don't we */ - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jsep) -{ - pData->bHasJSEP = MNG_TRUE; /* indicate we've had the 8-/12-bit separator */ - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* MNG chunks */ - -MNG_C_SPECIALFUNC (mng_special_mhdr) -{ - if (pData->bHasheader) /* can only be the first chunk! */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasMHDR = MNG_TRUE; /* oh boy, a real MNG */ - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_mng; /* fill header fields */ - pData->iWidth = ((mng_mhdrp)pChunk)->iWidth; - pData->iHeight = ((mng_mhdrp)pChunk)->iHeight; - pData->iTicks = ((mng_mhdrp)pChunk)->iTicks; - pData->iLayercount = ((mng_mhdrp)pChunk)->iLayercount; - pData->iFramecount = ((mng_mhdrp)pChunk)->iFramecount; - pData->iPlaytime = ((mng_mhdrp)pChunk)->iPlaytime; - pData->iSimplicity = ((mng_mhdrp)pChunk)->iSimplicity; -#ifndef MNG_NO_OLD_VERSIONS - pData->bPreDraft48 = MNG_FALSE; -#endif - /* predict alpha-depth */ - if ((pData->iSimplicity & 0x00000001) == 0) -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* no indicators = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - else - if ((pData->iSimplicity & 0x00000008) == 0) - pData->iAlphadepth = 0; /* no transparency at all */ - else - if ((pData->iSimplicity & 0x00000140) == 0x00000040) - pData->iAlphadepth = 1; /* no semi-transparency guaranteed */ - else -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* anything else = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - -#ifdef MNG_INCLUDE_JNG /* can we handle the complexity ? */ - if (pData->iSimplicity & 0x0000FC00) -#else - if (pData->iSimplicity & 0x0000FC10) -#endif - MNG_ERROR (pData, MNG_MNGTOOCOMPLEX); - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iImagelevel++; /* one level deeper */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_mend) -{ -#ifdef MNG_SUPPORT_DISPLAY - { /* do something */ - mng_retcode iRetcode = mng_process_display_mend (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (!pData->iTotalframes) /* save totals */ - pData->iTotalframes = pData->iFrameseq; - if (!pData->iTotallayers) - pData->iTotallayers = pData->iLayerseq; - if (!pData->iTotalplaytime) - pData->iTotalplaytime = pData->iFrametime; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - pData->bHasMHDR = MNG_FALSE; /* end of the line, bro! */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_F_SPECIALFUNC (mng_debunk_loop) -{ - mng_loopp pLOOP = (mng_loopp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if (iRawlen >= 5) /* length checks */ - { - if (iRawlen >= 6) - { - if ((iRawlen - 6) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (iRawlen >= 5) /* store the fields */ - { - pLOOP->iLevel = *pRawdata; - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) - { - pLOOP->iTermination = *(pRawdata+1); - pLOOP->iRepeat = mng_get_uint32 (pRawdata+2); - } - else -#endif - { - pLOOP->iRepeat = mng_get_uint32 (pRawdata+1); - } - - if (iRawlen >= 6) - { -#ifndef MNG_NO_OLD_VERSIONS - if (!pData->bPreDraft48) -#endif - pLOOP->iTermination = *(pRawdata+5); - - if (iRawlen >= 10) - { - pLOOP->iItermin = mng_get_uint32 (pRawdata+6); - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (iRawlen >= 14) - { - pLOOP->iItermax = mng_get_uint32 (pRawdata+10); - pLOOP->iCount = (iRawlen - 14) / 4; - - if (pLOOP->iCount) - { - MNG_ALLOC (pData, pLOOP->pSignals, pLOOP->iCount << 2); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata + 14; - mng_uint32p pOut = (mng_uint32p)pLOOP->pSignals; - - for (iX = 0; iX < pLOOP->iCount; iX++) - { - *pOut++ = mng_get_uint32 (pIn); - pIn += 4; - } - } -#else - MNG_COPY (pLOOP->pSignals, pRawdata + 14, pLOOP->iCount << 2); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } -#endif - } - } - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_C_SPECIALFUNC (mng_special_loop) -{ - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_LOOPWITHCACHEOFF); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - pData->bHasLOOP = MNG_TRUE; /* indicate we're inside a loop */ - /* create the LOOP ani-object */ - iRetcode = mng_create_ani_loop (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* skip till matching ENDL if iteration=0 */ - if ((!pData->bSkipping) && (((mng_loopp)pChunk)->iRepeat == 0)) - pData->bSkipping = MNG_TRUE; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_C_SPECIALFUNC (mng_special_endl) -{ -#ifdef MNG_SUPPORT_DISPLAY - if (pData->bHasLOOP) /* are we really processing a loop ? */ - { - mng_uint8 iLevel = ((mng_endlp)pChunk)->iLevel; - /* create an ENDL animation object */ - return mng_create_ani_endl (pData, iLevel); - } - else - MNG_ERROR (pData, MNG_NOMATCHINGLOOP); -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -MNG_C_SPECIALFUNC (mng_special_defi) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode; - - pData->iDEFIobjectid = ((mng_defip)pChunk)->iObjectid; - pData->bDEFIhasdonotshow = ((mng_defip)pChunk)->bHasdonotshow; - pData->iDEFIdonotshow = ((mng_defip)pChunk)->iDonotshow; - pData->bDEFIhasconcrete = ((mng_defip)pChunk)->bHasconcrete; - pData->iDEFIconcrete = ((mng_defip)pChunk)->iConcrete; - pData->bDEFIhasloca = ((mng_defip)pChunk)->bHasloca; - pData->iDEFIlocax = ((mng_defip)pChunk)->iXlocation; - pData->iDEFIlocay = ((mng_defip)pChunk)->iYlocation; - pData->bDEFIhasclip = ((mng_defip)pChunk)->bHasclip; - pData->iDEFIclipl = ((mng_defip)pChunk)->iLeftcb; - pData->iDEFIclipr = ((mng_defip)pChunk)->iRightcb; - pData->iDEFIclipt = ((mng_defip)pChunk)->iTopcb; - pData->iDEFIclipb = ((mng_defip)pChunk)->iBottomcb; - /* create an animation object */ - iRetcode = mng_create_ani_defi (pData); - if (!iRetcode) /* do display processing */ - iRetcode = mng_process_display_defi (pData); - return iRetcode; -#else - return MNG_NOERROR; /* done */ -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -MNG_C_SPECIALFUNC (mng_special_basi) -{ - pData->bHasBASI = MNG_TRUE; /* inside a BASI-IEND block now */ - /* store interesting fields */ - pData->iDatawidth = ((mng_basip)pChunk)->iWidth; - pData->iDataheight = ((mng_basip)pChunk)->iHeight; - pData->iBitdepth = ((mng_basip)pChunk)->iBitdepth; - pData->iColortype = ((mng_basip)pChunk)->iColortype; - pData->iCompression = ((mng_basip)pChunk)->iCompression; - pData->iFilter = ((mng_basip)pChunk)->iFilter; - pData->iInterlace = ((mng_basip)pChunk)->iInterlace; - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_basi (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_NO_16BIT_SUPPORT - if (((mng_basip)pChunk)->iBitdepth > 8) - ((mng_basip)pChunk)->iBitdepth = 8; -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -MNG_C_SPECIALFUNC (mng_special_clon) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_clon (pData, pChunk); -#else - return MNG_NOERROR; /* done */ -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -MNG_F_SPECIALFUNC (mng_debunk_past) -{ - mng_pastp pPAST = (mng_pastp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iSize; - mng_uint32 iX; - mng_past_sourcep pSource; - /* check the length */ - if ((iRawlen < 41) || (((iRawlen - 11) % 30) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pPAST->iDestid = mng_get_uint16 (pRawdata); - pPAST->iTargettype = *(pRawdata+2); - pPAST->iTargetx = mng_get_int32 (pRawdata+3); - pPAST->iTargety = mng_get_int32 (pRawdata+7); - pPAST->iCount = ((iRawlen - 11) / 30); /* how many entries again? */ - iSize = pPAST->iCount * sizeof (mng_past_source); - - pRawdata += 11; - /* get a buffer for all the source blocks */ - MNG_ALLOC (pData, pPAST->pSources, iSize); - - pSource = (mng_past_sourcep)(pPAST->pSources); - - for (iX = pPAST->iCount; iX > 0; iX--) - { /* now copy the source blocks */ - pSource->iSourceid = mng_get_uint16 (pRawdata); - pSource->iComposition = *(pRawdata+2); - pSource->iOrientation = *(pRawdata+3); - pSource->iOffsettype = *(pRawdata+4); - pSource->iOffsetx = mng_get_int32 (pRawdata+5); - pSource->iOffsety = mng_get_int32 (pRawdata+9); - pSource->iBoundarytype = *(pRawdata+13); - pSource->iBoundaryl = mng_get_int32 (pRawdata+14); - pSource->iBoundaryr = mng_get_int32 (pRawdata+18); - pSource->iBoundaryt = mng_get_int32 (pRawdata+22); - pSource->iBoundaryb = mng_get_int32 (pRawdata+26); - - pSource++; - pRawdata += 30; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -MNG_C_SPECIALFUNC (mng_special_past) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_past (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -MNG_F_SPECIALFUNC (mng_disc_entries) -{ - mng_discp pDISC = (mng_discp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if ((iRawlen % 2) != 0) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pDISC->iCount = (iRawlen / sizeof (mng_uint16)); - - if (pDISC->iCount) - { - MNG_ALLOC (pData, pDISC->pObjectids, iRawlen); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata; - mng_uint16p pOut = pDISC->pObjectids; - - for (iX = pDISC->iCount; iX > 0; iX--) - { - *pOut++ = mng_get_uint16 (pIn); - pIn += 2; - } - } -#else - MNG_COPY (pDISC->pObjectids, pRawdata, iRawlen); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -MNG_C_SPECIALFUNC (mng_special_disc) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_disc (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -MNG_C_SPECIALFUNC (mng_special_back) -{ -#ifdef MNG_SUPPORT_DISPLAY - /* retrieve the fields */ - pData->bHasBACK = MNG_TRUE; - pData->iBACKred = ((mng_backp)pChunk)->iRed; - pData->iBACKgreen = ((mng_backp)pChunk)->iGreen; - pData->iBACKblue = ((mng_backp)pChunk)->iBlue; - pData->iBACKmandatory = ((mng_backp)pChunk)->iMandatory; - pData->iBACKimageid = ((mng_backp)pChunk)->iImageid; - pData->iBACKtile = ((mng_backp)pChunk)->iTile; - - return mng_create_ani_back (pData); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_F_SPECIALFUNC (mng_fram_remainder) -{ - mng_framp pFRAM = (mng_framp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iRequired = 0; - - if (iRawlen < 4) /* must have at least 4 bytes */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iRequired = 4; /* calculate and check required remaining length */ - - pFRAM->iChangedelay = *pRawdata; - pFRAM->iChangetimeout = *(pRawdata+1); - pFRAM->iChangeclipping = *(pRawdata+2); - pFRAM->iChangesyncid = *(pRawdata+3); - - if (pFRAM->iChangedelay ) { iRequired += 4; } - if (pFRAM->iChangetimeout ) { iRequired += 4; } - if (pFRAM->iChangeclipping) { iRequired += 17; } - - if (pFRAM->iChangesyncid) - { - if ((iRawlen - iRequired) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { - if (iRawlen != iRequired) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - pRawdata += 4; - - if (pFRAM->iChangedelay) /* delay changed ? */ - { - pFRAM->iDelay = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - - if (pFRAM->iChangetimeout) /* timeout changed ? */ - { - pFRAM->iTimeout = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - - if (pFRAM->iChangeclipping) /* clipping changed ? */ - { - pFRAM->iBoundarytype = *pRawdata; - pFRAM->iBoundaryl = mng_get_int32 (pRawdata+1); - pFRAM->iBoundaryr = mng_get_int32 (pRawdata+5); - pFRAM->iBoundaryt = mng_get_int32 (pRawdata+9); - pFRAM->iBoundaryb = mng_get_int32 (pRawdata+13); - pRawdata += 17; - } - - if (pFRAM->iChangesyncid) - { - pFRAM->iCount = (iRawlen - iRequired) / 4; - - if (pFRAM->iCount) - { - MNG_ALLOC (pData, pFRAM->pSyncids, pFRAM->iCount * 4); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint32p pOut = pFRAM->pSyncids; - - for (iX = pFRAM->iCount; iX > 0; iX--) - { - *pOut++ = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - } -#else - MNG_COPY (pFRAM->pSyncids, pRawdata, pFRAM->iCount * 4); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) /* old style input-stream ? */ - { - switch (pFRAM->iMode) /* fix the framing mode then */ - { - case 0: { break; } - case 1: { pFRAM->iMode = 3; break; } - case 2: { pFRAM->iMode = 4; break; } - case 3: { pFRAM->iMode = 1; break; } - case 4: { pFRAM->iMode = 1; break; } - case 5: { pFRAM->iMode = 2; break; } - default: { pFRAM->iMode = 1; break; } - } - } -#endif - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_C_SPECIALFUNC (mng_special_fram) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_fram (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -MNG_C_SPECIALFUNC (mng_special_move) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_move (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -MNG_C_SPECIALFUNC (mng_special_clip) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_clip (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -MNG_C_SPECIALFUNC (mng_special_show) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode; - - if (!((mng_showp)pChunk)->bEmpty) /* any data ? */ - { - if (!((mng_showp)pChunk)->bHaslastid) - ((mng_showp)pChunk)->iLastid = ((mng_showp)pChunk)->iFirstid; - - pData->iSHOWfromid = ((mng_showp)pChunk)->iFirstid; - pData->iSHOWtoid = ((mng_showp)pChunk)->iLastid; - pData->iSHOWmode = ((mng_showp)pChunk)->iMode; - } - else /* use defaults then */ - { - pData->iSHOWfromid = 1; - pData->iSHOWtoid = 65535; - pData->iSHOWmode = 2; - } - /* create a SHOW animation object */ - iRetcode = mng_create_ani_show (pData); - if (!iRetcode) /* go and do it! */ - iRetcode = mng_process_display_show (pData); - -#endif /* MNG_SUPPORT_DISPLAY */ - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -MNG_C_SPECIALFUNC (mng_special_term) -{ - /* should be behind MHDR or SAVE !! */ - if ((!pData->bHasSAVE) && (pData->iChunkseq > 2)) - { - pData->bMisplacedTERM = MNG_TRUE; /* indicate we found a misplaced TERM */ - /* and send a warning signal!!! */ - MNG_WARNING (pData, MNG_SEQUENCEERROR); - } - - pData->bHasTERM = MNG_TRUE; - - if (pData->fProcessterm) /* inform the app ? */ - if (!pData->fProcessterm (((mng_handle)pData), - ((mng_termp)pChunk)->iTermaction, - ((mng_termp)pChunk)->iIteraction, - ((mng_termp)pChunk)->iDelay, - ((mng_termp)pChunk)->iItermax)) - MNG_ERROR (pData, MNG_APPMISCERROR); - -#ifdef MNG_SUPPORT_DISPLAY - { /* create the TERM ani-object */ - mng_retcode iRetcode = mng_create_ani_term (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* save for future reference */ - pData->pTermaniobj = pData->pLastaniobj; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_F_SPECIALFUNC (mng_save_entries) -{ - mng_savep pSAVE = (mng_savep)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_save_entryp pEntry = MNG_NULL; - mng_uint32 iCount = 0; - mng_uint8 iOtype = *pRawdata; - mng_uint8 iEtype; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint32 iOffset[2]; - mng_uint32 iStarttime[2]; - mng_uint32 iFramenr; - mng_uint32 iLayernr; - mng_uint32 iX; - mng_uint32 iNamesize; - - if ((iOtype != 4) && (iOtype != 8)) - MNG_ERROR (pData, MNG_INVOFFSETSIZE); - - pSAVE->iOffsettype = iOtype; - - for (iX = 0; iX < 2; iX++) /* do this twice to get the count first ! */ - { - pTemp = pRawdata + 1; - iLen = iRawlen - 1; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_save_entry))); - - pSAVE->iCount = iCount; - pSAVE->pEntries = pEntry; - } - - while (iLen) /* anything left ? */ - { - iEtype = *pTemp; /* entrytype */ - - if ((iEtype != 0) && (iEtype != 1) && (iEtype != 2) && (iEtype != 3)) - MNG_ERROR (pData, MNG_INVENTRYTYPE); - - pTemp++; - - if (iEtype > 1) - { - iOffset [0] = 0; - iOffset [1] = 0; - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iOffset [0] = 0; - iOffset [1] = mng_get_uint32 (pTemp); - - pTemp += 4; - } - else - { - iOffset [0] = mng_get_uint32 (pTemp); - iOffset [1] = mng_get_uint32 (pTemp+4); - - pTemp += 8; - } - - if (iEtype > 0) - { - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iStarttime [0] = 0; - iStarttime [1] = mng_get_uint32 (pTemp+0); - iLayernr = mng_get_uint32 (pTemp+4); - iFramenr = mng_get_uint32 (pTemp+8); - - pTemp += 12; - } - else - { - iStarttime [0] = mng_get_uint32 (pTemp+0); - iStarttime [1] = mng_get_uint32 (pTemp+4); - iLayernr = mng_get_uint32 (pTemp+8); - iFramenr = mng_get_uint32 (pTemp+12); - - pTemp += 16; - } - } - } - - pNull = pTemp; /* get the name length */ - while (*pNull) - pNull++; - - if ((pNull - pRawdata) > (mng_int32)iRawlen) - { - iNamesize = iLen; /* no null found; so end of SAVE */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen -= iNamesize; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!pEntry) - { - iCount++; - } - else - { - pEntry->iEntrytype = iEtype; - pEntry->iOffset [0] = iOffset [0]; - pEntry->iOffset [1] = iOffset [1]; - pEntry->iStarttime [0] = iStarttime [0]; - pEntry->iStarttime [1] = iStarttime [1]; - pEntry->iLayernr = iLayernr; - pEntry->iFramenr = iFramenr; - pEntry->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zName, iNamesize+1); - MNG_COPY (pEntry->zName, pTemp, iNamesize); - } - - pEntry++; - } - - pTemp += iNamesize; - } - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_C_SPECIALFUNC (mng_special_save) -{ - pData->bHasSAVE = MNG_TRUE; - - if (pData->fProcesssave) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesssave ((mng_handle)pData); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - /* TODO: something with the parameters */ - - /* create a SAVE animation object */ - iRetcode = mng_create_ani_save (pData); - if (!iRetcode) /* process it */ - iRetcode = mng_process_display_save (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -MNG_C_SPECIALFUNC (mng_special_seek) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_DISPLAY - /* create a SEEK animation object */ - iRetcode = mng_create_ani_seek (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - - if (pData->fProcessseek) /* inform the app ? */ - if (!pData->fProcessseek ((mng_handle)pData, ((mng_seekp)pChunk)->zName)) - MNG_ERROR (pData, MNG_APPMISCERROR); - -#ifdef MNG_SUPPORT_DISPLAY - return mng_process_display_seek (pData); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -MNG_C_SPECIALFUNC (mng_special_expi) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -MNG_C_SPECIALFUNC (mng_special_fpri) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_bool CheckKeyword (mng_datap pData, - mng_uint8p pKeyword) -{ - mng_chunkid handled_chunks [] = - { - MNG_UINT_BACK, /* keep it sorted !!!! */ - MNG_UINT_BASI, - MNG_UINT_CLIP, - MNG_UINT_CLON, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DBYK, */ -#endif - MNG_UINT_DEFI, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_DHDR, -#endif - MNG_UINT_DISC, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DROP, */ -#endif - MNG_UINT_ENDL, - MNG_UINT_FRAM, - MNG_UINT_IDAT, - MNG_UINT_IEND, - MNG_UINT_IHDR, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - MNG_UINT_IJNG, -#endif - MNG_UINT_IPNG, -#endif -#ifdef MNG_INCLUDE_JNG - MNG_UINT_JDAA, - MNG_UINT_JDAT, - MNG_UINT_JHDR, -/* TODO: MNG_UINT_JSEP, */ - MNG_UINT_JdAA, -#endif - MNG_UINT_LOOP, - MNG_UINT_MAGN, - MNG_UINT_MEND, - MNG_UINT_MHDR, - MNG_UINT_MOVE, -/* TODO: MNG_UINT_ORDR, */ - MNG_UINT_PAST, - MNG_UINT_PLTE, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_PPLT, - MNG_UINT_PROM, -#endif - MNG_UINT_SAVE, - MNG_UINT_SEEK, - MNG_UINT_SHOW, - MNG_UINT_TERM, - MNG_UINT_bKGD, - MNG_UINT_cHRM, -/* TODO: MNG_UINT_eXPI, */ - MNG_UINT_evNT, -/* TODO: MNG_UINT_fPRI, */ - MNG_UINT_gAMA, -/* TODO: MNG_UINT_hIST, */ - MNG_UINT_iCCP, - MNG_UINT_iTXt, - MNG_UINT_nEED, -/* TODO: MNG_UINT_oFFs, */ -/* TODO: MNG_UINT_pCAL, */ -/* TODO: MNG_UINT_pHYg, */ -/* TODO: MNG_UINT_pHYs, */ -/* TODO: MNG_UINT_sBIT, */ -/* TODO: MNG_UINT_sCAL, */ -/* TODO: MNG_UINT_sPLT, */ - MNG_UINT_sRGB, - MNG_UINT_tEXt, - MNG_UINT_tIME, - MNG_UINT_tRNS, - MNG_UINT_zTXt, - }; - - mng_bool bOke = MNG_FALSE; - - if (pData->fProcessneed) /* does the app handle it ? */ - bOke = pData->fProcessneed ((mng_handle)pData, (mng_pchar)pKeyword); - - if (!bOke) - { /* find the keyword length */ - mng_uint8p pNull = pKeyword; - while (*pNull) - pNull++; - - if ((pNull - pKeyword) == 4) /* test a chunk ? */ - { /* get the chunk-id */ - mng_chunkid iChunkid = (*pKeyword << 24) + (*(pKeyword+1) << 16) + - (*(pKeyword+2) << 8) + (*(pKeyword+3) ); - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - /* determine max index of table */ - iTop = (sizeof (handled_chunks) / sizeof (handled_chunks [0])) - 1; - - /* binary search; with 52 chunks, worst-case is 7 comparisons */ - iLower = 0; - iMiddle = iTop >> 1; - iUpper = iTop; - - do /* the binary search itself */ - { - if (handled_chunks [iMiddle] < iChunkid) - iLower = iMiddle + 1; - else if (handled_chunks [iMiddle] > iChunkid) - iUpper = iMiddle - 1; - else - { - bOke = MNG_TRUE; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - } - /* test draft ? */ - if ((!bOke) && ((pNull - pKeyword) == 8) && - (*pKeyword == 'd') && (*(pKeyword+1) == 'r') && - (*(pKeyword+2) == 'a') && (*(pKeyword+3) == 'f') && - (*(pKeyword+4) == 't') && (*(pKeyword+5) == ' ')) - { - mng_uint32 iDraft; - - iDraft = (*(pKeyword+6) - '0') * 10 + (*(pKeyword+7) - '0'); - bOke = (mng_bool)(iDraft <= MNG_MNG_DRAFT); - } - /* test MNG 1.0/1.1 ? */ - if ((!bOke) && ((pNull - pKeyword) == 7) && - (*pKeyword == 'M') && (*(pKeyword+1) == 'N') && - (*(pKeyword+2) == 'G') && (*(pKeyword+3) == '-') && - (*(pKeyword+4) == '1') && (*(pKeyword+5) == '.') && - ((*(pKeyword+6) == '0') || (*(pKeyword+6) == '1'))) - bOke = MNG_TRUE; - /* test CACHEOFF ? */ - if ((!bOke) && ((pNull - pKeyword) == 8) && - (*pKeyword == 'C') && (*(pKeyword+1) == 'A') && - (*(pKeyword+2) == 'C') && (*(pKeyword+3) == 'H') && - (*(pKeyword+4) == 'E') && (*(pKeyword+5) == 'O') && - (*(pKeyword+6) == 'F') && (*(pKeyword+7) == 'F')) - { - if (!pData->pFirstaniobj) /* only if caching hasn't started yet ! */ - { - bOke = MNG_TRUE; - pData->bCacheplayback = MNG_FALSE; - pData->bStorechunks = MNG_FALSE; - } - } - } - - return bOke; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -MNG_C_SPECIALFUNC (mng_special_need) -{ - /* let's check it */ - mng_bool bOke = MNG_TRUE; - mng_uint8p pNull, pTemp, pMax; - - pTemp = (mng_uint8p)((mng_needp)pChunk)->zKeywords; - pMax = (mng_uint8p)(pTemp + ((mng_needp)pChunk)->iKeywordssize); - pNull = pTemp; - while (*pNull) - pNull++; - - while ((bOke) && (pNull < pMax)) - { - bOke = CheckKeyword (pData, pTemp); - pTemp = pNull + 1; - pNull = pTemp; - while (*pNull) - pNull++; - } - - if (bOke) - bOke = CheckKeyword (pData, pTemp); - - if (!bOke) - MNG_ERROR (pData, MNG_UNSUPPORTEDNEED); - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -MNG_C_SPECIALFUNC (mng_special_phyg) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_dhdr) -{ - if ((((mng_dhdrp)pChunk)->iDeltatype == MNG_DELTATYPE_REPLACE) && (((mng_dhdrp)pChunk)->bHasblockloc)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - if ((((mng_dhdrp)pChunk)->iDeltatype == MNG_DELTATYPE_NOCHANGE) && (((mng_dhdrp)pChunk)->bHasblocksize)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasDHDR = MNG_TRUE; /* inside a DHDR-IEND block now */ - pData->iDeltatype = ((mng_dhdrp)pChunk)->iDeltatype; - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_dhdr (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_prom) -{ - if ((((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_GRAY ) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_RGB ) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_INDEXED) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_GRAYA ) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - -#ifdef MNG_NO_16BIT_SUPPORT - if (((mng_promp)pChunk)->iSampledepth == MNG_BITDEPTH_16 ) - ((mng_promp)pChunk)->iSampledepth = MNG_BITDEPTH_8; -#endif - - if ((((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_1 ) && - (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_2 ) && - (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_4 ) && - (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_16BIT_SUPPORT - && (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_prom (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_ipng) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode = mng_create_ani_ipng (pData); - if (!iRetcode) /* process it */ - iRetcode = mng_process_display_ipng (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_F_SPECIALFUNC (mng_pplt_entries) -{ - mng_ppltp pPPLT = (mng_ppltp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint8 iDeltatype = pPPLT->iDeltatype; - mng_uint32 iMax = 0; - mng_int32 iX, iY, iM; - mng_rgbpaltab aIndexentries; - mng_uint8arr aAlphaentries; - mng_uint8arr aUsedentries; - /* must be indexed color ! */ - if (pData->iColortype != MNG_COLORTYPE_INDEXED) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - for (iY = 255; iY >= 0; iY--) /* reset arrays */ - { - aIndexentries [iY].iRed = 0; - aIndexentries [iY].iGreen = 0; - aIndexentries [iY].iBlue = 0; - aAlphaentries [iY] = 255; - aUsedentries [iY] = 0; - } - - while (iRawlen) /* as long as there are entries left ... */ - { - mng_uint32 iDiff; - - if (iRawlen < 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iX = (mng_int32)(*pRawdata); /* get start and end index */ - iM = (mng_int32)(*(pRawdata+1)); - - if (iM < iX) - MNG_ERROR (pData, MNG_INVALIDINDEX); - - if (iM >= (mng_int32) iMax) /* determine highest used index */ - iMax = iM + 1; - - pRawdata += 2; - iRawlen -= 2; - iDiff = (iM - iX + 1); - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - iDiff = iDiff * 3; - else - if ((iDeltatype == MNG_DELTATYPE_REPLACERGBA) || - (iDeltatype == MNG_DELTATYPE_DELTARGBA ) ) - iDiff = iDiff * 4; - - if (iRawlen < iDiff) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - { - for (iY = iX; iY <= iM; iY++) - { - aIndexentries [iY].iRed = *pRawdata; - aIndexentries [iY].iGreen = *(pRawdata+1); - aIndexentries [iY].iBlue = *(pRawdata+2); - aUsedentries [iY] = 1; - - pRawdata += 3; - iRawlen -= 3; - } - } - else - if ((iDeltatype == MNG_DELTATYPE_REPLACEALPHA) || - (iDeltatype == MNG_DELTATYPE_DELTAALPHA ) ) - { - for (iY = iX; iY <= iM; iY++) - { - aAlphaentries [iY] = *pRawdata; - aUsedentries [iY] = 1; - - pRawdata++; - iRawlen--; - } - } - else - { - for (iY = iX; iY <= iM; iY++) - { - aIndexentries [iY].iRed = *pRawdata; - aIndexentries [iY].iGreen = *(pRawdata+1); - aIndexentries [iY].iBlue = *(pRawdata+2); - aAlphaentries [iY] = *(pRawdata+3); - aUsedentries [iY] = 1; - - pRawdata += 4; - iRawlen -= 4; - } - } - } - - switch (pData->iBitdepth) /* check maximum allowed entries for bitdepth */ - { - case MNG_BITDEPTH_1 : { - if (iMax > 2) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_2 : { - if (iMax > 4) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_4 : { - if (iMax > 16) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - } - - pPPLT->iCount = iMax; - - for (iY = 255; iY >= 0; iY--) - { - pPPLT->aEntries [iY].iRed = aIndexentries [iY].iRed; - pPPLT->aEntries [iY].iGreen = aIndexentries [iY].iGreen; - pPPLT->aEntries [iY].iBlue = aIndexentries [iY].iBlue; - pPPLT->aEntries [iY].iAlpha = aAlphaentries [iY]; - pPPLT->aEntries [iY].bUsed = (mng_bool)(aUsedentries [iY]); - } - - { /* create animation object */ - mng_retcode iRetcode = mng_create_ani_pplt (pData, iDeltatype, iMax, - aIndexentries, aAlphaentries, - aUsedentries); - if (iRetcode) - return iRetcode; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_pplt) -{ - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_ijng) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode = mng_create_ani_ijng (pData); - if (!iRetcode) /* process it */ - iRetcode = mng_process_display_ijng (pData); - return iRetcode; -#else - return MNG_NOERROR; /* done */ -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_F_SPECIALFUNC (mng_drop_entries) -{ - mng_dropp pDROP = (mng_dropp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iX; - mng_uint32p pEntry; - /* check length */ - if ((iRawlen < 4) || ((iRawlen % 4) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - MNG_ALLOC (pData, pEntry, iRawlen); - pDROP->iCount = iRawlen / 4; - pDROP->pChunknames = (mng_ptr)pEntry; - - for (iX = pDROP->iCount; iX > 0; iX--) - { - *pEntry++ = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_drop) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -MNG_C_SPECIALFUNC (mng_special_dbyk) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_F_SPECIALFUNC (mng_ordr_entries) -{ - mng_ordrp pORDR = (mng_ordrp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iX; - mng_ordr_entryp pEntry; - /* check length */ - if ((iRawlen < 5) || ((iRawlen % 5) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - MNG_ALLOC (pData, pEntry, iRawlen); - pORDR->iCount = iRawlen / 5; - pORDR->pEntries = (mng_ptr)pEntry; - - for (iX = pORDR->iCount; iX > 0; iX--) - { - pEntry->iChunkname = mng_get_uint32 (pRawdata); - pEntry->iOrdertype = *(pRawdata+4); - pEntry++; - pRawdata += 5; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_C_SPECIALFUNC (mng_special_ordr) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_F_SPECIALFUNC (mng_debunk_magn) -{ - mng_magnp pMAGN = (mng_magnp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_bool bFaulty; - /* check length */ - if (iRawlen > 20) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - /* following is an ugly hack to allow faulty layout caused by previous - versions of libmng and MNGeye, which wrote MAGN with a 16-bit - MethodX/MethodY (as opposed to the proper 8-bit as defined in the spec!) */ - - if ((iRawlen == 6) || (iRawlen == 8) || (iRawlen == 10) || (iRawlen == 12) || - (iRawlen == 14) || (iRawlen == 16) || (iRawlen == 20)) - bFaulty = MNG_TRUE; /* these lengths are all wrong */ - else /* length 18 can be right or wrong !!! */ - if ((iRawlen == 18) && (mng_get_uint16 (pRawdata+4) <= 5) && - (mng_get_uint16 (pRawdata+6) < 256) && - (mng_get_uint16 (pRawdata+8) < 256) && - (mng_get_uint16 (pRawdata+10) < 256) && - (mng_get_uint16 (pRawdata+12) < 256) && - (mng_get_uint16 (pRawdata+14) < 256) && - (mng_get_uint16 (pRawdata+16) < 256)) - bFaulty = MNG_TRUE; /* this is very likely the wrong layout */ - else - bFaulty = MNG_FALSE; /* all other cases are handled as right */ - - if (bFaulty) /* wrong layout ? */ - { - if (iRawlen > 0) /* get the fields */ - pMAGN->iFirstid = mng_get_uint16 (pRawdata); - else - pMAGN->iFirstid = 0; - - if (iRawlen > 2) - pMAGN->iLastid = mng_get_uint16 (pRawdata+2); - else - pMAGN->iLastid = pMAGN->iFirstid; - - if (iRawlen > 4) - pMAGN->iMethodX = (mng_uint8)(mng_get_uint16 (pRawdata+4)); - else - pMAGN->iMethodX = 0; - - if (iRawlen > 6) - pMAGN->iMX = mng_get_uint16 (pRawdata+6); - else - pMAGN->iMX = 1; - - if (iRawlen > 8) - pMAGN->iMY = mng_get_uint16 (pRawdata+8); - else - pMAGN->iMY = pMAGN->iMX; - - if (iRawlen > 10) - pMAGN->iML = mng_get_uint16 (pRawdata+10); - else - pMAGN->iML = pMAGN->iMX; - - if (iRawlen > 12) - pMAGN->iMR = mng_get_uint16 (pRawdata+12); - else - pMAGN->iMR = pMAGN->iMX; - - if (iRawlen > 14) - pMAGN->iMT = mng_get_uint16 (pRawdata+14); - else - pMAGN->iMT = pMAGN->iMY; - - if (iRawlen > 16) - pMAGN->iMB = mng_get_uint16 (pRawdata+16); - else - pMAGN->iMB = pMAGN->iMY; - - if (iRawlen > 18) - pMAGN->iMethodY = (mng_uint8)(mng_get_uint16 (pRawdata+18)); - else - pMAGN->iMethodY = pMAGN->iMethodX; - } - else /* proper layout !!!! */ - { - if (iRawlen > 0) /* get the fields */ - pMAGN->iFirstid = mng_get_uint16 (pRawdata); - else - pMAGN->iFirstid = 0; - - if (iRawlen > 2) - pMAGN->iLastid = mng_get_uint16 (pRawdata+2); - else - pMAGN->iLastid = pMAGN->iFirstid; - - if (iRawlen > 4) - pMAGN->iMethodX = *(pRawdata+4); - else - pMAGN->iMethodX = 0; - - if (iRawlen > 5) - pMAGN->iMX = mng_get_uint16 (pRawdata+5); - else - pMAGN->iMX = 1; - - if (iRawlen > 7) - pMAGN->iMY = mng_get_uint16 (pRawdata+7); - else - pMAGN->iMY = pMAGN->iMX; - - if (iRawlen > 9) - pMAGN->iML = mng_get_uint16 (pRawdata+9); - else - pMAGN->iML = pMAGN->iMX; - - if (iRawlen > 11) - pMAGN->iMR = mng_get_uint16 (pRawdata+11); - else - pMAGN->iMR = pMAGN->iMX; - - if (iRawlen > 13) - pMAGN->iMT = mng_get_uint16 (pRawdata+13); - else - pMAGN->iMT = pMAGN->iMY; - - if (iRawlen > 15) - pMAGN->iMB = mng_get_uint16 (pRawdata+15); - else - pMAGN->iMB = pMAGN->iMY; - - if (iRawlen > 17) - pMAGN->iMethodY = *(pRawdata+17); - else - pMAGN->iMethodY = pMAGN->iMethodX; - } - /* check field validity */ - if ((pMAGN->iMethodX > 5) || (pMAGN->iMethodY > 5)) - MNG_ERROR (pData, MNG_INVALIDMETHOD); - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_C_SPECIALFUNC (mng_special_magn) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_magn (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -MNG_F_SPECIALFUNC (mng_evnt_entries) -{ - mng_evntp pEVNT = (mng_evntp)pChunk; - mng_uint32 iRawlen; - mng_uint8p pRawdata; -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) - mng_retcode iRetcode; -#endif - mng_uint8p pNull; - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iNamesize; - mng_uint32 iCount = 0; - mng_evnt_entryp pEntry = MNG_NULL; - mng_uint32 iX; - - for (iX = 0; iX < 2; iX++) - { - iRawlen = *piRawlen; - pRawdata = *ppRawdata; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_evnt_entry))); - pEVNT->iCount = iCount; - pEVNT->pEntries = pEntry; - } - - while (iRawlen) /* anything left ? */ - { - if (iRawlen < 2) /* must have at least 2 bytes ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iEventtype = *pRawdata; /* eventtype */ - if (iEventtype > 5) - MNG_ERROR (pData, MNG_INVALIDEVENT); - - pRawdata++; - - iMasktype = *pRawdata; /* masktype */ - if (iMasktype > 5) - MNG_ERROR (pData, MNG_INVALIDMASK); - - pRawdata++; - iRawlen -= 2; - - iLeft = 0; - iRight = 0; - iTop = 0; - iBottom = 0; - iObjectid = 0; - iIndex = 0; - - switch (iMasktype) - { - case 1 : - { - if (iRawlen > 16) - { - iLeft = mng_get_int32 (pRawdata); - iRight = mng_get_int32 (pRawdata+4); - iTop = mng_get_int32 (pRawdata+8); - iBottom = mng_get_int32 (pRawdata+12); - pRawdata += 16; - iRawlen -= 16; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 2 : - { - if (iRawlen > 2) - { - iObjectid = mng_get_uint16 (pRawdata); - pRawdata += 2; - iRawlen -= 2; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 3 : - { - if (iRawlen > 3) - { - iObjectid = mng_get_uint16 (pRawdata); - iIndex = *(pRawdata+2); - pRawdata += 3; - iRawlen -= 3; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 4 : - { - if (iRawlen > 18) - { - iLeft = mng_get_int32 (pRawdata); - iRight = mng_get_int32 (pRawdata+4); - iTop = mng_get_int32 (pRawdata+8); - iBottom = mng_get_int32 (pRawdata+12); - iObjectid = mng_get_uint16 (pRawdata+16); - pRawdata += 18; - iRawlen -= 18; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 5 : - { - if (iRawlen > 19) - { - iLeft = mng_get_int32 (pRawdata); - iRight = mng_get_int32 (pRawdata+4); - iTop = mng_get_int32 (pRawdata+8); - iBottom = mng_get_int32 (pRawdata+12); - iObjectid = mng_get_uint16 (pRawdata+16); - iIndex = *(pRawdata+18); - pRawdata += 19; - iRawlen -= 19; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - } - - pNull = pRawdata; /* get the name length */ - while (*pNull) - pNull++; - - if ((pNull - pRawdata) > (mng_int32)iRawlen) - { - iNamesize = iRawlen; /* no null found; so end of evNT */ - iRawlen = 0; - } - else - { - iNamesize = pNull - pRawdata; /* should be another entry */ - iRawlen = iRawlen - iNamesize - 1; - - if (!iRawlen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!iX) - { - iCount++; - } - else - { - pEntry->iEventtype = iEventtype; - pEntry->iMasktype = iMasktype; - pEntry->iLeft = iLeft; - pEntry->iRight = iRight; - pEntry->iTop = iTop; - pEntry->iBottom = iBottom; - pEntry->iObjectid = iObjectid; - pEntry->iIndex = iIndex; - pEntry->iSegmentnamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zSegmentname, iNamesize+1); - MNG_COPY (pEntry->zSegmentname, pRawdata, iNamesize); - } - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) - iRetcode = mng_create_event (pData, (mng_ptr)pEntry); - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - - pEntry++; - } - - pRawdata = pRawdata + iNamesize + 1; - } - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -MNG_C_SPECIALFUNC (mng_special_evnt) -{ - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_C_SPECIALFUNC (mng_special_mpng) -{ - if ((pData->eImagetype != mng_it_png) && (pData->eImagetype != mng_it_jng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_mpng_obj (pData, pChunk); -#else - return MNG_NOERROR; -#endif -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_C_SPECIALFUNC (mng_special_ahdr) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ang_obj (pData, pChunk); -#else - return MNG_NOERROR; -#endif -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_F_SPECIALFUNC (mng_adat_tiles) -{ - if ((pData->eImagetype != mng_it_ang) || (!pData->pANG)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - { - mng_adatp pADAT = (mng_adatp)pChunk; - mng_ang_objp pANG = (mng_ang_objp)pData->pANG; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_retcode iRetcode; - mng_uint8p pBuf; - mng_uint32 iBufsize; - mng_uint32 iRealsize; - mng_uint8p pTemp; - mng_uint8p pTemp2; - mng_int32 iX; - mng_int32 iSize; - -#ifdef MNG_SUPPORT_DISPLAY - mng_imagep pImage; - mng_int32 iTemplen; - mng_uint8p pSwap; - - mng_processobject pProcess; - - mng_uint32 iSavedatawidth; - mng_uint32 iSavedataheight; - - mng_fptr fSaveinitrowproc; - mng_fptr fSavestorerow; - mng_fptr fSaveprocessrow; - mng_fptr fSavedifferrow; - mng_imagep fSavestoreobj; - mng_imagedatap fSavestorebuf; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - png_imgtype eSavepngimgtype; -#endif - - mng_uint8 iSaveinterlace; - mng_int8 iSavepass; - mng_int32 iSaverow; - mng_int32 iSaverowinc; - mng_int32 iSavecol; - mng_int32 iSavecolinc; - mng_int32 iSaverowsamples; - mng_int32 iSavesamplemul; - mng_int32 iSavesampleofs; - mng_int32 iSavesamplediv; - mng_int32 iSaverowsize; - mng_int32 iSaverowmax; - mng_int32 iSavefilterofs; - mng_int32 iSavepixelofs; - mng_uint32 iSavelevel0; - mng_uint32 iSavelevel1; - mng_uint32 iSavelevel2; - mng_uint32 iSavelevel3; - mng_uint8p pSaveworkrow; - mng_uint8p pSaveprevrow; - mng_uint8p pSaverGBArow; - mng_bool bSaveisRGBA16; - mng_bool bSaveisOpaque; - mng_int32 iSavefilterbpp; - - mng_int32 iSavedestl; - mng_int32 iSavedestt; - mng_int32 iSavedestr; - mng_int32 iSavedestb; - mng_int32 iSavesourcel; - mng_int32 iSavesourcet; - mng_int32 iSavesourcer; - mng_int32 iSavesourceb; -#endif /* MNG_SUPPORT_DISPLAY */ - - iRetcode = mng_inflate_buffer (pData, pRawdata, iRawlen, - &pBuf, &iBufsize, &iRealsize); - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - /* get buffer for tile info in ADAT chunk */ - pADAT->iTilessize = pANG->iNumframes * sizeof(mng_adat_tile); - MNG_ALLOCX (pData, pADAT->pTiles, pADAT->iTilessize); - if (!pADAT->pTiles) - { - pADAT->iTilessize = 0; - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - pTemp = pBuf; - pTemp2 = (mng_uint8p)pADAT->pTiles; - - if (!pANG->iStillused) - iSize = 12; - else - iSize = 13; - - for (iX = 0; iX < pANG->iNumframes; iX++) - { - MNG_COPY (pTemp2, pTemp, iSize); - pTemp += iSize; - pTemp2 += sizeof(mng_adat_tile); - } - -#ifdef MNG_SUPPORT_DISPLAY - /* get buffer for tile info in ANG object */ - pANG->iTilessize = pADAT->iTilessize; - MNG_ALLOCX (pData, pANG->pTiles, pANG->iTilessize); - if (!pANG->pTiles) - { - pANG->iTilessize = 0; - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* copy it from the ADAT object */ - MNG_COPY (pANG->pTiles, pADAT->pTiles, pANG->iTilessize); - - /* save IDAT work-parms */ - fSaveinitrowproc = pData->fInitrowproc; - fSavestorerow = pData->fDisplayrow; - fSaveprocessrow = pData->fProcessrow; - fSavedifferrow = pData->fDifferrow; - fSavestoreobj = pData->pStoreobj; - fSavestorebuf = pData->pStorebuf; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - eSavepngimgtype = pData->ePng_imgtype; -#endif - - iSavedatawidth = pData->iDatawidth; - iSavedataheight = pData->iDataheight; - iSaveinterlace = pData->iInterlace; - iSavepass = pData->iPass; - iSaverow = pData->iRow; - iSaverowinc = pData->iRowinc; - iSavecol = pData->iCol; - iSavecolinc = pData->iColinc; - iSaverowsamples = pData->iRowsamples; - iSavesamplemul = pData->iSamplemul; - iSavesampleofs = pData->iSampleofs; - iSavesamplediv = pData->iSamplediv; - iSaverowsize = pData->iRowsize; - iSaverowmax = pData->iRowmax; - iSavefilterofs = pData->iFilterofs; - iSavepixelofs = pData->iPixelofs; - iSavelevel0 = pData->iLevel0; - iSavelevel1 = pData->iLevel1; - iSavelevel2 = pData->iLevel2; - iSavelevel3 = pData->iLevel3; - pSaveworkrow = pData->pWorkrow; - pSaveprevrow = pData->pPrevrow; - pSaverGBArow = pData->pRGBArow; - bSaveisRGBA16 = pData->bIsRGBA16; - bSaveisOpaque = pData->bIsOpaque; - iSavefilterbpp = pData->iFilterbpp; - iSavedestl = pData->iDestl; - iSavedestt = pData->iDestt; - iSavedestr = pData->iDestr; - iSavedestb = pData->iDestb; - iSavesourcel = pData->iSourcel; - iSavesourcet = pData->iSourcet; - iSavesourcer = pData->iSourcer; - iSavesourceb = pData->iSourceb; - - pData->iDatawidth = pANG->iTilewidth; - pData->iDataheight = pANG->iTileheight; - - pData->iDestl = 0; - pData->iDestt = 0; - pData->iDestr = pANG->iTilewidth; - pData->iDestb = pANG->iTileheight; - pData->iSourcel = 0; - pData->iSourcet = 0; - pData->iSourcer = pANG->iTilewidth; - pData->iSourceb = pANG->iTileheight; - - pData->fInitrowproc = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - - /* clone image object to store the pixel-data from object 0 */ - iRetcode = mng_clone_imageobject (pData, 1, MNG_FALSE, MNG_FALSE, MNG_FALSE, - MNG_FALSE, 0, 0, 0, pData->pObjzero, &pImage); - if (iRetcode) /* on error, drop temp buffer and bail */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - /* make sure we got the right dimensions and interlacing */ - iRetcode = mng_reset_object_details (pData, pImage, pANG->iTilewidth, pANG->iTileheight, - pImage->pImgbuf->iBitdepth, pImage->pImgbuf->iColortype, - pImage->pImgbuf->iCompression, pImage->pImgbuf->iFilter, - pANG->iInterlace, MNG_FALSE); - if (iRetcode) /* on error, drop temp buffer and bail */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - pData->pStoreobj = pImage; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype = mng_png_imgtype(pData->iColortype,pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - { - switch (pData->iColortype) - { - case 0 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 1; - else - pData->iFilterofs = 2; - - break; - } - case 2 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 3; - else - pData->iFilterofs = 6; - - break; - } - case 3 : { - pData->iFilterofs = 1; - break; - } - case 4 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 2; - else - pData->iFilterofs = 4; - - break; - } - case 6 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 4; - else - pData->iFilterofs = 8; - - break; - } - } - } -#endif - -#ifdef FILTER193 /* no adaptive filtering ? */ - if (pData->iFilter == MNG_FILTER_NOFILTER) - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - - if (pData->fInitrowproc) /* need to initialize row processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - if (iRetcode) - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - /* calculate remainder of buffer */ - pTemp = pBuf + (mng_int32)(pANG->iNumframes * iSize); - iTemplen = iRealsize - (mng_int32)(pANG->iNumframes * iSize); - - do - { - if (iTemplen > pData->iRowmax) /* get a pixel-row from the temp buffer */ - { - MNG_COPY (pData->pWorkrow, pTemp, pData->iRowmax); - } - else - { - MNG_COPY (pData->pWorkrow, pTemp, iTemplen); - } - - { /* image not completed yet ? */ - if (pData->iRow < (mng_int32)pData->iDataheight) - { -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth == 1) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (pData->iRowsize+7)/8; - - for (iX = ((pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>7)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>6)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>5)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>3)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>1)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&1); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 2) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (2*pData->iRowsize+7)/8; - - for (iX = ((2*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (2*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>6)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&3); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 4) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (4*pData->iRowsize+7)/8; - - for (iX = ((4*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (4*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>4)&0x0f); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&0x0f); - if (iX-- <= 0) - break; - pSrc++; - } - } - if (pData->iPNGdepth < 8 && pData->iColortype == 0) - { - /* Expand samples to 8-bit by LBR */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - - for (iX = pData->iRowsize; iX > 0; iX--) - *pSrc++ *= multiplier[pData->iPNGdepth]; - } -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - { - /* Reduce Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc; - - for (iX = pData->iRowsize; iX > 0; iX--) - { - *pDest = *pSrc; - pDest++; - pSrc+=2; - } - } -#endif - -#ifdef FILTER192 /* has leveling info ? */ - if (pData->iFilterofs == MNG_FILTER_DIFFERING) - iRetcode = init_rowdiffering (pData); - else -#endif - iRetcode = MNG_NOERROR; - /* filter the row if necessary */ - if ((!iRetcode) && (pData->iFilterofs < pData->iPixelofs ) && - (*(pData->pWorkrow + pData->iFilterofs)) ) - iRetcode = mng_filter_a_row (pData); - - /* additional leveling/differing ? */ - if ((!iRetcode) && (pData->fDifferrow)) - { - iRetcode = ((mng_differrow)pData->fDifferrow) (pData); - - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* make sure we're processing the right data */ - } - - if (!iRetcode) - { - { /* process this row */ - if ((!iRetcode) && (pData->fProcessrow)) - iRetcode = ((mng_processrow)pData->fProcessrow) (pData); - /* store in object ? */ - if ((!iRetcode) && (pData->fStorerow)) - iRetcode = ((mng_storerow)pData->fStorerow) (pData); - } - } - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, iRetcode); - } - - if (!pData->fDifferrow) /* swap row-pointers */ - { - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* so prev points to the processed row! */ - } - /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, iRetcode); - } - } - } - - pTemp += pData->iRowmax; - iTemplen -= pData->iRowmax; - } /* until some error or EOI - or all pixels received */ - while ( (iTemplen > 0) && - ( (pData->iRow < (mng_int32)pData->iDataheight) || - ( (pData->iPass >= 0) && (pData->iPass < 7) ) ) ); - - mng_cleanup_rowproc (pData); /* cleanup row processing buffers !! */ - - /* restore saved work-parms */ - pData->iDatawidth = iSavedatawidth; - pData->iDataheight = iSavedataheight; - - pData->fInitrowproc = fSaveinitrowproc; - pData->fDisplayrow = fSavestorerow; - pData->fProcessrow = fSaveprocessrow; - pData->fDifferrow = fSavedifferrow; - pData->pStoreobj = fSavestoreobj; - pData->pStorebuf = fSavestorebuf; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->ePng_imgtype = eSavepngimgtype; -#endif - - pData->iInterlace = iSaveinterlace; - pData->iPass = iSavepass; - pData->iRow = iSaverow; - pData->iRowinc = iSaverowinc; - pData->iCol = iSavecol; - pData->iColinc = iSavecolinc; - pData->iRowsamples = iSaverowsamples; - pData->iSamplemul = iSavesamplemul; - pData->iSampleofs = iSavesampleofs; - pData->iSamplediv = iSavesamplediv; - pData->iRowsize = iSaverowsize; - pData->iRowmax = iSaverowmax; - pData->iFilterofs = iSavefilterofs; - pData->iPixelofs = iSavepixelofs; - pData->iLevel0 = iSavelevel0; - pData->iLevel1 = iSavelevel1; - pData->iLevel2 = iSavelevel2; - pData->iLevel3 = iSavelevel3; - pData->pWorkrow = pSaveworkrow; - pData->pPrevrow = pSaveprevrow; - pData->pRGBArow = pSaverGBArow; - pData->bIsRGBA16 = bSaveisRGBA16; - pData->bIsOpaque = bSaveisOpaque; - pData->iFilterbpp = iSavefilterbpp; - pData->iDestl = iSavedestl; - pData->iDestt = iSavedestt; - pData->iDestr = iSavedestr; - pData->iDestb = iSavedestb; - pData->iSourcel = iSavesourcel; - pData->iSourcet = iSavesourcet; - pData->iSourcer = iSavesourcer; - pData->iSourceb = iSavesourceb; - - /* create the animation directives ! */ - pProcess = (mng_processobject)pANG->sHeader.fProcess; - iRetcode = pProcess (pData, (mng_objectp)pData->pANG); - if (iRetcode) - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - - MNG_FREE (pData, pBuf, iBufsize); /* always free the temp buffer ! */ - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_C_SPECIALFUNC (mng_special_adat) -{ - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_unknown) -{ - /* critical chunk ? */ - if ((((mng_uint32)pData->iChunkname & 0x20000000) == 0) -#ifdef MNG_SKIPCHUNK_SAVE - && (pData->iChunkname != MNG_UINT_SAVE) -#endif -#ifdef MNG_SKIPCHUNK_SEEK - && (pData->iChunkname != MNG_UINT_SEEK) -#endif -#ifdef MNG_SKIPCHUNK_DBYK - && (pData->iChunkname != MNG_UINT_DBYK) -#endif -#ifdef MNG_SKIPCHUNK_ORDR - && (pData->iChunkname != MNG_UINT_ORDR) -#endif - ) - MNG_ERROR (pData, MNG_UNKNOWNCRITICAL); - - if (pData->fProcessunknown) /* let the app handle it ? */ - { - mng_bool bOke = pData->fProcessunknown ((mng_handle)pData, pData->iChunkname, - ((mng_unknown_chunkp)pChunk)->iDatasize, - ((mng_unknown_chunkp)pChunk)->pData); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS || MNG_INCLUDE_WRITE_PROCS */ -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - - - diff --git a/Engine/lib/lmng/libmng_chunk_descr.h b/Engine/lib/lmng/libmng_chunk_descr.h deleted file mode 100644 index 3781ab052..000000000 --- a/Engine/lib/lmng/libmng_chunk_descr.h +++ /dev/null @@ -1,146 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_descr.h copyright (c) 2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk descriptor functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : definition of the chunk- anf field-descriptor routines * */ -/* * * */ -/* * changes : 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunk_descr_h_ -#define _libmng_chunk_descr_h_ - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER -#if defined(MNG_INCLUDE_READ_PROCS) || defined(MNG_INCLUDE_WRITE_PROCS) - -/* ************************************************************************** */ - -void mng_get_chunkheader (mng_chunkid iChunkname, - mng_chunk_headerp pResult); - -/* ************************************************************************** */ - -#define MNG_F_SPECIALFUNC(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunk, \ - mng_uint32* piRawlen, \ - mng_uint8p* ppRawdata) - -MNG_F_SPECIALFUNC (mng_debunk_plte) ; -MNG_F_SPECIALFUNC (mng_debunk_trns) ; -MNG_F_SPECIALFUNC (mng_deflate_itxt) ; -MNG_F_SPECIALFUNC (mng_splt_entries) ; -MNG_F_SPECIALFUNC (mng_hist_entries) ; - -MNG_F_SPECIALFUNC (mng_debunk_loop) ; -MNG_F_SPECIALFUNC (mng_debunk_past) ; -MNG_F_SPECIALFUNC (mng_disc_entries) ; -MNG_F_SPECIALFUNC (mng_fram_remainder) ; -MNG_F_SPECIALFUNC (mng_save_entries) ; -MNG_F_SPECIALFUNC (mng_pplt_entries) ; -MNG_F_SPECIALFUNC (mng_drop_entries) ; -MNG_F_SPECIALFUNC (mng_ordr_entries) ; -MNG_F_SPECIALFUNC (mng_debunk_magn) ; -MNG_F_SPECIALFUNC (mng_evnt_entries) ; -MNG_F_SPECIALFUNC (mng_adat_tiles) ; - -/* ************************************************************************** */ - -#define MNG_C_SPECIALFUNC(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunk) - -MNG_C_SPECIALFUNC (mng_special_ihdr) ; -MNG_C_SPECIALFUNC (mng_special_plte) ; -MNG_C_SPECIALFUNC (mng_special_idat) ; -MNG_C_SPECIALFUNC (mng_special_iend) ; -MNG_C_SPECIALFUNC (mng_special_trns) ; -MNG_C_SPECIALFUNC (mng_special_gama) ; -MNG_C_SPECIALFUNC (mng_special_chrm) ; -MNG_C_SPECIALFUNC (mng_special_srgb) ; -MNG_C_SPECIALFUNC (mng_special_iccp) ; -MNG_C_SPECIALFUNC (mng_special_text) ; -MNG_C_SPECIALFUNC (mng_special_ztxt) ; -MNG_C_SPECIALFUNC (mng_special_itxt) ; -MNG_C_SPECIALFUNC (mng_special_bkgd) ; -MNG_C_SPECIALFUNC (mng_special_phys) ; -MNG_C_SPECIALFUNC (mng_special_sbit) ; -MNG_C_SPECIALFUNC (mng_special_splt) ; -MNG_C_SPECIALFUNC (mng_special_hist) ; -MNG_C_SPECIALFUNC (mng_special_time) ; - -MNG_C_SPECIALFUNC (mng_special_jhdr) ; -MNG_C_SPECIALFUNC (mng_special_jdaa) ; -MNG_C_SPECIALFUNC (mng_special_jdat) ; -MNG_C_SPECIALFUNC (mng_special_jsep) ; - -MNG_C_SPECIALFUNC (mng_special_mhdr) ; -MNG_C_SPECIALFUNC (mng_special_mend) ; -MNG_C_SPECIALFUNC (mng_special_loop) ; -MNG_C_SPECIALFUNC (mng_special_endl) ; -MNG_C_SPECIALFUNC (mng_special_defi) ; -MNG_C_SPECIALFUNC (mng_special_basi) ; -MNG_C_SPECIALFUNC (mng_special_clon) ; -MNG_C_SPECIALFUNC (mng_special_past) ; -MNG_C_SPECIALFUNC (mng_special_disc) ; -MNG_C_SPECIALFUNC (mng_special_back) ; -MNG_C_SPECIALFUNC (mng_special_fram) ; -MNG_C_SPECIALFUNC (mng_special_move) ; -MNG_C_SPECIALFUNC (mng_special_clip) ; -MNG_C_SPECIALFUNC (mng_special_show) ; -MNG_C_SPECIALFUNC (mng_special_term) ; -MNG_C_SPECIALFUNC (mng_special_save) ; -MNG_C_SPECIALFUNC (mng_special_seek) ; -MNG_C_SPECIALFUNC (mng_special_expi) ; -MNG_C_SPECIALFUNC (mng_special_fpri) ; -MNG_C_SPECIALFUNC (mng_special_need) ; -MNG_C_SPECIALFUNC (mng_special_phyg) ; - -MNG_C_SPECIALFUNC (mng_special_dhdr) ; -MNG_C_SPECIALFUNC (mng_special_prom) ; -MNG_C_SPECIALFUNC (mng_special_ipng) ; -MNG_C_SPECIALFUNC (mng_special_pplt) ; -MNG_C_SPECIALFUNC (mng_special_ijng) ; -MNG_C_SPECIALFUNC (mng_special_drop) ; -MNG_C_SPECIALFUNC (mng_special_dbyk) ; -MNG_C_SPECIALFUNC (mng_special_ordr) ; - -MNG_C_SPECIALFUNC (mng_special_magn) ; -MNG_C_SPECIALFUNC (mng_special_evnt) ; -MNG_C_SPECIALFUNC (mng_special_mpng) ; -MNG_C_SPECIALFUNC (mng_special_ahdr) ; -MNG_C_SPECIALFUNC (mng_special_adat) ; -MNG_C_SPECIALFUNC (mng_special_unknown) ; - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS) || MNG_INCLUDE_WRITE_PROCS */ -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#endif /* _libmng_chunk_descr_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_chunk_io.c b/Engine/lib/lmng/libmng_chunk_io.c deleted file mode 100644 index eb18099fd..000000000 --- a/Engine/lib/lmng/libmng_chunk_io.c +++ /dev/null @@ -1,10740 +0,0 @@ -/** ************************************************************************* */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_io.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk I/O routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of chunk input/output routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/01/2000 - G.Juyn * */ -/* * - cleaned up left-over teststuff in the BACK chunk routine * */ -/* * 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - changed CRC initialization to use dynamic structure * */ -/* * (wasn't thread-safe the old way !) * */ -/* * 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - filled in many missing sequence&length checks * */ -/* * - filled in many missing chunk-store snippets * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added checks for running animations * */ -/* * - filled some write routines * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/10/2000 - G.Juyn * */ -/* * - filled some more write routines * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - filled remaining write routines * */ -/* * - fixed read_pplt with regard to deltatype * */ -/* * - added callback error-reporting support * */ -/* * - added pre-draft48 support (short MHDR, frame_mode, LOOP) * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * - fixed chunk-storage bit in several routines * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * - supplemented the SAVE & SEEK display processing * */ -/* * * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - B004 - fixed problem with MNG_SUPPORT_WRITE not defined * */ -/* * also for MNG_SUPPORT_WRITE without MNG_INCLUDE_JNG * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - cleaned up some code regarding mixed support * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - implemented JNG support * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for global color-chunks in animation * */ -/* * - added support for global PLTE,tRNS,bKGD in animation * */ -/* * - added support for SAVE & SEEK in animation * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - changed ani_create calls not returning object pointer * */ -/* * - create ani objects always (not just inside TERM/LOOP) * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added support for delta-image processing * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * * */ -/* * 0.5.3 - 06/12/2000 - G.Juyn * */ -/* * - added processing of color-info on delta-image * */ -/* * 0.5.3 - 06/13/2000 - G.Juyn * */ -/* * - fixed handling of empty SAVE chunk * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed to support delta-images * */ -/* * - added extra checks for delta-images * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed possible trouble if IEND display-process got * */ -/* * broken up * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added processing of PLTE & tRNS for delta-images * */ -/* * - added administration of imagelevel parameter * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - implemented support for PPLT chunk * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - added precaution against faulty iCCP chunks from PS * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed some 64-bit warnings * */ -/* * * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed pre-draft48 frame_mode=3 to frame_mode=1 * */ -/* * 0.9.1 - 07/16/2000 - G.Juyn * */ -/* * - fixed storage of images during mng_read() * */ -/* * - fixed support for mng_display() after mng_read() * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed several chunk-writing routines * */ -/* * 0.9.1 - 07/24/2000 - G.Juyn * */ -/* * - fixed reading of still-images * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/08/2000 - G.Juyn * */ -/* * - fixed compiler-warnings from Mozilla * */ -/* * 0.9.3 - 08/09/2000 - G.Juyn * */ -/* * - added check for simplicity-bits in MHDR * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - fixed check for simplicity-bits in MHDR (JNG) * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 08/22/2000 - G.Juyn * */ -/* * - fixed write-code for zTXt & iTXt * */ -/* * - fixed read-code for iTXt * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/02/2000 - G.Juyn * */ -/* * - fixed simplicity-check in compliance with draft 81/0.98a * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - fixed support for MAGN * */ -/* * - implemented nEED "xxxx" (where "xxxx" is a chunkid) * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/23/2000 - G.Juyn * */ -/* * - fixed bug in empty PLTE handling * */ -/* * * */ -/* * 0.9.4 - 11/20/2000 - G.Juyn * */ -/* * - changed IHDR filter_method check for PNGs * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added errorchecking for MAGN methods * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * * */ -/* * 0.9.5 - 1/25/2001 - G.Juyn * */ -/* * - fixed some small compiler warnings (thanks Nikki) * */ -/* * * */ -/* * 1.0.2 - 05/05/2000 - G.Juyn * */ -/* * - B421427 - writes wrong format in bKGD and tRNS * */ -/* * 1.0.2 - 06/20/2000 - G.Juyn * */ -/* * - B434583 - compiler-warning if MNG_STORE_CHUNKS undefined * */ -/* * * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/07/2002 - G.Juyn * */ -/* * - fixed reading of FRAM with just frame_mode and name * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - misplaced TERM is now treated as warning * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 10/03/2002 - G.Juyn * */ -/* * - fixed chunk-storage for evNT chunk * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * 1.0.5 - 10/17/2002 - G.Juyn * */ -/* * - fixed initializtion of pIds in dISC read routine * */ -/* * 1.0.5 - 11/06/2002 - G.Juyn * */ -/* * - added support for nEED "MNG 1.1" * */ -/* * - added support for nEED "CACHEOFF" * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 06/02/2003 - G.R-P * */ -/* * - removed some redundant checks for iRawlen==0 * */ -/* * 1.0.6 - 06/22/2003 - G.R-P * */ -/* * - added MNG_NO_16BIT_SUPPORT, MNG_NO_DELTA_PNG reductions * */ -/* * - optionally use zlib's crc32 function instead of * */ -/* * local mng_update_crc * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 10/29/2003 - G.R-P * */ -/* * - revised JDAA and JDAT readers to avoid compiler bug * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 01/27/2004 - J.S * */ -/* * - fixed inclusion of IJNG chunk for non-JNG use * */ -/* * 1.0.7 - 02/26/2004 - G.Juyn * */ -/* * - fixed bug in chunk-storage of SHOW chunk (from == to) * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 07/07/2004 - G.R-P * */ -/* * - change worst-case iAlphadepth to 1 for standalone PNGs * */ -/* * * */ -/* * 1.0.9 - 09/28/2004 - G.R-P * */ -/* * - improved handling of cheap transparency when 16-bit * */ -/* * support is disabled * */ -/* * 1.0.9 - 10/04/2004 - G.Juyn * */ -/* * - fixed bug in writing sBIT for indexed color * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * 1.0.9 - 12/07/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * 1.0.9 - 01/17/2005 - G.Juyn * */ -/* * - fixed problem with global PLTE/tRNS * */ -/* * * */ -/* * 1.0.10 - 02/07/2005 - G.Juyn * */ -/* * - fixed display routines called twice for FULL_MNG * */ -/* * support in mozlibmngconf.h * */ -/* * 1.0.10 - 12/04/2005 - G.R-P. * */ -/* * - #ifdef out use of mng_inflate_buffer when it is not * */ -/* * available. * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * 1.0.10 - 05/02/2007 - G.Juyn * */ -/* * - fixed inflate_buffer for extreme compression ratios * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_chunks.h" -#ifdef MNG_CHECK_BAD_ICCP -#include "libmng_chunk_prc.h" -#endif -#include "libmng_memory.h" -#include "libmng_display.h" -#include "libmng_zlib.h" -#include "libmng_pixels.h" -#include "libmng_chunk_io.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * CRC - Cyclic Redundancy Check * */ -/* * * */ -/* * The code below is taken directly from the sample provided with the * */ -/* * PNG specification. * */ -/* * (it is only adapted to the library's internal data-definitions) * */ -/* * * */ -/* ************************************************************************** */ -/* Make the table for a fast CRC. */ -#ifndef MNG_USE_ZLIB_CRC -MNG_LOCAL void make_crc_table (mng_datap pData) -{ - mng_uint32 iC; - mng_int32 iN, iK; - - for (iN = 0; iN < 256; iN++) - { - iC = (mng_uint32) iN; - - for (iK = 0; iK < 8; iK++) - { - if (iC & 1) - iC = 0xedb88320U ^ (iC >> 1); - else - iC = iC >> 1; - } - - pData->aCRCtable [iN] = iC; - } - - pData->bCRCcomputed = MNG_TRUE; -} -#endif - -/* Update a running CRC with the bytes buf[0..len-1]--the CRC - should be initialized to all 1's, and the transmitted value - is the 1's complement of the final running CRC (see the - crc() routine below). */ - -MNG_LOCAL mng_uint32 update_crc (mng_datap pData, - mng_uint32 iCrc, - mng_uint8p pBuf, - mng_int32 iLen) -{ -#ifdef MNG_USE_ZLIB_CRC - return crc32 (iCrc, pBuf, iLen); -#else - mng_uint32 iC = iCrc; - mng_int32 iN; - - if (!pData->bCRCcomputed) - make_crc_table (pData); - - for (iN = 0; iN < iLen; iN++) - iC = pData->aCRCtable [(iC ^ pBuf [iN]) & 0xff] ^ (iC >> 8); - - return iC; -#endif -} - -/* Return the CRC of the bytes buf[0..len-1]. */ -mng_uint32 mng_crc (mng_datap pData, - mng_uint8p pBuf, - mng_int32 iLen) -{ -#ifdef MNG_USE_ZLIB_CRC - return update_crc (pData, 0, pBuf, iLen); -#else - return update_crc (pData, 0xffffffffU, pBuf, iLen) ^ 0xffffffffU; -#endif -} - -/* ************************************************************************** */ -/* * * */ -/* * Routines for swapping byte-order from and to graphic files * */ -/* * (This code is adapted from the libpng package) * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_BIGENDIAN_SUPPORTED - -/* ************************************************************************** */ - -mng_uint32 mng_get_uint32 (mng_uint8p pBuf) -{ - mng_uint32 i = ((mng_uint32)(*pBuf) << 24) + - ((mng_uint32)(*(pBuf + 1)) << 16) + - ((mng_uint32)(*(pBuf + 2)) << 8) + - (mng_uint32)(*(pBuf + 3)); - return (i); -} - -/* ************************************************************************** */ - -mng_int32 mng_get_int32 (mng_uint8p pBuf) -{ - mng_int32 i = ((mng_int32)(*pBuf) << 24) + - ((mng_int32)(*(pBuf + 1)) << 16) + - ((mng_int32)(*(pBuf + 2)) << 8) + - (mng_int32)(*(pBuf + 3)); - return (i); -} - -/* ************************************************************************** */ - -mng_uint16 mng_get_uint16 (mng_uint8p pBuf) -{ - mng_uint16 i = (mng_uint16)(((mng_uint16)(*pBuf) << 8) + - (mng_uint16)(*(pBuf + 1))); - return (i); -} - -/* ************************************************************************** */ - -void mng_put_uint32 (mng_uint8p pBuf, - mng_uint32 i) -{ - *pBuf = (mng_uint8)((i >> 24) & 0xff); - *(pBuf+1) = (mng_uint8)((i >> 16) & 0xff); - *(pBuf+2) = (mng_uint8)((i >> 8) & 0xff); - *(pBuf+3) = (mng_uint8)(i & 0xff); -} - -/* ************************************************************************** */ - -void mng_put_int32 (mng_uint8p pBuf, - mng_int32 i) -{ - *pBuf = (mng_uint8)((i >> 24) & 0xff); - *(pBuf+1) = (mng_uint8)((i >> 16) & 0xff); - *(pBuf+2) = (mng_uint8)((i >> 8) & 0xff); - *(pBuf+3) = (mng_uint8)(i & 0xff); -} - -/* ************************************************************************** */ - -void mng_put_uint16 (mng_uint8p pBuf, - mng_uint16 i) -{ - *pBuf = (mng_uint8)((i >> 8) & 0xff); - *(pBuf+1) = (mng_uint8)(i & 0xff); -} - -/* ************************************************************************** */ - -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - -/* ************************************************************************** */ -/* * * */ -/* * Helper routines to simplify chunk-data extraction * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -MNG_LOCAL mng_uint8p find_null (mng_uint8p pIn) -{ - mng_uint8p pOut = pIn; - while (*pOut) /* the read_graphic routine has made sure there's */ - pOut++; /* always at least 1 zero-byte in the buffer */ - return pOut; -} -#endif - -/* ************************************************************************** */ - -#if !defined(MNG_SKIPCHUNK_iCCP) || !defined(MNG_SKIPCHUNK_zTXt) || \ - !defined(MNG_SKIPCHUNK_iTXt) || defined(MNG_INCLUDE_MPNG_PROPOSAL) || \ - defined(MNG_INCLUDE_ANG_PROPOSAL) -mng_retcode mng_inflate_buffer (mng_datap pData, - mng_uint8p pInbuf, - mng_uint32 iInsize, - mng_uint8p *pOutbuf, - mng_uint32 *iOutsize, - mng_uint32 *iRealsize) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INFLATE_BUFFER, MNG_LC_START); -#endif - - if (iInsize) /* anything to do ? */ - { - *iOutsize = iInsize * 3; /* estimate uncompressed size */ - /* and allocate a temporary buffer */ - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - - do - { - mngzlib_inflateinit (pData); /* initialize zlib */ - /* let zlib know where to store the output */ - pData->sZlib.next_out = *pOutbuf; - /* "size - 1" so we've got space for the - zero-termination of a possible string */ - pData->sZlib.avail_out = *iOutsize - 1; - /* ok; let's inflate... */ - iRetcode = mngzlib_inflatedata (pData, iInsize, pInbuf); - /* determine actual output size */ - *iRealsize = (mng_uint32)pData->sZlib.total_out; - - mngzlib_inflatefree (pData); /* zlib's done */ - - if (iRetcode == MNG_BUFOVERFLOW) /* not enough space ? */ - { /* then get some more */ - MNG_FREEX (pData, *pOutbuf, *iOutsize); - *iOutsize = *iOutsize + *iOutsize; - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - } - } /* repeat if we didn't have enough space */ - while ((iRetcode == MNG_BUFOVERFLOW) && - (*iOutsize < 200 * iInsize)); - - if (!iRetcode) /* if oke ? */ - *((*pOutbuf) + *iRealsize) = 0; /* then put terminator zero */ - - } - else - { - *pOutbuf = 0; /* nothing to do; then there's no output */ - *iOutsize = 0; - *iRealsize = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INFLATE_BUFFER, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ -/* * * */ -/* * Helper routines to simplify chunk writing * */ -/* * * */ -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_WRITE_PROCS -/* ************************************************************************** */ - -#if !defined(MNG_SKIPCHUNK_iCCP) || !defined(MNG_SKIPCHUNK_zTXt) || !defined(MNG_SKIPCHUNK_iTXt) -MNG_LOCAL mng_retcode deflate_buffer (mng_datap pData, - mng_uint8p pInbuf, - mng_uint32 iInsize, - mng_uint8p *pOutbuf, - mng_uint32 *iOutsize, - mng_uint32 *iRealsize) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DEFLATE_BUFFER, MNG_LC_START); -#endif - - if (iInsize) /* anything to do ? */ - { - *iOutsize = (iInsize * 5) >> 2; /* estimate compressed size */ - /* and allocate a temporary buffer */ - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - - do - { - mngzlib_deflateinit (pData); /* initialize zlib */ - /* let zlib know where to store the output */ - pData->sZlib.next_out = *pOutbuf; - pData->sZlib.avail_out = *iOutsize; - /* ok; let's deflate... */ - iRetcode = mngzlib_deflatedata (pData, iInsize, pInbuf); - /* determine actual output size */ - *iRealsize = pData->sZlib.total_out; - - mngzlib_deflatefree (pData); /* zlib's done */ - - if (iRetcode == MNG_BUFOVERFLOW) /* not enough space ? */ - { /* then get some more */ - MNG_FREEX (pData, *pOutbuf, *iOutsize); - *iOutsize = *iOutsize + (iInsize >> 1); - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - } - } /* repeat if we didn't have enough space */ - while (iRetcode == MNG_BUFOVERFLOW); - } - else - { - *pOutbuf = 0; /* nothing to do; then there's no output */ - *iOutsize = 0; - *iRealsize = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DEFLATE_BUFFER, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode write_raw_chunk (mng_datap pData, - mng_chunkid iChunkname, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -{ - mng_uint32 iCrc; - mng_uint32 iWritten; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_RAW_CHUNK, MNG_LC_START); -#endif - /* temporary buffer ? */ - if ((pRawdata != 0) && (pRawdata != pData->pWritebuf+8)) - { /* store length & chunktype in default buffer */ - mng_put_uint32 (pData->pWritebuf, iRawlen); - mng_put_uint32 (pData->pWritebuf+4, (mng_uint32)iChunkname); - - if (pData->iCrcmode & MNG_CRC_OUTPUT) - { - if ((pData->iCrcmode & MNG_CRC_OUTPUT) == MNG_CRC_OUTPUT_GENERATE) - { /* calculate the crc */ - iCrc = update_crc (pData, 0xffffffffL, pData->pWritebuf+4, 4); - iCrc = update_crc (pData, iCrc, pRawdata, iRawlen) ^ 0xffffffffL; - } else { - iCrc = 0; /* dummy crc */ - } /* store in default buffer */ - mng_put_uint32 (pData->pWritebuf+8, iCrc); - } - /* write the length & chunktype */ - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, 8, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != 8) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - /* write the temporary buffer */ - if (!pData->fWritedata ((mng_handle)pData, pRawdata, iRawlen, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != iRawlen) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - - if (pData->iCrcmode & MNG_CRC_OUTPUT) - { /* write the crc */ - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf+8, 4, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != 4) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - } - } - else - { /* prefix with length & chunktype */ - mng_put_uint32 (pData->pWritebuf, iRawlen); - mng_put_uint32 (pData->pWritebuf+4, (mng_uint32)iChunkname); - - if (pData->iCrcmode & MNG_CRC_OUTPUT) - { - if ((pData->iCrcmode & MNG_CRC_OUTPUT) == MNG_CRC_OUTPUT_GENERATE) - /* calculate the crc */ - iCrc = mng_crc (pData, pData->pWritebuf+4, iRawlen + 4); - else - iCrc = 0; /* dummy crc */ - /* add it to the buffer */ - mng_put_uint32 (pData->pWritebuf + iRawlen + 8, iCrc); - /* write it in a single pass */ - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, iRawlen + 12, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != iRawlen + 12) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - } else { - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, iRawlen + 8, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != iRawlen + 8) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_RAW_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* B004 */ -#endif /* MNG_INCLUDE_WRITE_PROCS */ -/* B004 */ -/* ************************************************************************** */ -/* * * */ -/* * chunk read functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode create_chunk_storage (mng_datap pData, - mng_chunkp pHeader, - mng_uint32 iRawlen, - mng_uint8p pRawdata, - mng_field_descp pField, - mng_uint16 iFields, - mng_chunkp* ppChunk, - mng_bool bWorkcopy) -{ - mng_field_descp pTempfield = pField; - mng_uint16 iFieldcount = iFields; - mng_uint8p pTempdata = pRawdata; - mng_uint32 iTemplen = iRawlen; - mng_uint16 iLastgroup = 0; - mng_uint8p pChunkdata; - mng_uint32 iDatalen; - mng_uint8 iColortype; - mng_bool bProcess; - /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (((mng_chunk_headerp)(*ppChunk))->iChunkname == MNG_UINT_HUH) - ((mng_chunk_headerp)(*ppChunk))->iChunkname = pData->iChunkname; - - if ((!bWorkcopy) || - ((((mng_chunk_headerp)pHeader)->iChunkname != MNG_UINT_IDAT) && - (((mng_chunk_headerp)pHeader)->iChunkname != MNG_UINT_JDAT) && - (((mng_chunk_headerp)pHeader)->iChunkname != MNG_UINT_JDAA) )) - { - pChunkdata = (mng_uint8p)(*ppChunk); - -#ifdef MNG_INCLUDE_JNG /* determine current colortype */ - if (pData->bHasJHDR) - iColortype = (mng_uint8)(pData->iJHDRcolortype - 8); - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - iColortype = pData->iColortype; - else - iColortype = 6; - - if (iTemplen) /* not empty ? */ - { /* then go fill the fields */ - while ((iFieldcount) && (iTemplen)) - { - if (pTempfield->iOffsetchunk) - { - if (pTempfield->iFlags & MNG_FIELD_PUTIMGTYPE) - { - *(pChunkdata+pTempfield->iOffsetchunk) = iColortype; - bProcess = MNG_FALSE; - } - else - if (pTempfield->iFlags & MNG_FIELD_IFIMGTYPES) - bProcess = (mng_bool)(((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE0) && (iColortype == 0)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE2) && (iColortype == 2)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE3) && (iColortype == 3)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE4) && (iColortype == 4)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE6) && (iColortype == 6)) ); - else - bProcess = MNG_TRUE; - - if (bProcess) - { - iLastgroup = (mng_uint16)(pTempfield->iFlags & MNG_FIELD_GROUPMASK); - /* numeric field ? */ - if (pTempfield->iFlags & MNG_FIELD_INT) - { - if (iTemplen < pTempfield->iLengthmax) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - switch (pTempfield->iLengthmax) - { - case 1 : { mng_uint8 iNum = *pTempdata; - if (((mng_uint16)iNum < pTempfield->iMinvalue) || - ((mng_uint16)iNum > pTempfield->iMaxvalue) ) - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - *(pChunkdata+pTempfield->iOffsetchunk) = iNum; - break; } - case 2 : { mng_uint16 iNum = mng_get_uint16 (pTempdata); - if ((iNum < pTempfield->iMinvalue) || (iNum > pTempfield->iMaxvalue)) - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - *((mng_uint16p)(pChunkdata+pTempfield->iOffsetchunk)) = iNum; - break; } - case 4 : { mng_uint32 iNum = mng_get_uint32 (pTempdata); - if ((iNum < pTempfield->iMinvalue) || - ((pTempfield->iFlags & MNG_FIELD_NOHIGHBIT) && (iNum & 0x80000000)) ) - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunk)) = iNum; - break; } - } - - pTempdata += pTempfield->iLengthmax; - iTemplen -= pTempfield->iLengthmax; - - } else { /* not numeric so it's a bunch of bytes */ - - if (!pTempfield->iOffsetchunklen) /* big fat NONO */ - MNG_ERROR (pData, MNG_INTERNALERROR); - /* with terminating 0 ? */ - if (pTempfield->iFlags & MNG_FIELD_TERMINATOR) - { - mng_uint8p pWork = pTempdata; - while (*pWork) /* find the zero */ - pWork++; - iDatalen = (mng_uint32)(pWork - pTempdata); - } else { /* no terminator, so everything that's left ! */ - iDatalen = iTemplen; - } - - if ((pTempfield->iLengthmax) && (iDatalen > pTempfield->iLengthmax)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); -#if !defined(MNG_SKIPCHUNK_iCCP) || !defined(MNG_SKIPCHUNK_zTXt) || \ - !defined(MNG_SKIPCHUNK_iTXt) || defined(MNG_INCLUDE_MPNG_PROPOSAL) || \ - defined(MNG_INCLUDE_ANG_PROPOSAL) - /* needs decompression ? */ - if (pTempfield->iFlags & MNG_FIELD_DEFLATED) - { - mng_uint8p pBuf = 0; - mng_uint32 iBufsize = 0; - mng_uint32 iRealsize; - mng_ptr pWork; - - iRetcode = mng_inflate_buffer (pData, pTempdata, iDatalen, - &pBuf, &iBufsize, &iRealsize); - -#ifdef MNG_CHECK_BAD_ICCP /* Check for bad iCCP chunk */ - if ((iRetcode) && (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_iCCP)) - { - *((mng_ptr *)(pChunkdata+pTempfield->iOffsetchunk)) = MNG_NULL; - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunklen)) = iDatalen; - } - else -#endif - { - if (iRetcode) - return iRetcode; - -#if defined(MNG_INCLUDE_MPNG_PROPOSAL) || defined(MNG_INCLUDE_ANG_PROPOSAL) - if ( (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_mpNG) || - (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_adAT) ) - { - MNG_ALLOC (pData, pWork, iRealsize); - } - else - { -#endif - /* don't forget to generate null terminator */ - MNG_ALLOC (pData, pWork, iRealsize+1); -#if defined(MNG_INCLUDE_MPNG_PROPOSAL) || defined(MNG_INCLUDE_ANG_PROPOSAL) - } -#endif - MNG_COPY (pWork, pBuf, iRealsize); - - *((mng_ptr *)(pChunkdata+pTempfield->iOffsetchunk)) = pWork; - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunklen)) = iRealsize; - } - - if (pBuf) /* free the temporary buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - - } else -#endif - { /* no decompression, so just copy */ - - mng_ptr pWork; - /* don't forget to generate null terminator */ - MNG_ALLOC (pData, pWork, iDatalen+1); - MNG_COPY (pWork, pTempdata, iDatalen); - - *((mng_ptr *)(pChunkdata+pTempfield->iOffsetchunk)) = pWork; - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunklen)) = iDatalen; - } - - if (pTempfield->iFlags & MNG_FIELD_TERMINATOR) - iDatalen++; /* skip the terminating zero as well !!! */ - - iTemplen -= iDatalen; - pTempdata += iDatalen; - } - /* need to set an indicator ? */ - if (pTempfield->iOffsetchunkind) - *((mng_uint8p)(pChunkdata+pTempfield->iOffsetchunkind)) = MNG_TRUE; - } - } - - if (pTempfield->pSpecialfunc) /* special function required ? */ - { - iRetcode = pTempfield->pSpecialfunc(pData, *ppChunk, &iTemplen, &pTempdata); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - pTempfield++; /* Neeeeeeexxxtt */ - iFieldcount--; - } - - if (iTemplen) /* extra data ??? */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - while (iFieldcount) /* not enough data ??? */ - { - if (pTempfield->iFlags & MNG_FIELD_IFIMGTYPES) - bProcess = (mng_bool)(((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE0) && (iColortype == 0)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE2) && (iColortype == 2)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE3) && (iColortype == 3)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE4) && (iColortype == 4)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE6) && (iColortype == 6)) ); - else - bProcess = MNG_TRUE; - - if (bProcess) - { - if (!(pTempfield->iFlags & MNG_FIELD_OPTIONAL)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - if ((pTempfield->iFlags & MNG_FIELD_GROUPMASK) && - ((mng_uint16)(pTempfield->iFlags & MNG_FIELD_GROUPMASK) == iLastgroup)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - pTempfield++; - iFieldcount--; - } - } - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -READ_CHUNK (mng_read_general) -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_chunk_descp pDescr = ((mng_chunk_headerp)pHeader)->pChunkdescr; - mng_field_descp pField; - mng_uint16 iFields; - - if (!pDescr) /* this is a bad booboo !!! */ - MNG_ERROR (pData, MNG_INTERNALERROR); - - pField = pDescr->pFielddesc; - iFields = pDescr->iFielddesc; - /* check chunk against signature */ - if ((pDescr->eImgtype == mng_it_mng) && (pData->eSigtype != mng_it_mng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if ((pDescr->eImgtype == mng_it_jng) && (pData->eSigtype == mng_it_png)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* empties allowed ? */ - if ((iRawlen == 0) && (!(pDescr->iAllowed & MNG_DESCR_EMPTY))) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->eImagetype != mng_it_mng) || (!(pDescr->iAllowed & MNG_DESCR_GLOBAL))) - { /* *a* header required ? */ - if ((pDescr->iMusthaves & MNG_DESCR_GenHDR) && -#ifdef MNG_INCLUDE_JNG - (!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - (!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pDescr->iMusthaves & MNG_DESCR_JngHDR) && - (!pData->bHasDHDR) && (!pData->bHasJHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); -#endif - } - /* specific chunk pre-requisite ? */ - if (((pDescr->iMusthaves & MNG_DESCR_IHDR) && (!pData->bHasIHDR)) || -#ifdef MNG_INCLUDE_JNG - ((pDescr->iMusthaves & MNG_DESCR_JHDR) && (!pData->bHasJHDR)) || -#endif - ((pDescr->iMusthaves & MNG_DESCR_DHDR) && (!pData->bHasDHDR)) || - ((pDescr->iMusthaves & MNG_DESCR_LOOP) && (!pData->bHasLOOP)) || - ((pDescr->iMusthaves & MNG_DESCR_PLTE) && (!pData->bHasPLTE)) || - ((pDescr->iMusthaves & MNG_DESCR_MHDR) && (!pData->bHasMHDR)) || - ((pDescr->iMusthaves & MNG_DESCR_SAVE) && (!pData->bHasSAVE)) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* specific chunk undesired ? */ - if (((pDescr->iMustNOThaves & MNG_DESCR_NOIHDR) && (pData->bHasIHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOBASI) && (pData->bHasBASI)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NODHDR) && (pData->bHasDHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOIDAT) && (pData->bHasIDAT)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOPLTE) && (pData->bHasPLTE)) || -#ifdef MNG_INCLUDE_JNG - ((pDescr->iMustNOThaves & MNG_DESCR_NOJHDR) && (pData->bHasJHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOJDAT) && (pData->bHasJDAT)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOJDAA) && (pData->bHasJDAA)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOJSEP) && (pData->bHasJSEP)) || -#endif - ((pDescr->iMustNOThaves & MNG_DESCR_NOMHDR) && (pData->bHasMHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOLOOP) && (pData->bHasLOOP)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOTERM) && (pData->bHasTERM)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOSAVE) && (pData->bHasSAVE)) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->eSigtype == mng_it_mng) /* check global and embedded empty chunks */ - { -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - if ((iRawlen == 0) && (!(pDescr->iAllowed & MNG_DESCR_EMPTYEMBED))) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } else { - if ((iRawlen == 0) && (!(pDescr->iAllowed & MNG_DESCR_EMPTYGLOBAL))) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - - if (pDescr->pSpecialfunc) /* need special processing ? */ - { - iRetcode = create_chunk_storage (pData, pHeader, iRawlen, pRawdata, - pField, iFields, ppChunk, MNG_TRUE); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* empty indicator ? */ - if ((!iRawlen) && (pDescr->iOffsetempty)) - *(((mng_uint8p)*ppChunk)+pDescr->iOffsetempty) = MNG_TRUE; - - iRetcode = pDescr->pSpecialfunc(pData, *ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - - if ((((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_IDAT) || - (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAT) || - (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAA) ) - { - iRetcode = ((mng_chunk_headerp)*ppChunk)->fCleanup (pData, *ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - *ppChunk = MNG_NULL; - } else { -#ifdef MNG_STORE_CHUNKS - if (!pData->bStorechunks) -#endif - { - iRetcode = ((mng_chunk_headerp)*ppChunk)->fCleanup (pData, *ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - *ppChunk = MNG_NULL; - } - } - } - -#ifdef MNG_SUPPORT_DISPLAY - if (iRawlen) - { -#ifdef MNG_OPTIMIZE_DISPLAYCALLS - pData->iRawlen = iRawlen; - pData->pRawdata = pRawdata; -#endif - - /* display processing */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_IDAT) - iRetcode = mng_process_display_idat (pData, iRawlen, pRawdata); -#ifdef MNG_INCLUDE_JNG - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAT) - iRetcode = mng_process_display_jdat (pData, iRawlen, pRawdata); - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAA) - iRetcode = mng_process_display_jdaa (pData, iRawlen, pRawdata); -#endif -#else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_IDAT) - iRetcode = mng_process_display_idat (pData); -#ifdef MNG_INCLUDE_JNG - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAT) - iRetcode = mng_process_display_jdat (pData); - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAA) - iRetcode = mng_process_display_jdaa (pData); -#endif -#endif - - if (iRetcode) - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if ((pData->bStorechunks) && (!(*ppChunk))) - { - iRetcode = create_chunk_storage (pData, pHeader, iRawlen, pRawdata, - pField, iFields, ppChunk, MNG_FALSE); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* empty indicator ? */ - if ((!iRawlen) && (pDescr->iOffsetempty)) - *(((mng_uint8p)*ppChunk)+pDescr->iOffsetempty) = MNG_TRUE; - } -#endif /* MNG_STORE_CHUNKS */ - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IHDR, MNG_LC_START); -#endif - - if (iRawlen != 13) /* length oke ? */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* only allowed inside PNG or MNG */ - if ((pData->eSigtype != mng_it_png) && (pData->eSigtype != mng_it_mng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* sequence checks */ - if ((pData->eSigtype == mng_it_png) && (pData->iChunkseq > 1)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasIDAT) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasIDAT)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasIHDR = MNG_TRUE; /* indicate IHDR is present */ - /* and store interesting fields */ - if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_NOCHANGE)) - { - pData->iDatawidth = mng_get_uint32 (pRawdata); - pData->iDataheight = mng_get_uint32 (pRawdata+4); - } - - pData->iBitdepth = *(pRawdata+8); - pData->iColortype = *(pRawdata+9); - pData->iCompression = *(pRawdata+10); - pData->iFilter = *(pRawdata+11); - pData->iInterlace = *(pRawdata+12); - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iCompression != MNG_COMPRESSION_DEFLATE) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iInterlace != MNG_INTERLACE_NONE ) && - (pData->iInterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* check the colortype for delta-images ! */ - { - mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - - if (pData->iColortype != pBuf->iColortype) - { - if ( ( (pData->iColortype != MNG_COLORTYPE_INDEXED) || - (pBuf->iColortype == MNG_COLORTYPE_GRAY ) ) && - ( (pData->iColortype != MNG_COLORTYPE_GRAY ) || - (pBuf->iColortype == MNG_COLORTYPE_INDEXED) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - } - } -#endif -#endif - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_png; /* then this must be a PNG */ - pData->iWidth = pData->iDatawidth; - pData->iHeight = pData->iDataheight; - /* predict alpha-depth ! */ - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) - pData->iAlphadepth = pData->iBitdepth; - else - if (pData->iColortype == MNG_COLORTYPE_INDEXED) - pData->iAlphadepth = 8; /* worst case scenario */ - else - pData->iAlphadepth = 1; /* Possible tRNS cheap binary transparency */ - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - -#if !defined(MNG_INCLUDE_MPNG_PROPOSAL) || !defined(MNG_SUPPORT_DISPLAY) - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); -#endif - } - - if (!pData->bHasDHDR) - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_process_display_ihdr (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the fields */ - ((mng_ihdrp)*ppChunk)->iWidth = mng_get_uint32 (pRawdata); - ((mng_ihdrp)*ppChunk)->iHeight = mng_get_uint32 (pRawdata+4); - ((mng_ihdrp)*ppChunk)->iBitdepth = pData->iBitdepth; - ((mng_ihdrp)*ppChunk)->iColortype = pData->iColortype; - ((mng_ihdrp)*ppChunk)->iCompression = pData->iCompression; - ((mng_ihdrp)*ppChunk)->iFilter = pData->iFilter; - ((mng_ihdrp)*ppChunk)->iInterlace = pData->iInterlace; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_plte) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - mng_uint32 iX; - mng_uint8p pRawdata2; -#endif -#ifdef MNG_SUPPORT_DISPLAY - mng_uint32 iRawlen2; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PLTE, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJHDR)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* multiple PLTE only inside BASI */ - if ((pData->bHasPLTE) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - /* length must be multiple of 3 */ - if (((iRawlen % 3) != 0) || (iRawlen > 768)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* only allowed for indexed-color or - rgb(a)-color! */ - if ((pData->iColortype != 2) && (pData->iColortype != 3) && (pData->iColortype != 6)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* empty only allowed if global present */ - if ((iRawlen == 0) && (!pData->bHasglobalPLTE)) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - else - { - if (iRawlen == 0) /* cannot be empty as global! */ - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasPLTE = MNG_TRUE; /* got it! */ - else - pData->bHasglobalPLTE = MNG_TRUE; - - pData->iPLTEcount = iRawlen / 3; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; - pBuf->bHasPLTE = MNG_TRUE; /* it's definitely got a PLTE now */ - pBuf->iPLTEcount = iRawlen / 3; /* this is the exact length */ - pRawdata2 = pRawdata; /* copy the entries */ - - for (iX = 0; iX < iRawlen / 3; iX++) - { - pBuf->aPLTEentries[iX].iRed = *pRawdata2; - pBuf->aPLTEentries[iX].iGreen = *(pRawdata2+1); - pBuf->aPLTEentries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - } - else -#endif - { /* get the current object */ - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address the object buffer */ - pBuf->bHasPLTE = MNG_TRUE; /* and tell it it's got a PLTE now */ - - if (!iRawlen) /* if empty, inherit from global */ - { - pBuf->iPLTEcount = pData->iGlobalPLTEcount; - MNG_COPY (pBuf->aPLTEentries, pData->aGlobalPLTEentries, - sizeof (pBuf->aPLTEentries)); - - if (pData->bHasglobalTRNS) /* also copy global tRNS ? */ - { /* indicate tRNS available */ - pBuf->bHasTRNS = MNG_TRUE; - - iRawlen2 = pData->iGlobalTRNSrawlen; - pRawdata2 = (mng_uint8p)(pData->aGlobalTRNSrawdata); - /* global length oke ? */ - if ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - /* copy it */ - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - } - } - else - { /* store fields for future reference */ - pBuf->iPLTEcount = iRawlen / 3; - pRawdata2 = pRawdata; - - for (iX = 0; iX < pBuf->iPLTEcount; iX++) - { - pBuf->aPLTEentries[iX].iRed = *pRawdata2; - pBuf->aPLTEentries[iX].iGreen = *(pRawdata2+1); - pBuf->aPLTEentries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - } - } - } - else /* store as global */ - { - pData->iGlobalPLTEcount = iRawlen / 3; - pRawdata2 = pRawdata; - - for (iX = 0; iX < pData->iGlobalPLTEcount; iX++) - { - pData->aGlobalPLTEentries[iX].iRed = *pRawdata2; - pData->aGlobalPLTEentries[iX].iGreen = *(pRawdata2+1); - pData->aGlobalPLTEentries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_plte (pData, pData->iGlobalPLTEcount, - pData->aGlobalPLTEentries); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_pltep)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_pltep)*ppChunk)->iEntrycount = iRawlen / 3; - pRawdata2 = pRawdata; - - for (iX = 0; iX < ((mng_pltep)*ppChunk)->iEntrycount; iX++) - { - ((mng_pltep)*ppChunk)->aEntries[iX].iRed = *pRawdata2; - ((mng_pltep)*ppChunk)->aEntries[iX].iGreen = *(pRawdata2+1); - ((mng_pltep)*ppChunk)->aEntries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IDAT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_JNG /* sequence checks */ - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasJHDR) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasJSEP) - MNG_ERROR (pData, MNG_SEQUENCEERROR); -#endif - /* not allowed for deltatype NO_CHANGE */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && ((pData->iDeltatype == MNG_DELTATYPE_NOCHANGE))) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); -#endif - /* can only be empty in BASI-block! */ - if ((iRawlen == 0) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* indexed-color requires PLTE */ - if ((pData->bHasIHDR) && (pData->iColortype == 3) && (!pData->bHasPLTE)) - MNG_ERROR (pData, MNG_PLTEMISSING); - - pData->bHasIDAT = MNG_TRUE; /* got some IDAT now, don't we */ - -#ifdef MNG_SUPPORT_DISPLAY - if (iRawlen) - { /* display processing */ - mng_retcode iRetcode = mng_process_display_idat (pData, iRawlen, pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_idatp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_idatp)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen != 0) /* is there any data ? */ - { - MNG_ALLOC (pData, ((mng_idatp)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_idatp)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IEND, MNG_LC_START); -#endif - - if (iRawlen > 0) /* must not contain data! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_INCLUDE_JNG /* sequence checks */ - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* IHDR-block requires IDAT */ - if ((pData->bHasIHDR) && (!pData->bHasIDAT)) - MNG_ERROR (pData, MNG_IDATMISSING); - - pData->iImagelevel--; /* one level up */ - -#ifdef MNG_SUPPORT_DISPLAY - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_image (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* display processing */ - iRetcode = mng_process_display_iend (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_SUPPORT_DISPLAY - if (!pData->bTimerset) /* reset only if not broken !!! */ - { -#endif - /* IEND signals the end for most ... */ - pData->bHasIHDR = MNG_FALSE; - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; -#ifdef MNG_SUPPORT_DISPLAY - } -#endif - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_trns) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TRNS, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJHDR)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* multiple tRNS only inside BASI */ - if ((pData->bHasTRNS) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - - if (iRawlen > 256) /* it just can't be bigger than that! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not allowed with full alpha-channel */ - if ((pData->iColortype == 4) || (pData->iColortype == 6)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if (iRawlen != 0) /* filled ? */ - { /* length checks */ - if ((pData->iColortype == 0) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 2) && (iRawlen != 6)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - if (pData->iColortype == 3) - { - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; - - if (!pImage) /* no object then check obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - - if (iRawlen > pBuf->iPLTEcount) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } -#endif - } - else /* if empty there must be global stuff! */ - { - if (!pData->bHasglobalTRNS) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasTRNS = MNG_TRUE; /* indicate tRNS available */ - else - pData->bHasglobalTRNS = MNG_TRUE; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - mng_uint8p pRawdata2; - mng_uint32 iRawlen2; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; /* address object buffer */ - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1, - 0,0,0,0,0,0,0,1}; -#endif - pBuf->iTRNSgray = mng_get_uint16 (pRawdata); - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - pBuf->iTRNSgray *= multiplier[pData->iPNGdepth]; -#endif -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = mng_get_uint16 (pRawdata); - pBuf->iTRNSgreen = mng_get_uint16 (pRawdata+2); - pBuf->iTRNSblue = mng_get_uint16 (pRawdata+4); - pBuf->iTRNScount = 0; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = iRawlen; - MNG_COPY (pBuf->aTRNSentries, pRawdata, iRawlen); - break; - } - } - - pBuf->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */ - } - else -#endif - { /* address current object */ - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasTRNS = MNG_TRUE; /* and tell it it's got a tRNS now */ - - if (iRawlen == 0) /* if empty, inherit from global */ - { - iRawlen2 = pData->iGlobalTRNSrawlen; - pRawdata2 = (mng_ptr)(pData->aGlobalTRNSrawdata); - /* global length oke ? */ - if ((pData->iColortype == 0) && (iRawlen2 != 2)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 2) && (iRawlen2 != 6)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 3) && ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount))) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - } - else - { - iRawlen2 = iRawlen; - pRawdata2 = pRawdata; - } - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = mng_get_uint16 (pRawdata2); - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = mng_get_uint16 (pRawdata2); - pBuf->iTRNSgreen = mng_get_uint16 (pRawdata2+2); - pBuf->iTRNSblue = mng_get_uint16 (pRawdata2+4); - pBuf->iTRNScount = 0; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - break; - } - } - } - } - else /* store as global */ - { - pData->iGlobalTRNSrawlen = iRawlen; - MNG_COPY (pData->aGlobalTRNSrawdata, pRawdata, iRawlen); - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_trns (pData, pData->iGlobalTRNSrawlen, - pData->aGlobalTRNSrawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not global! */ - ((mng_trnsp)*ppChunk)->bGlobal = MNG_FALSE; - ((mng_trnsp)*ppChunk)->iType = pData->iColortype; - - if (iRawlen == 0) /* if empty, indicate so */ - ((mng_trnsp)*ppChunk)->bEmpty = MNG_TRUE; - else - { - ((mng_trnsp)*ppChunk)->bEmpty = MNG_FALSE; - - switch (pData->iColortype) /* store fields */ - { - case 0: { /* gray */ - ((mng_trnsp)*ppChunk)->iGray = mng_get_uint16 (pRawdata); - break; - } - case 2: { /* rgb */ - ((mng_trnsp)*ppChunk)->iRed = mng_get_uint16 (pRawdata); - ((mng_trnsp)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+2); - ((mng_trnsp)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+4); - break; - } - case 3: { /* indexed */ - ((mng_trnsp)*ppChunk)->iCount = iRawlen; - MNG_COPY (((mng_trnsp)*ppChunk)->aEntries, pRawdata, iRawlen); - break; - } - } - } - } - else /* it's global! */ - { - ((mng_trnsp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_trnsp)*ppChunk)->bGlobal = MNG_TRUE; - ((mng_trnsp)*ppChunk)->iType = 0; - ((mng_trnsp)*ppChunk)->iRawlen = iRawlen; - - MNG_COPY (((mng_trnsp)*ppChunk)->aRawdata, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GAMA, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be exactly 4 */ - if (iRawlen != 4) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or exactly 4 */ - if ((iRawlen != 0) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasGAMA = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalGAMA = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata); - pImage->pImgbuf->bHasGAMA = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata); - pImage->pImgbuf->bHasGAMA = MNG_TRUE; - } - } - else - { /* store as global */ - if (iRawlen != 0) - pData->iGlobalGamma = mng_get_uint32 (pRawdata); - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_gama (pData, (mng_bool)(iRawlen == 0), - pData->iGlobalGamma); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_gamap)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - ((mng_gamap)*ppChunk)->iGamma = mng_get_uint32 (pRawdata); - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_cHRM -READ_CHUNK (mng_read_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHRM, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be exactly 32 */ - if (iRawlen != 32) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or exactly 32 */ - if ((iRawlen != 0) && (iRawlen != 32)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasCHRM = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalCHRM = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint32 iWhitepointx, iWhitepointy; - mng_uint32 iPrimaryredx, iPrimaryredy; - mng_uint32 iPrimarygreenx, iPrimarygreeny; - mng_uint32 iPrimarybluex, iPrimarybluey; - - iWhitepointx = mng_get_uint32 (pRawdata); - iWhitepointy = mng_get_uint32 (pRawdata+4); - iPrimaryredx = mng_get_uint32 (pRawdata+8); - iPrimaryredy = mng_get_uint32 (pRawdata+12); - iPrimarygreenx = mng_get_uint32 (pRawdata+16); - iPrimarygreeny = mng_get_uint32 (pRawdata+20); - iPrimarybluex = mng_get_uint32 (pRawdata+24); - iPrimarybluey = mng_get_uint32 (pRawdata+28); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store it in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */ - /* store for color-processing routines */ - pBuf->iWhitepointx = iWhitepointx; - pBuf->iWhitepointy = iWhitepointy; - pBuf->iPrimaryredx = iPrimaryredx; - pBuf->iPrimaryredy = iPrimaryredy; - pBuf->iPrimarygreenx = iPrimarygreenx; - pBuf->iPrimarygreeny = iPrimarygreeny; - pBuf->iPrimarybluex = iPrimarybluex; - pBuf->iPrimarybluey = iPrimarybluey; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */ - /* store for color-processing routines */ - pBuf->iWhitepointx = iWhitepointx; - pBuf->iWhitepointy = iWhitepointy; - pBuf->iPrimaryredx = iPrimaryredx; - pBuf->iPrimaryredy = iPrimaryredy; - pBuf->iPrimarygreenx = iPrimarygreenx; - pBuf->iPrimarygreeny = iPrimarygreeny; - pBuf->iPrimarybluex = iPrimarybluex; - pBuf->iPrimarybluey = iPrimarybluey; - } - } - else - { /* store as global */ - if (iRawlen != 0) - { - pData->iGlobalWhitepointx = iWhitepointx; - pData->iGlobalWhitepointy = iWhitepointy; - pData->iGlobalPrimaryredx = iPrimaryredx; - pData->iGlobalPrimaryredy = iPrimaryredy; - pData->iGlobalPrimarygreenx = iPrimarygreenx; - pData->iGlobalPrimarygreeny = iPrimarygreeny; - pData->iGlobalPrimarybluex = iPrimarybluex; - pData->iGlobalPrimarybluey = iPrimarybluey; - } - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_chrm (pData, (mng_bool)(iRawlen == 0), - iWhitepointx, iWhitepointy, - iPrimaryredx, iPrimaryredy, - iPrimarygreenx, iPrimarygreeny, - iPrimarybluex, iPrimarybluey); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_chrmp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_chrmp)*ppChunk)->iWhitepointx = mng_get_uint32 (pRawdata); - ((mng_chrmp)*ppChunk)->iWhitepointy = mng_get_uint32 (pRawdata+4); - ((mng_chrmp)*ppChunk)->iRedx = mng_get_uint32 (pRawdata+8); - ((mng_chrmp)*ppChunk)->iRedy = mng_get_uint32 (pRawdata+12); - ((mng_chrmp)*ppChunk)->iGreenx = mng_get_uint32 (pRawdata+16); - ((mng_chrmp)*ppChunk)->iGreeny = mng_get_uint32 (pRawdata+20); - ((mng_chrmp)*ppChunk)->iBluex = mng_get_uint32 (pRawdata+24); - ((mng_chrmp)*ppChunk)->iBluey = mng_get_uint32 (pRawdata+28); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SRGB, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be exactly 1 */ - if (iRawlen != 1) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or exactly 1 */ - if ((iRawlen != 0) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasSRGB = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalSRGB = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iRenderingintent = *pRawdata; - pImage->pImgbuf->bHasSRGB = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iRenderingintent = *pRawdata; - pImage->pImgbuf->bHasSRGB = MNG_TRUE; - } - } - else - { /* store as global */ - if (iRawlen != 0) - pData->iGlobalRendintent = *pRawdata; - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_srgb (pData, (mng_bool)(iRawlen == 0), - pData->iGlobalRendintent); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_srgbp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - ((mng_srgbp)*ppChunk)->iRenderingintent = *pRawdata; - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_iCCP -READ_CHUNK (mng_read_iccp) -{ - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iCompressedsize; - mng_uint32 iProfilesize; - mng_uint32 iBufsize = 0; - mng_uint8p pBuf = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ICCP, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be at least 2 */ - if (iRawlen < 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or at least 2 */ - if ((iRawlen != 0) && (iRawlen < 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - pTemp = find_null (pRawdata); /* find null-separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - /* determine size of compressed profile */ - iCompressedsize = (mng_uint32)(iRawlen - (pTemp - pRawdata) - 2); - /* decompress the profile */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iProfilesize); - -#ifdef MNG_CHECK_BAD_ICCP /* Check for bad iCCP chunk */ - if ((iRetcode) && (!strncmp ((char *)pRawdata, "Photoshop ICC profile", 21))) - { - if (iRawlen == 2615) /* is it the sRGB profile ? */ - { - mng_chunk_header chunk_srgb = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)}; -#else - {MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0}; -#endif - /* pretend it's an sRGB chunk then ! */ - iRetcode = mng_read_srgb (pData, &chunk_srgb, 1, (mng_ptr)"0", ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - } - else - { -#endif /* MNG_CHECK_BAD_ICCP */ - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasICCP = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalICCP = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, pBuf, iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, pBuf, iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - } - else - { /* store as global */ - if (iRawlen == 0) /* empty chunk ? */ - { - if (pData->pGlobalProfile) /* did we have a global profile ? */ - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; /* reset to null */ - pData->pGlobalProfile = MNG_NULL; - } - else - { /* allocate a global buffer & copy it */ - MNG_ALLOC (pData, pData->pGlobalProfile, iProfilesize); - MNG_COPY (pData->pGlobalProfile, pBuf, iProfilesize); - /* store its length as well */ - pData->iGlobalProfilesize = iProfilesize; - } - - /* create an animation object */ - iRetcode = mng_create_ani_iccp (pData, (mng_bool)(iRawlen == 0), - pData->iGlobalProfilesize, - pData->pGlobalProfile); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - /* store the fields */ - ((mng_iccpp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) /* not empty ? */ - { - if (!pBuf) /* hasn't been unpuzzled it yet ? */ - { /* find null-separator */ - pTemp = find_null (pRawdata); - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - /* determine size of compressed profile */ - iCompressedsize = iRawlen - (pTemp - pRawdata) - 2; - /* decompress the profile */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iProfilesize); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - - ((mng_iccpp)*ppChunk)->iNamesize = (mng_uint32)(pTemp - pRawdata); - - if (((mng_iccpp)*ppChunk)->iNamesize) - { - MNG_ALLOC (pData, ((mng_iccpp)*ppChunk)->zName, - ((mng_iccpp)*ppChunk)->iNamesize + 1); - MNG_COPY (((mng_iccpp)*ppChunk)->zName, pRawdata, - ((mng_iccpp)*ppChunk)->iNamesize); - } - - ((mng_iccpp)*ppChunk)->iCompression = *(pTemp+1); - ((mng_iccpp)*ppChunk)->iProfilesize = iProfilesize; - - MNG_ALLOC (pData, ((mng_iccpp)*ppChunk)->pProfile, iProfilesize); - MNG_COPY (((mng_iccpp)*ppChunk)->pProfile, pBuf, iProfilesize); - } - } -#endif /* MNG_STORE_CHUNKS */ - - if (pBuf) /* free the temporary buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - -#ifdef MNG_CHECK_BAD_ICCP - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_tEXt -READ_CHUNK (mng_read_text) -{ - mng_uint32 iKeywordlen, iTextlen; - mng_pchar zKeyword, zText; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TEXT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 2) /* length must be at least 2 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pTemp = find_null (pRawdata); /* find the null separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - if (pTemp == pRawdata) /* there must be at least 1 char for keyword */ - MNG_ERROR (pData, MNG_KEYWORDNULL); - - iKeywordlen = (mng_uint32)(pTemp - pRawdata); - iTextlen = iRawlen - iKeywordlen - 1; - - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke; - - MNG_ALLOC (pData, zKeyword, iKeywordlen + 1); - MNG_COPY (zKeyword, pRawdata, iKeywordlen); - - MNG_ALLOCX (pData, zText, iTextlen + 1); - - if (!zText) /* on error bail out */ - { - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - if (iTextlen) - MNG_COPY (zText, pTemp+1, iTextlen); - - bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_TEXT, zKeyword, zText, 0, 0); - - MNG_FREEX (pData, zText, iTextlen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_textp)*ppChunk)->iKeywordsize = iKeywordlen; - ((mng_textp)*ppChunk)->iTextsize = iTextlen; - - if (iKeywordlen) - { - MNG_ALLOC (pData, ((mng_textp)*ppChunk)->zKeyword, iKeywordlen+1); - MNG_COPY (((mng_textp)*ppChunk)->zKeyword, pRawdata, iKeywordlen); - } - - if (iTextlen) - { - MNG_ALLOC (pData, ((mng_textp)*ppChunk)->zText, iTextlen+1); - MNG_COPY (((mng_textp)*ppChunk)->zText, pTemp+1, iTextlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_zTXt -READ_CHUNK (mng_read_ztxt) -{ - mng_retcode iRetcode; - mng_uint32 iKeywordlen, iTextlen; - mng_pchar zKeyword; - mng_uint8p pTemp; - mng_uint32 iCompressedsize; - mng_uint32 iBufsize; - mng_uint8p pBuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ZTXT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 3) /* length must be at least 3 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pTemp = find_null (pRawdata); /* find the null separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - if (pTemp == pRawdata) /* there must be at least 1 char for keyword */ - MNG_ERROR (pData, MNG_KEYWORDNULL); - - if (*(pTemp+1) != 0) /* only deflate compression-method allowed */ - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - iKeywordlen = (mng_uint32)(pTemp - pRawdata); - iCompressedsize = (mng_uint32)(iRawlen - iKeywordlen - 2); - - zKeyword = 0; /* there's no keyword buffer yet */ - pBuf = 0; /* or a temporary buffer ! */ - - if (pData->fProcesstext) /* inform the application ? */ - { /* decompress the text */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - MNG_ALLOCX (pData, zKeyword, iKeywordlen+1); - - if (!zKeyword) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (zKeyword, pRawdata, iKeywordlen); - - if (!pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ZTXT, zKeyword, (mng_pchar)pBuf, 0, 0)) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - MNG_ERROR (pData, MNG_APPMISCERROR); - } - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - return iRetcode; - } - /* store the fields */ - ((mng_ztxtp)*ppChunk)->iKeywordsize = iKeywordlen; - ((mng_ztxtp)*ppChunk)->iCompression = *(pTemp+1); - - if ((!pBuf) && (iCompressedsize)) /* did we not get a text-buffer yet ? */ - { /* decompress the text */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - return iRetcode; - } - } - - MNG_ALLOCX (pData, ((mng_ztxtp)*ppChunk)->zKeyword, iKeywordlen + 1); - /* on error bail out */ - if (!((mng_ztxtp)*ppChunk)->zKeyword) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_ztxtp)*ppChunk)->zKeyword, pRawdata, iKeywordlen); - - ((mng_ztxtp)*ppChunk)->iTextsize = iTextlen; - - if (iCompressedsize) - { - MNG_ALLOCX (pData, ((mng_ztxtp)*ppChunk)->zText, iTextlen + 1); - /* on error bail out */ - if (!((mng_ztxtp)*ppChunk)->zText) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_ztxtp)*ppChunk)->zText, pBuf, iTextlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - - MNG_FREEX (pData, pBuf, iBufsize); /* free the temporary buffers */ - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_iTXt -READ_CHUNK (mng_read_itxt) -{ - mng_retcode iRetcode; - mng_uint32 iKeywordlen, iTextlen, iLanguagelen, iTranslationlen; - mng_pchar zKeyword, zLanguage, zTranslation; - mng_uint8p pNull1, pNull2, pNull3; - mng_uint32 iCompressedsize; - mng_uint8 iCompressionflag; - mng_uint32 iBufsize; - mng_uint8p pBuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ITXT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 6) /* length must be at least 6 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pNull1 = find_null (pRawdata); /* find the null separators */ - pNull2 = find_null (pNull1+3); - pNull3 = find_null (pNull2+1); - /* not found inside input-data ? */ - if (((pNull1 - pRawdata) > (mng_int32)iRawlen) || - ((pNull2 - pRawdata) > (mng_int32)iRawlen) || - ((pNull3 - pRawdata) > (mng_int32)iRawlen) ) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - if (pNull1 == pRawdata) /* there must be at least 1 char for keyword */ - MNG_ERROR (pData, MNG_KEYWORDNULL); - /* compression or not ? */ - if ((*(pNull1+1) != 0) && (*(pNull1+1) != 1)) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if (*(pNull1+2) != 0) /* only deflate compression-method allowed */ - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - iKeywordlen = (mng_uint32)(pNull1 - pRawdata); - iLanguagelen = (mng_uint32)(pNull2 - pNull1 - 3); - iTranslationlen = (mng_uint32)(pNull3 - pNull2 - 1); - iCompressedsize = (mng_uint32)(iRawlen - iKeywordlen - iLanguagelen - iTranslationlen - 5); - iCompressionflag = *(pNull1+1); - - zKeyword = 0; /* no buffers acquired yet */ - zLanguage = 0; - zTranslation = 0; - pBuf = 0; - iTextlen = 0; - - if (pData->fProcesstext) /* inform the application ? */ - { - if (iCompressionflag) /* decompress the text ? */ - { - iRetcode = mng_inflate_buffer (pData, pNull3+1, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - else - { - iTextlen = iCompressedsize; - iBufsize = iTextlen+1; /* plus 1 for terminator byte!!! */ - - MNG_ALLOC (pData, pBuf, iBufsize); - MNG_COPY (pBuf, pNull3+1, iTextlen); - } - - MNG_ALLOCX (pData, zKeyword, iKeywordlen + 1); - MNG_ALLOCX (pData, zLanguage, iLanguagelen + 1); - MNG_ALLOCX (pData, zTranslation, iTranslationlen + 1); - /* on error bail out */ - if ((!zKeyword) || (!zLanguage) || (!zTranslation)) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (zKeyword, pRawdata, iKeywordlen); - MNG_COPY (zLanguage, pNull1+3, iLanguagelen); - MNG_COPY (zTranslation, pNull2+1, iTranslationlen); - - if (!pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ITXT, zKeyword, (mng_pchar)pBuf, - zLanguage, zTranslation)) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - - MNG_ERROR (pData, MNG_APPMISCERROR); - } - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - /* store the fields */ - ((mng_itxtp)*ppChunk)->iKeywordsize = iKeywordlen; - ((mng_itxtp)*ppChunk)->iLanguagesize = iLanguagelen; - ((mng_itxtp)*ppChunk)->iTranslationsize = iTranslationlen; - ((mng_itxtp)*ppChunk)->iCompressionflag = *(pNull1+1); - ((mng_itxtp)*ppChunk)->iCompressionmethod = *(pNull1+2); - - if ((!pBuf) && (iCompressedsize)) /* did we not get a text-buffer yet ? */ - { - if (iCompressionflag) /* decompress the text ? */ - { - iRetcode = mng_inflate_buffer (pData, pNull3+1, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - else - { - iTextlen = iCompressedsize; - iBufsize = iTextlen+1; /* plus 1 for terminator byte!!! */ - - MNG_ALLOC (pData, pBuf, iBufsize); - MNG_COPY (pBuf, pNull3+1, iTextlen); - } - } - - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zKeyword, iKeywordlen + 1); - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zLanguage, iLanguagelen + 1); - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zTranslation, iTranslationlen + 1); - /* on error bail out */ - if ((!((mng_itxtp)*ppChunk)->zKeyword ) || - (!((mng_itxtp)*ppChunk)->zLanguage ) || - (!((mng_itxtp)*ppChunk)->zTranslation) ) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_itxtp)*ppChunk)->zKeyword, pRawdata, iKeywordlen); - MNG_COPY (((mng_itxtp)*ppChunk)->zLanguage, pNull1+3, iLanguagelen); - MNG_COPY (((mng_itxtp)*ppChunk)->zTranslation, pNull2+1, iTranslationlen); - - ((mng_itxtp)*ppChunk)->iTextsize = iTextlen; - - if (iTextlen) - { - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zText, iTextlen + 1); - - if (!((mng_itxtp)*ppChunk)->zText) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_itxtp)*ppChunk)->zText, pBuf, iTextlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - /* free the temporary buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_bKGD -READ_CHUNK (mng_read_bkgd) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BKGD, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen > 6) /* it just can't be bigger than that! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_INCLUDE_JNG /* length checks */ - if (pData->bHasJHDR) - { - if (((pData->iJHDRcolortype == 8) || (pData->iJHDRcolortype == 12)) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (((pData->iJHDRcolortype == 10) || (pData->iJHDRcolortype == 14)) && (iRawlen != 6)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - if (((pData->iColortype == 0) || (pData->iColortype == 4)) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (((pData->iColortype == 2) || (pData->iColortype == 6)) && (iRawlen != 6)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 3) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { - if (iRawlen != 6) /* global is always 16-bit RGB ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasBKGD = MNG_TRUE; /* indicate bKGD available */ - else - pData->bHasglobalBKGD = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY - if (!pImage) /* if no object dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iJHDRcolortype) /* store fields for future reference */ - { - case 8 : ; /* gray */ - case 12 : { /* graya */ - pBuf->iBKGDgray = mng_get_uint16 (pRawdata); - break; - } - case 10 : ; /* rgb */ - case 14 : { /* rgba */ - pBuf->iBKGDred = mng_get_uint16 (pRawdata); - pBuf->iBKGDgreen = mng_get_uint16 (pRawdata+2); - pBuf->iBKGDblue = mng_get_uint16 (pRawdata+4); - break; - } - } - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0 : ; /* gray */ - case 4 : { /* graya */ - pBuf->iBKGDgray = mng_get_uint16 (pRawdata); - break; - } - case 2 : ; /* rgb */ - case 6 : { /* rgba */ - pBuf->iBKGDred = mng_get_uint16 (pRawdata); - pBuf->iBKGDgreen = mng_get_uint16 (pRawdata+2); - pBuf->iBKGDblue = mng_get_uint16 (pRawdata+4); - break; - } - case 3 : { /* indexed */ - pBuf->iBKGDindex = *pRawdata; - break; - } - } - } - else /* store as global */ - { - if (iRawlen) - { - pData->iGlobalBKGDred = mng_get_uint16 (pRawdata); - pData->iGlobalBKGDgreen = mng_get_uint16 (pRawdata+2); - pData->iGlobalBKGDblue = mng_get_uint16 (pRawdata+4); - } - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_bkgd (pData, pData->iGlobalBKGDred, - pData->iGlobalBKGDgreen, - pData->iGlobalBKGDblue); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_bkgdp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_bkgdp)*ppChunk)->iType = pData->iColortype; - - if (iRawlen) - { - switch (iRawlen) /* guess from length */ - { - case 1 : { /* indexed */ - ((mng_bkgdp)*ppChunk)->iType = 3; - ((mng_bkgdp)*ppChunk)->iIndex = *pRawdata; - break; - } - case 2 : { /* gray */ - ((mng_bkgdp)*ppChunk)->iType = 0; - ((mng_bkgdp)*ppChunk)->iGray = mng_get_uint16 (pRawdata); - break; - } - case 6 : { /* rgb */ - ((mng_bkgdp)*ppChunk)->iType = 2; - ((mng_bkgdp)*ppChunk)->iRed = mng_get_uint16 (pRawdata); - ((mng_bkgdp)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+2); - ((mng_bkgdp)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+4); - break; - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_pHYs -READ_CHUNK (mng_read_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYS, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* it's 9 bytes or empty; no more, no less! */ - if ((iRawlen != 9) && (iRawlen != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_physp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_physp)*ppChunk)->iSizex = mng_get_uint32 (pRawdata); - ((mng_physp)*ppChunk)->iSizey = mng_get_uint32 (pRawdata+4); - ((mng_physp)*ppChunk)->iUnit = *(pRawdata+8); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_sBIT -READ_CHUNK (mng_read_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SBIT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasPLTE) || (pData->bHasIDAT) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasPLTE) || (pData->bHasIDAT)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen > 4) /* it just can't be bigger than that! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_INCLUDE_JNG /* length checks */ - if (pData->bHasJHDR) - { - if ((pData->iJHDRcolortype == 8) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iJHDRcolortype == 10) && (iRawlen != 3)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iJHDRcolortype == 12) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iJHDRcolortype == 14) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - if ((pData->iColortype == 0) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 2) && (iRawlen != 3)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 3) && (iRawlen != 3)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 4) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 6) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* global = empty or RGBA */ - if ((iRawlen != 0) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_sbitp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) - ((mng_sbitp)*ppChunk)->iType = pData->iJHDRcolortype; - else -#endif - if (pData->bHasIHDR) - ((mng_sbitp)*ppChunk)->iType = pData->iColortype; - else /* global ! */ - ((mng_sbitp)*ppChunk)->iType = 6; - - if (iRawlen > 0) - ((mng_sbitp)*ppChunk)->aBits [0] = *pRawdata; - if (iRawlen > 1) - ((mng_sbitp)*ppChunk)->aBits [1] = *(pRawdata+1); - if (iRawlen > 2) - ((mng_sbitp)*ppChunk)->aBits [2] = *(pRawdata+2); - if (iRawlen > 3) - ((mng_sbitp)*ppChunk)->aBits [3] = *(pRawdata+3); - - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_sPLT -READ_CHUNK (mng_read_splt) -{ - mng_uint8p pTemp; - mng_uint32 iNamelen; - mng_uint8 iSampledepth; - mng_uint32 iRemain; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SPLT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasIDAT) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen) - { - pTemp = find_null (pRawdata); /* find null-separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - iNamelen = (mng_uint32)(pTemp - pRawdata); - iSampledepth = *(pTemp+1); - iRemain = (iRawlen - 2 - iNamelen); - - if ((iSampledepth != 1) && (iSampledepth != 2)) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - /* check remaining length */ - if ( ((iSampledepth == 1) && (iRemain % 6 != 0)) || - ((iSampledepth == 2) && (iRemain % 10 != 0)) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - } - else - { - pTemp = MNG_NULL; - iNamelen = 0; - iSampledepth = 0; - iRemain = 0; - } - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_spltp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_spltp)*ppChunk)->iNamesize = iNamelen; - ((mng_spltp)*ppChunk)->iSampledepth = iSampledepth; - - if (iSampledepth == 1) - ((mng_spltp)*ppChunk)->iEntrycount = iRemain / 6; - else - ((mng_spltp)*ppChunk)->iEntrycount = iRemain / 10; - - if (iNamelen) - { - MNG_ALLOC (pData, ((mng_spltp)*ppChunk)->zName, iNamelen+1); - MNG_COPY (((mng_spltp)*ppChunk)->zName, pRawdata, iNamelen); - } - - if (iRemain) - { - MNG_ALLOC (pData, ((mng_spltp)*ppChunk)->pEntries, iRemain); - MNG_COPY (((mng_spltp)*ppChunk)->pEntries, pTemp+2, iRemain); - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_hIST -READ_CHUNK (mng_read_hist) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_HIST, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if ((!pData->bHasPLTE) || (pData->bHasIDAT)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* length oke ? */ - if ( ((iRawlen & 0x01) != 0) || ((iRawlen >> 1) != pData->iPLTEcount) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { - mng_uint32 iX; - /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_histp)*ppChunk)->iEntrycount = iRawlen >> 1; - - for (iX = 0; iX < (iRawlen >> 1); iX++) - { - ((mng_histp)*ppChunk)->aEntries [iX] = mng_get_uint16 (pRawdata); - pRawdata += 2; - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_tIME -READ_CHUNK (mng_read_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TIME, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 7) /* length must be exactly 7 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -/* if (pData->fProcesstime) */ /* inform the application ? */ -/* { - - pData->fProcesstime ((mng_handle)pData, ); - } */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_timep)*ppChunk)->iYear = mng_get_uint16 (pRawdata); - ((mng_timep)*ppChunk)->iMonth = *(pRawdata+2); - ((mng_timep)*ppChunk)->iDay = *(pRawdata+3); - ((mng_timep)*ppChunk)->iHour = *(pRawdata+4); - ((mng_timep)*ppChunk)->iMinute = *(pRawdata+5); - ((mng_timep)*ppChunk)->iSecond = *(pRawdata+6); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MHDR, MNG_LC_START); -#endif - - if (pData->eSigtype != mng_it_mng) /* sequence checks */ - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if (pData->bHasheader) /* can only be the first chunk! */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* correct length ? */ -#ifndef MNG_NO_OLD_VERSIONS - if ((iRawlen != 28) && (iRawlen != 12)) -#else - if ((iRawlen != 28)) -#endif - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasMHDR = MNG_TRUE; /* oh boy, a real MNG */ - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_mng; /* fill header fields */ - pData->iWidth = mng_get_uint32 (pRawdata); - pData->iHeight = mng_get_uint32 (pRawdata+4); - pData->iTicks = mng_get_uint32 (pRawdata+8); - -#ifndef MNG_NO_OLD_VERSIONS - if (iRawlen == 28) /* proper MHDR ? */ - { -#endif - pData->iLayercount = mng_get_uint32 (pRawdata+12); - pData->iFramecount = mng_get_uint32 (pRawdata+16); - pData->iPlaytime = mng_get_uint32 (pRawdata+20); - pData->iSimplicity = mng_get_uint32 (pRawdata+24); - -#ifndef MNG_NO_OLD_VERSIONS - pData->bPreDraft48 = MNG_FALSE; - } - else /* probably pre-draft48 then */ - { - pData->iLayercount = 0; - pData->iFramecount = 0; - pData->iPlaytime = 0; - pData->iSimplicity = 0; - - pData->bPreDraft48 = MNG_TRUE; - } -#endif - /* predict alpha-depth */ - if ((pData->iSimplicity & 0x00000001) == 0) -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* no indicators = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - else - if ((pData->iSimplicity & 0x00000008) == 0) - pData->iAlphadepth = 0; /* no transparency at all */ - else - if ((pData->iSimplicity & 0x00000140) == 0x00000040) - pData->iAlphadepth = 1; /* no semi-transparency guaranteed */ - else -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* anything else = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - -#ifdef MNG_INCLUDE_JNG /* can we handle the complexity ? */ - if (pData->iSimplicity & 0x0000FC00) -#else - if (pData->iSimplicity & 0x0000FC10) -#endif - MNG_ERROR (pData, MNG_MNGTOOCOMPLEX); - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_mhdrp)*ppChunk)->iWidth = pData->iWidth; - ((mng_mhdrp)*ppChunk)->iHeight = pData->iHeight; - ((mng_mhdrp)*ppChunk)->iTicks = pData->iTicks; - ((mng_mhdrp)*ppChunk)->iLayercount = pData->iLayercount; - ((mng_mhdrp)*ppChunk)->iFramecount = pData->iFramecount; - ((mng_mhdrp)*ppChunk)->iPlaytime = pData->iPlaytime; - ((mng_mhdrp)*ppChunk)->iSimplicity = pData->iSimplicity; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MEND, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen > 0) /* must not contain data! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { /* do something */ - mng_retcode iRetcode = mng_process_display_mend (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (!pData->iTotalframes) /* save totals */ - pData->iTotalframes = pData->iFrameseq; - if (!pData->iTotallayers) - pData->iTotallayers = pData->iLayerseq; - if (!pData->iTotalplaytime) - pData->iTotalplaytime = pData->iFrametime; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - pData->bHasMHDR = MNG_FALSE; /* end of the line, bro! */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_LOOP -READ_CHUNK (mng_read_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_LOOP, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_LOOPWITHCACHEOFF); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen >= 5) /* length checks */ - { - if (iRawlen >= 6) - { - if ((iRawlen - 6) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint8 iLevel; - mng_uint32 iRepeat; - mng_uint8 iTermination = 0; - mng_uint32 iItermin = 1; - mng_uint32 iItermax = 0x7fffffffL; - mng_retcode iRetcode; - - pData->bHasLOOP = MNG_TRUE; /* indicate we're inside a loop */ - - iLevel = *pRawdata; /* determine the fields for processing */ - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) - { - iTermination = *(pRawdata+1); - - iRepeat = mng_get_uint32 (pRawdata+2); - } - else -#endif - iRepeat = mng_get_uint32 (pRawdata+1); - - if (iRawlen >= 6) - { -#ifndef MNG_NO_OLD_VERSIONS - if (!pData->bPreDraft48) -#endif - iTermination = *(pRawdata+5); - - if (iRawlen >= 10) - { - iItermin = mng_get_uint32 (pRawdata+6); - - if (iRawlen >= 14) - { - iItermax = mng_get_uint32 (pRawdata+10); - - /* TODO: process signals */ - - } - } - } - /* create the LOOP ani-object */ - iRetcode = mng_create_ani_loop (pData, iLevel, iRepeat, iTermination, - iItermin, iItermax, 0, 0); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* skip till matching ENDL if iteration=0 */ - if ((!pData->bSkipping) && (iRepeat == 0)) - pData->bSkipping = MNG_TRUE; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (iRawlen >= 5) /* store the fields */ - { - ((mng_loopp)*ppChunk)->iLevel = *pRawdata; - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) - { - ((mng_loopp)*ppChunk)->iTermination = *(pRawdata+1); - ((mng_loopp)*ppChunk)->iRepeat = mng_get_uint32 (pRawdata+2); - } - else -#endif - { - ((mng_loopp)*ppChunk)->iRepeat = mng_get_uint32 (pRawdata+1); - } - - if (iRawlen >= 6) - { -#ifndef MNG_NO_OLD_VERSIONS - if (!pData->bPreDraft48) -#endif - ((mng_loopp)*ppChunk)->iTermination = *(pRawdata+5); - - if (iRawlen >= 10) - { - ((mng_loopp)*ppChunk)->iItermin = mng_get_uint32 (pRawdata+6); - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (iRawlen >= 14) - { - ((mng_loopp)*ppChunk)->iItermax = mng_get_uint32 (pRawdata+10); - ((mng_loopp)*ppChunk)->iCount = (iRawlen - 14) / 4; - - if (((mng_loopp)*ppChunk)->iCount) - { - MNG_ALLOC (pData, ((mng_loopp)*ppChunk)->pSignals, - ((mng_loopp)*ppChunk)->iCount << 2); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata + 14; - mng_uint32p pOut = (mng_uint32p)((mng_loopp)*ppChunk)->pSignals; - - for (iX = 0; iX < ((mng_loopp)*ppChunk)->iCount; iX++) - { - *pOut++ = mng_get_uint32 (pIn); - pIn += 4; - } - } -#else - MNG_COPY (((mng_loopp)*ppChunk)->pSignals, pRawdata + 14, - ((mng_loopp)*ppChunk)->iCount << 2); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } -#endif - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_LOOP -READ_CHUNK (mng_read_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ENDL, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 1) /* length must be exactly 1 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - if (pData->bHasLOOP) /* are we really processing a loop ? */ - { - mng_uint8 iLevel = *pRawdata; /* get the nest level */ - /* create an ENDL animation object */ - mng_retcode iRetcode = mng_create_ani_endl (pData, iLevel); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -/* { - mng_ani_endlp pENDL = (mng_ani_endlp)pData->pLastaniobj; - - iRetcode = pENDL->sHeader.fProcess (pData, pENDL); - - if (iRetcode) - return iRetcode; - } */ - } - else - MNG_ERROR (pData, MNG_NOMATCHINGLOOP); - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_endlp)*ppChunk)->iLevel = *pRawdata; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_DEFI -READ_CHUNK (mng_read_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DEFI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 2) && (iRawlen != 3) && (iRawlen != 4) && - (iRawlen != 12) && (iRawlen != 28)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - pData->iDEFIobjectid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - { - pData->bDEFIhasdonotshow = MNG_TRUE; - pData->iDEFIdonotshow = *(pRawdata+2); - } - else - { - pData->bDEFIhasdonotshow = MNG_FALSE; - pData->iDEFIdonotshow = 0; - } - - if (iRawlen > 3) - { - pData->bDEFIhasconcrete = MNG_TRUE; - pData->iDEFIconcrete = *(pRawdata+3); - } - else - { - pData->bDEFIhasconcrete = MNG_FALSE; - pData->iDEFIconcrete = 0; - } - - if (iRawlen > 4) - { - pData->bDEFIhasloca = MNG_TRUE; - pData->iDEFIlocax = mng_get_int32 (pRawdata+4); - pData->iDEFIlocay = mng_get_int32 (pRawdata+8); - } - else - { - pData->bDEFIhasloca = MNG_FALSE; - pData->iDEFIlocax = 0; - pData->iDEFIlocay = 0; - } - - if (iRawlen > 12) - { - pData->bDEFIhasclip = MNG_TRUE; - pData->iDEFIclipl = mng_get_int32 (pRawdata+12); - pData->iDEFIclipr = mng_get_int32 (pRawdata+16); - pData->iDEFIclipt = mng_get_int32 (pRawdata+20); - pData->iDEFIclipb = mng_get_int32 (pRawdata+24); - } - else - { - pData->bDEFIhasclip = MNG_FALSE; - pData->iDEFIclipl = 0; - pData->iDEFIclipr = 0; - pData->iDEFIclipt = 0; - pData->iDEFIclipb = 0; - } - /* create an animation object */ - iRetcode = mng_create_ani_defi (pData); - - if (!iRetcode) /* do display processing */ - iRetcode = mng_process_display_defi (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_defip)*ppChunk)->iObjectid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - { - ((mng_defip)*ppChunk)->bHasdonotshow = MNG_TRUE; - ((mng_defip)*ppChunk)->iDonotshow = *(pRawdata+2); - } - else - ((mng_defip)*ppChunk)->bHasdonotshow = MNG_FALSE; - - if (iRawlen > 3) - { - ((mng_defip)*ppChunk)->bHasconcrete = MNG_TRUE; - ((mng_defip)*ppChunk)->iConcrete = *(pRawdata+3); - } - else - ((mng_defip)*ppChunk)->bHasconcrete = MNG_FALSE; - - if (iRawlen > 4) - { - ((mng_defip)*ppChunk)->bHasloca = MNG_TRUE; - ((mng_defip)*ppChunk)->iXlocation = mng_get_int32 (pRawdata+4); - ((mng_defip)*ppChunk)->iYlocation = mng_get_int32 (pRawdata+8); - } - else - ((mng_defip)*ppChunk)->bHasloca = MNG_FALSE; - - if (iRawlen > 12) - { - ((mng_defip)*ppChunk)->bHasclip = MNG_TRUE; - ((mng_defip)*ppChunk)->iLeftcb = mng_get_int32 (pRawdata+12); - ((mng_defip)*ppChunk)->iRightcb = mng_get_int32 (pRawdata+16); - ((mng_defip)*ppChunk)->iTopcb = mng_get_int32 (pRawdata+20); - ((mng_defip)*ppChunk)->iBottomcb = mng_get_int32 (pRawdata+24); - } - else - ((mng_defip)*ppChunk)->bHasclip = MNG_FALSE; - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_BASI -READ_CHUNK (mng_read_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BASI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 13) && (iRawlen != 19) && (iRawlen != 21) && (iRawlen != 22)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasBASI = MNG_TRUE; /* inside a BASI-IEND block now */ - /* store interesting fields */ - pData->iDatawidth = mng_get_uint32 (pRawdata); - pData->iDataheight = mng_get_uint32 (pRawdata+4); - pData->iBitdepth = *(pRawdata+8); - pData->iColortype = *(pRawdata+9); - pData->iCompression = *(pRawdata+10); - pData->iFilter = *(pRawdata+11); - pData->iInterlace = *(pRawdata+12); - - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iCompression != MNG_COMPRESSION_DEFLATE) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iInterlace != MNG_INTERLACE_NONE ) && - (pData->iInterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint16 iRed = 0; - mng_uint16 iGreen = 0; - mng_uint16 iBlue = 0; - mng_bool bHasalpha = MNG_FALSE; - mng_uint16 iAlpha = 0xFFFF; - mng_uint8 iViewable = 0; - mng_retcode iRetcode; - - if (iRawlen > 13) /* get remaining fields, if any */ - { - iRed = mng_get_uint16 (pRawdata+13); - iGreen = mng_get_uint16 (pRawdata+15); - iBlue = mng_get_uint16 (pRawdata+17); - } - - if (iRawlen > 19) - { - bHasalpha = MNG_TRUE; - iAlpha = mng_get_uint16 (pRawdata+19); - } - - if (iRawlen > 21) - iViewable = *(pRawdata+21); - /* create an animation object */ - iRetcode = mng_create_ani_basi (pData, iRed, iGreen, iBlue, - bHasalpha, iAlpha, iViewable); - -/* if (!iRetcode) - iRetcode = mng_process_display_basi (pData, iRed, iGreen, iBlue, - bHasalpha, iAlpha, iViewable); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_basip)*ppChunk)->iWidth = mng_get_uint32 (pRawdata); - ((mng_basip)*ppChunk)->iHeight = mng_get_uint32 (pRawdata+4); -#ifdef MNG_NO_16BIT_SUPPORT - if (*(pRawdata+8) > 8) - ((mng_basip)*ppChunk)->iBitdepth = 8; - else -#endif - ((mng_basip)*ppChunk)->iBitdepth = *(pRawdata+8); - ((mng_basip)*ppChunk)->iColortype = *(pRawdata+9); - ((mng_basip)*ppChunk)->iCompression = *(pRawdata+10); - ((mng_basip)*ppChunk)->iFilter = *(pRawdata+11); - ((mng_basip)*ppChunk)->iInterlace = *(pRawdata+12); - - if (iRawlen > 13) - { - ((mng_basip)*ppChunk)->iRed = mng_get_uint16 (pRawdata+13); - ((mng_basip)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+15); - ((mng_basip)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+17); - } - - if (iRawlen > 19) - ((mng_basip)*ppChunk)->iAlpha = mng_get_uint16 (pRawdata+19); - - if (iRawlen > 21) - ((mng_basip)*ppChunk)->iViewable = *(pRawdata+21); - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_CLON -READ_CHUNK (mng_read_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLON, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 4) && (iRawlen != 5) && (iRawlen != 6) && - (iRawlen != 7) && (iRawlen != 16)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint16 iSourceid, iCloneid; - mng_uint8 iClonetype = 0; - mng_bool bHasdonotshow = MNG_FALSE; - mng_uint8 iDonotshow = 0; - mng_uint8 iConcrete = 0; - mng_bool bHasloca = MNG_FALSE; - mng_uint8 iLocationtype = 0; - mng_int32 iLocationx = 0; - mng_int32 iLocationy = 0; - mng_retcode iRetcode; - - iSourceid = mng_get_uint16 (pRawdata); - iCloneid = mng_get_uint16 (pRawdata+2); - - if (iRawlen > 4) - iClonetype = *(pRawdata+4); - - if (iRawlen > 5) - { - bHasdonotshow = MNG_TRUE; - iDonotshow = *(pRawdata+5); - } - - if (iRawlen > 6) - iConcrete = *(pRawdata+6); - - if (iRawlen > 7) - { - bHasloca = MNG_TRUE; - iLocationtype = *(pRawdata+7); - iLocationx = mng_get_int32 (pRawdata+8); - iLocationy = mng_get_int32 (pRawdata+12); - } - - iRetcode = mng_create_ani_clon (pData, iSourceid, iCloneid, iClonetype, - bHasdonotshow, iDonotshow, iConcrete, - bHasloca, iLocationtype, iLocationx, iLocationy); - -/* if (!iRetcode) - iRetcode = mng_process_display_clon (pData, iSourceid, iCloneid, iClonetype, - bHasdonotshow, iDonotshow, iConcrete, - bHasloca, iLocationtype, iLocationx, - iLocationy); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_clonp)*ppChunk)->iSourceid = mng_get_uint16 (pRawdata); - ((mng_clonp)*ppChunk)->iCloneid = mng_get_uint16 (pRawdata+2); - - if (iRawlen > 4) - ((mng_clonp)*ppChunk)->iClonetype = *(pRawdata+4); - - if (iRawlen > 5) - ((mng_clonp)*ppChunk)->iDonotshow = *(pRawdata+5); - - if (iRawlen > 6) - ((mng_clonp)*ppChunk)->iConcrete = *(pRawdata+6); - - if (iRawlen > 7) - { - ((mng_clonp)*ppChunk)->bHasloca = MNG_TRUE; - ((mng_clonp)*ppChunk)->iLocationtype = *(pRawdata+7); - ((mng_clonp)*ppChunk)->iLocationx = mng_get_int32 (pRawdata+8); - ((mng_clonp)*ppChunk)->iLocationy = mng_get_int32 (pRawdata+12); - } - else - { - ((mng_clonp)*ppChunk)->bHasloca = MNG_FALSE; - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_PAST -READ_CHUNK (mng_read_past) -{ -#if defined(MNG_STORE_CHUNKS) || defined(MNG_SUPPORT_DISPLAY) - mng_retcode iRetcode; - mng_uint16 iTargetid; - mng_uint8 iTargettype; - mng_int32 iTargetx; - mng_int32 iTargety; - mng_uint32 iCount; - mng_uint32 iSize; - mng_ptr pSources; - mng_uint32 iX; - mng_past_sourcep pSource; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PAST, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - /* check the length */ - if ((iRawlen < 41) || (((iRawlen - 11) % 30) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#if defined(MNG_STORE_CHUNKS) || defined(MNG_SUPPORT_DISPLAY) - iTargetid = mng_get_uint16 (pRawdata); - iTargettype = *(pRawdata+2); - iTargetx = mng_get_int32 (pRawdata+3); - iTargety = mng_get_int32 (pRawdata+7); - iCount = ((iRawlen - 11) / 30); /* how many entries again? */ - iSize = iCount * sizeof (mng_past_source); - - pRawdata += 11; - /* get a buffer for all the source blocks */ - MNG_ALLOC (pData, pSources, iSize); - - pSource = (mng_past_sourcep)pSources; - - for (iX = 0; iX < iCount; iX++) /* now copy the source blocks */ - { - pSource->iSourceid = mng_get_uint16 (pRawdata); - pSource->iComposition = *(pRawdata+2); - pSource->iOrientation = *(pRawdata+3); - pSource->iOffsettype = *(pRawdata+4); - pSource->iOffsetx = mng_get_int32 (pRawdata+5); - pSource->iOffsety = mng_get_int32 (pRawdata+9); - pSource->iBoundarytype = *(pRawdata+13); - pSource->iBoundaryl = mng_get_int32 (pRawdata+14); - pSource->iBoundaryr = mng_get_int32 (pRawdata+18); - pSource->iBoundaryt = mng_get_int32 (pRawdata+22); - pSource->iBoundaryb = mng_get_int32 (pRawdata+26); - - pSource++; - pRawdata += 30; - } -#endif - -#ifdef MNG_SUPPORT_DISPLAY - { /* create playback object */ - iRetcode = mng_create_ani_past (pData, iTargetid, iTargettype, iTargetx, - iTargety, iCount, pSources); - -/* if (!iRetcode) - iRetcode = mng_process_display_past (pData, iTargetid, iTargettype, iTargetx, - iTargety, iCount, pSources); */ - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pSources, iSize); - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pSources, iSize); - return iRetcode; - } - /* store the fields */ - ((mng_pastp)*ppChunk)->iDestid = iTargetid; - ((mng_pastp)*ppChunk)->iTargettype = iTargettype; - ((mng_pastp)*ppChunk)->iTargetx = iTargetx; - ((mng_pastp)*ppChunk)->iTargety = iTargety; - ((mng_pastp)*ppChunk)->iCount = iCount; - /* get a buffer & copy the source blocks */ - MNG_ALLOC (pData, ((mng_pastp)*ppChunk)->pSources, iSize); - MNG_COPY (((mng_pastp)*ppChunk)->pSources, pSources, iSize); - } -#endif /* MNG_STORE_CHUNKS */ - -#if defined(MNG_STORE_CHUNKS) || defined(MNG_SUPPORT_DISPLAY) - /* free the source block buffer */ - MNG_FREEX (pData, pSources, iSize); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_DISC -READ_CHUNK (mng_read_disc) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - mng_uint32 iCount; - mng_uint16p pIds = MNG_NULL; - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DISC, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if ((iRawlen % 2) != 0) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - iCount = (iRawlen / sizeof (mng_uint16)); - - if (iCount) - { - MNG_ALLOC (pData, pIds, iRawlen); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata; - mng_uint16p pOut = pIds; - - for (iX = 0; iX < iCount; iX++) - { - *pOut++ = mng_get_uint16 (pIn); - pIn += 2; - } - } -#else - MNG_COPY (pIds, pRawdata, iRawlen); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } -#endif - -#ifdef MNG_SUPPORT_DISPLAY - { /* create playback object */ - iRetcode = mng_create_ani_disc (pData, iCount, pIds); - -/* if (!iRetcode) - iRetcode = mng_process_display_disc (pData, iCount, pIds); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_discp)*ppChunk)->iCount = iCount; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_discp)*ppChunk)->pObjectids, iRawlen); - MNG_COPY (((mng_discp)*ppChunk)->pObjectids, pIds, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - if (iRawlen) - MNG_FREEX (pData, pIds, iRawlen); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_BACK -READ_CHUNK (mng_read_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BACK, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 6) && (iRawlen != 7) && (iRawlen != 9) && (iRawlen != 10)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - /* retrieve the fields */ - pData->bHasBACK = MNG_TRUE; - pData->iBACKred = mng_get_uint16 (pRawdata); - pData->iBACKgreen = mng_get_uint16 (pRawdata+2); - pData->iBACKblue = mng_get_uint16 (pRawdata+4); - - if (iRawlen > 6) - pData->iBACKmandatory = *(pRawdata+6); - else - pData->iBACKmandatory = 0; - - if (iRawlen > 7) - pData->iBACKimageid = mng_get_uint16 (pRawdata+7); - else - pData->iBACKimageid = 0; - - if (iRawlen > 9) - pData->iBACKtile = *(pRawdata+9); - else - pData->iBACKtile = 0; - - iRetcode = mng_create_ani_back (pData, pData->iBACKred, pData->iBACKgreen, - pData->iBACKblue, pData->iBACKmandatory, - pData->iBACKimageid, pData->iBACKtile); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_backp)*ppChunk)->iRed = mng_get_uint16 (pRawdata); - ((mng_backp)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+2); - ((mng_backp)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+4); - - if (iRawlen > 6) - ((mng_backp)*ppChunk)->iMandatory = *(pRawdata+6); - - if (iRawlen > 7) - ((mng_backp)*ppChunk)->iImageid = mng_get_uint16 (pRawdata+7); - - if (iRawlen > 9) - ((mng_backp)*ppChunk)->iTile = *(pRawdata+9); - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_FRAM -READ_CHUNK (mng_read_fram) -{ - mng_uint8p pTemp; -#ifdef MNG_STORE_CHUNKS - mng_uint32 iNamelen; -#endif - mng_uint32 iRemain; - mng_uint32 iRequired = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FRAM, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen <= 1) /* only framing-mode ? */ - { -#ifdef MNG_STORE_CHUNKS - iNamelen = 0; /* indicate so */ -#endif - iRemain = 0; - pTemp = MNG_NULL; - } - else - { - pTemp = find_null (pRawdata+1); /* find null-separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - pTemp = pRawdata + iRawlen; /* than remainder is name */ - -#ifdef MNG_STORE_CHUNKS - iNamelen = (mng_uint32)((pTemp - pRawdata) - 1); -#endif - iRemain = (mng_uint32)(iRawlen - (pTemp - pRawdata)); - - if (iRemain) /* if there is remaining data it's less 1 byte */ - iRemain--; - - if ((iRemain) && (iRemain < 4)) /* remains must be empty or at least 4 bytes */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (iRemain) - { - iRequired = 4; /* calculate and check required remaining length */ - - if (*(pTemp+1)) { iRequired += 4; } - if (*(pTemp+2)) { iRequired += 4; } - if (*(pTemp+3)) { iRequired += 17; } - - if (*(pTemp+4)) - { - if ((iRemain - iRequired) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { - if (iRemain != iRequired) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - } - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint8p pWork = pTemp; - mng_uint8 iFramemode = 0; - mng_uint8 iChangedelay = 0; - mng_uint32 iDelay = 0; - mng_uint8 iChangetimeout = 0; - mng_uint32 iTimeout = 0; - mng_uint8 iChangeclipping = 0; - mng_uint8 iCliptype = 0; - mng_int32 iClipl = 0; - mng_int32 iClipr = 0; - mng_int32 iClipt = 0; - mng_int32 iClipb = 0; - mng_retcode iRetcode; - - if (iRawlen) /* any data specified ? */ - { - if (*(pRawdata)) /* save the new framing mode ? */ - { - iFramemode = *(pRawdata); - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) /* old style input-stream ? */ - { - switch (iFramemode) - { - case 0: { break; } - case 1: { iFramemode = 3; break; } - case 2: { iFramemode = 4; break; } - case 3: { iFramemode = 1; break; } - case 4: { iFramemode = 1; break; } - case 5: { iFramemode = 2; break; } - default: { iFramemode = 1; break; } - } - } -#endif - } - - if (iRemain) - { - iChangedelay = *(pWork+1); - iChangetimeout = *(pWork+2); - iChangeclipping = *(pWork+3); - pWork += 5; - - if (iChangedelay) /* delay changed ? */ - { - iDelay = mng_get_uint32 (pWork); - pWork += 4; - } - - if (iChangetimeout) /* timeout changed ? */ - { - iTimeout = mng_get_uint32 (pWork); - pWork += 4; - } - - if (iChangeclipping) /* clipping changed ? */ - { - iCliptype = *pWork; - iClipl = mng_get_int32 (pWork+1); - iClipr = mng_get_int32 (pWork+5); - iClipt = mng_get_int32 (pWork+9); - iClipb = mng_get_int32 (pWork+13); - } - } - } - - iRetcode = mng_create_ani_fram (pData, iFramemode, iChangedelay, iDelay, - iChangetimeout, iTimeout, - iChangeclipping, iCliptype, - iClipl, iClipr, iClipt, iClipb); - -/* if (!iRetcode) - iRetcode = mng_process_display_fram (pData, iFramemode, iChangedelay, iDelay, - iChangetimeout, iTimeout, - iChangeclipping, iCliptype, - iClipl, iClipr, iClipt, iClipb); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_framp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - mng_uint8 iFramemode = *(pRawdata); - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) /* old style input-stream ? */ - { - switch (iFramemode) - { - case 1: { iFramemode = 3; break; } - case 2: { iFramemode = 4; break; } - case 3: { iFramemode = 5; break; } /* TODO: provision for mode=5 ??? */ - case 4: { iFramemode = 1; break; } - case 5: { iFramemode = 2; break; } - default: { iFramemode = 1; break; } - } - } -#endif - - ((mng_framp)*ppChunk)->iMode = iFramemode; - ((mng_framp)*ppChunk)->iNamesize = iNamelen; - - if (iNamelen) - { - MNG_ALLOC (pData, ((mng_framp)*ppChunk)->zName, iNamelen+1); - MNG_COPY (((mng_framp)*ppChunk)->zName, pRawdata+1, iNamelen); - } - - if (iRemain) - { - ((mng_framp)*ppChunk)->iChangedelay = *(pTemp+1); - ((mng_framp)*ppChunk)->iChangetimeout = *(pTemp+2); - ((mng_framp)*ppChunk)->iChangeclipping = *(pTemp+3); - ((mng_framp)*ppChunk)->iChangesyncid = *(pTemp+4); - - pTemp += 5; - - if (((mng_framp)*ppChunk)->iChangedelay) - { - ((mng_framp)*ppChunk)->iDelay = mng_get_uint32 (pTemp); - pTemp += 4; - } - - if (((mng_framp)*ppChunk)->iChangetimeout) - { - ((mng_framp)*ppChunk)->iTimeout = mng_get_uint32 (pTemp); - pTemp += 4; - } - - if (((mng_framp)*ppChunk)->iChangeclipping) - { - ((mng_framp)*ppChunk)->iBoundarytype = *pTemp; - ((mng_framp)*ppChunk)->iBoundaryl = mng_get_int32 (pTemp+1); - ((mng_framp)*ppChunk)->iBoundaryr = mng_get_int32 (pTemp+5); - ((mng_framp)*ppChunk)->iBoundaryt = mng_get_int32 (pTemp+9); - ((mng_framp)*ppChunk)->iBoundaryb = mng_get_int32 (pTemp+13); - pTemp += 17; - } - - if (((mng_framp)*ppChunk)->iChangesyncid) - { - ((mng_framp)*ppChunk)->iCount = (iRemain - iRequired) / 4; - - if (((mng_framp)*ppChunk)->iCount) - { - MNG_ALLOC (pData, ((mng_framp)*ppChunk)->pSyncids, - ((mng_framp)*ppChunk)->iCount * 4); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint32p pOut = ((mng_framp)*ppChunk)->pSyncids; - - for (iX = 0; iX < ((mng_framp)*ppChunk)->iCount; iX++) - { - *pOut++ = mng_get_uint32 (pTemp); - pTemp += 4; - } - } -#else - MNG_COPY (((mng_framp)*ppChunk)->pSyncids, pTemp, - ((mng_framp)*ppChunk)->iCount * 4); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_MOVE -READ_CHUNK (mng_read_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MOVE, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 13) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - /* create a MOVE animation object */ - iRetcode = mng_create_ani_move (pData, mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9)); - -/* if (!iRetcode) - iRetcode = mng_process_display_move (pData, - mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9)); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_movep)*ppChunk)->iFirstid = mng_get_uint16 (pRawdata); - ((mng_movep)*ppChunk)->iLastid = mng_get_uint16 (pRawdata+2); - ((mng_movep)*ppChunk)->iMovetype = *(pRawdata+4); - ((mng_movep)*ppChunk)->iMovex = mng_get_int32 (pRawdata+5); - ((mng_movep)*ppChunk)->iMovey = mng_get_int32 (pRawdata+9); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_CLIP -READ_CHUNK (mng_read_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLIP, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 21) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - /* create a CLIP animation object */ - iRetcode = mng_create_ani_clip (pData, mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9), - mng_get_int32 (pRawdata+13), - mng_get_int32 (pRawdata+17)); - -/* if (!iRetcode) - iRetcode = mng_process_display_clip (pData, - mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9), - mng_get_int32 (pRawdata+13), - mng_get_int32 (pRawdata+17)); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_clipp)*ppChunk)->iFirstid = mng_get_uint16 (pRawdata); - ((mng_clipp)*ppChunk)->iLastid = mng_get_uint16 (pRawdata+2); - ((mng_clipp)*ppChunk)->iCliptype = *(pRawdata+4); - ((mng_clipp)*ppChunk)->iClipl = mng_get_int32 (pRawdata+5); - ((mng_clipp)*ppChunk)->iClipr = mng_get_int32 (pRawdata+9); - ((mng_clipp)*ppChunk)->iClipt = mng_get_int32 (pRawdata+13); - ((mng_clipp)*ppChunk)->iClipb = mng_get_int32 (pRawdata+17); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_SHOW -READ_CHUNK (mng_read_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SHOW, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 0) && (iRawlen != 2) && (iRawlen != 4) && (iRawlen != 5)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - if (iRawlen) /* determine parameters if any */ - { - pData->iSHOWfromid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - pData->iSHOWtoid = mng_get_uint16 (pRawdata+2); - else - pData->iSHOWtoid = pData->iSHOWfromid; - - if (iRawlen > 4) - pData->iSHOWmode = *(pRawdata+4); - else - pData->iSHOWmode = 0; - } - else /* use defaults then */ - { - pData->iSHOWmode = 2; - pData->iSHOWfromid = 1; - pData->iSHOWtoid = 65535; - } - /* create a SHOW animation object */ - iRetcode = mng_create_ani_show (pData, pData->iSHOWfromid, - pData->iSHOWtoid, pData->iSHOWmode); - - if (!iRetcode) - iRetcode = mng_process_display_show (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_showp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_showp)*ppChunk)->iFirstid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - ((mng_showp)*ppChunk)->iLastid = mng_get_uint16 (pRawdata+2); - else - ((mng_showp)*ppChunk)->iLastid = ((mng_showp)*ppChunk)->iFirstid; - - if (iRawlen > 4) - ((mng_showp)*ppChunk)->iMode = *(pRawdata+4); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_TERM -READ_CHUNK (mng_read_term) -{ - mng_uint8 iTermaction; - mng_uint8 iIteraction = 0; - mng_uint32 iDelay = 0; - mng_uint32 iItermax = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TERM, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - /* should be behind MHDR or SAVE !! */ - if ((!pData->bHasSAVE) && (pData->iChunkseq > 2)) - { - pData->bMisplacedTERM = MNG_TRUE; /* indicate we found a misplaced TERM */ - /* and send a warning signal!!! */ - MNG_WARNING (pData, MNG_SEQUENCEERROR); - } - - if (pData->bHasLOOP) /* no way, jose! */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasTERM) /* only 1 allowed! */ - MNG_ERROR (pData, MNG_MULTIPLEERROR); - /* check the length */ - if ((iRawlen != 1) && (iRawlen != 10)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasTERM = MNG_TRUE; - - iTermaction = *pRawdata; /* get the fields */ - - if (iRawlen > 1) - { - iIteraction = *(pRawdata+1); - iDelay = mng_get_uint32 (pRawdata+2); - iItermax = mng_get_uint32 (pRawdata+6); - } - - if (pData->fProcessterm) /* inform the app ? */ - if (!pData->fProcessterm (((mng_handle)pData), iTermaction, iIteraction, - iDelay, iItermax)) - MNG_ERROR (pData, MNG_APPMISCERROR); - -#ifdef MNG_SUPPORT_DISPLAY - { /* create the TERM ani-object */ - mng_retcode iRetcode = mng_create_ani_term (pData, iTermaction, iIteraction, - iDelay, iItermax); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* save for future reference */ - pData->pTermaniobj = pData->pLastaniobj; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_termp)*ppChunk)->iTermaction = iTermaction; - ((mng_termp)*ppChunk)->iIteraction = iIteraction; - ((mng_termp)*ppChunk)->iDelay = iDelay; - ((mng_termp)*ppChunk)->iItermax = iItermax; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_SAVE -READ_CHUNK (mng_read_save) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SAVE, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (pData->bHasSAVE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasSAVE = MNG_TRUE; - - if (pData->fProcesssave) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesssave ((mng_handle)pData); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - - /* TODO: something with the parameters */ - - - /* create a SAVE animation object */ - iRetcode = mng_create_ani_save (pData); - - if (!iRetcode) - iRetcode = mng_process_display_save (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_savep)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) /* not empty ? */ - { - mng_uint8 iOtype = *pRawdata; - mng_uint8 iEtype; - mng_uint32 iCount = 0; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint32 iOffset[2]; - mng_uint32 iStarttime[2]; - mng_uint32 iFramenr; - mng_uint32 iLayernr; - mng_uint32 iX; - mng_save_entryp pEntry = MNG_NULL; - mng_uint32 iNamesize; - - if ((iOtype != 4) && (iOtype != 8)) - MNG_ERROR (pData, MNG_INVOFFSETSIZE); - - ((mng_savep)*ppChunk)->iOffsettype = iOtype; - - for (iX = 0; iX < 2; iX++) /* do this twice to get the count first ! */ - { - pTemp = pRawdata + 1; - iLen = iRawlen - 1; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_save_entry))); - - ((mng_savep)*ppChunk)->iCount = iCount; - ((mng_savep)*ppChunk)->pEntries = pEntry; - } - - while (iLen) /* anything left ? */ - { - iEtype = *pTemp; /* entrytype */ - - if ((iEtype != 0) && (iEtype != 1) && (iEtype != 2) && (iEtype != 3)) - MNG_ERROR (pData, MNG_INVENTRYTYPE); - - pTemp++; - - if (iEtype > 1) - { - iOffset [0] = 0; - iOffset [1] = 0; - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iOffset [0] = 0; - iOffset [1] = mng_get_uint32 (pTemp); - - pTemp += 4; - } - else - { - iOffset [0] = mng_get_uint32 (pTemp); - iOffset [1] = mng_get_uint32 (pTemp+4); - - pTemp += 8; - } - - if (iEtype > 0) - { - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iStarttime [0] = 0; - iStarttime [1] = mng_get_uint32 (pTemp+0); - iLayernr = mng_get_uint32 (pTemp+4); - iFramenr = mng_get_uint32 (pTemp+8); - - pTemp += 12; - } - else - { - iStarttime [0] = mng_get_uint32 (pTemp+0); - iStarttime [1] = mng_get_uint32 (pTemp+4); - iLayernr = mng_get_uint32 (pTemp+8); - iFramenr = mng_get_uint32 (pTemp+12); - - pTemp += 16; - } - } - } - - pNull = find_null (pTemp); /* get the name length */ - - if ((pNull - pRawdata) > (mng_int32)iRawlen) - { - iNamesize = iLen; /* no null found; so end of SAVE */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen -= iNamesize; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!pEntry) - { - iCount++; - } - else - { - pEntry->iEntrytype = iEtype; - pEntry->iOffset [0] = iOffset [0]; - pEntry->iOffset [1] = iOffset [1]; - pEntry->iStarttime [0] = iStarttime [0]; - pEntry->iStarttime [1] = iStarttime [1]; - pEntry->iLayernr = iLayernr; - pEntry->iFramenr = iFramenr; - pEntry->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zName, iNamesize+1); - MNG_COPY (pEntry->zName, pTemp, iNamesize); - } - - pEntry++; - } - - pTemp += iNamesize; - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_SEEK -READ_CHUNK (mng_read_seek) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SEEK, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasSAVE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_SUPPORT_DISPLAY - /* create a SEEK animation object */ - iRetcode = mng_create_ani_seek (pData, iRawlen, (mng_pchar)pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - - if (pData->fProcessseek) /* inform the app ? */ - { - mng_bool bOke; - mng_pchar zName; - - MNG_ALLOC (pData, zName, iRawlen + 1); - - if (iRawlen) - MNG_COPY (zName, pRawdata, iRawlen); - - bOke = pData->fProcessseek ((mng_handle)pData, zName); - - MNG_FREEX (pData, zName, iRawlen + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_SUPPORT_DISPLAY - /* do display processing of the SEEK */ - iRetcode = mng_process_display_seek (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_seekp)*ppChunk)->iNamesize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_seekp)*ppChunk)->zName, iRawlen+1); - MNG_COPY (((mng_seekp)*ppChunk)->zName, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_eXPI -READ_CHUNK (mng_read_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EXPI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 3) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_expip)*ppChunk)->iSnapshotid = mng_get_uint16 (pRawdata); - ((mng_expip)*ppChunk)->iNamesize = iRawlen - 2; - - if (((mng_expip)*ppChunk)->iNamesize) - { - MNG_ALLOC (pData, ((mng_expip)*ppChunk)->zName, - ((mng_expip)*ppChunk)->iNamesize + 1); - MNG_COPY (((mng_expip)*ppChunk)->zName, pRawdata+2, - ((mng_expip)*ppChunk)->iNamesize); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_fPRI -READ_CHUNK (mng_read_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FPRI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 2) /* must be two bytes long */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_fprip)*ppChunk)->iDeltatype = *pRawdata; - ((mng_fprip)*ppChunk)->iPriority = *(pRawdata+1); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_bool CheckKeyword (mng_datap pData, - mng_uint8p pKeyword) -{ - mng_chunkid handled_chunks [] = - { - MNG_UINT_BACK, /* keep it sorted !!!! */ - MNG_UINT_BASI, - MNG_UINT_CLIP, - MNG_UINT_CLON, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DBYK, */ -#endif - MNG_UINT_DEFI, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_DHDR, -#endif - MNG_UINT_DISC, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DROP, */ -#endif - MNG_UINT_ENDL, - MNG_UINT_FRAM, - MNG_UINT_IDAT, - MNG_UINT_IEND, - MNG_UINT_IHDR, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - MNG_UINT_IJNG, -#endif - MNG_UINT_IPNG, -#endif -#ifdef MNG_INCLUDE_JNG - MNG_UINT_JDAA, - MNG_UINT_JDAT, - MNG_UINT_JHDR, -/* TODO: MNG_UINT_JSEP, */ - MNG_UINT_JdAA, -#endif - MNG_UINT_LOOP, - MNG_UINT_MAGN, - MNG_UINT_MEND, - MNG_UINT_MHDR, - MNG_UINT_MOVE, -/* TODO: MNG_UINT_ORDR, */ - MNG_UINT_PAST, - MNG_UINT_PLTE, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_PPLT, - MNG_UINT_PROM, -#endif - MNG_UINT_SAVE, - MNG_UINT_SEEK, - MNG_UINT_SHOW, - MNG_UINT_TERM, -#ifdef MNG_INCLUDE_ANG_PROPOSAL - MNG_UINT_adAT, - MNG_UINT_ahDR, -#endif - MNG_UINT_bKGD, - MNG_UINT_cHRM, -/* TODO: MNG_UINT_eXPI, */ - MNG_UINT_evNT, -/* TODO: MNG_UINT_fPRI, */ - MNG_UINT_gAMA, -/* TODO: MNG_UINT_hIST, */ - MNG_UINT_iCCP, - MNG_UINT_iTXt, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - MNG_UINT_mpNG, -#endif - MNG_UINT_nEED, -/* TODO: MNG_UINT_oFFs, */ -/* TODO: MNG_UINT_pCAL, */ -/* TODO: MNG_UINT_pHYg, */ -/* TODO: MNG_UINT_pHYs, */ -/* TODO: MNG_UINT_sBIT, */ -/* TODO: MNG_UINT_sCAL, */ -/* TODO: MNG_UINT_sPLT, */ - MNG_UINT_sRGB, - MNG_UINT_tEXt, - MNG_UINT_tIME, - MNG_UINT_tRNS, - MNG_UINT_zTXt, - }; - - mng_bool bOke = MNG_FALSE; - - if (pData->fProcessneed) /* does the app handle it ? */ - bOke = pData->fProcessneed ((mng_handle)pData, (mng_pchar)pKeyword); - - if (!bOke) - { /* find the keyword length */ - mng_uint8p pNull = find_null (pKeyword); - - if (pNull - pKeyword == 4) /* test a chunk ? */ - { /* get the chunk-id */ - mng_chunkid iChunkid = (*pKeyword << 24) + (*(pKeyword+1) << 16) + - (*(pKeyword+2) << 8) + (*(pKeyword+3) ); - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - /* determine max index of table */ - iTop = (sizeof (handled_chunks) / sizeof (handled_chunks [0])) - 1; - - /* binary search; with 52 chunks, worst-case is 7 comparisons */ - iLower = 0; - iMiddle = iTop >> 1; - iUpper = iTop; - - do /* the binary search itself */ - { - if (handled_chunks [iMiddle] < iChunkid) - iLower = iMiddle + 1; - else if (handled_chunks [iMiddle] > iChunkid) - iUpper = iMiddle - 1; - else - { - bOke = MNG_TRUE; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - } - /* test draft ? */ - if ((!bOke) && (pNull - pKeyword == 8) && - (*pKeyword == 'd') && (*(pKeyword+1) == 'r') && - (*(pKeyword+2) == 'a') && (*(pKeyword+3) == 'f') && - (*(pKeyword+4) == 't') && (*(pKeyword+5) == ' ')) - { - mng_uint32 iDraft; - - iDraft = (*(pKeyword+6) - '0') * 10 + (*(pKeyword+7) - '0'); - bOke = (mng_bool)(iDraft <= MNG_MNG_DRAFT); - } - /* test MNG 1.0/1.1 ? */ - if ((!bOke) && (pNull - pKeyword == 7) && - (*pKeyword == 'M') && (*(pKeyword+1) == 'N') && - (*(pKeyword+2) == 'G') && (*(pKeyword+3) == '-') && - (*(pKeyword+4) == '1') && (*(pKeyword+5) == '.') && - ((*(pKeyword+6) == '0') || (*(pKeyword+6) == '1'))) - bOke = MNG_TRUE; - /* test CACHEOFF ? */ - if ((!bOke) && (pNull - pKeyword == 8) && - (*pKeyword == 'C') && (*(pKeyword+1) == 'A') && - (*(pKeyword+2) == 'C') && (*(pKeyword+3) == 'H') && - (*(pKeyword+4) == 'E') && (*(pKeyword+5) == 'O') && - (*(pKeyword+6) == 'F') && (*(pKeyword+7) == 'F')) - { - if (!pData->pFirstaniobj) /* only if caching hasn't started yet ! */ - { - bOke = MNG_TRUE; - pData->bCacheplayback = MNG_FALSE; - pData->bStorechunks = MNG_FALSE; - } - } - } - - return bOke; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_nEED -READ_CHUNK (mng_read_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_NEED, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 1) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - { /* let's check it */ - mng_bool bOke = MNG_TRUE; - mng_pchar zKeywords; - mng_uint8p pNull, pTemp; - - MNG_ALLOC (pData, zKeywords, iRawlen + 1); - - if (iRawlen) - MNG_COPY (zKeywords, pRawdata, iRawlen); - - pTemp = (mng_uint8p)zKeywords; - pNull = find_null (pTemp); - - while ((bOke) && (pNull < (mng_uint8p)zKeywords + iRawlen)) - { - bOke = CheckKeyword (pData, pTemp); - pTemp = pNull + 1; - pNull = find_null (pTemp); - } - - if (bOke) - bOke = CheckKeyword (pData, pTemp); - - MNG_FREEX (pData, zKeywords, iRawlen + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_UNSUPPORTEDNEED); - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_needp)*ppChunk)->iKeywordssize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_needp)*ppChunk)->zKeywords, iRawlen+1); - MNG_COPY (((mng_needp)*ppChunk)->zKeywords, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_pHYg -READ_CHUNK (mng_read_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYG, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* it's 9 bytes or empty; no more, no less! */ - if ((iRawlen != 9) && (iRawlen != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_phygp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_phygp)*ppChunk)->iSizex = mng_get_uint32 (pRawdata); - ((mng_phygp)*ppChunk)->iSizey = mng_get_uint32 (pRawdata+4); - ((mng_phygp)*ppChunk)->iUnit = *(pRawdata+8); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JHDR, MNG_LC_START); -#endif - /* sequence checks */ - if ((pData->eSigtype != mng_it_jng) && (pData->eSigtype != mng_it_mng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if ((pData->eSigtype == mng_it_jng) && (pData->iChunkseq > 1)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 16) /* length oke ? */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* inside a JHDR-IEND block now */ - pData->bHasJHDR = MNG_TRUE; - /* and store interesting fields */ - pData->iDatawidth = mng_get_uint32 (pRawdata); - pData->iDataheight = mng_get_uint32 (pRawdata+4); - pData->iJHDRcolortype = *(pRawdata+8); - pData->iJHDRimgbitdepth = *(pRawdata+9); - pData->iJHDRimgcompression = *(pRawdata+10); - pData->iJHDRimginterlace = *(pRawdata+11); - pData->iJHDRalphabitdepth = *(pRawdata+12); - pData->iJHDRalphacompression = *(pRawdata+13); - pData->iJHDRalphafilter = *(pRawdata+14); - pData->iJHDRalphainterlace = *(pRawdata+15); - - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iJHDRalphabitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iJHDRalphabitdepth < 8) - pData->iJHDRalphabitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iJHDRalphabitdepth > 8) - { - pData->iPNGmult = 2; - pData->iJHDRalphabitdepth = 8; - } -#endif - /* parameter validity checks */ - if ((pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAY ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLORA) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG12 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8AND12) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iJHDRimgcompression != MNG_COMPRESSION_BASELINEJPEG) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if ((pData->iJHDRimginterlace != MNG_INTERLACE_SEQUENTIAL ) && - (pData->iJHDRimginterlace != MNG_INTERLACE_PROGRESSIVE) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - if ((pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_1 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_2 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_4 ) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE ) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) ) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if ((pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iJHDRalphafilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) && - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iJHDRalphainterlace != MNG_INTERLACE_NONE ) && - (pData->iJHDRalphainterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - } - else - { - if (pData->iJHDRalphabitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iJHDRalphacompression) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); - - if (pData->iJHDRalphainterlace) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - } - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_jng; /* then this must be a JNG */ - pData->iWidth = mng_get_uint32 (pRawdata); - pData->iHeight = mng_get_uint32 (pRawdata+4); - /* predict alpha-depth ! */ - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - pData->iAlphadepth = pData->iJHDRalphabitdepth; - else - pData->iAlphadepth = 0; - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - } - - pData->iColortype = 0; /* fake grayscale for other routines */ - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_process_display_jhdr (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_jhdrp)*ppChunk)->iWidth = mng_get_uint32 (pRawdata); - ((mng_jhdrp)*ppChunk)->iHeight = mng_get_uint32 (pRawdata+4); - ((mng_jhdrp)*ppChunk)->iColortype = *(pRawdata+8); - ((mng_jhdrp)*ppChunk)->iImagesampledepth = *(pRawdata+9); - ((mng_jhdrp)*ppChunk)->iImagecompression = *(pRawdata+10); - ((mng_jhdrp)*ppChunk)->iImageinterlace = *(pRawdata+11); - ((mng_jhdrp)*ppChunk)->iAlphasampledepth = *(pRawdata+12); -#ifdef MNG_NO_16BIT_SUPPORT - if (*(pRawdata+12) > 8) - ((mng_jhdrp)*ppChunk)->iAlphasampledepth = 8; -#endif - ((mng_jhdrp)*ppChunk)->iAlphacompression = *(pRawdata+13); - ((mng_jhdrp)*ppChunk)->iAlphafilter = *(pRawdata+14); - ((mng_jhdrp)*ppChunk)->iAlphainterlace = *(pRawdata+15); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jhdr 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jdaa) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - volatile mng_retcode iRetcode; - - iRetcode=MNG_NOERROR; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAA, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasJHDR) && (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasJSEP) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen == 0) /* can never be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasJDAA = MNG_TRUE; /* got some JDAA now, don't we */ - -#ifdef MNG_SUPPORT_DISPLAY - iRetcode = mng_process_display_jdaa (pData, iRawlen, pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_jdaap)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_jdaap)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen != 0) /* is there any data ? */ - { - MNG_ALLOC (pData, ((mng_jdaap)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_jdaap)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jdaa 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jdat) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - volatile mng_retcode iRetcode; - - iRetcode=MNG_NOERROR; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasJHDR) && (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen == 0) /* can never be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasJDAT = MNG_TRUE; /* got some JDAT now, don't we */ - -#ifdef MNG_SUPPORT_DISPLAY - iRetcode = mng_process_display_jdat (pData, iRawlen, pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_jdatp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_jdatp)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen != 0) /* is there any data ? */ - { - MNG_ALLOC (pData, ((mng_jdatp)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_jdatp)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jdat 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JSEP, MNG_LC_START); -#endif - - if (!pData->bHasJHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 0) /* must be empty ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasJSEP = MNG_TRUE; /* indicate we've had the 8-/12-bit separator */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jsep 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_dhdr) -{ - mng_uint8 iImagetype, iDeltatype; -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DHDR, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check for valid length */ - if ((iRawlen != 4) && (iRawlen != 12) && (iRawlen != 20)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iImagetype = *(pRawdata+2); /* check fields for validity */ - iDeltatype = *(pRawdata+3); - - if (iImagetype > MNG_IMAGETYPE_JNG) - MNG_ERROR (pData, MNG_INVIMAGETYPE); - - if (iDeltatype > MNG_DELTATYPE_NOCHANGE) - MNG_ERROR (pData, MNG_INVDELTATYPE); - - if ((iDeltatype == MNG_DELTATYPE_REPLACE) && (iRawlen > 12)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((iDeltatype == MNG_DELTATYPE_NOCHANGE) && (iRawlen > 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasDHDR = MNG_TRUE; /* inside a DHDR-IEND block now */ - pData->iDeltatype = iDeltatype; - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint16 iObjectid = mng_get_uint16 (pRawdata); - mng_uint32 iBlockwidth = 0; - mng_uint32 iBlockheight = 0; - mng_uint32 iBlockx = 0; - mng_uint32 iBlocky = 0; - mng_retcode iRetcode; - - if (iRawlen > 4) - { - iBlockwidth = mng_get_uint32 (pRawdata+4); - iBlockheight = mng_get_uint32 (pRawdata+8); - } - - if (iRawlen > 12) - { - iBlockx = mng_get_uint32 (pRawdata+12); - iBlocky = mng_get_uint32 (pRawdata+16); - } - - iRetcode = mng_create_ani_dhdr (pData, iObjectid, iImagetype, iDeltatype, - iBlockwidth, iBlockheight, iBlockx, iBlocky); - -/* if (!iRetcode) - iRetcode = mng_process_display_dhdr (pData, iObjectid, iImagetype, iDeltatype, - iBlockwidth, iBlockheight, iBlockx, iBlocky); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_dhdrp)*ppChunk)->iObjectid = mng_get_uint16 (pRawdata); - ((mng_dhdrp)*ppChunk)->iImagetype = iImagetype; - ((mng_dhdrp)*ppChunk)->iDeltatype = iDeltatype; - - if (iRawlen > 4) - { - ((mng_dhdrp)*ppChunk)->iBlockwidth = mng_get_uint32 (pRawdata+4); - ((mng_dhdrp)*ppChunk)->iBlockheight = mng_get_uint32 (pRawdata+8); - } - - if (iRawlen > 12) - { - ((mng_dhdrp)*ppChunk)->iBlockx = mng_get_uint32 (pRawdata+12); - ((mng_dhdrp)*ppChunk)->iBlocky = mng_get_uint32 (pRawdata+16); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_prom) -{ - mng_uint8 iColortype; - mng_uint8 iSampledepth; - mng_uint8 iFilltype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PROM, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 3) /* gotta be exactly 3 bytes */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iColortype = *pRawdata; /* check fields for validity */ - iSampledepth = *(pRawdata+1); - iFilltype = *(pRawdata+2); - - if ((iColortype != MNG_COLORTYPE_GRAY ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_INDEXED) && - (iColortype != MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - -#ifdef MNG_NO_16BIT_SUPPORT - if (iSampledepth == MNG_BITDEPTH_16 ) - iSampledepth = MNG_BITDEPTH_8; -#endif - - if ((iSampledepth != MNG_BITDEPTH_1 ) && - (iSampledepth != MNG_BITDEPTH_2 ) && - (iSampledepth != MNG_BITDEPTH_4 ) && - (iSampledepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_16BIT_SUPPORT - && (iSampledepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - - if ((iFilltype != MNG_FILLMETHOD_LEFTBITREPLICATE) && - (iFilltype != MNG_FILLMETHOD_ZEROFILL ) ) - MNG_ERROR (pData, MNG_INVFILLMETHOD); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_prom (pData, iSampledepth, - iColortype, iFilltype); - -/* if (!iRetcode) - iRetcode = mng_process_display_prom (pData, iSampledepth, - iColortype, iFilltype); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_promp)*ppChunk)->iColortype = iColortype; - ((mng_promp)*ppChunk)->iSampledepth = iSampledepth; - ((mng_promp)*ppChunk)->iFilltype = iFilltype; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IPNG, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 0) /* gotta be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_ipng (pData); - - if (!iRetcode) - iRetcode = mng_process_display_ipng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_pplt) -{ - mng_uint8 iDeltatype; - mng_uint8p pTemp; - mng_uint32 iLen; - mng_uint8 iX, iM; - mng_uint32 iY; - mng_uint32 iMax; - mng_rgbpaltab aIndexentries; - mng_uint8arr aAlphaentries; - mng_uint8arr aUsedentries; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PPLT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 1) /* must have at least 1 byte */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iDeltatype = *pRawdata; - /* valid ? */ - if (iDeltatype > MNG_DELTATYPE_DELTARGBA) - MNG_ERROR (pData, MNG_INVDELTATYPE); - /* must be indexed color ! */ - if (pData->iColortype != MNG_COLORTYPE_INDEXED) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - pTemp = pRawdata + 1; - iLen = iRawlen - 1; - iMax = 0; - - for (iY = 0; iY < 256; iY++) /* reset arrays */ - { - aIndexentries [iY].iRed = 0; - aIndexentries [iY].iGreen = 0; - aIndexentries [iY].iBlue = 0; - aAlphaentries [iY] = 255; - aUsedentries [iY] = 0; - } - - while (iLen) /* as long as there are entries left ... */ - { - mng_uint32 iDiff; - - if (iLen < 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iX = *pTemp; /* get start and end index */ - iM = *(pTemp+1); - - if (iM < iX) - MNG_ERROR (pData, MNG_INVALIDINDEX); - - if ((mng_uint32)iM >= iMax) /* determine highest used index */ - iMax = (mng_uint32)iM + 1; - - pTemp += 2; - iLen -= 2; - iDiff = (iM - iX + 1); - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - iDiff = iDiff * 3; - else - if ((iDeltatype == MNG_DELTATYPE_REPLACERGBA) || - (iDeltatype == MNG_DELTATYPE_DELTARGBA ) ) - iDiff = iDiff * 4; - - if (iLen < iDiff) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - { - for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++) - { - aIndexentries [iY].iRed = *pTemp; - aIndexentries [iY].iGreen = *(pTemp+1); - aIndexentries [iY].iBlue = *(pTemp+2); - aUsedentries [iY] = 1; - - pTemp += 3; - iLen -= 3; - } - } - else - if ((iDeltatype == MNG_DELTATYPE_REPLACEALPHA) || - (iDeltatype == MNG_DELTATYPE_DELTAALPHA ) ) - { - for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++) - { - aAlphaentries [iY] = *pTemp; - aUsedentries [iY] = 1; - - pTemp++; - iLen--; - } - } - else - { - for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++) - { - aIndexentries [iY].iRed = *pTemp; - aIndexentries [iY].iGreen = *(pTemp+1); - aIndexentries [iY].iBlue = *(pTemp+2); - aAlphaentries [iY] = *(pTemp+3); - aUsedentries [iY] = 1; - - pTemp += 4; - iLen -= 4; - } - } - } - - switch (pData->iBitdepth) /* check maximum allowed entries for bitdepth */ - { - case MNG_BITDEPTH_1 : { - if (iMax > 2) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_2 : { - if (iMax > 4) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_4 : { - if (iMax > 16) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - } - -#ifdef MNG_SUPPORT_DISPLAY - { /* create animation object */ - mng_retcode iRetcode = mng_create_ani_pplt (pData, iDeltatype, iMax, - aIndexentries, aAlphaentries, - aUsedentries); - -/* if (!iRetcode) - iRetcode = mng_process_display_pplt (pData, iDeltatype, iMax, aIndexentries, - aAlphaentries, aUsedentries); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_ppltp)*ppChunk)->iDeltatype = iDeltatype; - ((mng_ppltp)*ppChunk)->iCount = iMax; - - for (iY = 0; iY < 256; iY++) - { - ((mng_ppltp)*ppChunk)->aEntries [iY].iRed = aIndexentries [iY].iRed; - ((mng_ppltp)*ppChunk)->aEntries [iY].iGreen = aIndexentries [iY].iGreen; - ((mng_ppltp)*ppChunk)->aEntries [iY].iBlue = aIndexentries [iY].iBlue; - ((mng_ppltp)*ppChunk)->aEntries [iY].iAlpha = aAlphaentries [iY]; - ((mng_ppltp)*ppChunk)->aEntries [iY].bUsed = (mng_bool)(aUsedentries [iY]); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IJNG, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 0) /* gotta be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_ijng (pData); - - if (!iRetcode) - iRetcode = mng_process_display_ijng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DROP, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check length */ - if ((iRawlen < 4) || ((iRawlen % 4) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_dropp)*ppChunk)->iCount = iRawlen / 4; - - if (iRawlen) - { - mng_uint32 iX; - mng_uint8p pTemp = pRawdata; - mng_uint32p pEntry; - - MNG_ALLOC (pData, pEntry, iRawlen); - - ((mng_dropp)*ppChunk)->pChunknames = (mng_ptr)pEntry; - - for (iX = 0; iX < iRawlen / 4; iX++) - { - *pEntry = mng_get_uint32 (pTemp); - - pTemp += 4; - pEntry++; - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -READ_CHUNK (mng_read_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DBYK, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 6) /* must be at least 6 long */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_dbykp)*ppChunk)->iChunkname = mng_get_uint32 (pRawdata); - ((mng_dbykp)*ppChunk)->iPolarity = *(pRawdata+4); - ((mng_dbykp)*ppChunk)->iKeywordssize = iRawlen - 5; - - if (iRawlen > 5) - { - MNG_ALLOC (pData, ((mng_dbykp)*ppChunk)->zKeywords, iRawlen-4); - MNG_COPY (((mng_dbykp)*ppChunk)->zKeywords, pRawdata+5, iRawlen-5); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -READ_CHUNK (mng_read_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ORDR, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check length */ - if ((iRawlen < 5) || ((iRawlen % 5) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_ordrp)*ppChunk)->iCount = iRawlen / 5; - - if (iRawlen) - { - mng_uint32 iX; - mng_ordr_entryp pEntry; - mng_uint8p pTemp = pRawdata; - - MNG_ALLOC (pData, pEntry, iRawlen); - - ((mng_ordrp)*ppChunk)->pEntries = pEntry; - - for (iX = 0; iX < iRawlen / 5; iX++) - { - pEntry->iChunkname = mng_get_uint32 (pTemp); - pEntry->iOrdertype = *(pTemp+4); - - pTemp += 5; - pEntry++; - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_MAGN -READ_CHUNK (mng_read_magn) -{ - mng_uint16 iFirstid, iLastid; - mng_uint8 iMethodX, iMethodY; - mng_uint16 iMX, iMY, iML, iMR, iMT, iMB; - mng_bool bFaulty; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MAGN, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_SUPPORT_JNG - if ((!pData->bHasMHDR) || (pData->bHasIHDR) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) || (pData->bHasIHDR) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check length */ - if (iRawlen > 20) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - /* following is an ugly hack to allow faulty layout caused by previous - versions of libmng and MNGeye, which wrote MAGN with a 16-bit - MethodX/MethodY (as opposed to the proper 8-bit as defined in the spec!) */ - - if ((iRawlen == 6) || (iRawlen == 8) || (iRawlen == 10) || (iRawlen == 12) || - (iRawlen == 14) || (iRawlen == 16) || (iRawlen == 20)) - bFaulty = MNG_TRUE; /* these lengths are all wrong */ - else /* length 18 can be right or wrong !!! */ - if ((iRawlen == 18) && (mng_get_uint16 (pRawdata+4) <= 5) && - (mng_get_uint16 (pRawdata+6) < 256) && - (mng_get_uint16 (pRawdata+8) < 256) && - (mng_get_uint16 (pRawdata+10) < 256) && - (mng_get_uint16 (pRawdata+12) < 256) && - (mng_get_uint16 (pRawdata+14) < 256) && - (mng_get_uint16 (pRawdata+16) < 256)) - bFaulty = MNG_TRUE; /* this is very likely the wrong layout */ - else - bFaulty = MNG_FALSE; /* all other cases are handled as right */ - - if (bFaulty) /* wrong layout ? */ - { - if (iRawlen > 0) /* get the fields */ - iFirstid = mng_get_uint16 (pRawdata); - else - iFirstid = 0; - - if (iRawlen > 2) - iLastid = mng_get_uint16 (pRawdata+2); - else - iLastid = iFirstid; - - if (iRawlen > 4) - iMethodX = (mng_uint8)(mng_get_uint16 (pRawdata+4)); - else - iMethodX = 0; - - if (iRawlen > 6) - iMX = mng_get_uint16 (pRawdata+6); - else - iMX = 1; - - if (iRawlen > 8) - iMY = mng_get_uint16 (pRawdata+8); - else - iMY = iMX; - - if (iRawlen > 10) - iML = mng_get_uint16 (pRawdata+10); - else - iML = iMX; - - if (iRawlen > 12) - iMR = mng_get_uint16 (pRawdata+12); - else - iMR = iMX; - - if (iRawlen > 14) - iMT = mng_get_uint16 (pRawdata+14); - else - iMT = iMY; - - if (iRawlen > 16) - iMB = mng_get_uint16 (pRawdata+16); - else - iMB = iMY; - - if (iRawlen > 18) - iMethodY = (mng_uint8)(mng_get_uint16 (pRawdata+18)); - else - iMethodY = iMethodX; - } - else /* proper layout !!!! */ - { - if (iRawlen > 0) /* get the fields */ - iFirstid = mng_get_uint16 (pRawdata); - else - iFirstid = 0; - - if (iRawlen > 2) - iLastid = mng_get_uint16 (pRawdata+2); - else - iLastid = iFirstid; - - if (iRawlen > 4) - iMethodX = *(pRawdata+4); - else - iMethodX = 0; - - if (iRawlen > 5) - iMX = mng_get_uint16 (pRawdata+5); - else - iMX = 1; - - if (iRawlen > 7) - iMY = mng_get_uint16 (pRawdata+7); - else - iMY = iMX; - - if (iRawlen > 9) - iML = mng_get_uint16 (pRawdata+9); - else - iML = iMX; - - if (iRawlen > 11) - iMR = mng_get_uint16 (pRawdata+11); - else - iMR = iMX; - - if (iRawlen > 13) - iMT = mng_get_uint16 (pRawdata+13); - else - iMT = iMY; - - if (iRawlen > 15) - iMB = mng_get_uint16 (pRawdata+15); - else - iMB = iMY; - - if (iRawlen > 17) - iMethodY = *(pRawdata+17); - else - iMethodY = iMethodX; - } - /* check field validity */ - if ((iMethodX > 5) || (iMethodY > 5)) - MNG_ERROR (pData, MNG_INVALIDMETHOD); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - iRetcode = mng_create_ani_magn (pData, iFirstid, iLastid, iMethodX, - iMX, iMY, iML, iMR, iMT, iMB, iMethodY); - -/* if (!iRetcode) - iRetcode = mng_process_display_magn (pData, iFirstid, iLastid, iMethodX, - iMX, iMY, iML, iMR, iMT, iMB, iMethodY); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_magnp)*ppChunk)->iFirstid = iFirstid; - ((mng_magnp)*ppChunk)->iLastid = iLastid; - ((mng_magnp)*ppChunk)->iMethodX = iMethodX; - ((mng_magnp)*ppChunk)->iMX = iMX; - ((mng_magnp)*ppChunk)->iMY = iMY; - ((mng_magnp)*ppChunk)->iML = iML; - ((mng_magnp)*ppChunk)->iMR = iMR; - ((mng_magnp)*ppChunk)->iMT = iMT; - ((mng_magnp)*ppChunk)->iMB = iMB; - ((mng_magnp)*ppChunk)->iMethodY = iMethodY; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -READ_CHUNK (mng_read_mpng) -{ - mng_uint32 iFramewidth; - mng_uint32 iFrameheight; - mng_uint16 iTickspersec; - mng_uint32 iFramessize; - mng_uint32 iCompressedsize; -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - mng_retcode iRetcode; - mng_uint16 iNumplays; - mng_uint32 iBufsize; - mng_uint8p pBuf = 0; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MPNG, MNG_LC_START); -#endif - /* sequence checks */ - if (!pData->bHasIHDR) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 41) /* length must be at least 41 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iFramewidth = mng_get_int32 (pRawdata); - if (iFramewidth == 0) /* frame_width must not be zero */ - MNG_ERROR (pData, MNG_INVALIDWIDTH); - - iFrameheight = mng_get_int32 (pRawdata+4); - if (iFrameheight == 0) /* frame_height must not be zero */ - MNG_ERROR (pData, MNG_INVALIDHEIGHT); - - iTickspersec = mng_get_uint16 (pRawdata+10); - if (iTickspersec == 0) /* delay_den must not be zero */ - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - - if (*(pRawdata+12) != 0) /* only deflate compression-method allowed */ - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - iNumplays = mng_get_uint16 (pRawdata+8); - iCompressedsize = (mng_uint32)(iRawlen - 13); -#endif - -#ifdef MNG_SUPPORT_DISPLAY - { - iRetcode = mng_inflate_buffer (pData, pRawdata+13, iCompressedsize, - &pBuf, &iBufsize, &iFramessize); - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - if (iFramessize % 26) - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - iRetcode = mng_create_mpng_obj (pData, iFramewidth, iFrameheight, iNumplays, - iTickspersec, iFramessize, pBuf); - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_mpngp)*ppChunk)->iFramewidth = iFramewidth; - ((mng_mpngp)*ppChunk)->iFrameheight = iFrameheight; - ((mng_mpngp)*ppChunk)->iNumplays = iNumplays; - ((mng_mpngp)*ppChunk)->iTickspersec = iTickspersec; - ((mng_mpngp)*ppChunk)->iCompressionmethod = *(pRawdata+14); - -#ifndef MNG_SUPPORT_DISPLAY - iRetcode = mng_inflate_buffer (pData, pRawdata+13, iCompressedsize, - &pBuf, &iBufsize, &iFramessize); - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - if (iFramessize % 26) - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } -#endif - - if (iFramessize) - { - MNG_ALLOCX (pData, ((mng_mpngp)*ppChunk)->pFrames, iFramessize); - if (((mng_mpngp)*ppChunk)->pFrames == 0) - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - ((mng_mpngp)*ppChunk)->iFramessize = iFramessize; - MNG_COPY (((mng_mpngp)*ppChunk)->pFrames, pBuf, iFramessize); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - MNG_FREEX (pData, pBuf, iBufsize); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_evNT -READ_CHUNK (mng_read_evnt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EVNT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (pData->bHasSAVE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 2) /* must have at least 1 entry ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) - { - if (iRawlen) /* not empty ? */ - { - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iNamesize; - - pTemp = pRawdata; - iLen = iRawlen; - - while (iLen) /* anything left ? */ - { - iEventtype = *pTemp; /* eventtype */ - if (iEventtype > 5) - MNG_ERROR (pData, MNG_INVALIDEVENT); - - pTemp++; - - iMasktype = *pTemp; /* masktype */ - if (iMasktype > 5) - MNG_ERROR (pData, MNG_INVALIDMASK); - - pTemp++; - iLen -= 2; - - iLeft = 0; - iRight = 0; - iTop = 0; - iBottom = 0; - iObjectid = 0; - iIndex = 0; - - switch (iMasktype) - { - case 1 : - { - if (iLen > 16) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - pTemp += 16; - iLen -= 16; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 2 : - { - if (iLen > 2) - { - iObjectid = mng_get_uint16 (pTemp); - pTemp += 2; - iLen -= 2; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 3 : - { - if (iLen > 3) - { - iObjectid = mng_get_uint16 (pTemp); - iIndex = *(pTemp+2); - pTemp += 3; - iLen -= 3; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 4 : - { - if (iLen > 18) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - pTemp += 18; - iLen -= 18; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 5 : - { - if (iLen > 19) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - iIndex = *(pTemp+18); - pTemp += 19; - iLen -= 19; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - } - - pNull = find_null (pTemp); /* get the name length */ - - if ((pNull - pTemp) > (mng_int32)iLen) - { - iNamesize = iLen; /* no null found; so end of evNT */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen = iLen - iNamesize - 1; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - iRetcode = mng_create_event (pData, iEventtype, iMasktype, iLeft, iRight, - iTop, iBottom, iObjectid, iIndex, - iNamesize, (mng_pchar)pTemp); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pTemp = pTemp + iNamesize + 1; - } - } - } -#endif /* MNG_SUPPORT_DISPLAY && MNG_SUPPORT_DYNAMICMNG */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (iRawlen) /* not empty ? */ - { - mng_uint32 iX; - mng_uint32 iCount = 0; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iNamesize; - mng_evnt_entryp pEntry = MNG_NULL; - - for (iX = 0; iX < 2; iX++) /* do this twice to get the count first ! */ - { - pTemp = pRawdata; - iLen = iRawlen; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_evnt_entry))); - - ((mng_evntp)*ppChunk)->iCount = iCount; - ((mng_evntp)*ppChunk)->pEntries = pEntry; - } - - while (iLen) /* anything left ? */ - { - iEventtype = *pTemp; /* eventtype */ - if (iEventtype > 5) - MNG_ERROR (pData, MNG_INVALIDEVENT); - - pTemp++; - - iMasktype = *pTemp; /* masktype */ - if (iMasktype > 5) - MNG_ERROR (pData, MNG_INVALIDMASK); - - pTemp++; - iLen -= 2; - - iLeft = 0; - iRight = 0; - iTop = 0; - iBottom = 0; - iObjectid = 0; - iIndex = 0; - - switch (iMasktype) - { - case 1 : - { - if (iLen > 16) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - pTemp += 16; - iLen -= 16; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 2 : - { - if (iLen > 2) - { - iObjectid = mng_get_uint16 (pTemp); - pTemp += 2; - iLen -= 2; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 3 : - { - if (iLen > 3) - { - iObjectid = mng_get_uint16 (pTemp); - iIndex = *(pTemp+2); - pTemp += 3; - iLen -= 3; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 4 : - { - if (iLen > 18) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - pTemp += 18; - iLen -= 18; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 5 : - { - if (iLen > 19) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - iIndex = *(pTemp+18); - pTemp += 19; - iLen -= 19; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - } - - pNull = find_null (pTemp); /* get the name length */ - - if ((pNull - pTemp) > (mng_int32)iLen) - { - iNamesize = iLen; /* no null found; so end of evNT */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen = iLen - iNamesize - 1; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!iX) - { - iCount++; - } - else - { - pEntry->iEventtype = iEventtype; - pEntry->iMasktype = iMasktype; - pEntry->iLeft = iLeft; - pEntry->iRight = iRight; - pEntry->iTop = iTop; - pEntry->iBottom = iBottom; - pEntry->iObjectid = iObjectid; - pEntry->iIndex = iIndex; - pEntry->iSegmentnamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zSegmentname, iNamesize+1); - MNG_COPY (pEntry->zSegmentname, pTemp, iNamesize); - } - - pEntry++; - } - - pTemp = pTemp + iNamesize + 1; - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_UNKNOWN, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* critical chunk ? */ - if ((((mng_uint32)pData->iChunkname & 0x20000000) == 0) -#ifdef MNG_SKIPCHUNK_SAVE - && (pData->iChunkname != MNG_UINT_SAVE) -#endif -#ifdef MNG_SKIPCHUNK_SEEK - && (pData->iChunkname != MNG_UINT_SEEK) -#endif -#ifdef MNG_SKIPCHUNK_DBYK - && (pData->iChunkname != MNG_UINT_DBYK) -#endif -#ifdef MNG_SKIPCHUNK_ORDR - && (pData->iChunkname != MNG_UINT_ORDR) -#endif - ) - MNG_ERROR (pData, MNG_UNKNOWNCRITICAL); - - if (pData->fProcessunknown) /* let the app handle it ? */ - { - mng_bool bOke = pData->fProcessunknown ((mng_handle)pData, pData->iChunkname, - iRawlen, (mng_ptr)pRawdata); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the length */ - ((mng_chunk_headerp)*ppChunk)->iChunkname = pData->iChunkname; - ((mng_unknown_chunkp)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen == 0) /* any data at all ? */ - ((mng_unknown_chunkp)*ppChunk)->pData = 0; - else - { /* then store it */ - MNG_ALLOC (pData, ((mng_unknown_chunkp)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_unknown_chunkp)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ -/* * * */ -/* * chunk write functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_ihdr) -{ - mng_ihdrp pIHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IHDR, MNG_LC_START); -#endif - - pIHDR = (mng_ihdrp)pChunk; /* address the proper chunk */ - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 13; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pIHDR->iWidth); - mng_put_uint32 (pRawdata+4, pIHDR->iHeight); - - *(pRawdata+8) = pIHDR->iBitdepth; - *(pRawdata+9) = pIHDR->iColortype; - *(pRawdata+10) = pIHDR->iCompression; - *(pRawdata+11) = pIHDR->iFilter; - *(pRawdata+12) = pIHDR->iInterlace; - /* and write it */ - iRetcode = write_raw_chunk (pData, pIHDR->sHeader.iChunkname, iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IHDR, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_plte) -{ - mng_pltep pPLTE; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PLTE, MNG_LC_START); -#endif - - pPLTE = (mng_pltep)pChunk; /* address the proper chunk */ - - if (pPLTE->bEmpty) /* write empty chunk ? */ - iRetcode = write_raw_chunk (pData, pPLTE->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pPLTE->iEntrycount * 3; - /* fill the output buffer */ - pTemp = pRawdata; - - for (iX = 0; iX < pPLTE->iEntrycount; iX++) - { - *pTemp = pPLTE->aEntries [iX].iRed; - *(pTemp+1) = pPLTE->aEntries [iX].iGreen; - *(pTemp+2) = pPLTE->aEntries [iX].iBlue; - - pTemp += 3; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pPLTE->sHeader.iChunkname, iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PLTE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_idat) -{ - mng_idatp pIDAT; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IDAT, MNG_LC_START); -#endif - - pIDAT = (mng_idatp)pChunk; /* address the proper chunk */ - - if (pIDAT->bEmpty) /* and write it */ - iRetcode = write_raw_chunk (pData, pIDAT->sHeader.iChunkname, 0, 0); - else - iRetcode = write_raw_chunk (pData, pIDAT->sHeader.iChunkname, - pIDAT->iDatasize, pIDAT->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IDAT, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_iend) -{ - mng_iendp pIEND; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IEND, MNG_LC_START); -#endif - - pIEND = (mng_iendp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pIEND->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IEND, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_trns) -{ - mng_trnsp pTRNS; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TRNS, MNG_LC_START); -#endif - - pTRNS = (mng_trnsp)pChunk; /* address the proper chunk */ - - if (pTRNS->bEmpty) /* write empty chunk ? */ - iRetcode = write_raw_chunk (pData, pTRNS->sHeader.iChunkname, 0, 0); - else - if (pTRNS->bGlobal) /* write global chunk ? */ - iRetcode = write_raw_chunk (pData, pTRNS->sHeader.iChunkname, - pTRNS->iRawlen, (mng_uint8p)pTRNS->aRawdata); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer */ - iRawlen = 0; /* and default size */ - - switch (pTRNS->iType) - { - case 0: { - iRawlen = 2; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pTRNS->iGray); - - break; - } - case 2: { - iRawlen = 6; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pTRNS->iRed); - mng_put_uint16 (pRawdata+2, pTRNS->iGreen); - mng_put_uint16 (pRawdata+4, pTRNS->iBlue); - - break; - } - case 3: { /* init output buffer size */ - iRawlen = pTRNS->iCount; - - pTemp = pRawdata; /* fill the output buffer */ - - for (iX = 0; iX < pTRNS->iCount; iX++) - { - *pTemp = pTRNS->aEntries[iX]; - pTemp++; - } - - break; - } - } - /* write the chunk */ - iRetcode = write_raw_chunk (pData, pTRNS->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TRNS, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_gama) -{ - mng_gamap pGAMA; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GAMA, MNG_LC_START); -#endif - - pGAMA = (mng_gamap)pChunk; /* address the proper chunk */ - - if (pGAMA->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pGAMA->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 4; - /* fill the buffer */ - mng_put_uint32 (pRawdata, pGAMA->iGamma); - /* and write it */ - iRetcode = write_raw_chunk (pData, pGAMA->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GAMA, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -WRITE_CHUNK (mng_write_chrm) -{ - mng_chrmp pCHRM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CHRM, MNG_LC_START); -#endif - - pCHRM = (mng_chrmp)pChunk; /* address the proper chunk */ - - if (pCHRM->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pCHRM->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 32; - /* fill the buffer */ - mng_put_uint32 (pRawdata, pCHRM->iWhitepointx); - mng_put_uint32 (pRawdata+4, pCHRM->iWhitepointy); - mng_put_uint32 (pRawdata+8, pCHRM->iRedx); - mng_put_uint32 (pRawdata+12, pCHRM->iRedy); - mng_put_uint32 (pRawdata+16, pCHRM->iGreenx); - mng_put_uint32 (pRawdata+20, pCHRM->iGreeny); - mng_put_uint32 (pRawdata+24, pCHRM->iBluex); - mng_put_uint32 (pRawdata+28, pCHRM->iBluey); - /* and write it */ - iRetcode = write_raw_chunk (pData, pCHRM->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CHRM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_srgb) -{ - mng_srgbp pSRGB; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SRGB, MNG_LC_START); -#endif - - pSRGB = (mng_srgbp)pChunk; /* address the proper chunk */ - - if (pSRGB->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pSRGB->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - /* fill the buffer */ - *pRawdata = pSRGB->iRenderingintent; - /* and write it */ - iRetcode = write_raw_chunk (pData, pSRGB->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SRGB, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -WRITE_CHUNK (mng_write_iccp) -{ - mng_iccpp pICCP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ICCP, MNG_LC_START); -#endif - - pICCP = (mng_iccpp)pChunk; /* address the proper chunk */ - - if (pICCP->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pICCP->sHeader.iChunkname, 0, 0); - else - { /* compress the profile */ - iRetcode = deflate_buffer (pData, pICCP->pProfile, pICCP->iProfilesize, - &pBuf, &iBuflen, &iReallen); - - if (!iRetcode) /* still oke ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pICCP->iNamesize + 2 + iReallen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pICCP->iNamesize) - { - MNG_COPY (pTemp, pICCP->zName, pICCP->iNamesize); - pTemp += pICCP->iNamesize; - } - - *pTemp = 0; - *(pTemp+1) = pICCP->iCompression; - pTemp += 2; - - if (iReallen) - MNG_COPY (pTemp, pBuf, iReallen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pICCP->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the extra buffer */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ICCP, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -WRITE_CHUNK (mng_write_text) -{ - mng_textp pTEXT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TEXT, MNG_LC_START); -#endif - - pTEXT = (mng_textp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pTEXT->iKeywordsize + 1 + pTEXT->iTextsize; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pTEXT->iKeywordsize) - { - MNG_COPY (pTemp, pTEXT->zKeyword, pTEXT->iKeywordsize); - pTemp += pTEXT->iKeywordsize; - } - - *pTemp = 0; - pTemp += 1; - - if (pTEXT->iTextsize) - MNG_COPY (pTemp, pTEXT->zText, pTEXT->iTextsize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pTEXT->sHeader.iChunkname, - iRawlen, pRawdata); - - if (iRawlen > pData->iWritebufsize) /* drop the temp buffer ? */ - MNG_FREEX (pData, pRawdata, iRawlen); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TEXT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -WRITE_CHUNK (mng_write_ztxt) -{ - mng_ztxtp pZTXT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ZTXT, MNG_LC_START); -#endif - - pZTXT = (mng_ztxtp)pChunk; /* address the proper chunk */ - /* compress the text */ - iRetcode = deflate_buffer (pData, (mng_uint8p)pZTXT->zText, pZTXT->iTextsize, - &pBuf, &iBuflen, &iReallen); - - if (!iRetcode) /* all ok ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pZTXT->iKeywordsize + 2 + iReallen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pZTXT->iKeywordsize) - { - MNG_COPY (pTemp, pZTXT->zKeyword, pZTXT->iKeywordsize); - pTemp += pZTXT->iKeywordsize; - } - - *pTemp = 0; /* terminator zero */ - pTemp++; - *pTemp = 0; /* compression type */ - pTemp++; - - if (iReallen) - MNG_COPY (pTemp, pBuf, iReallen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pZTXT->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the compression buffer */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ZTXT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -WRITE_CHUNK (mng_write_itxt) -{ - mng_itxtp pITXT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ITXT, MNG_LC_START); -#endif - - pITXT = (mng_itxtp)pChunk; /* address the proper chunk */ - - if (pITXT->iCompressionflag) /* compress the text */ - iRetcode = deflate_buffer (pData, (mng_uint8p)pITXT->zText, pITXT->iTextsize, - &pBuf, &iBuflen, &iReallen); - else - iRetcode = MNG_NOERROR; - - if (!iRetcode) /* all ok ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pITXT->iKeywordsize + pITXT->iLanguagesize + - pITXT->iTranslationsize + 5; - - if (pITXT->iCompressionflag) - iRawlen = iRawlen + iReallen; - else - iRawlen = iRawlen + pITXT->iTextsize; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pITXT->iKeywordsize) - { - MNG_COPY (pTemp, pITXT->zKeyword, pITXT->iKeywordsize); - pTemp += pITXT->iKeywordsize; - } - - *pTemp = 0; - pTemp++; - *pTemp = pITXT->iCompressionflag; - pTemp++; - *pTemp = pITXT->iCompressionmethod; - pTemp++; - - if (pITXT->iLanguagesize) - { - MNG_COPY (pTemp, pITXT->zLanguage, pITXT->iLanguagesize); - pTemp += pITXT->iLanguagesize; - } - - *pTemp = 0; - pTemp++; - - if (pITXT->iTranslationsize) - { - MNG_COPY (pTemp, pITXT->zTranslation, pITXT->iTranslationsize); - pTemp += pITXT->iTranslationsize; - } - - *pTemp = 0; - pTemp++; - - if (pITXT->iCompressionflag) - { - if (iReallen) - MNG_COPY (pTemp, pBuf, iReallen); - } - else - { - if (pITXT->iTextsize) - MNG_COPY (pTemp, pITXT->zText, pITXT->iTextsize); - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pITXT->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the compression buffer */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -WRITE_CHUNK (mng_write_bkgd) -{ - mng_bkgdp pBKGD; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BKGD, MNG_LC_START); -#endif - - pBKGD = (mng_bkgdp)pChunk; /* address the proper chunk */ - - if (pBKGD->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pBKGD->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 0; /* and default size */ - - switch (pBKGD->iType) - { - case 0: { /* gray */ - iRawlen = 2; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pBKGD->iGray); - - break; - } - case 2: { /* rgb */ - iRawlen = 6; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pBKGD->iRed); - mng_put_uint16 (pRawdata+2, pBKGD->iGreen); - mng_put_uint16 (pRawdata+4, pBKGD->iBlue); - - break; - } - case 3: { /* indexed */ - iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pBKGD->iIndex; - - break; - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pBKGD->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BKGD, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -WRITE_CHUNK (mng_write_phys) -{ - mng_physp pPHYS; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYS, MNG_LC_START); -#endif - - pPHYS = (mng_physp)pChunk; /* address the proper chunk */ - - if (pPHYS->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pPHYS->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 9; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pPHYS->iSizex); - mng_put_uint32 (pRawdata+4, pPHYS->iSizey); - - *(pRawdata+8) = pPHYS->iUnit; - /* and write it */ - iRetcode = write_raw_chunk (pData, pPHYS->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYS, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -WRITE_CHUNK (mng_write_sbit) -{ - mng_sbitp pSBIT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SBIT, MNG_LC_START); -#endif - - pSBIT = (mng_sbitp)pChunk; /* address the proper chunk */ - - if (pSBIT->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pSBIT->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 0; /* and default size */ - - switch (pSBIT->iType) - { - case 0: { /* gray */ - iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - - break; - } - case 2: { /* rgb */ - iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - - break; - } - case 3: { /* indexed */ - iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *pRawdata = pSBIT->aBits[1]; - *pRawdata = pSBIT->aBits[2]; - - break; - } - case 4: { /* gray + alpha */ - iRawlen = 2; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - - break; - } - case 6: { /* rgb + alpha */ - iRawlen = 4; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - *(pRawdata+3) = pSBIT->aBits[3]; - - break; - } - case 10: { /* jpeg gray */ - iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - - break; - } - case 12: { /* jpeg rgb */ - iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - - break; - } - case 14: { /* jpeg gray + alpha */ - iRawlen = 2; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - - break; - } - case 16: { /* jpeg rgb + alpha */ - iRawlen = 4; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - *(pRawdata+3) = pSBIT->aBits[3]; - - break; - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pSBIT->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SBIT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -WRITE_CHUNK (mng_write_splt) -{ - mng_spltp pSPLT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint32 iEntrieslen; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SPLT, MNG_LC_START); -#endif - - pSPLT = (mng_spltp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iEntrieslen = ((pSPLT->iSampledepth >> 3) * 4 + 2) * pSPLT->iEntrycount; - iRawlen = pSPLT->iNamesize + 2 + iEntrieslen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pSPLT->iNamesize) - { - MNG_COPY (pTemp, pSPLT->zName, pSPLT->iNamesize); - pTemp += pSPLT->iNamesize; - } - - *pTemp = 0; - *(pTemp+1) = pSPLT->iSampledepth; - pTemp += 2; - - if (pSPLT->iEntrycount) - MNG_COPY (pTemp, pSPLT->pEntries, iEntrieslen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pSPLT->sHeader.iChunkname, - iRawlen, pRawdata); - - if (iRawlen > pData->iWritebufsize) /* drop the temp buffer ? */ - MNG_FREEX (pData, pRawdata, iRawlen); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SPLT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -WRITE_CHUNK (mng_write_hist) -{ - mng_histp pHIST; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_HIST, MNG_LC_START); -#endif - - pHIST = (mng_histp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pHIST->iEntrycount << 1; - - pTemp = pRawdata; /* fill the output buffer */ - - for (iX = 0; iX < pHIST->iEntrycount; iX++) - { - mng_put_uint16 (pTemp, pHIST->aEntries [iX]); - pTemp += 2; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pHIST->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_HIST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -WRITE_CHUNK (mng_write_time) -{ - mng_timep pTIME; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TIME, MNG_LC_START); -#endif - - pTIME = (mng_timep)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 7; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pTIME->iYear); - - *(pRawdata+2) = pTIME->iMonth; - *(pRawdata+3) = pTIME->iDay; - *(pRawdata+4) = pTIME->iHour; - *(pRawdata+5) = pTIME->iMinute; - *(pRawdata+6) = pTIME->iSecond; - /* and write it */ - iRetcode = write_raw_chunk (pData, pTIME->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TIME, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_mhdr) -{ - mng_mhdrp pMHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MHDR, MNG_LC_START); -#endif - - pMHDR = (mng_mhdrp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 28; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pMHDR->iWidth); - mng_put_uint32 (pRawdata+4, pMHDR->iHeight); - mng_put_uint32 (pRawdata+8, pMHDR->iTicks); - mng_put_uint32 (pRawdata+12, pMHDR->iLayercount); - mng_put_uint32 (pRawdata+16, pMHDR->iFramecount); - mng_put_uint32 (pRawdata+20, pMHDR->iPlaytime); - mng_put_uint32 (pRawdata+24, pMHDR->iSimplicity); - - /* and write it */ - iRetcode = write_raw_chunk (pData, pMHDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MHDR, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_mend) -{ - mng_mendp pMEND; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MEND, MNG_LC_START); -#endif - - pMEND = (mng_mendp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pMEND->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MEND, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_loop) -{ - mng_loopp pLOOP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - mng_uint8p pTemp1; - mng_uint32p pTemp2; - mng_uint32 iX; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_LOOP, MNG_LC_START); -#endif - - pLOOP = (mng_loopp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 5; - /* fill the output buffer */ - *pRawdata = pLOOP->iLevel; - mng_put_uint32 (pRawdata+1, pLOOP->iRepeat); - - if (pLOOP->iTermination) - { - iRawlen++; - *(pRawdata+5) = pLOOP->iTermination; - - if ((pLOOP->iCount) || - (pLOOP->iItermin != 1) || (pLOOP->iItermax != 0x7FFFFFFFL)) - { - iRawlen += 8; - - mng_put_uint32 (pRawdata+6, pLOOP->iItermin); - mng_put_uint32 (pRawdata+10, pLOOP->iItermax); - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (pLOOP->iCount) - { - iRawlen += pLOOP->iCount * 4; - - pTemp1 = pRawdata+14; - pTemp2 = pLOOP->pSignals; - - for (iX = 0; iX < pLOOP->iCount; iX++) - { - mng_put_uint32 (pTemp1, *pTemp2); - - pTemp1 += 4; - pTemp2++; - } - } -#endif - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pLOOP->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_LOOP, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_endl) -{ - mng_endlp pENDL; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ENDL, MNG_LC_START); -#endif - - pENDL = (mng_endlp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pENDL->iLevel; /* fill the output buffer */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pENDL->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ENDL, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_defi) -{ - mng_defip pDEFI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DEFI, MNG_LC_START); -#endif - - pDEFI = (mng_defip)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pDEFI->iObjectid); - - if ((pDEFI->iDonotshow) || (pDEFI->iConcrete) || (pDEFI->bHasloca) || (pDEFI->bHasclip)) - { - iRawlen++; - *(pRawdata+2) = pDEFI->iDonotshow; - - if ((pDEFI->iConcrete) || (pDEFI->bHasloca) || (pDEFI->bHasclip)) - { - iRawlen++; - *(pRawdata+3) = pDEFI->iConcrete; - - if ((pDEFI->bHasloca) || (pDEFI->bHasclip)) - { - iRawlen += 8; - - mng_put_uint32 (pRawdata+4, pDEFI->iXlocation); - mng_put_uint32 (pRawdata+8, pDEFI->iYlocation); - - if (pDEFI->bHasclip) - { - iRawlen += 16; - - mng_put_uint32 (pRawdata+12, pDEFI->iLeftcb); - mng_put_uint32 (pRawdata+16, pDEFI->iRightcb); - mng_put_uint32 (pRawdata+20, pDEFI->iTopcb); - mng_put_uint32 (pRawdata+24, pDEFI->iBottomcb); - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDEFI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DEFI, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_basi) -{ - mng_basip pBASI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_bool bOpaque; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BASI, MNG_LC_START); -#endif - - pBASI = (mng_basip)pChunk; /* address the proper chunk */ - -#ifndef MNG_NO_16BIT_SUPPORT - if (pBASI->iBitdepth <= 8) /* determine opacity alpha-field */ -#endif - bOpaque = (mng_bool)(pBASI->iAlpha == 0xFF); -#ifndef MNG_NO_16BIT_SUPPORT - else - bOpaque = (mng_bool)(pBASI->iAlpha == 0xFFFF); -#endif - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 13; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pBASI->iWidth); - mng_put_uint32 (pRawdata+4, pBASI->iHeight); - - *(pRawdata+8) = pBASI->iBitdepth; - *(pRawdata+9) = pBASI->iColortype; - *(pRawdata+10) = pBASI->iCompression; - *(pRawdata+11) = pBASI->iFilter; - *(pRawdata+12) = pBASI->iInterlace; - - if ((pBASI->iRed) || (pBASI->iGreen) || (pBASI->iBlue) || - (!bOpaque) || (pBASI->iViewable)) - { - iRawlen += 6; - mng_put_uint16 (pRawdata+13, pBASI->iRed); - mng_put_uint16 (pRawdata+15, pBASI->iGreen); - mng_put_uint16 (pRawdata+17, pBASI->iBlue); - - if ((!bOpaque) || (pBASI->iViewable)) - { - iRawlen += 2; - mng_put_uint16 (pRawdata+19, pBASI->iAlpha); - - if (pBASI->iViewable) - { - iRawlen++; - *(pRawdata+21) = pBASI->iViewable; - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pBASI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BASI, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_clon) -{ - mng_clonp pCLON; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLON, MNG_LC_START); -#endif - - pCLON = (mng_clonp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 4; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pCLON->iSourceid); - mng_put_uint16 (pRawdata+2, pCLON->iCloneid); - - if ((pCLON->iClonetype) || (pCLON->iDonotshow) || (pCLON->iConcrete) || (pCLON->bHasloca)) - { - iRawlen++; - *(pRawdata+4) = pCLON->iClonetype; - - if ((pCLON->iDonotshow) || (pCLON->iConcrete) || (pCLON->bHasloca)) - { - iRawlen++; - *(pRawdata+5) = pCLON->iDonotshow; - - if ((pCLON->iConcrete) || (pCLON->bHasloca)) - { - iRawlen++; - *(pRawdata+6) = pCLON->iConcrete; - - if (pCLON->bHasloca) - { - iRawlen += 9; - *(pRawdata+7) = pCLON->iLocationtype; - mng_put_int32 (pRawdata+8, pCLON->iLocationx); - mng_put_int32 (pRawdata+12, pCLON->iLocationy); - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pCLON->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLON, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -WRITE_CHUNK (mng_write_past) -{ - mng_pastp pPAST; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_past_sourcep pSource; - mng_uint32 iX; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PAST, MNG_LC_START); -#endif - - pPAST = (mng_pastp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 11 + (30 * pPAST->iCount); - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pPAST->iDestid); - - *(pRawdata+2) = pPAST->iTargettype; - - mng_put_int32 (pRawdata+3, pPAST->iTargetx); - mng_put_int32 (pRawdata+7, pPAST->iTargety); - - pTemp = pRawdata+11; - pSource = pPAST->pSources; - - for (iX = 0; iX < pPAST->iCount; iX++) - { - mng_put_uint16 (pTemp, pSource->iSourceid); - - *(pTemp+2) = pSource->iComposition; - *(pTemp+3) = pSource->iOrientation; - *(pTemp+4) = pSource->iOffsettype; - - mng_put_int32 (pTemp+5, pSource->iOffsetx); - mng_put_int32 (pTemp+9, pSource->iOffsety); - - *(pTemp+13) = pSource->iBoundarytype; - - mng_put_int32 (pTemp+14, pSource->iBoundaryl); - mng_put_int32 (pTemp+18, pSource->iBoundaryr); - mng_put_int32 (pTemp+22, pSource->iBoundaryt); - mng_put_int32 (pTemp+26, pSource->iBoundaryb); - - pSource++; - pTemp += 30; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pPAST->sHeader.iChunkname, - iRawlen, pRawdata); - /* free temporary buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PAST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_disc) -{ - mng_discp pDISC; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint32 iX; - mng_uint8p pTemp1; - mng_uint16p pTemp2; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DISC, MNG_LC_START); -#endif - - pDISC = (mng_discp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pDISC->iCount << 1; - - pTemp1 = pRawdata; /* fill the output buffer */ - pTemp2 = pDISC->pObjectids; - - for (iX = 0; iX < pDISC->iCount; iX++) - { - mng_put_uint16 (pTemp1, *pTemp2); - - pTemp2++; - pTemp1 += 2; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDISC->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DISC, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_back) -{ - mng_backp pBACK; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BACK, MNG_LC_START); -#endif - - pBACK = (mng_backp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 6; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pBACK->iRed); - mng_put_uint16 (pRawdata+2, pBACK->iGreen); - mng_put_uint16 (pRawdata+4, pBACK->iBlue); - - if ((pBACK->iMandatory) || (pBACK->iImageid) || (pBACK->iTile)) - { - iRawlen++; - *(pRawdata+6) = pBACK->iMandatory; - - if ((pBACK->iImageid) || (pBACK->iTile)) - { - iRawlen += 2; - mng_put_uint16 (pRawdata+7, pBACK->iImageid); - - if (pBACK->iTile) - { - iRawlen++; - *(pRawdata+9) = pBACK->iTile; - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pBACK->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BACK, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_fram) -{ - mng_framp pFRAM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32p pTemp2; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FRAM, MNG_LC_START); -#endif - - pFRAM = (mng_framp)pChunk; /* address the proper chunk */ - - if (pFRAM->bEmpty) /* empty ? */ - iRetcode = write_raw_chunk (pData, pFRAM->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - /* fill the output buffer */ - *pRawdata = pFRAM->iMode; - - if ((pFRAM->iNamesize ) || - (pFRAM->iChangedelay ) || (pFRAM->iChangetimeout) || - (pFRAM->iChangeclipping) || (pFRAM->iChangesyncid ) ) - { - if (pFRAM->iNamesize) - MNG_COPY (pRawdata+1, pFRAM->zName, pFRAM->iNamesize); - - iRawlen += pFRAM->iNamesize; - pTemp = pRawdata + pFRAM->iNamesize + 1; - - if ((pFRAM->iChangedelay ) || (pFRAM->iChangetimeout) || - (pFRAM->iChangeclipping) || (pFRAM->iChangesyncid ) ) - { - *pTemp = 0; - *(pTemp+1) = pFRAM->iChangedelay; - *(pTemp+2) = pFRAM->iChangetimeout; - *(pTemp+3) = pFRAM->iChangeclipping; - *(pTemp+4) = pFRAM->iChangesyncid; - - iRawlen += 5; - pTemp += 5; - - if (pFRAM->iChangedelay) - { - mng_put_uint32 (pTemp, pFRAM->iDelay); - iRawlen += 4; - pTemp += 4; - } - - if (pFRAM->iChangetimeout) - { - mng_put_uint32 (pTemp, pFRAM->iTimeout); - iRawlen += 4; - pTemp += 4; - } - - if (pFRAM->iChangeclipping) - { - *pTemp = pFRAM->iBoundarytype; - - mng_put_uint32 (pTemp+1, pFRAM->iBoundaryl); - mng_put_uint32 (pTemp+5, pFRAM->iBoundaryr); - mng_put_uint32 (pTemp+9, pFRAM->iBoundaryt); - mng_put_uint32 (pTemp+13, pFRAM->iBoundaryb); - - iRawlen += 17; - pTemp += 17; - } - - if (pFRAM->iChangesyncid) - { - iRawlen += pFRAM->iCount * 4; - pTemp2 = pFRAM->pSyncids; - - for (iX = 0; iX < pFRAM->iCount; iX++) - { - mng_put_uint32 (pTemp, *pTemp2); - - pTemp2++; - pTemp += 4; - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pFRAM->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_move) -{ - mng_movep pMOVE; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MOVE, MNG_LC_START); -#endif - - pMOVE = (mng_movep)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 13; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pMOVE->iFirstid); - mng_put_uint16 (pRawdata+2, pMOVE->iLastid); - - *(pRawdata+4) = pMOVE->iMovetype; - - mng_put_int32 (pRawdata+5, pMOVE->iMovex); - mng_put_int32 (pRawdata+9, pMOVE->iMovey); - /* and write it */ - iRetcode = write_raw_chunk (pData, pMOVE->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MOVE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_clip) -{ - mng_clipp pCLIP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLIP, MNG_LC_START); -#endif - - pCLIP = (mng_clipp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 21; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pCLIP->iFirstid); - mng_put_uint16 (pRawdata+2, pCLIP->iLastid); - - *(pRawdata+4) = pCLIP->iCliptype; - - mng_put_int32 (pRawdata+5, pCLIP->iClipl); - mng_put_int32 (pRawdata+9, pCLIP->iClipr); - mng_put_int32 (pRawdata+13, pCLIP->iClipt); - mng_put_int32 (pRawdata+17, pCLIP->iClipb); - /* and write it */ - iRetcode = write_raw_chunk (pData, pCLIP->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLIP, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_show) -{ - mng_showp pSHOW; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SHOW, MNG_LC_START); -#endif - - pSHOW = (mng_showp)pChunk; /* address the proper chunk */ - - if (pSHOW->bEmpty) /* empty ? */ - iRetcode = write_raw_chunk (pData, pSHOW->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pSHOW->iFirstid); - - if ((pSHOW->iLastid != pSHOW->iFirstid) || (pSHOW->iMode)) - { - iRawlen += 2; - mng_put_uint16 (pRawdata+2, pSHOW->iLastid); - - if (pSHOW->iMode) - { - iRawlen++; - *(pRawdata+4) = pSHOW->iMode; - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pSHOW->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SHOW, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_term) -{ - mng_termp pTERM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TERM, MNG_LC_START); -#endif - - pTERM = (mng_termp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pTERM->iTermaction; /* fill the output buffer */ - - if (pTERM->iTermaction == 3) - { - iRawlen = 10; - *(pRawdata+1) = pTERM->iIteraction; - - mng_put_uint32 (pRawdata+2, pTERM->iDelay); - mng_put_uint32 (pRawdata+6, pTERM->iItermax); - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pTERM->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TERM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -WRITE_CHUNK (mng_write_save) -{ - mng_savep pSAVE; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_save_entryp pEntry; - mng_uint32 iEntrysize; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SAVE, MNG_LC_START); -#endif - - pSAVE = (mng_savep)pChunk; /* address the proper chunk */ - - if (pSAVE->bEmpty) /* empty ? */ - iRetcode = write_raw_chunk (pData, pSAVE->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pSAVE->iOffsettype; /* fill the output buffer */ - - if (pSAVE->iOffsettype == 16) - iEntrysize = 25; - else - iEntrysize = 17; - - pTemp = pRawdata+1; - pEntry = pSAVE->pEntries; - - for (iX = 0; iX < pSAVE->iCount; iX++) - { - if (iX) /* put separator null-byte, except the first */ - { - *pTemp = 0; - pTemp++; - iRawlen++; - } - - iRawlen += iEntrysize + pEntry->iNamesize; - *pTemp = pEntry->iEntrytype; - - if (pSAVE->iOffsettype == 16) - { - mng_put_uint32 (pTemp+1, pEntry->iOffset[0]); - mng_put_uint32 (pTemp+5, pEntry->iOffset[1]); - mng_put_uint32 (pTemp+9, pEntry->iStarttime[0]); - mng_put_uint32 (pTemp+13, pEntry->iStarttime[1]); - mng_put_uint32 (pTemp+17, pEntry->iLayernr); - mng_put_uint32 (pTemp+21, pEntry->iFramenr); - - pTemp += 25; - } - else - { - mng_put_uint32 (pTemp+1, pEntry->iOffset[1]); - mng_put_uint32 (pTemp+5, pEntry->iStarttime[1]); - mng_put_uint32 (pTemp+9, pEntry->iLayernr); - mng_put_uint32 (pTemp+13, pEntry->iFramenr); - - pTemp += 17; - } - - if (pEntry->iNamesize) - { - MNG_COPY (pTemp, pEntry->zName, pEntry->iNamesize); - pTemp += pEntry->iNamesize; - } - - pEntry++; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pSAVE->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SAVE, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -WRITE_CHUNK (mng_write_seek) -{ - mng_seekp pSEEK; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SEEK, MNG_LC_START); -#endif - - pSEEK = (mng_seekp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pSEEK->iNamesize; - - if (iRawlen) /* fill the output buffer */ - MNG_COPY (pRawdata, pSEEK->zName, iRawlen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pSEEK->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SEEK, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -WRITE_CHUNK (mng_write_expi) -{ - mng_expip pEXPI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EXPI, MNG_LC_START); -#endif - - pEXPI = (mng_expip)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2 + pEXPI->iNamesize; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pEXPI->iSnapshotid); - - if (pEXPI->iNamesize) - MNG_COPY (pRawdata+2, pEXPI->zName, pEXPI->iNamesize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pEXPI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EXPI, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -WRITE_CHUNK (mng_write_fpri) -{ - mng_fprip pFPRI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FPRI, MNG_LC_START); -#endif - - pFPRI = (mng_fprip)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2; - - *pRawdata = pFPRI->iDeltatype; /* fill the output buffer */ - *(pRawdata+1) = pFPRI->iPriority; - /* and write it */ - iRetcode = write_raw_chunk (pData, pFPRI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FPRI, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -WRITE_CHUNK (mng_write_need) -{ - mng_needp pNEED; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_NEED, MNG_LC_START); -#endif - - pNEED = (mng_needp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pNEED->iKeywordssize; - /* fill the output buffer */ - if (pNEED->iKeywordssize) - MNG_COPY (pRawdata, pNEED->zKeywords, pNEED->iKeywordssize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pNEED->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_NEED, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -WRITE_CHUNK (mng_write_phyg) -{ - mng_phygp pPHYG; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYG, MNG_LC_START); -#endif - - pPHYG = (mng_phygp)pChunk; /* address the proper chunk */ - - if (pPHYG->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pPHYG->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 9; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pPHYG->iSizex); - mng_put_uint32 (pRawdata+4, pPHYG->iSizey); - - *(pRawdata+8) = pPHYG->iUnit; - /* and write it */ - iRetcode = write_raw_chunk (pData, pPHYG->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -/* B004 */ -#ifdef MNG_INCLUDE_JNG -/* B004 */ -WRITE_CHUNK (mng_write_jhdr) -{ - mng_jhdrp pJHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JHDR, MNG_LC_START); -#endif - - pJHDR = (mng_jhdrp)pChunk; /* address the proper chunk */ - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 16; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pJHDR->iWidth); - mng_put_uint32 (pRawdata+4, pJHDR->iHeight); - - *(pRawdata+8) = pJHDR->iColortype; - *(pRawdata+9) = pJHDR->iImagesampledepth; - *(pRawdata+10) = pJHDR->iImagecompression; - *(pRawdata+11) = pJHDR->iImageinterlace; - *(pRawdata+12) = pJHDR->iAlphasampledepth; - *(pRawdata+13) = pJHDR->iAlphacompression; - *(pRawdata+14) = pJHDR->iAlphafilter; - *(pRawdata+15) = pJHDR->iAlphainterlace; - /* and write it */ - iRetcode = write_raw_chunk (pData, pJHDR->sHeader.iChunkname, iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jhdr 0 -/* B004 */ -#endif /* MNG_INCLUDE_JNG */ -/* B004 */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_jdaa) -{ - mng_jdatp pJDAA; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAA, MNG_LC_START); -#endif - - pJDAA = (mng_jdaap)pChunk; /* address the proper chunk */ - - if (pJDAA->bEmpty) /* and write it */ - iRetcode = write_raw_chunk (pData, pJDAA->sHeader.iChunkname, 0, 0); - else - iRetcode = write_raw_chunk (pData, pJDAA->sHeader.iChunkname, - pJDAA->iDatasize, pJDAA->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAA, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jdaa 0 -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -/* B004 */ -#ifdef MNG_INCLUDE_JNG -/* B004 */ -WRITE_CHUNK (mng_write_jdat) -{ - mng_jdatp pJDAT; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAT, MNG_LC_START); -#endif - - pJDAT = (mng_jdatp)pChunk; /* address the proper chunk */ - - if (pJDAT->bEmpty) /* and write it */ - iRetcode = write_raw_chunk (pData, pJDAT->sHeader.iChunkname, 0, 0); - else - iRetcode = write_raw_chunk (pData, pJDAT->sHeader.iChunkname, - pJDAT->iDatasize, pJDAT->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAT, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jdat 0 -/* B004 */ -#endif /* MNG_INCLUDE_JNG */ -/* B004 */ - -/* ************************************************************************** */ - -/* B004 */ -#ifdef MNG_INCLUDE_JNG -/* B004 */ -WRITE_CHUNK (mng_write_jsep) -{ - mng_jsepp pJSEP; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JSEP, MNG_LC_START); -#endif - - pJSEP = (mng_jsepp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pJSEP->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JSEP, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jsep 0 -/* B004 */ -#endif /* MNG_INCLUDE_JNG */ -/* B004 */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_dhdr) -{ - mng_dhdrp pDHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DHDR, MNG_LC_START); -#endif - - pDHDR = (mng_dhdrp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 4; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pDHDR->iObjectid); - - *(pRawdata+2) = pDHDR->iImagetype; - *(pRawdata+3) = pDHDR->iDeltatype; - - if (pDHDR->iDeltatype != 7) - { - iRawlen += 8; - mng_put_uint32 (pRawdata+4, pDHDR->iBlockwidth); - mng_put_uint32 (pRawdata+8, pDHDR->iBlockheight); - - if (pDHDR->iDeltatype != 0) - { - iRawlen += 8; - mng_put_uint32 (pRawdata+12, pDHDR->iBlockx); - mng_put_uint32 (pRawdata+16, pDHDR->iBlocky); - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDHDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_prom) -{ - mng_promp pPROM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PROM, MNG_LC_START); -#endif - - pPROM = (mng_promp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 3; - - *pRawdata = pPROM->iColortype; /* fill the output buffer */ - *(pRawdata+1) = pPROM->iSampledepth; - *(pRawdata+2) = pPROM->iFilltype; - /* and write it */ - iRetcode = write_raw_chunk (pData, pPROM->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PROM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_ipng) -{ - mng_ipngp pIPNG; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IPNG, MNG_LC_START); -#endif - - pIPNG = (mng_ipngp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pIPNG->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IPNG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_pplt) -{ - mng_ppltp pPPLT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_pplt_entryp pEntry; - mng_uint8p pTemp; - mng_uint32 iX; - mng_bool bHasgroup; - mng_uint8p pLastid = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PPLT, MNG_LC_START); -#endif - - pPPLT = (mng_ppltp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pPPLT->iDeltatype; /* fill the output buffer */ - - pTemp = pRawdata+1; - bHasgroup = MNG_FALSE; - - for (iX = 0; iX < pPPLT->iCount; iX++) - { - pEntry = &pPPLT->aEntries[iX]; - - if (pEntry->bUsed) /* valid entry ? */ - { - if (!bHasgroup) /* start a new group ? */ - { - bHasgroup = MNG_TRUE; - pLastid = pTemp+1; - - *pTemp = (mng_uint8)iX; - *(pTemp+1) = 0; - - pTemp += 2; - iRawlen += 2; - } - - switch (pPPLT->iDeltatype) /* add group-entry depending on type */ - { - case 0: ; - case 1: { - *pTemp = pEntry->iRed; - *(pTemp+1) = pEntry->iGreen; - *(pTemp+2) = pEntry->iBlue; - - pTemp += 3; - iRawlen += 3; - - break; - } - - case 2: ; - case 3: { - *pTemp = pEntry->iAlpha; - - pTemp++; - iRawlen++; - - break; - } - - case 4: ; - case 5: { - *pTemp = pEntry->iRed; - *(pTemp+1) = pEntry->iGreen; - *(pTemp+2) = pEntry->iBlue; - *(pTemp+3) = pEntry->iAlpha; - - pTemp += 4; - iRawlen += 4; - - break; - } - - } - } - else - { - if (bHasgroup) /* finish off a group ? */ - *pLastid = (mng_uint8)(iX-1); - - bHasgroup = MNG_FALSE; - } - } - - if (bHasgroup) /* last group unfinished ? */ - *pLastid = (mng_uint8)(pPPLT->iCount-1); - /* write the output buffer */ - iRetcode = write_raw_chunk (pData, pPPLT->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PPLT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_ijng) -{ - mng_ijngp pIJNG; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IJNG, MNG_LC_START); -#endif - - pIJNG = (mng_ijngp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pIJNG->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IJNG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_drop) -{ - mng_dropp pDROP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint32 iX; - mng_uint8p pTemp1; - mng_chunkidp pTemp2; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DROP, MNG_LC_START); -#endif - - pDROP = (mng_dropp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pDROP->iCount << 2; - - pTemp1 = pRawdata; /* fill the output buffer */ - pTemp2 = pDROP->pChunknames; - - for (iX = 0; iX < pDROP->iCount; iX++) - { - mng_put_uint32 (pTemp1, (mng_uint32)*pTemp2); - - pTemp2++; - pTemp1 += 4; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDROP->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DROP, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -WRITE_CHUNK (mng_write_dbyk) -{ - mng_dbykp pDBYK; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DBYK, MNG_LC_START); -#endif - - pDBYK = (mng_dbykp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 5 + pDBYK->iKeywordssize; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pDBYK->iChunkname); - *(pRawdata+4) = pDBYK->iPolarity; - - if (pDBYK->iKeywordssize) - MNG_COPY (pRawdata+5, pDBYK->zKeywords, pDBYK->iKeywordssize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pDBYK->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DBYK, MNG_LC_END); -#endif - - return iRetcode; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -WRITE_CHUNK (mng_write_ordr) -{ - mng_ordrp pORDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_ordr_entryp pEntry; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ORDR, MNG_LC_START); -#endif - - pORDR = (mng_ordrp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pORDR->iCount * 5; - - pTemp = pRawdata; /* fill the output buffer */ - pEntry = pORDR->pEntries; - - for (iX = 0; iX < pORDR->iCount; iX++) - { - mng_put_uint32 (pTemp, pEntry->iChunkname); - *(pTemp+4) = pEntry->iOrdertype; - pTemp += 5; - pEntry++; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pORDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ORDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_magn) -{ - mng_magnp pMAGN; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MAGN, MNG_LC_START); -#endif - - pMAGN = (mng_magnp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 18; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pMAGN->iFirstid); - mng_put_uint16 (pRawdata+2, pMAGN->iLastid); - *(pRawdata+4) = pMAGN->iMethodX; - mng_put_uint16 (pRawdata+5, pMAGN->iMX); - mng_put_uint16 (pRawdata+7, pMAGN->iMY); - mng_put_uint16 (pRawdata+9, pMAGN->iML); - mng_put_uint16 (pRawdata+11, pMAGN->iMR); - mng_put_uint16 (pRawdata+13, pMAGN->iMT); - mng_put_uint16 (pRawdata+15, pMAGN->iMB); - *(pRawdata+17) = pMAGN->iMethodY; - /* optimize length */ - if (pMAGN->iMethodY == pMAGN->iMethodX) - { - iRawlen--; - - if (pMAGN->iMB == pMAGN->iMY) - { - iRawlen -= 2; - - if (pMAGN->iMT == pMAGN->iMY) - { - iRawlen -= 2; - - if (pMAGN->iMR == pMAGN->iMX) - { - iRawlen -= 2; - - if (pMAGN->iML == pMAGN->iMX) - { - iRawlen -= 2; - - if (pMAGN->iMY == pMAGN->iMX) - { - iRawlen -= 2; - - if (pMAGN->iMX == 1) - { - iRawlen -= 2; - - if (pMAGN->iMethodX == 0) - { - iRawlen--; - - if (pMAGN->iLastid == pMAGN->iFirstid) - { - iRawlen -= 2; - - if (pMAGN->iFirstid == 0) - iRawlen = 0; - - } - } - } - } - } - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pMAGN->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MAGN, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -WRITE_CHUNK (mng_write_mpng) -{ - mng_mpngp pMPNG; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MPNG, MNG_LC_START); -#endif - - pMPNG = (mng_mpngp)pChunk; /* address the proper chunk */ - /* compress the frame structures */ - iRetcode = deflate_buffer (pData, (mng_uint8p)pMPNG->pFrames, pMPNG->iFramessize, - &pBuf, &iBuflen, &iReallen); - - if (!iRetcode) /* all ok ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 15 + iReallen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - /* fill the buffer */ - mng_put_uint32 (pRawdata, pMPNG->iFramewidth); - mng_put_uint32 (pRawdata+4, pMPNG->iFrameheight); - mng_put_uint16 (pRawdata+8, pMPNG->iNumplays); - mng_put_uint16 (pRawdata+10, pMPNG->iTickspersec); - *(pRawdata+12) = pMPNG->iCompressionmethod; - - if (iReallen) - MNG_COPY (pRawdata+13, pBuf, iReallen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pMPNG->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the compression buffer */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MPNG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -WRITE_CHUNK (mng_write_ahdr) -{ - mng_ahdrp pAHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_AHDR, MNG_LC_START); -#endif - - pAHDR = (mng_ahdrp)pChunk; /* address the proper chunk */ - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 22; - /* fill the buffer */ - mng_put_uint32 (pRawdata, pAHDR->iNumframes); - mng_put_uint32 (pRawdata+4, pAHDR->iTickspersec); - mng_put_uint32 (pRawdata+8, pAHDR->iNumplays); - mng_put_uint32 (pRawdata+12, pAHDR->iTilewidth); - mng_put_uint32 (pRawdata+16, pAHDR->iTileheight); - *(pRawdata+20) = pAHDR->iInterlace; - *(pRawdata+21) = pAHDR->iStillused; - /* and write it */ - iRetcode = write_raw_chunk (pData, pAHDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_AHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -WRITE_CHUNK (mng_write_adat) -{ - - /* TODO: something */ - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -WRITE_CHUNK (mng_write_evnt) -{ - mng_evntp pEVNT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_evnt_entryp pEntry; - mng_uint8p pTemp; - mng_uint32 iX; - mng_uint32 iNamesize; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EVNT, MNG_LC_START); -#endif - - pEVNT = (mng_evntp)pChunk; /* address the proper chunk */ - - if (!pEVNT->iCount) /* empty ? */ - iRetcode = write_raw_chunk (pData, pEVNT->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 0; - pTemp = pRawdata; - pEntry = pEVNT->pEntries; - - for (iX = 0; iX < pEVNT->iCount; iX++) - { - if (iX) /* put separator null-byte, except the first */ - { - *pTemp = 0; - pTemp++; - iRawlen++; - } - - *pTemp = pEntry->iEventtype; - *(pTemp+1) = pEntry->iMasktype; - pTemp += 2; - iRawlen += 2; - - switch (pEntry->iMasktype) - { - case 1 : - { - mng_put_int32 (pTemp, pEntry->iLeft); - mng_put_int32 (pTemp+4, pEntry->iRight); - mng_put_int32 (pTemp+8, pEntry->iTop); - mng_put_int32 (pTemp+12, pEntry->iBottom); - pTemp += 16; - iRawlen += 16; - break; - } - case 2 : - { - mng_put_uint16 (pTemp, pEntry->iObjectid); - pTemp += 2; - iRawlen += 2; - break; - } - case 3 : - { - mng_put_uint16 (pTemp, pEntry->iObjectid); - *(pTemp+2) = pEntry->iIndex; - pTemp += 3; - iRawlen += 3; - break; - } - case 4 : - { - mng_put_int32 (pTemp, pEntry->iLeft); - mng_put_int32 (pTemp+4, pEntry->iRight); - mng_put_int32 (pTemp+8, pEntry->iTop); - mng_put_int32 (pTemp+12, pEntry->iBottom); - mng_put_uint16 (pTemp+16, pEntry->iObjectid); - pTemp += 18; - iRawlen += 18; - break; - } - case 5 : - { - mng_put_int32 (pTemp, pEntry->iLeft); - mng_put_int32 (pTemp+4, pEntry->iRight); - mng_put_int32 (pTemp+8, pEntry->iTop); - mng_put_int32 (pTemp+12, pEntry->iBottom); - mng_put_uint16 (pTemp+16, pEntry->iObjectid); - *(pTemp+18) = pEntry->iIndex; - pTemp += 19; - iRawlen += 19; - break; - } - } - - iNamesize = pEntry->iSegmentnamesize; - - if (iNamesize) - { - MNG_COPY (pTemp, pEntry->zSegmentname, iNamesize); - pTemp += iNamesize; - iRawlen += iNamesize; - } - - pEntry++; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pEVNT->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EVNT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_unknown) -{ - mng_unknown_chunkp pUnknown; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_UNKNOWN, MNG_LC_START); -#endif - /* address the proper chunk */ - pUnknown = (mng_unknown_chunkp)pChunk; - /* and write it */ - iRetcode = write_raw_chunk (pData, pUnknown->sHeader.iChunkname, - pUnknown->iDatasize, pUnknown->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_UNKNOWN, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_chunk_io.h b/Engine/lib/lmng/libmng_chunk_io.h deleted file mode 100644 index f8505baec..000000000 --- a/Engine/lib/lmng/libmng_chunk_io.h +++ /dev/null @@ -1,415 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_io.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.109 * */ -/* * * */ -/* * purpose : Chunk I/O routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the chunk input/output routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - changed CRC initialization to use dynamic structure * */ -/* * (wasn't thread-safe the old way !) * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed write routines definition * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added SKIP_CHUNK and NO_DELTA_PNG support * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed SKIPCHUNK_itXT and SKIPCHUNK_ztXT typos * */ -/* * * */ -/* * 1.0.9 - 12/07/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunk_io_h_ -#define _libmng_chunk_io_h_ - -/* ************************************************************************** */ - -mng_uint32 mng_crc (mng_datap pData, - mng_uint8p buf, - mng_int32 len); - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_inflate_buffer (mng_datap pData, - mng_uint8p pInbuf, - mng_uint32 iInsize, - mng_uint8p *pOutbuf, - mng_uint32 *iOutsize, - mng_uint32 *iRealsize); - -/* ************************************************************************** */ - -#define READ_CHUNK(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pHeader, \ - mng_uint32 iRawlen, \ - mng_uint8p pRawdata, \ - mng_chunkp* ppChunk) - -#ifdef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_general) ; -#endif - -READ_CHUNK (mng_read_ihdr) ; -READ_CHUNK (mng_read_plte) ; -READ_CHUNK (mng_read_idat) ; -READ_CHUNK (mng_read_iend) ; -READ_CHUNK (mng_read_trns) ; -READ_CHUNK (mng_read_gama) ; -READ_CHUNK (mng_read_chrm) ; -READ_CHUNK (mng_read_srgb) ; -#ifndef MNG_SKIPCHUNK_iCCP -READ_CHUNK (mng_read_iccp) ; -#endif -#ifndef MNG_SKIPCHUNK_tEXt -READ_CHUNK (mng_read_text) ; -#endif -#ifndef MNG_SKIPCHUNK_zTXt -READ_CHUNK (mng_read_ztxt) ; -#endif -#ifndef MNG_SKIPCHUNK_iTXt -READ_CHUNK (mng_read_itxt) ; -#endif -#ifndef MNG_SKIPCHUNK_bKGD -READ_CHUNK (mng_read_bkgd) ; -#endif -#ifndef MNG_SKIPCHUNK_pHYs -READ_CHUNK (mng_read_phys) ; -#endif -#ifndef MNG_SKIPCHUNK_sBIT -READ_CHUNK (mng_read_sbit) ; -#endif -#ifndef MNG_SKIPCHUNK_sPLT -READ_CHUNK (mng_read_splt) ; -#endif -#ifndef MNG_SKIPCHUNK_hIST -READ_CHUNK (mng_read_hist) ; -#endif -#ifndef MNG_SKIPCHUNK_tIME -READ_CHUNK (mng_read_time) ; -#endif -READ_CHUNK (mng_read_mhdr) ; -READ_CHUNK (mng_read_mend) ; -READ_CHUNK (mng_read_loop) ; -READ_CHUNK (mng_read_endl) ; -READ_CHUNK (mng_read_defi) ; -READ_CHUNK (mng_read_basi) ; -READ_CHUNK (mng_read_clon) ; -#ifndef MNG_SKIPCHUNK_PAST -READ_CHUNK (mng_read_past) ; -#endif -READ_CHUNK (mng_read_disc) ; -READ_CHUNK (mng_read_back) ; -READ_CHUNK (mng_read_fram) ; -READ_CHUNK (mng_read_move) ; -READ_CHUNK (mng_read_clip) ; -READ_CHUNK (mng_read_show) ; -READ_CHUNK (mng_read_term) ; -READ_CHUNK (mng_read_save) ; -READ_CHUNK (mng_read_seek) ; -#ifndef MNG_SKIPCHUNK_eXPI -READ_CHUNK (mng_read_expi) ; -#endif -#ifndef MNG_SKIPCHUNK_fPRI -READ_CHUNK (mng_read_fpri) ; -#endif -#ifndef MNG_SKIPCHUNK_pHYg -READ_CHUNK (mng_read_phyg) ; -#endif -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jhdr) ; -READ_CHUNK (mng_read_jdaa) ; -READ_CHUNK (mng_read_jdat) ; -READ_CHUNK (mng_read_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_dhdr) ; -READ_CHUNK (mng_read_prom) ; -READ_CHUNK (mng_read_ipng) ; -READ_CHUNK (mng_read_pplt) ; -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_ijng) ; -#endif -READ_CHUNK (mng_read_drop) ; -READ_CHUNK (mng_read_dbyk) ; -READ_CHUNK (mng_read_ordr) ; -#endif -READ_CHUNK (mng_read_magn) ; -#ifndef MNG_SKIPCHUNK_nEED -READ_CHUNK (mng_read_need) ; -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -READ_CHUNK (mng_read_mpng) ; -#endif -#ifndef MNG_SKIPCHUNK_evNT -READ_CHUNK (mng_read_evnt) ; -#endif -READ_CHUNK (mng_read_unknown) ; - -/* ************************************************************************** */ - -#else /* MNG_INCLUDE_READ_PROCS */ -#define mng_read_ihdr 0 -#define mng_read_plte 0 -#define mng_read_idat 0 -#define mng_read_iend 0 -#define mng_read_trns 0 -#define mng_read_gama 0 -#define mng_read_chrm 0 -#define mng_read_srgb 0 -#define mng_read_iccp 0 -#define mng_read_text 0 -#define mng_read_ztxt 0 -#define mng_read_itxt 0 -#define mng_read_bkgd 0 -#define mng_read_phys 0 -#define mng_read_sbit 0 -#define mng_read_splt 0 -#define mng_read_hist 0 -#define mng_read_time 0 -#define mng_read_mhdr 0 -#define mng_read_mend 0 -#define mng_read_loop 0 -#define mng_read_endl 0 -#define mng_read_defi 0 -#define mng_read_basi 0 -#define mng_read_clon 0 -#ifndef MNG_SKIPCHUNK_PAST -#define mng_read_past 0 -#endif -#define mng_read_disc 0 -#define mng_read_back 0 -#define mng_read_fram 0 -#define mng_read_move 0 -#define mng_read_clip 0 -#define mng_read_show 0 -#define mng_read_term 0 -#define mng_read_save 0 -#define mng_read_seek 0 -#define mng_read_expi 0 -#define mng_read_fpri 0 -#define mng_read_phyg 0 -#ifdef MNG_INCLUDE_JNG -#define mng_read_jhdr 0 -#define mng_read_jdaa 0 -#define mng_read_jdat 0 -#define mng_read_jsep 0 -#endif -#ifndef MNG_NO_DELTA_PNG -#define mng_read_dhdr 0 -#define mng_read_prom 0 -#define mng_read_ipng 0 -#define mng_read_pplt 0 -#ifdef MNG_INCLUDE_JNG -#define mng_read_ijng 0 -#endif -#define mng_read_drop 0 -#define mng_read_dbyk 0 -#define mng_read_ordr 0 -#endif -#define mng_read_magn 0 -#define mng_read_need 0 -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -#define mng_read_mpng 0 -#endif -#define mng_read_evnt 0 -#define mng_read_unknown 0 -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -#define WRITE_CHUNK(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunk) - -WRITE_CHUNK (mng_write_ihdr) ; -WRITE_CHUNK (mng_write_plte) ; -WRITE_CHUNK (mng_write_idat) ; -WRITE_CHUNK (mng_write_iend) ; -WRITE_CHUNK (mng_write_trns) ; -WRITE_CHUNK (mng_write_gama) ; -WRITE_CHUNK (mng_write_chrm) ; -WRITE_CHUNK (mng_write_srgb) ; -WRITE_CHUNK (mng_write_iccp) ; -WRITE_CHUNK (mng_write_text) ; -WRITE_CHUNK (mng_write_ztxt) ; -WRITE_CHUNK (mng_write_itxt) ; -WRITE_CHUNK (mng_write_bkgd) ; -WRITE_CHUNK (mng_write_phys) ; -WRITE_CHUNK (mng_write_sbit) ; -WRITE_CHUNK (mng_write_splt) ; -WRITE_CHUNK (mng_write_hist) ; -WRITE_CHUNK (mng_write_time) ; -WRITE_CHUNK (mng_write_mhdr) ; -WRITE_CHUNK (mng_write_mend) ; -WRITE_CHUNK (mng_write_loop) ; -WRITE_CHUNK (mng_write_endl) ; -WRITE_CHUNK (mng_write_defi) ; -WRITE_CHUNK (mng_write_basi) ; -WRITE_CHUNK (mng_write_clon) ; -#ifndef MNG_SKIPCHUNK_PAST -WRITE_CHUNK (mng_write_past) ; -#endif -WRITE_CHUNK (mng_write_disc) ; -WRITE_CHUNK (mng_write_back) ; -WRITE_CHUNK (mng_write_fram) ; -WRITE_CHUNK (mng_write_move) ; -WRITE_CHUNK (mng_write_clip) ; -WRITE_CHUNK (mng_write_show) ; -WRITE_CHUNK (mng_write_term) ; -WRITE_CHUNK (mng_write_save) ; -WRITE_CHUNK (mng_write_seek) ; -WRITE_CHUNK (mng_write_expi) ; -WRITE_CHUNK (mng_write_fpri) ; -WRITE_CHUNK (mng_write_phyg) ; -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_jhdr) ; -WRITE_CHUNK (mng_write_jdaa) ; -WRITE_CHUNK (mng_write_jdat) ; -WRITE_CHUNK (mng_write_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_dhdr) ; -WRITE_CHUNK (mng_write_prom) ; -WRITE_CHUNK (mng_write_ipng) ; -WRITE_CHUNK (mng_write_pplt) ; -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_ijng) ; -#endif -WRITE_CHUNK (mng_write_drop) ; -WRITE_CHUNK (mng_write_dbyk) ; -WRITE_CHUNK (mng_write_ordr) ; -#endif -WRITE_CHUNK (mng_write_magn) ; -WRITE_CHUNK (mng_write_need) ; -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -WRITE_CHUNK (mng_write_mpng) ; -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -WRITE_CHUNK (mng_write_ahdr) ; -WRITE_CHUNK (mng_write_adat) ; -#endif -WRITE_CHUNK (mng_write_evnt) ; -WRITE_CHUNK (mng_write_unknown) ; - -/* ************************************************************************** */ - -#else /* MNG_INCLUDE_WRITE_PROCS */ -#define mng_write_ihdr 0 -#define mng_write_plte 0 -#define mng_write_idat 0 -#define mng_write_iend 0 -#define mng_write_trns 0 -#define mng_write_gama 0 -#define mng_write_chrm 0 -#define mng_write_srgb 0 -#define mng_write_iccp 0 -#define mng_write_text 0 -#define mng_write_ztxt 0 -#define mng_write_itxt 0 -#define mng_write_bkgd 0 -#define mng_write_phys 0 -#define mng_write_sbit 0 -#define mng_write_splt 0 -#define mng_write_hist 0 -#define mng_write_time 0 -#define mng_write_mhdr 0 -#define mng_write_mend 0 -#define mng_write_loop 0 -#define mng_write_endl 0 -#define mng_write_defi 0 -#define mng_write_basi 0 -#define mng_write_clon 0 -#ifndef MNG_SKIPCHUNK_PAST -#define mng_write_past 0 -#endif -#define mng_write_disc 0 -#define mng_write_back 0 -#define mng_write_fram 0 -#define mng_write_move 0 -#define mng_write_clip 0 -#define mng_write_show 0 -#define mng_write_term 0 -#define mng_write_save 0 -#define mng_write_seek 0 -#define mng_write_expi 0 -#define mng_write_fpri 0 -#define mng_write_phyg 0 -#ifdef MNG_INCLUDE_JNG -#define mng_write_jhdr 0 -#define mng_write_jdaa 0 -#define mng_write_jdat 0 -#define mng_write_jsep 0 -#endif -#ifndef MNG_NO_DELTA_PNG -#define mng_write_dhdr 0 -#define mng_write_prom 0 -#define mng_write_ipng 0 -#define mng_write_pplt 0 -#ifdef MNG_INCLUDE_JNG -#define mng_write_ijng 0 -#endif -#define mng_write_drop 0 -#define mng_write_dbyk 0 -#define mng_write_ordr 0 -#endif -#define mng_write_magn 0 -#define mng_write_need 0 -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -#define mng_write_mpng 0 -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -#define mng_write_adat 0 -#define mng_write_ahdr 0 -#endif -#define mng_write_evnt 0 -#define mng_write_unknown 0 -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_chunk_io_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_chunk_prc.c b/Engine/lib/lmng/libmng_chunk_prc.c deleted file mode 100644 index e633e7e26..000000000 --- a/Engine/lib/lmng/libmng_chunk_prc.c +++ /dev/null @@ -1,4452 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_prc.c copyright (c) 2000-2005 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk initialization & cleanup (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the chunk initialization & cleanup * */ -/* * routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed creation-code * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - put add_chunk() inside MNG_INCLUDE_WRITE_PROCS wrapper * */ -/* * 0.9.2 - 08/01/2000 - G.Juyn * */ -/* * - wrapper for add_chunk() changed * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 10/04/2002 - G.Juyn * */ -/* * - fixed chunk-storage for evNT chunk * */ -/* * 1.0.5 - 10/17/2002 - G.Juyn * */ -/* * - fixed issue in freeing evNT chunk * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * - added MNG_NO_DELTA_PNG reduction feature * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed SKIPCHUNK_eXPI -> fPRI typo * */ -/* * * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 07/30/2005 - G.Juyn * */ -/* * - fixed problem with CLON object during readdisplay() * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#include "libmng_chunk_prc.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * General chunk routines * */ -/* * * */ -/* ************************************************************************** */ - -void mng_add_chunk (mng_datap pData, - mng_chunkp pChunk) -{ - if (!pData->pFirstchunk) /* list is still empty ? */ - { - pData->pFirstchunk = pChunk; /* then this becomes the first */ - -#ifdef MNG_SUPPORT_WRITE - if (!pData->iFirstchunkadded) - { - pData->iFirstchunkadded = ((mng_chunk_headerp)pChunk)->iChunkname; -#endif - - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_IHDR) - pData->eImagetype = mng_it_png; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_JHDR) - pData->eImagetype = mng_it_jng; - else -#endif - pData->eImagetype = mng_it_mng; - - pData->eSigtype = pData->eImagetype; -#ifdef MNG_SUPPORT_WRITE - } -#endif - } - else - { /* else we make appropriate links */ - ((mng_chunk_headerp)pChunk)->pPrev = pData->pLastchunk; - ((mng_chunk_headerp)pData->pLastchunk)->pNext = pChunk; - } - - pData->pLastchunk = pChunk; /* and it's always the last */ - - return; -} - -/* ************************************************************************** */ -/* * * */ -/* * Chunk specific initialization routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -INIT_CHUNK_HDR (mng_init_general) -{ - MNG_ALLOC (pData, *ppChunk, ((mng_chunk_headerp)pHeader)->iChunksize); - MNG_COPY (*ppChunk, pHeader, sizeof (mng_chunk_header)); - return MNG_NOERROR; -} - -#else /* MNG_OPTIMIZE_CHUNKINITFREE */ - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ihdr)); - ((mng_ihdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_plte) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PLTE, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_plte)); - ((mng_pltep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDAT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_idat)); - ((mng_idatp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IEND, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_iend)); - ((mng_iendp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_trns) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TRNS, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_trns)); - ((mng_trnsp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -INIT_CHUNK_HDR (mng_init_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMA, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_gama)); - ((mng_gamap)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -INIT_CHUNK_HDR (mng_init_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CHRM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_chrm)); - ((mng_chrmp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -INIT_CHUNK_HDR (mng_init_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SRGB, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_srgb)); - ((mng_srgbp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -INIT_CHUNK_HDR (mng_init_iccp) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ICCP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_iccp)); - ((mng_iccpp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -INIT_CHUNK_HDR (mng_init_text) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TEXT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_text)); - ((mng_textp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -INIT_CHUNK_HDR (mng_init_ztxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ZTXT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ztxt)); - ((mng_ztxtp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -INIT_CHUNK_HDR (mng_init_itxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ITXT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_itxt)); - ((mng_itxtp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -INIT_CHUNK_HDR (mng_init_bkgd) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BKGD, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_bkgd)); - ((mng_bkgdp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -INIT_CHUNK_HDR (mng_init_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYS, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_phys)); - ((mng_physp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -INIT_CHUNK_HDR (mng_init_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SBIT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_sbit)); - ((mng_sbitp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -INIT_CHUNK_HDR (mng_init_splt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SPLT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_splt)); - ((mng_spltp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -INIT_CHUNK_HDR (mng_init_hist) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_HIST, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_hist)); - ((mng_histp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -INIT_CHUNK_HDR (mng_init_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TIME, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_time)); - ((mng_timep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_mhdr)); - ((mng_mhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MEND, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_mend)); - ((mng_mendp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -INIT_CHUNK_HDR (mng_init_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_LOOP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_loop)); - ((mng_loopp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ENDL, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_endl)); - ((mng_endlp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -INIT_CHUNK_HDR (mng_init_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DEFI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_defi)); - ((mng_defip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -INIT_CHUNK_HDR (mng_init_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BASI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_basi)); - ((mng_basip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -INIT_CHUNK_HDR (mng_init_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLON, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_clon)); - ((mng_clonp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -INIT_CHUNK_HDR (mng_init_past) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PAST, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_past)); - ((mng_pastp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -INIT_CHUNK_HDR (mng_init_disc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DISC, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_disc)); - ((mng_discp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -INIT_CHUNK_HDR (mng_init_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BACK, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_back)); - ((mng_backp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -INIT_CHUNK_HDR (mng_init_fram) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FRAM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_fram)); - ((mng_framp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -INIT_CHUNK_HDR (mng_init_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MOVE, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_move)); - ((mng_movep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -INIT_CHUNK_HDR (mng_init_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLIP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_clip)); - ((mng_clipp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -INIT_CHUNK_HDR (mng_init_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SHOW, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_show)); - ((mng_showp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -INIT_CHUNK_HDR (mng_init_term) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TERM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_term)); - ((mng_termp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -INIT_CHUNK_HDR (mng_init_save) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SAVE, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_save)); - ((mng_savep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; - -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -INIT_CHUNK_HDR (mng_init_seek) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SEEK, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_seek)); - ((mng_seekp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -INIT_CHUNK_HDR (mng_init_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EXPI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_expi)); - ((mng_expip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -INIT_CHUNK_HDR (mng_init_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FPRI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_fpri)); - ((mng_fprip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -INIT_CHUNK_HDR (mng_init_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_NEED, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_need)); - ((mng_needp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -INIT_CHUNK_HDR (mng_init_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYG, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_phyg)); - ((mng_phygp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jhdr)); - ((mng_jhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jdaa) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jdaa)); - ((mng_jdaap)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jdat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jdat)); - ((mng_jdatp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JSEP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jsep)); - ((mng_jsepp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_dhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_dhdr)); - ((mng_dhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_prom) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PROM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_prom)); - ((mng_promp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IPNG, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ipng)); - ((mng_ipngp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_pplt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PPLT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_pplt)); - ((mng_ppltp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IJNG, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ijng)); - ((mng_ijngp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DROP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_drop)); - ((mng_dropp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -INIT_CHUNK_HDR (mng_init_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DBYK, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_dbyk)); - ((mng_dbykp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -INIT_CHUNK_HDR (mng_init_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ORDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ordr)); - ((mng_ordrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -INIT_CHUNK_HDR (mng_init_magn) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_magn)); - ((mng_magnp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -INIT_CHUNK_HDR (mng_init_evnt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EVNT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_evnt)); - ((mng_evntp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_UNKNOWN, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_unknown_chunk)); - ((mng_unknown_chunkp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - -/* ************************************************************************** */ -/* * * */ -/* * Chunk specific cleanup routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_general) -{ - MNG_FREEX (pData, pHeader, ((mng_chunk_headerp)pHeader)->iChunksize); - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_ihdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_plte) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PLTE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_plte)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -FREE_CHUNK_HDR (mng_free_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IDAT, MNG_LC_START); -#endif - - if (((mng_idatp)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_idatp)pHeader)->pData, - ((mng_idatp)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_idat)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IDAT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IEND, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_iend)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_trns) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TRNS, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_trns)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_gAMA -FREE_CHUNK_HDR (mng_free_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_GAMA, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_gama)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_cHRM -FREE_CHUNK_HDR (mng_free_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CHRM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_chrm)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_sRGB -FREE_CHUNK_HDR (mng_free_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SRGB, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_srgb)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -FREE_CHUNK_HDR (mng_free_iccp) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ICCP, MNG_LC_START); -#endif - - if (((mng_iccpp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_iccpp)pHeader)->zName, - ((mng_iccpp)pHeader)->iNamesize + 1); - - if (((mng_iccpp)pHeader)->iProfilesize) - MNG_FREEX (pData, ((mng_iccpp)pHeader)->pProfile, - ((mng_iccpp)pHeader)->iProfilesize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_iccp)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ICCP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -FREE_CHUNK_HDR (mng_free_text) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TEXT, MNG_LC_START); -#endif - - if (((mng_textp)pHeader)->iKeywordsize) - MNG_FREEX (pData, ((mng_textp)pHeader)->zKeyword, - ((mng_textp)pHeader)->iKeywordsize + 1); - - if (((mng_textp)pHeader)->iTextsize) - MNG_FREEX (pData, ((mng_textp)pHeader)->zText, - ((mng_textp)pHeader)->iTextsize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_text)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TEXT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -FREE_CHUNK_HDR (mng_free_ztxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ZTXT, MNG_LC_START); -#endif - - if (((mng_ztxtp)pHeader)->iKeywordsize) - MNG_FREEX (pData, ((mng_ztxtp)pHeader)->zKeyword, - ((mng_ztxtp)pHeader)->iKeywordsize + 1); - - if (((mng_ztxtp)pHeader)->iTextsize) - MNG_FREEX (pData, ((mng_ztxtp)pHeader)->zText, - ((mng_ztxtp)pHeader)->iTextsize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_ztxt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ZTXT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ -#ifndef MNG_SKIPCHUNK_iTXt -FREE_CHUNK_HDR (mng_free_itxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ITXT, MNG_LC_START); -#endif - - if (((mng_itxtp)pHeader)->iKeywordsize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zKeyword, - ((mng_itxtp)pHeader)->iKeywordsize + 1); - - if (((mng_itxtp)pHeader)->iLanguagesize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zLanguage, - ((mng_itxtp)pHeader)->iLanguagesize + 1); - - if (((mng_itxtp)pHeader)->iTranslationsize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zTranslation, - ((mng_itxtp)pHeader)->iTranslationsize + 1); - - if (((mng_itxtp)pHeader)->iTextsize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zText, - ((mng_itxtp)pHeader)->iTextsize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_itxt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ITXT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -FREE_CHUNK_HDR (mng_free_mpng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG, MNG_LC_START); -#endif - - if (((mng_mpngp)pHeader)->iFramessize) - MNG_FREEX (pData, ((mng_mpngp)pHeader)->pFrames, - ((mng_mpngp)pHeader)->iFramessize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_mpng)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_ANG_PROPOSAL -FREE_CHUNK_HDR (mng_free_adat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ADAT, MNG_LC_START); -#endif - - if (((mng_adatp)pHeader)->iTilessize) - MNG_FREEX (pData, ((mng_adatp)pHeader)->pTiles, ((mng_adatp)pHeader)->iTilessize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_adat)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ADAT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_bKGD -FREE_CHUNK_HDR (mng_free_bkgd) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BKGD, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_bkgd)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_pHYs -FREE_CHUNK_HDR (mng_free_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYS, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_phys)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_sBIT -FREE_CHUNK_HDR (mng_free_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SBIT, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_sbit)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -FREE_CHUNK_HDR (mng_free_splt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SPLT, MNG_LC_START); -#endif - - if (((mng_spltp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_spltp)pHeader)->zName, - ((mng_spltp)pHeader)->iNamesize + 1); - - if (((mng_spltp)pHeader)->iEntrycount) - MNG_FREEX (pData, ((mng_spltp)pHeader)->pEntries, - ((mng_spltp)pHeader)->iEntrycount * - (((mng_spltp)pHeader)->iSampledepth * 3 + sizeof (mng_uint16)) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_splt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SPLT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_hIST -FREE_CHUNK_HDR (mng_free_hist) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_HIST, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_hist)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_tIME -FREE_CHUNK_HDR (mng_free_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TIME, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_time)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_mhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MEND, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_mend)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -FREE_CHUNK_HDR (mng_free_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_LOOP, MNG_LC_START); -#endif - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (((mng_loopp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_loopp)pHeader)->pSignals, - ((mng_loopp)pHeader)->iCount * sizeof (mng_uint32) ); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_loop)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_LOOP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ENDL, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_endl)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_DEFI -FREE_CHUNK_HDR (mng_free_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DEFI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_defi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_BASI -FREE_CHUNK_HDR (mng_free_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BASI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_basi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_CLON -FREE_CHUNK_HDR (mng_free_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLON, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_clon)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -FREE_CHUNK_HDR (mng_free_past) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PAST, MNG_LC_START); -#endif - - if (((mng_pastp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_pastp)pHeader)->pSources, - ((mng_pastp)pHeader)->iCount * sizeof (mng_past_source) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_past)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PAST, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -FREE_CHUNK_HDR (mng_free_disc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DISC, MNG_LC_START); -#endif - - if (((mng_discp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_discp)pHeader)->pObjectids, - ((mng_discp)pHeader)->iCount * sizeof (mng_uint16) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_disc)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DISC, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_BACK -FREE_CHUNK_HDR (mng_free_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BACK, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_back)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -FREE_CHUNK_HDR (mng_free_fram) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FRAM, MNG_LC_START); -#endif - - if (((mng_framp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_framp)pHeader)->zName, - ((mng_framp)pHeader)->iNamesize + 1); - - if (((mng_framp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_framp)pHeader)->pSyncids, - ((mng_framp)pHeader)->iCount * sizeof (mng_uint32) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_fram)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FRAM, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_MOVE -FREE_CHUNK_HDR (mng_free_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MOVE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_move)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_CLIP -FREE_CHUNK_HDR (mng_free_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLIP, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_clip)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_SHOW -FREE_CHUNK_HDR (mng_free_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SHOW, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_show)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_TERM -FREE_CHUNK_HDR (mng_free_term) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TERM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_term)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -FREE_CHUNK_HDR (mng_free_save) -{ - mng_save_entryp pEntry = ((mng_savep)pHeader)->pEntries; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SAVE, MNG_LC_START); -#endif - - for (iX = 0; iX < ((mng_savep)pHeader)->iCount; iX++) - { - if (pEntry->iNamesize) - MNG_FREEX (pData, pEntry->zName, pEntry->iNamesize); - - pEntry = pEntry + sizeof (mng_save_entry); - } - - if (((mng_savep)pHeader)->iCount) - MNG_FREEX (pData, ((mng_savep)pHeader)->pEntries, - ((mng_savep)pHeader)->iCount * sizeof (mng_save_entry) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_save)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SAVE, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -FREE_CHUNK_HDR (mng_free_seek) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SEEK, MNG_LC_START); -#endif - - if (((mng_seekp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_seekp)pHeader)->zName, - ((mng_seekp)pHeader)->iNamesize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_seek)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SEEK, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -FREE_CHUNK_HDR (mng_free_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EXPI, MNG_LC_START); -#endif - - if (((mng_expip)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_expip)pHeader)->zName, - ((mng_expip)pHeader)->iNamesize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_expi)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EXPI, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_fPRI -FREE_CHUNK_HDR (mng_free_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FPRI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_fpri)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -FREE_CHUNK_HDR (mng_free_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_NEED, MNG_LC_START); -#endif - - if (((mng_needp)pHeader)->iKeywordssize) - MNG_FREEX (pData, ((mng_needp)pHeader)->zKeywords, - ((mng_needp)pHeader)->iKeywordssize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_need)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_NEED, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_pHYg -FREE_CHUNK_HDR (mng_free_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_phyg)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_jhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jdaa) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_START); -#endif - - if (((mng_jdaap)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_jdaap)pHeader)->pData, - ((mng_jdaap)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_jdaa)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jdat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAT, MNG_LC_START); -#endif - - if (((mng_jdatp)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_jdatp)pHeader)->pData, - ((mng_jdatp)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_jdat)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JSEP, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_jsep)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_dhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_dhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_prom) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PROM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_prom)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IPNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_ipng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_pplt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PPLT, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_pplt)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IJNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_ijng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DROP, MNG_LC_START); -#endif - - if (((mng_dropp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_dropp)pHeader)->pChunknames, - ((mng_dropp)pHeader)->iCount * sizeof (mng_chunkid) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_drop)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DROP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -FREE_CHUNK_HDR (mng_free_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DBYK, MNG_LC_START); -#endif - - if (((mng_dbykp)pHeader)->iKeywordssize) - MNG_FREEX (pData, ((mng_dbykp)pHeader)->zKeywords, - ((mng_dbykp)pHeader)->iKeywordssize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_dbyk)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DBYK, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -FREE_CHUNK_HDR (mng_free_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ORDR, MNG_LC_START); -#endif - - if (((mng_ordrp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_ordrp)pHeader)->pEntries, - ((mng_ordrp)pHeader)->iCount * sizeof (mng_ordr_entry) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_ordr)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ORDR, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_MAGN -FREE_CHUNK_HDR (mng_free_magn) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_magn)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -FREE_CHUNK_HDR (mng_free_evnt) -{ - mng_evnt_entryp pEntry = ((mng_evntp)pHeader)->pEntries; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVNT, MNG_LC_START); -#endif - - for (iX = 0; iX < ((mng_evntp)pHeader)->iCount; iX++) - { - if (pEntry->iSegmentnamesize) - MNG_FREEX (pData, pEntry->zSegmentname, pEntry->iSegmentnamesize+1); - - pEntry++; - } - - if (((mng_evntp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_evntp)pHeader)->pEntries, - ((mng_evntp)pHeader)->iCount * sizeof (mng_evnt_entry) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_evnt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVNT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -FREE_CHUNK_HDR (mng_free_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_UNKNOWN, MNG_LC_START); -#endif - - if (((mng_unknown_chunkp)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_unknown_chunkp)pHeader)->pData, - ((mng_unknown_chunkp)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_unknown_chunk)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_UNKNOWN, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} - -/* ************************************************************************** */ -/* * * */ -/* * Chunk specific copy routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_general) -{ - mng_ptr pSrc = (mng_uint8p)pChunkfrom + sizeof (mng_chunk_header); - mng_ptr pDst = (mng_uint8p)pChunkto + sizeof (mng_chunk_header); - mng_size_t iLen = ((mng_chunk_headerp)pChunkfrom)->iChunksize - sizeof (mng_chunk_header); - - MNG_COPY (pDst, pSrc, iLen); - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ihdrp)pChunkto)->iWidth = ((mng_ihdrp)pChunkfrom)->iWidth; - ((mng_ihdrp)pChunkto)->iHeight = ((mng_ihdrp)pChunkfrom)->iHeight; - ((mng_ihdrp)pChunkto)->iBitdepth = ((mng_ihdrp)pChunkfrom)->iBitdepth; - ((mng_ihdrp)pChunkto)->iColortype = ((mng_ihdrp)pChunkfrom)->iColortype; - ((mng_ihdrp)pChunkto)->iCompression = ((mng_ihdrp)pChunkfrom)->iCompression; - ((mng_ihdrp)pChunkto)->iFilter = ((mng_ihdrp)pChunkfrom)->iFilter; - ((mng_ihdrp)pChunkto)->iInterlace = ((mng_ihdrp)pChunkfrom)->iInterlace; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_plte) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PLTE, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PLTE) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_pltep)pChunkto)->bEmpty = ((mng_pltep)pChunkfrom)->bEmpty; - ((mng_pltep)pChunkto)->iEntrycount = ((mng_pltep)pChunkfrom)->iEntrycount; - - for (iX = 0; iX < ((mng_pltep)pChunkto)->iEntrycount; iX++) - ((mng_pltep)pChunkto)->aEntries [iX] = ((mng_pltep)pChunkfrom)->aEntries [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -ASSIGN_CHUNK_HDR (mng_assign_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IDAT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_idatp)pChunkto)->bEmpty = ((mng_idatp)pChunkfrom)->bEmpty; - ((mng_idatp)pChunkto)->iDatasize = ((mng_idatp)pChunkfrom)->iDatasize; - - if (((mng_idatp)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_idatp)pChunkto)->pData, ((mng_idatp)pChunkto)->iDatasize); - MNG_COPY (((mng_idatp)pChunkto)->pData, ((mng_idatp)pChunkfrom)->pData, - ((mng_idatp)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IEND, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IEND) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_trns) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TRNS, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_tRNS) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_trnsp)pChunkto)->bEmpty = ((mng_trnsp)pChunkfrom)->bEmpty; - ((mng_trnsp)pChunkto)->bGlobal = ((mng_trnsp)pChunkfrom)->bGlobal; - ((mng_trnsp)pChunkto)->iType = ((mng_trnsp)pChunkfrom)->iType; - ((mng_trnsp)pChunkto)->iCount = ((mng_trnsp)pChunkfrom)->iCount; - ((mng_trnsp)pChunkto)->iGray = ((mng_trnsp)pChunkfrom)->iGray; - ((mng_trnsp)pChunkto)->iRed = ((mng_trnsp)pChunkfrom)->iRed; - ((mng_trnsp)pChunkto)->iGreen = ((mng_trnsp)pChunkfrom)->iGreen; - ((mng_trnsp)pChunkto)->iBlue = ((mng_trnsp)pChunkfrom)->iBlue; - ((mng_trnsp)pChunkto)->iRawlen = ((mng_trnsp)pChunkfrom)->iRawlen; - - for (iX = 0; iX < ((mng_trnsp)pChunkto)->iCount; iX++) - ((mng_trnsp)pChunkto)->aEntries [iX] = ((mng_trnsp)pChunkfrom)->aEntries [iX]; - - for (iX = 0; iX < ((mng_trnsp)pChunkto)->iRawlen; iX++) - ((mng_trnsp)pChunkto)->aRawdata [iX] = ((mng_trnsp)pChunkfrom)->aRawdata [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_gAMA -ASSIGN_CHUNK_HDR (mng_assign_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_GAMA, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_gAMA) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_gamap)pChunkto)->bEmpty = ((mng_gamap)pChunkfrom)->bEmpty; - ((mng_gamap)pChunkto)->iGamma = ((mng_gamap)pChunkfrom)->iGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_cHRM -ASSIGN_CHUNK_HDR (mng_assign_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CHRM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_cHRM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_chrmp)pChunkto)->bEmpty = ((mng_chrmp)pChunkfrom)->bEmpty; - ((mng_chrmp)pChunkto)->iWhitepointx = ((mng_chrmp)pChunkfrom)->iWhitepointx; - ((mng_chrmp)pChunkto)->iWhitepointy = ((mng_chrmp)pChunkfrom)->iWhitepointy; - ((mng_chrmp)pChunkto)->iRedx = ((mng_chrmp)pChunkfrom)->iRedx; - ((mng_chrmp)pChunkto)->iRedy = ((mng_chrmp)pChunkfrom)->iRedy; - ((mng_chrmp)pChunkto)->iGreenx = ((mng_chrmp)pChunkfrom)->iGreenx; - ((mng_chrmp)pChunkto)->iGreeny = ((mng_chrmp)pChunkfrom)->iGreeny; - ((mng_chrmp)pChunkto)->iBluex = ((mng_chrmp)pChunkfrom)->iBluex; - ((mng_chrmp)pChunkto)->iBluey = ((mng_chrmp)pChunkfrom)->iBluey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_sRGB -ASSIGN_CHUNK_HDR (mng_assign_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SRGB, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_sRGB) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_srgbp)pChunkto)->iRenderingintent = ((mng_srgbp)pChunkfrom)->iRenderingintent; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -ASSIGN_CHUNK_HDR (mng_assign_iccp) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ICCP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_iCCP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_iccpp)pChunkto)->bEmpty = ((mng_iccpp)pChunkfrom)->bEmpty; - ((mng_iccpp)pChunkto)->iNamesize = ((mng_iccpp)pChunkfrom)->iNamesize; - ((mng_iccpp)pChunkto)->iCompression = ((mng_iccpp)pChunkfrom)->iCompression; - ((mng_iccpp)pChunkto)->iProfilesize = ((mng_iccpp)pChunkfrom)->iProfilesize; - - if (((mng_iccpp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunkto)->zName, ((mng_iccpp)pChunkto)->iNamesize); - MNG_COPY (((mng_iccpp)pChunkto)->zName, ((mng_iccpp)pChunkfrom)->zName, - ((mng_iccpp)pChunkto)->iNamesize); - } - - if (((mng_iccpp)pChunkto)->iProfilesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunkto)->pProfile, ((mng_iccpp)pChunkto)->iProfilesize); - MNG_COPY (((mng_iccpp)pChunkto)->pProfile, ((mng_iccpp)pChunkfrom)->pProfile, - ((mng_iccpp)pChunkto)->iProfilesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -ASSIGN_CHUNK_HDR (mng_assign_text) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TEXT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_tEXt) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_textp)pChunkto)->iKeywordsize = ((mng_textp)pChunkfrom)->iKeywordsize; - ((mng_textp)pChunkto)->iTextsize = ((mng_textp)pChunkfrom)->iTextsize; - - if (((mng_textp)pChunkto)->iKeywordsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zKeyword, ((mng_textp)pChunkto)->iKeywordsize); - MNG_COPY (((mng_itxtp)pChunkto)->zKeyword, ((mng_textp)pChunkfrom)->zKeyword, - ((mng_itxtp)pChunkto)->iKeywordsize); - } - - if (((mng_textp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_textp)pChunkto)->zText, ((mng_textp)pChunkto)->iTextsize); - MNG_COPY (((mng_textp)pChunkto)->zText, ((mng_textp)pChunkfrom)->zText, - ((mng_textp)pChunkto)->iTextsize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -ASSIGN_CHUNK_HDR (mng_assign_ztxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ZTXT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_zTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ztxtp)pChunkto)->iKeywordsize = ((mng_ztxtp)pChunkfrom)->iKeywordsize; - ((mng_ztxtp)pChunkto)->iCompression = ((mng_ztxtp)pChunkfrom)->iCompression; - ((mng_ztxtp)pChunkto)->iTextsize = ((mng_ztxtp)pChunkfrom)->iTextsize; - - if (((mng_ztxtp)pChunkto)->iKeywordsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunkto)->zKeyword, ((mng_ztxtp)pChunkto)->iKeywordsize); - MNG_COPY (((mng_ztxtp)pChunkto)->zKeyword, ((mng_ztxtp)pChunkfrom)->zKeyword, - ((mng_ztxtp)pChunkto)->iKeywordsize); - } - - if (((mng_ztxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunkto)->zText, ((mng_ztxtp)pChunkto)->iTextsize); - MNG_COPY (((mng_ztxtp)pChunkto)->zText, ((mng_ztxtp)pChunkfrom)->zText, - ((mng_ztxtp)pChunkto)->iTextsize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -ASSIGN_CHUNK_HDR (mng_assign_itxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ITXT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_iTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_itxtp)pChunkto)->iKeywordsize = ((mng_itxtp)pChunkfrom)->iKeywordsize; - ((mng_itxtp)pChunkto)->iCompressionflag = ((mng_itxtp)pChunkfrom)->iCompressionflag; - ((mng_itxtp)pChunkto)->iCompressionmethod = ((mng_itxtp)pChunkfrom)->iCompressionmethod; - ((mng_itxtp)pChunkto)->iLanguagesize = ((mng_itxtp)pChunkfrom)->iLanguagesize; - ((mng_itxtp)pChunkto)->iTranslationsize = ((mng_itxtp)pChunkfrom)->iTranslationsize; - ((mng_itxtp)pChunkto)->iTextsize = ((mng_itxtp)pChunkfrom)->iTextsize; - - if (((mng_itxtp)pChunkto)->iKeywordsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zKeyword, ((mng_itxtp)pChunkto)->iKeywordsize); - MNG_COPY (((mng_itxtp)pChunkto)->zKeyword, ((mng_itxtp)pChunkfrom)->zKeyword, - ((mng_itxtp)pChunkto)->iKeywordsize); - } - - if (((mng_itxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zLanguage, ((mng_itxtp)pChunkto)->iLanguagesize); - MNG_COPY (((mng_itxtp)pChunkto)->zLanguage, ((mng_itxtp)pChunkfrom)->zLanguage, - ((mng_itxtp)pChunkto)->iLanguagesize); - } - - if (((mng_itxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zTranslation, ((mng_itxtp)pChunkto)->iTranslationsize); - MNG_COPY (((mng_itxtp)pChunkto)->zTranslation, ((mng_itxtp)pChunkfrom)->zTranslation, - ((mng_itxtp)pChunkto)->iTranslationsize); - } - - if (((mng_itxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zText, ((mng_itxtp)pChunkto)->iTextsize); - MNG_COPY (((mng_itxtp)pChunkto)->zText, ((mng_itxtp)pChunkfrom)->zText, - ((mng_itxtp)pChunkto)->iTextsize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_bKGD -ASSIGN_CHUNK_HDR (mng_assign_bkgd) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BKGD, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_bKGD) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_bkgdp)pChunkto)->bEmpty = ((mng_bkgdp)pChunkfrom)->bEmpty; - ((mng_bkgdp)pChunkto)->iType = ((mng_bkgdp)pChunkfrom)->iType; - ((mng_bkgdp)pChunkto)->iIndex = ((mng_bkgdp)pChunkfrom)->iIndex; - ((mng_bkgdp)pChunkto)->iGray = ((mng_bkgdp)pChunkfrom)->iGray; - ((mng_bkgdp)pChunkto)->iRed = ((mng_bkgdp)pChunkfrom)->iRed; - ((mng_bkgdp)pChunkto)->iGreen = ((mng_bkgdp)pChunkfrom)->iGreen; - ((mng_bkgdp)pChunkto)->iBlue = ((mng_bkgdp)pChunkfrom)->iBlue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_pHYs -ASSIGN_CHUNK_HDR (mng_assign_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYS, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_pHYs) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_physp)pChunkto)->bEmpty = ((mng_physp)pChunkfrom)->bEmpty; - ((mng_physp)pChunkto)->iSizex = ((mng_physp)pChunkfrom)->iSizex; - ((mng_physp)pChunkto)->iSizey = ((mng_physp)pChunkfrom)->iSizey; - ((mng_physp)pChunkto)->iUnit = ((mng_physp)pChunkfrom)->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_sBIT -ASSIGN_CHUNK_HDR (mng_assign_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SBIT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_sBIT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_sbitp)pChunkto)->bEmpty = ((mng_sbitp)pChunkfrom)->bEmpty; - ((mng_sbitp)pChunkto)->iType = ((mng_sbitp)pChunkfrom)->iType; - ((mng_sbitp)pChunkto)->aBits [0] = ((mng_sbitp)pChunkfrom)->aBits [0]; - ((mng_sbitp)pChunkto)->aBits [1] = ((mng_sbitp)pChunkfrom)->aBits [1]; - ((mng_sbitp)pChunkto)->aBits [2] = ((mng_sbitp)pChunkfrom)->aBits [2]; - ((mng_sbitp)pChunkto)->aBits [3] = ((mng_sbitp)pChunkfrom)->aBits [3]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -ASSIGN_CHUNK_HDR (mng_assign_splt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SPLT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_sPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_spltp)pChunkto)->bEmpty = ((mng_spltp)pChunkfrom)->bEmpty; - ((mng_spltp)pChunkto)->iNamesize = ((mng_spltp)pChunkfrom)->iNamesize; - ((mng_spltp)pChunkto)->iSampledepth = ((mng_spltp)pChunkfrom)->iSampledepth; - ((mng_spltp)pChunkto)->iEntrycount = ((mng_spltp)pChunkfrom)->iEntrycount; - ((mng_spltp)pChunkto)->pEntries = ((mng_spltp)pChunkfrom)->pEntries; - - if (((mng_spltp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_spltp)pChunkto)->zName, ((mng_spltp)pChunkto)->iNamesize); - MNG_COPY (((mng_spltp)pChunkto)->zName, ((mng_spltp)pChunkfrom)->zName, - ((mng_spltp)pChunkto)->iNamesize); - } - - if (((mng_spltp)pChunkto)->iEntrycount) - { - mng_uint32 iLen = ((mng_spltp)pChunkto)->iEntrycount * - (((mng_spltp)pChunkto)->iSampledepth * 3 + sizeof (mng_uint16)); - - MNG_ALLOC (pData, ((mng_spltp)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_spltp)pChunkto)->pEntries, ((mng_spltp)pChunkfrom)->pEntries, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_hIST -ASSIGN_CHUNK_HDR (mng_assign_hist) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_HIST, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_hIST) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_histp)pChunkto)->iEntrycount = ((mng_histp)pChunkfrom)->iEntrycount; - - for (iX = 0; iX < ((mng_histp)pChunkto)->iEntrycount; iX++) - ((mng_histp)pChunkto)->aEntries [iX] = ((mng_histp)pChunkfrom)->aEntries [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_tIME -ASSIGN_CHUNK_HDR (mng_assign_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TIME, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_tIME) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_timep)pChunkto)->iYear = ((mng_timep)pChunkfrom)->iYear; - ((mng_timep)pChunkto)->iMonth = ((mng_timep)pChunkfrom)->iMonth; - ((mng_timep)pChunkto)->iDay = ((mng_timep)pChunkfrom)->iDay; - ((mng_timep)pChunkto)->iHour = ((mng_timep)pChunkfrom)->iHour; - ((mng_timep)pChunkto)->iMinute = ((mng_timep)pChunkfrom)->iMinute; - ((mng_timep)pChunkto)->iSecond = ((mng_timep)pChunkfrom)->iSecond; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_mhdrp)pChunkto)->iWidth = ((mng_mhdrp)pChunkfrom)->iWidth; - ((mng_mhdrp)pChunkto)->iHeight = ((mng_mhdrp)pChunkfrom)->iHeight; - ((mng_mhdrp)pChunkto)->iTicks = ((mng_mhdrp)pChunkfrom)->iTicks; - ((mng_mhdrp)pChunkto)->iLayercount = ((mng_mhdrp)pChunkfrom)->iLayercount; - ((mng_mhdrp)pChunkto)->iFramecount = ((mng_mhdrp)pChunkfrom)->iFramecount; - ((mng_mhdrp)pChunkto)->iPlaytime = ((mng_mhdrp)pChunkfrom)->iPlaytime; - ((mng_mhdrp)pChunkto)->iSimplicity = ((mng_mhdrp)pChunkfrom)->iSimplicity; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MEND, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MEND) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -ASSIGN_CHUNK_HDR (mng_assign_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_LOOP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_LOOP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_loopp)pChunkto)->iLevel = ((mng_loopp)pChunkfrom)->iLevel; - ((mng_loopp)pChunkto)->iRepeat = ((mng_loopp)pChunkfrom)->iRepeat; - ((mng_loopp)pChunkto)->iTermination = ((mng_loopp)pChunkfrom)->iTermination; - ((mng_loopp)pChunkto)->iItermin = ((mng_loopp)pChunkfrom)->iItermin; - ((mng_loopp)pChunkto)->iItermax = ((mng_loopp)pChunkfrom)->iItermax; - ((mng_loopp)pChunkto)->iCount = ((mng_loopp)pChunkfrom)->iCount; - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (((mng_loopp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_loopp)pChunkto)->iCount * sizeof (mng_uint32); - MNG_ALLOC (pData, ((mng_loopp)pChunkto)->pSignals, iLen); - MNG_COPY (((mng_loopp)pChunkto)->pSignals, ((mng_loopp)pChunkfrom)->pSignals, iLen); - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ENDL, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_ENDL) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_endlp)pChunkto)->iLevel = ((mng_endlp)pChunkfrom)->iLevel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_DEFI -ASSIGN_CHUNK_HDR (mng_assign_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DEFI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DEFI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_defip)pChunkto)->iObjectid = ((mng_defip)pChunkfrom)->iObjectid; - ((mng_defip)pChunkto)->bHasdonotshow = ((mng_defip)pChunkfrom)->bHasdonotshow; - ((mng_defip)pChunkto)->iDonotshow = ((mng_defip)pChunkfrom)->iDonotshow; - ((mng_defip)pChunkto)->bHasconcrete = ((mng_defip)pChunkfrom)->bHasconcrete; - ((mng_defip)pChunkto)->iConcrete = ((mng_defip)pChunkfrom)->iConcrete; - ((mng_defip)pChunkto)->bHasloca = ((mng_defip)pChunkfrom)->bHasloca; - ((mng_defip)pChunkto)->iXlocation = ((mng_defip)pChunkfrom)->iXlocation; - ((mng_defip)pChunkto)->iYlocation = ((mng_defip)pChunkfrom)->iYlocation; - ((mng_defip)pChunkto)->bHasclip = ((mng_defip)pChunkfrom)->bHasclip; - ((mng_defip)pChunkto)->iLeftcb = ((mng_defip)pChunkfrom)->iLeftcb; - ((mng_defip)pChunkto)->iRightcb = ((mng_defip)pChunkfrom)->iRightcb; - ((mng_defip)pChunkto)->iTopcb = ((mng_defip)pChunkfrom)->iTopcb; - ((mng_defip)pChunkto)->iBottomcb = ((mng_defip)pChunkfrom)->iBottomcb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_BASI -ASSIGN_CHUNK_HDR (mng_assign_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BASI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_BASI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_basip)pChunkto)->iWidth = ((mng_basip)pChunkfrom)->iWidth; - ((mng_basip)pChunkto)->iHeight = ((mng_basip)pChunkfrom)->iHeight; - ((mng_basip)pChunkto)->iBitdepth = ((mng_basip)pChunkfrom)->iBitdepth; - ((mng_basip)pChunkto)->iColortype = ((mng_basip)pChunkfrom)->iColortype; - ((mng_basip)pChunkto)->iCompression = ((mng_basip)pChunkfrom)->iCompression; - ((mng_basip)pChunkto)->iFilter = ((mng_basip)pChunkfrom)->iFilter; - ((mng_basip)pChunkto)->iInterlace = ((mng_basip)pChunkfrom)->iInterlace; - ((mng_basip)pChunkto)->iRed = ((mng_basip)pChunkfrom)->iRed; - ((mng_basip)pChunkto)->iGreen = ((mng_basip)pChunkfrom)->iGreen; - ((mng_basip)pChunkto)->iBlue = ((mng_basip)pChunkfrom)->iBlue; - ((mng_basip)pChunkto)->iAlpha = ((mng_basip)pChunkfrom)->iAlpha; - ((mng_basip)pChunkto)->iViewable = ((mng_basip)pChunkfrom)->iViewable; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_CLON -ASSIGN_CHUNK_HDR (mng_assign_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLON, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_CLON) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_clonp)pChunkto)->iSourceid = ((mng_clonp)pChunkfrom)->iSourceid; - ((mng_clonp)pChunkto)->iCloneid = ((mng_clonp)pChunkfrom)->iCloneid; - ((mng_clonp)pChunkto)->iClonetype = ((mng_clonp)pChunkfrom)->iClonetype; -#ifdef MNG_OPTIMIZE_CHUNKREADER - ((mng_clonp)pChunkto)->bHasdonotshow = ((mng_clonp)pChunkfrom)->bHasdonotshow; -#endif - ((mng_clonp)pChunkto)->iDonotshow = ((mng_clonp)pChunkfrom)->iDonotshow; - ((mng_clonp)pChunkto)->iConcrete = ((mng_clonp)pChunkfrom)->iConcrete; - ((mng_clonp)pChunkto)->bHasloca = ((mng_clonp)pChunkfrom)->bHasloca; - ((mng_clonp)pChunkto)->iLocationtype = ((mng_clonp)pChunkfrom)->iLocationtype; - ((mng_clonp)pChunkto)->iLocationx = ((mng_clonp)pChunkfrom)->iLocationx; - ((mng_clonp)pChunkto)->iLocationy = ((mng_clonp)pChunkfrom)->iLocationy; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -ASSIGN_CHUNK_HDR (mng_assign_past) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PAST, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_pastp)pChunkto)->iDestid = ((mng_pastp)pChunkfrom)->iDestid; - ((mng_pastp)pChunkto)->iTargettype = ((mng_pastp)pChunkfrom)->iTargettype; - ((mng_pastp)pChunkto)->iTargetx = ((mng_pastp)pChunkfrom)->iTargetx; - ((mng_pastp)pChunkto)->iTargety = ((mng_pastp)pChunkfrom)->iTargety; - ((mng_pastp)pChunkto)->iCount = ((mng_pastp)pChunkfrom)->iCount; - - if (((mng_pastp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_pastp)pChunkto)->iCount * sizeof (mng_past_source); - - MNG_ALLOC (pData, ((mng_pastp)pChunkto)->pSources, iLen); - MNG_COPY (((mng_pastp)pChunkto)->pSources, ((mng_pastp)pChunkfrom)->pSources, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -ASSIGN_CHUNK_HDR (mng_assign_disc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DISC, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DISC) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_discp)pChunkto)->iCount = ((mng_discp)pChunkfrom)->iCount; - - if (((mng_discp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_discp)pChunkto)->iCount * sizeof (mng_uint16); - - MNG_ALLOC (pData, ((mng_discp)pChunkto)->pObjectids, iLen); - MNG_COPY (((mng_discp)pChunkto)->pObjectids, ((mng_discp)pChunkfrom)->pObjectids, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_BACK -ASSIGN_CHUNK_HDR (mng_assign_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BACK, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_BACK) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_backp)pChunkto)->iRed = ((mng_backp)pChunkfrom)->iRed; - ((mng_backp)pChunkto)->iGreen = ((mng_backp)pChunkfrom)->iGreen; - ((mng_backp)pChunkto)->iBlue = ((mng_backp)pChunkfrom)->iBlue; - ((mng_backp)pChunkto)->iMandatory = ((mng_backp)pChunkfrom)->iMandatory; - ((mng_backp)pChunkto)->iImageid = ((mng_backp)pChunkfrom)->iImageid; - ((mng_backp)pChunkto)->iTile = ((mng_backp)pChunkfrom)->iTile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -ASSIGN_CHUNK_HDR (mng_assign_fram) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FRAM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_FRAM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_framp)pChunkto)->bEmpty = ((mng_framp)pChunkfrom)->bEmpty; - ((mng_framp)pChunkto)->iMode = ((mng_framp)pChunkfrom)->iMode; - ((mng_framp)pChunkto)->iNamesize = ((mng_framp)pChunkfrom)->iNamesize; - ((mng_framp)pChunkto)->iChangedelay = ((mng_framp)pChunkfrom)->iChangedelay; - ((mng_framp)pChunkto)->iChangetimeout = ((mng_framp)pChunkfrom)->iChangetimeout; - ((mng_framp)pChunkto)->iChangeclipping = ((mng_framp)pChunkfrom)->iChangeclipping; - ((mng_framp)pChunkto)->iChangesyncid = ((mng_framp)pChunkfrom)->iChangesyncid; - ((mng_framp)pChunkto)->iDelay = ((mng_framp)pChunkfrom)->iDelay; - ((mng_framp)pChunkto)->iTimeout = ((mng_framp)pChunkfrom)->iTimeout; - ((mng_framp)pChunkto)->iBoundarytype = ((mng_framp)pChunkfrom)->iBoundarytype; - ((mng_framp)pChunkto)->iBoundaryl = ((mng_framp)pChunkfrom)->iBoundaryl; - ((mng_framp)pChunkto)->iBoundaryr = ((mng_framp)pChunkfrom)->iBoundaryr; - ((mng_framp)pChunkto)->iBoundaryt = ((mng_framp)pChunkfrom)->iBoundaryt; - ((mng_framp)pChunkto)->iBoundaryb = ((mng_framp)pChunkfrom)->iBoundaryb; - ((mng_framp)pChunkto)->iCount = ((mng_framp)pChunkfrom)->iCount; - - if (((mng_framp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_framp)pChunkto)->zName, ((mng_framp)pChunkto)->iNamesize); - MNG_COPY (((mng_framp)pChunkto)->zName, ((mng_framp)pChunkfrom)->zName, - ((mng_framp)pChunkto)->iNamesize); - } - - if (((mng_framp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_framp)pChunkto)->iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_framp)pChunkto)->pSyncids, iLen); - MNG_COPY (((mng_framp)pChunkto)->pSyncids, ((mng_framp)pChunkfrom)->pSyncids, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_MOVE -ASSIGN_CHUNK_HDR (mng_assign_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MOVE, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MOVE) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_movep)pChunkto)->iFirstid = ((mng_movep)pChunkfrom)->iFirstid; - ((mng_movep)pChunkto)->iLastid = ((mng_movep)pChunkfrom)->iLastid; - ((mng_movep)pChunkto)->iMovetype = ((mng_movep)pChunkfrom)->iMovetype; - ((mng_movep)pChunkto)->iMovex = ((mng_movep)pChunkfrom)->iMovex; - ((mng_movep)pChunkto)->iMovey = ((mng_movep)pChunkfrom)->iMovey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_CLIP -ASSIGN_CHUNK_HDR (mng_assign_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLIP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_CLIP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_clipp)pChunkto)->iFirstid = ((mng_clipp)pChunkfrom)->iFirstid; - ((mng_clipp)pChunkto)->iLastid = ((mng_clipp)pChunkfrom)->iLastid; - ((mng_clipp)pChunkto)->iCliptype = ((mng_clipp)pChunkfrom)->iCliptype; - ((mng_clipp)pChunkto)->iClipl = ((mng_clipp)pChunkfrom)->iClipl; - ((mng_clipp)pChunkto)->iClipr = ((mng_clipp)pChunkfrom)->iClipr; - ((mng_clipp)pChunkto)->iClipt = ((mng_clipp)pChunkfrom)->iClipt; - ((mng_clipp)pChunkto)->iClipb = ((mng_clipp)pChunkfrom)->iClipb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_SHOW -ASSIGN_CHUNK_HDR (mng_assign_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SHOW, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_SHOW) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_showp)pChunkto)->bEmpty = ((mng_showp)pChunkfrom)->bEmpty; - ((mng_showp)pChunkto)->iFirstid = ((mng_showp)pChunkfrom)->iFirstid; - ((mng_showp)pChunkto)->iLastid = ((mng_showp)pChunkfrom)->iLastid; - ((mng_showp)pChunkto)->iMode = ((mng_showp)pChunkfrom)->iMode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_TERM -ASSIGN_CHUNK_HDR (mng_assign_term) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TERM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_TERM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_termp)pChunkto)->iTermaction = ((mng_termp)pChunkfrom)->iTermaction; - ((mng_termp)pChunkto)->iIteraction = ((mng_termp)pChunkfrom)->iIteraction; - ((mng_termp)pChunkto)->iDelay = ((mng_termp)pChunkfrom)->iDelay; - ((mng_termp)pChunkto)->iItermax = ((mng_termp)pChunkfrom)->iItermax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -ASSIGN_CHUNK_HDR (mng_assign_save) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SAVE, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_savep)pChunkto)->bEmpty = ((mng_savep)pChunkfrom)->bEmpty; - ((mng_savep)pChunkto)->iOffsettype = ((mng_savep)pChunkfrom)->iOffsettype; - ((mng_savep)pChunkto)->iCount = ((mng_savep)pChunkfrom)->iCount; - - if (((mng_savep)pChunkto)->iCount) - { - mng_uint32 iX; - mng_save_entryp pEntry; - mng_uint32 iLen = ((mng_savep)pChunkto)->iCount * sizeof (mng_save_entry); - - MNG_ALLOC (pData, ((mng_savep)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_savep)pChunkto)->pEntries, ((mng_savep)pChunkfrom)->pEntries, iLen); - - pEntry = ((mng_savep)pChunkto)->pEntries; - - for (iX = 0; iX < ((mng_savep)pChunkto)->iCount; iX++) - { - if (pEntry->iNamesize) - { - mng_pchar pTemp = pEntry->zName; - - MNG_ALLOC (pData, pEntry->zName, pEntry->iNamesize); - MNG_COPY (pEntry->zName, pTemp, pEntry->iNamesize); - } - else - { - pEntry->zName = MNG_NULL; - } - - pEntry++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -ASSIGN_CHUNK_HDR (mng_assign_seek) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SEEK, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_SEEK) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_seekp)pChunkto)->iNamesize = ((mng_seekp)pChunkfrom)->iNamesize; - - if (((mng_seekp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_seekp)pChunkto)->zName, ((mng_seekp)pChunkto)->iNamesize); - MNG_COPY (((mng_seekp)pChunkto)->zName, ((mng_seekp)pChunkfrom)->zName, - ((mng_seekp)pChunkto)->iNamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -ASSIGN_CHUNK_HDR (mng_assign_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EXPI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_eXPI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_expip)pChunkto)->iSnapshotid = ((mng_expip)pChunkfrom)->iSnapshotid; - ((mng_expip)pChunkto)->iNamesize = ((mng_expip)pChunkfrom)->iNamesize; - - if (((mng_expip)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_expip)pChunkto)->zName, ((mng_expip)pChunkto)->iNamesize); - MNG_COPY (((mng_expip)pChunkto)->zName, ((mng_expip)pChunkfrom)->zName, - ((mng_expip)pChunkto)->iNamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_fPRI -ASSIGN_CHUNK_HDR (mng_assign_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FPRI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_fPRI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_fprip)pChunkto)->iDeltatype = ((mng_fprip)pChunkfrom)->iDeltatype; - ((mng_fprip)pChunkto)->iPriority = ((mng_fprip)pChunkfrom)->iPriority; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -ASSIGN_CHUNK_HDR (mng_assign_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_NEED, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_nEED) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_needp)pChunkto)->iKeywordssize = ((mng_needp)pChunkfrom)->iKeywordssize; - - if (((mng_needp)pChunkto)->iKeywordssize) - { - MNG_ALLOC (pData, ((mng_needp)pChunkto)->zKeywords, ((mng_needp)pChunkto)->iKeywordssize); - MNG_COPY (((mng_needp)pChunkto)->zKeywords, ((mng_needp)pChunkfrom)->zKeywords, - ((mng_needp)pChunkto)->iKeywordssize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_pHYg -ASSIGN_CHUNK_HDR (mng_assign_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_pHYg) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_phygp)pChunkto)->bEmpty = ((mng_phygp)pChunkfrom)->bEmpty; - ((mng_phygp)pChunkto)->iSizex = ((mng_phygp)pChunkfrom)->iSizex; - ((mng_phygp)pChunkto)->iSizey = ((mng_phygp)pChunkfrom)->iSizey; - ((mng_phygp)pChunkto)->iUnit = ((mng_phygp)pChunkfrom)->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_jhdrp)pChunkto)->iWidth = ((mng_jhdrp)pChunkfrom)->iWidth; - ((mng_jhdrp)pChunkto)->iHeight = ((mng_jhdrp)pChunkfrom)->iHeight; - ((mng_jhdrp)pChunkto)->iColortype = ((mng_jhdrp)pChunkfrom)->iColortype; - ((mng_jhdrp)pChunkto)->iImagesampledepth = ((mng_jhdrp)pChunkfrom)->iImagesampledepth; - ((mng_jhdrp)pChunkto)->iImagecompression = ((mng_jhdrp)pChunkfrom)->iImagecompression; - ((mng_jhdrp)pChunkto)->iImageinterlace = ((mng_jhdrp)pChunkfrom)->iImageinterlace; - ((mng_jhdrp)pChunkto)->iAlphasampledepth = ((mng_jhdrp)pChunkfrom)->iAlphasampledepth; - ((mng_jhdrp)pChunkto)->iAlphacompression = ((mng_jhdrp)pChunkfrom)->iAlphacompression; - ((mng_jhdrp)pChunkto)->iAlphafilter = ((mng_jhdrp)pChunkfrom)->iAlphafilter; - ((mng_jhdrp)pChunkto)->iAlphainterlace = ((mng_jhdrp)pChunkfrom)->iAlphainterlace; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jdaa) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAA, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JDAA) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_jdaap)pChunkto)->bEmpty = ((mng_jdaap)pChunkfrom)->bEmpty; - ((mng_jdaap)pChunkto)->iDatasize = ((mng_jdaap)pChunkfrom)->iDatasize; - - if (((mng_jdaap)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_jdaap)pChunkto)->pData, ((mng_jdaap)pChunkto)->iDatasize); - MNG_COPY (((mng_jdaap)pChunkto)->pData, ((mng_jdaap)pChunkfrom)->pData, - ((mng_jdaap)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jdat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_jdatp)pChunkto)->bEmpty = ((mng_jdatp)pChunkfrom)->bEmpty; - ((mng_jdatp)pChunkto)->iDatasize = ((mng_jdatp)pChunkfrom)->iDatasize; - - if (((mng_jdatp)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_jdatp)pChunkto)->pData, ((mng_jdatp)pChunkto)->iDatasize); - MNG_COPY (((mng_jdatp)pChunkto)->pData, ((mng_jdatp)pChunkfrom)->pData, - ((mng_jdatp)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JSEP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JSEP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_dhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_dhdrp)pChunkto)->iObjectid = ((mng_dhdrp)pChunkfrom)->iObjectid; - ((mng_dhdrp)pChunkto)->iImagetype = ((mng_dhdrp)pChunkfrom)->iImagetype; - ((mng_dhdrp)pChunkto)->iDeltatype = ((mng_dhdrp)pChunkfrom)->iDeltatype; - ((mng_dhdrp)pChunkto)->iBlockwidth = ((mng_dhdrp)pChunkfrom)->iBlockwidth; - ((mng_dhdrp)pChunkto)->iBlockheight = ((mng_dhdrp)pChunkfrom)->iBlockheight; - ((mng_dhdrp)pChunkto)->iBlockx = ((mng_dhdrp)pChunkfrom)->iBlockx; - ((mng_dhdrp)pChunkto)->iBlocky = ((mng_dhdrp)pChunkfrom)->iBlocky; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_prom) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PROM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PROM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_promp)pChunkto)->iColortype = ((mng_promp)pChunkfrom)->iColortype; - ((mng_promp)pChunkto)->iSampledepth = ((mng_promp)pChunkfrom)->iSampledepth; - ((mng_promp)pChunkto)->iFilltype = ((mng_promp)pChunkfrom)->iFilltype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IPNG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IPNG) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_pplt) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PPLT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ppltp)pChunkto)->iDeltatype = ((mng_ppltp)pChunkfrom)->iDeltatype; - ((mng_ppltp)pChunkto)->iCount = ((mng_ppltp)pChunkfrom)->iCount; - - for (iX = 0; iX < ((mng_ppltp)pChunkto)->iCount; iX++) - ((mng_ppltp)pChunkto)->aEntries [iX] = ((mng_ppltp)pChunkfrom)->aEntries [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IJNG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IJNG) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DROP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DROP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_dropp)pChunkto)->iCount = ((mng_dropp)pChunkfrom)->iCount; - - if (((mng_dropp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_dropp)pChunkto)->iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_dropp)pChunkto)->pChunknames, iLen); - MNG_COPY (((mng_dropp)pChunkto)->pChunknames, ((mng_dropp)pChunkfrom)->pChunknames, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -ASSIGN_CHUNK_HDR (mng_assign_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DBYK, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DBYK) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_dbykp)pChunkto)->iChunkname = ((mng_dbykp)pChunkfrom)->iChunkname; - ((mng_dbykp)pChunkto)->iPolarity = ((mng_dbykp)pChunkfrom)->iPolarity; - ((mng_dbykp)pChunkto)->iKeywordssize = ((mng_dbykp)pChunkfrom)->iKeywordssize; - - if (((mng_dbykp)pChunkto)->iKeywordssize) - { - MNG_ALLOC (pData, ((mng_dbykp)pChunkto)->zKeywords, ((mng_dbykp)pChunkto)->iKeywordssize); - MNG_COPY (((mng_dbykp)pChunkto)->zKeywords, ((mng_dbykp)pChunkfrom)->zKeywords, - ((mng_dbykp)pChunkto)->iKeywordssize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -ASSIGN_CHUNK_HDR (mng_assign_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ORDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ordrp)pChunkto)->iCount = ((mng_ordrp)pChunkfrom)->iCount; - - if (((mng_ordrp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_ordrp)pChunkto)->iCount * sizeof (mng_ordr_entry); - - MNG_ALLOC (pData, ((mng_ordrp)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_ordrp)pChunkto)->pEntries, ((mng_ordrp)pChunkfrom)->pEntries, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_MAGN -ASSIGN_CHUNK_HDR (mng_assign_magn) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MAGN, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MAGN) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_magnp)pChunkto)->iFirstid = ((mng_magnp)pChunkfrom)->iFirstid; - ((mng_magnp)pChunkto)->iLastid = ((mng_magnp)pChunkfrom)->iLastid; - ((mng_magnp)pChunkto)->iMethodX = ((mng_magnp)pChunkfrom)->iMethodX; - ((mng_magnp)pChunkto)->iMX = ((mng_magnp)pChunkfrom)->iMX; - ((mng_magnp)pChunkto)->iMY = ((mng_magnp)pChunkfrom)->iMY; - ((mng_magnp)pChunkto)->iML = ((mng_magnp)pChunkfrom)->iML; - ((mng_magnp)pChunkto)->iMR = ((mng_magnp)pChunkfrom)->iMR; - ((mng_magnp)pChunkto)->iMT = ((mng_magnp)pChunkfrom)->iMT; - ((mng_magnp)pChunkto)->iMB = ((mng_magnp)pChunkfrom)->iMB; - ((mng_magnp)pChunkto)->iMethodY = ((mng_magnp)pChunkfrom)->iMethodY; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_mpng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MPNG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_mpngp)pChunkto)->iFramewidth = ((mng_mpngp)pChunkfrom)->iFramewidth; - ((mng_mpngp)pChunkto)->iFrameheight = ((mng_mpngp)pChunkfrom)->iFrameheight; - ((mng_mpngp)pChunkto)->iNumplays = ((mng_mpngp)pChunkfrom)->iNumplays; - ((mng_mpngp)pChunkto)->iTickspersec = ((mng_mpngp)pChunkfrom)->iTickspersec; - ((mng_mpngp)pChunkto)->iCompressionmethod = ((mng_mpngp)pChunkfrom)->iCompressionmethod; - ((mng_mpngp)pChunkto)->iFramessize = ((mng_mpngp)pChunkfrom)->iFramessize; - - if (((mng_mpngp)pChunkto)->iFramessize) - { - MNG_ALLOC (pData, ((mng_mpngp)pChunkto)->pFrames, ((mng_mpngp)pChunkto)->iFramessize); - MNG_COPY (((mng_mpngp)pChunkto)->pFrames, ((mng_mpngp)pChunkfrom)->pFrames, - ((mng_mpngp)pChunkto)->iFramessize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_ahdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_AHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_ahDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ahdrp)pChunkto)->iNumframes = ((mng_ahdrp)pChunkfrom)->iNumframes; - ((mng_ahdrp)pChunkto)->iTickspersec = ((mng_ahdrp)pChunkfrom)->iTickspersec; - ((mng_ahdrp)pChunkto)->iNumplays = ((mng_ahdrp)pChunkfrom)->iNumplays; - ((mng_ahdrp)pChunkto)->iTilewidth = ((mng_ahdrp)pChunkfrom)->iTilewidth; - ((mng_ahdrp)pChunkto)->iTileheight = ((mng_ahdrp)pChunkfrom)->iTileheight; - ((mng_ahdrp)pChunkto)->iInterlace = ((mng_ahdrp)pChunkfrom)->iInterlace; - ((mng_ahdrp)pChunkto)->iStillused = ((mng_ahdrp)pChunkfrom)->iStillused; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_AHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_adat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ADAT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_adAT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_adatp)pChunkto)->iTilessize = ((mng_adatp)pChunkfrom)->iTilessize; - - if (((mng_adatp)pChunkto)->iTilessize) - { - MNG_ALLOC (pData, ((mng_adatp)pChunkto)->pTiles, ((mng_adatp)pChunkto)->iTilessize); - MNG_COPY (((mng_adatp)pChunkto)->pTiles, ((mng_adatp)pChunkfrom)->pTiles, - ((mng_adatp)pChunkto)->iTilessize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ADAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -ASSIGN_CHUNK_HDR (mng_assign_evnt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EVNT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_evntp)pChunkto)->iCount = ((mng_evntp)pChunkfrom)->iCount; - - if (((mng_evntp)pChunkto)->iCount) - { - mng_uint32 iX; - mng_evnt_entryp pEntry; - mng_uint32 iLen = ((mng_evntp)pChunkto)->iCount * sizeof (mng_evnt_entry); - - MNG_ALLOC (pData, ((mng_evntp)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_evntp)pChunkto)->pEntries, ((mng_evntp)pChunkfrom)->pEntries, iLen); - - pEntry = ((mng_evntp)pChunkto)->pEntries; - - for (iX = 0; iX < ((mng_evntp)pChunkto)->iCount; iX++) - { - if (pEntry->iSegmentnamesize) - { - mng_pchar pTemp = pEntry->zSegmentname; - - MNG_ALLOC (pData, pEntry->zSegmentname, pEntry->iSegmentnamesize+1); - MNG_COPY (pEntry->zSegmentname, pTemp, pEntry->iSegmentnamesize); - } - else - { - pEntry->zSegmentname = MNG_NULL; - } - - pEntry++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -ASSIGN_CHUNK_HDR (mng_assign_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_UNKNOWN, MNG_LC_START); -#endif - - ((mng_unknown_chunkp)pChunkto)->iDatasize = ((mng_unknown_chunkp)pChunkfrom)->iDatasize; - - if (((mng_unknown_chunkp)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_unknown_chunkp)pChunkto)->pData, ((mng_unknown_chunkp)pChunkto)->iDatasize); - MNG_COPY (((mng_unknown_chunkp)pChunkto)->pData, ((mng_unknown_chunkp)pChunkfrom)->pData, - ((mng_unknown_chunkp)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_chunk_prc.h b/Engine/lib/lmng/libmng_chunk_prc.h deleted file mode 100644 index 0cf0f3c1d..000000000 --- a/Engine/lib/lmng/libmng_chunk_prc.h +++ /dev/null @@ -1,381 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_prc.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk initialization & cleanup (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : definition of the chunk initialization & cleanup routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added NO_DELTA_PNG support * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunk_prc_h_ -#define _libmng_chunk_prc_h_ - -/* ************************************************************************** */ - -void mng_add_chunk (mng_datap pData, - mng_chunkp pChunk); - -/* ************************************************************************** */ - -#define INIT_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pHeader, \ - mng_chunkp* ppChunk) - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -INIT_CHUNK_HDR (mng_init_general) ; -#else -INIT_CHUNK_HDR (mng_init_ihdr) ; -INIT_CHUNK_HDR (mng_init_plte) ; -INIT_CHUNK_HDR (mng_init_idat) ; -INIT_CHUNK_HDR (mng_init_iend) ; -INIT_CHUNK_HDR (mng_init_trns) ; -INIT_CHUNK_HDR (mng_init_gama) ; -INIT_CHUNK_HDR (mng_init_chrm) ; -INIT_CHUNK_HDR (mng_init_srgb) ; -INIT_CHUNK_HDR (mng_init_iccp) ; -INIT_CHUNK_HDR (mng_init_text) ; -INIT_CHUNK_HDR (mng_init_ztxt) ; -INIT_CHUNK_HDR (mng_init_itxt) ; -INIT_CHUNK_HDR (mng_init_bkgd) ; -INIT_CHUNK_HDR (mng_init_phys) ; -INIT_CHUNK_HDR (mng_init_sbit) ; -INIT_CHUNK_HDR (mng_init_splt) ; -INIT_CHUNK_HDR (mng_init_hist) ; -INIT_CHUNK_HDR (mng_init_time) ; -INIT_CHUNK_HDR (mng_init_mhdr) ; -INIT_CHUNK_HDR (mng_init_mend) ; -INIT_CHUNK_HDR (mng_init_loop) ; -INIT_CHUNK_HDR (mng_init_endl) ; -INIT_CHUNK_HDR (mng_init_defi) ; -INIT_CHUNK_HDR (mng_init_basi) ; -INIT_CHUNK_HDR (mng_init_clon) ; -#ifndef MNG_SKIPCHUNK_PAST -INIT_CHUNK_HDR (mng_init_past) ; -#endif -INIT_CHUNK_HDR (mng_init_disc) ; -INIT_CHUNK_HDR (mng_init_back) ; -INIT_CHUNK_HDR (mng_init_fram) ; -INIT_CHUNK_HDR (mng_init_move) ; -INIT_CHUNK_HDR (mng_init_clip) ; -INIT_CHUNK_HDR (mng_init_show) ; -INIT_CHUNK_HDR (mng_init_term) ; -INIT_CHUNK_HDR (mng_init_save) ; -INIT_CHUNK_HDR (mng_init_seek) ; -INIT_CHUNK_HDR (mng_init_expi) ; -INIT_CHUNK_HDR (mng_init_fpri) ; -INIT_CHUNK_HDR (mng_init_need) ; -INIT_CHUNK_HDR (mng_init_phyg) ; -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jhdr) ; -INIT_CHUNK_HDR (mng_init_jdaa) ; -INIT_CHUNK_HDR (mng_init_jdat) ; -INIT_CHUNK_HDR (mng_init_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_dhdr) ; -INIT_CHUNK_HDR (mng_init_prom) ; -INIT_CHUNK_HDR (mng_init_ipng) ; -INIT_CHUNK_HDR (mng_init_pplt) ; -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_ijng) ; -#endif -INIT_CHUNK_HDR (mng_init_drop) ; -INIT_CHUNK_HDR (mng_init_dbyk) ; -INIT_CHUNK_HDR (mng_init_ordr) ; -#endif -INIT_CHUNK_HDR (mng_init_magn) ; -INIT_CHUNK_HDR (mng_init_evnt) ; -INIT_CHUNK_HDR (mng_init_unknown) ; -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - -/* ************************************************************************** */ - -#define FREE_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pHeader) - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_general) ; -#else /* MNG_OPTIMIZE_CHUNKINITFREE */ -FREE_CHUNK_HDR (mng_free_ihdr) ; -FREE_CHUNK_HDR (mng_free_plte) ; -FREE_CHUNK_HDR (mng_free_iend) ; -FREE_CHUNK_HDR (mng_free_trns) ; -FREE_CHUNK_HDR (mng_free_gama) ; -FREE_CHUNK_HDR (mng_free_chrm) ; -FREE_CHUNK_HDR (mng_free_srgb) ; -FREE_CHUNK_HDR (mng_free_bkgd) ; -FREE_CHUNK_HDR (mng_free_phys) ; -FREE_CHUNK_HDR (mng_free_sbit) ; -FREE_CHUNK_HDR (mng_free_hist) ; -FREE_CHUNK_HDR (mng_free_time) ; -FREE_CHUNK_HDR (mng_free_mhdr) ; -FREE_CHUNK_HDR (mng_free_mend) ; -FREE_CHUNK_HDR (mng_free_endl) ; -FREE_CHUNK_HDR (mng_free_defi) ; -FREE_CHUNK_HDR (mng_free_basi) ; -FREE_CHUNK_HDR (mng_free_clon) ; -FREE_CHUNK_HDR (mng_free_back) ; -FREE_CHUNK_HDR (mng_free_move) ; -FREE_CHUNK_HDR (mng_free_clip) ; -FREE_CHUNK_HDR (mng_free_show) ; -FREE_CHUNK_HDR (mng_free_term) ; -FREE_CHUNK_HDR (mng_free_fpri) ; -FREE_CHUNK_HDR (mng_free_phyg) ; -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jhdr) ; -FREE_CHUNK_HDR (mng_free_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_dhdr) ; -FREE_CHUNK_HDR (mng_free_prom) ; -FREE_CHUNK_HDR (mng_free_ipng) ; -FREE_CHUNK_HDR (mng_free_pplt) ; -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_ijng) ; -#endif -#endif -FREE_CHUNK_HDR (mng_free_magn) ; -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - -FREE_CHUNK_HDR (mng_free_idat) ; -FREE_CHUNK_HDR (mng_free_iccp) ; -FREE_CHUNK_HDR (mng_free_text) ; -FREE_CHUNK_HDR (mng_free_ztxt) ; -FREE_CHUNK_HDR (mng_free_itxt) ; -FREE_CHUNK_HDR (mng_free_splt) ; -FREE_CHUNK_HDR (mng_free_loop) ; -#ifndef MNG_SKIPCHUNK_PAST -FREE_CHUNK_HDR (mng_free_past) ; -#endif -FREE_CHUNK_HDR (mng_free_disc) ; -FREE_CHUNK_HDR (mng_free_fram) ; -FREE_CHUNK_HDR (mng_free_save) ; -FREE_CHUNK_HDR (mng_free_seek) ; -FREE_CHUNK_HDR (mng_free_expi) ; -FREE_CHUNK_HDR (mng_free_need) ; -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jdaa) ; -FREE_CHUNK_HDR (mng_free_jdat) ; -#endif -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_drop) ; -FREE_CHUNK_HDR (mng_free_dbyk) ; -FREE_CHUNK_HDR (mng_free_ordr) ; -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -FREE_CHUNK_HDR (mng_free_mpng) ; -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -FREE_CHUNK_HDR (mng_free_adat) ; -#endif -FREE_CHUNK_HDR (mng_free_evnt) ; -FREE_CHUNK_HDR (mng_free_unknown) ; - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -#define ASSIGN_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunkto, \ - mng_chunkp pChunkfrom) - -#ifdef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_general) ; -#else /* MNG_OPTIMIZE_CHUNKASSIGN */ -ASSIGN_CHUNK_HDR (mng_assign_ihdr) ; -ASSIGN_CHUNK_HDR (mng_assign_plte) ; -ASSIGN_CHUNK_HDR (mng_assign_iend) ; -ASSIGN_CHUNK_HDR (mng_assign_trns) ; -ASSIGN_CHUNK_HDR (mng_assign_gama) ; -ASSIGN_CHUNK_HDR (mng_assign_chrm) ; -ASSIGN_CHUNK_HDR (mng_assign_srgb) ; -ASSIGN_CHUNK_HDR (mng_assign_bkgd) ; -ASSIGN_CHUNK_HDR (mng_assign_phys) ; -ASSIGN_CHUNK_HDR (mng_assign_sbit) ; -ASSIGN_CHUNK_HDR (mng_assign_hist) ; -ASSIGN_CHUNK_HDR (mng_assign_time) ; -ASSIGN_CHUNK_HDR (mng_assign_mhdr) ; -ASSIGN_CHUNK_HDR (mng_assign_mend) ; -ASSIGN_CHUNK_HDR (mng_assign_endl) ; -ASSIGN_CHUNK_HDR (mng_assign_defi) ; -ASSIGN_CHUNK_HDR (mng_assign_basi) ; -ASSIGN_CHUNK_HDR (mng_assign_clon) ; -ASSIGN_CHUNK_HDR (mng_assign_back) ; -ASSIGN_CHUNK_HDR (mng_assign_move) ; -ASSIGN_CHUNK_HDR (mng_assign_clip) ; -ASSIGN_CHUNK_HDR (mng_assign_show) ; -ASSIGN_CHUNK_HDR (mng_assign_term) ; -ASSIGN_CHUNK_HDR (mng_assign_fpri) ; -ASSIGN_CHUNK_HDR (mng_assign_phyg) ; -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jhdr) ; -ASSIGN_CHUNK_HDR (mng_assign_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_dhdr) ; -ASSIGN_CHUNK_HDR (mng_assign_prom) ; -ASSIGN_CHUNK_HDR (mng_assign_ipng) ; -ASSIGN_CHUNK_HDR (mng_assign_pplt) ; -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_ijng) ; -#endif -#endif -ASSIGN_CHUNK_HDR (mng_assign_magn) ; -#endif /* MNG_OPTIMIZE_CHUNKASSIGN */ - -ASSIGN_CHUNK_HDR (mng_assign_idat) ; -ASSIGN_CHUNK_HDR (mng_assign_iccp) ; -ASSIGN_CHUNK_HDR (mng_assign_text) ; -ASSIGN_CHUNK_HDR (mng_assign_ztxt) ; -ASSIGN_CHUNK_HDR (mng_assign_itxt) ; -ASSIGN_CHUNK_HDR (mng_assign_splt) ; -ASSIGN_CHUNK_HDR (mng_assign_loop) ; -#ifndef MNG_SKIPCHUNK_PAST -ASSIGN_CHUNK_HDR (mng_assign_past) ; -#endif -ASSIGN_CHUNK_HDR (mng_assign_disc) ; -ASSIGN_CHUNK_HDR (mng_assign_fram) ; -ASSIGN_CHUNK_HDR (mng_assign_save) ; -ASSIGN_CHUNK_HDR (mng_assign_seek) ; -ASSIGN_CHUNK_HDR (mng_assign_need) ; -ASSIGN_CHUNK_HDR (mng_assign_expi) ; -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jdaa) ; -ASSIGN_CHUNK_HDR (mng_assign_jdat) ; -#endif -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_drop) ; -ASSIGN_CHUNK_HDR (mng_assign_dbyk) ; -ASSIGN_CHUNK_HDR (mng_assign_ordr) ; -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_mpng) ; -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_ahdr) ; -ASSIGN_CHUNK_HDR (mng_assign_adat) ; -#endif -ASSIGN_CHUNK_HDR (mng_assign_evnt) ; -ASSIGN_CHUNK_HDR (mng_assign_unknown) ; - -/* ************************************************************************** */ - -#else /* MNG_INCLUDE_WRITE_PROCS */ -#define mng_assign_general 0 -#define mng_assign_ihdr 0 -#define mng_assign_plte 0 -#define mng_assign_idat 0 -#define mng_assign_iend 0 -#define mng_assign_trns 0 -#define mng_assign_gama 0 -#define mng_assign_chrm 0 -#define mng_assign_srgb 0 -#define mng_assign_iccp 0 -#define mng_assign_text 0 -#define mng_assign_ztxt 0 -#define mng_assign_itxt 0 -#define mng_assign_bkgd 0 -#define mng_assign_phys 0 -#define mng_assign_sbit 0 -#define mng_assign_splt 0 -#define mng_assign_hist 0 -#define mng_assign_time 0 -#define mng_assign_mhdr 0 -#define mng_assign_mend 0 -#define mng_assign_loop 0 -#define mng_assign_endl 0 -#define mng_assign_defi 0 -#define mng_assign_basi 0 -#define mng_assign_clon 0 -#ifndef MNG_SKIPCHUNK_PAST -#define mng_assign_past 0 -#endif -#define mng_assign_disc 0 -#define mng_assign_back 0 -#define mng_assign_fram 0 -#define mng_assign_move 0 -#define mng_assign_clip 0 -#define mng_assign_show 0 -#define mng_assign_term 0 -#define mng_assign_save 0 -#define mng_assign_seek 0 -#define mng_assign_expi 0 -#define mng_assign_fpri 0 -#define mng_assign_phyg 0 -#ifdef MNG_INCLUDE_JNG -#define mng_assign_jhdr 0 -#define mng_assign_jdaa 0 -#define mng_assign_jdat 0 -#define mng_assign_jsep 0 -#endif -#ifndef MNG_NO_DELTA_PNG -#define mng_assign_dhdr 0 -#define mng_assign_prom 0 -#define mng_assign_ipng 0 -#define mng_assign_pplt 0 -#ifdef MNG_INCLUDE_JNG -#define mng_assign_ijng 0 -#endif -#define mng_assign_drop 0 -#define mng_assign_dbyk 0 -#define mng_assign_ordr 0 -#endif -#define mng_assign_magn 0 -#define mng_assign_need 0 -#define mng_assign_mpng 0 -#define mng_assign_ahdr 0 -#define mng_assign_adat 0 -#define mng_assign_evnt 0 -#define mng_assign_unknown 0 -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_chunk_prc_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_chunk_xs.c b/Engine/lib/lmng/libmng_chunk_xs.c deleted file mode 100644 index 13114090d..000000000 --- a/Engine/lib/lmng/libmng_chunk_xs.c +++ /dev/null @@ -1,7016 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_xs.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : chunk access functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the chunk access functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - changed and filled iterate-chunk function * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - fixed calling convention * */ -/* * - added getchunk functions * */ -/* * - added putchunk functions * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added empty-chunk put-routines * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/15/2000 - G.Juyn * */ -/* * - added getimgdata & putimgdata functions * */ -/* * * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - B004 - fixed problem with MNG_SUPPORT_WRITE not defined * */ -/* * also for MNG_SUPPORT_WRITE without MNG_INCLUDE_JNG * */ -/* * - Cleaned up some code regarding mixed support * */ -/* * * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed creation-code * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added function to set simplicity field * */ -/* * - fixed putchunk_unknown() function * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - fixed putchunk_plte() to set bEmpty parameter * */ -/* * * */ -/* * 0.9.5 - 01/25/2001 - G.Juyn * */ -/* * - fixed some small compiler warnings (thanks Nikki) * */ -/* * * */ -/* * 1.0.5 - 09/07/2002 - G.Juyn * */ -/* * - B578940 - unimplemented functions return errorcode * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added check for TERM placement during create/write * */ -/* * 1.0.5 - 11/28/2002 - G.Juyn * */ -/* * - fixed definition of iMethodX/Y for MAGN chunk * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_NO_DELTA_PNG reduction and more SKIPCHUNK * */ -/* * optimizations * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.8 - 04/01/2004 - G.Juyn * */ -/* * - added missing get-/put-chunk-jdaa * */ -/* * 1.0.8 - 08/02/2004 - G.Juyn * */ -/* * - added conditional to allow easier writing of large MNG's * */ -/* * * */ -/* * 1.0.9 - 09/17/2004 - G.R-P * */ -/* * - added two more conditionals * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 17/14/2004 - G.Juyn * */ -/* * - fixed PPLT getchunk/putchunk routines * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#ifdef MNG_OPTIMIZE_CHUNKREADER -#include "libmng_chunk_descr.h" -#endif -#include "libmng_chunk_prc.h" -#include "libmng_chunk_io.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_ACCESS_CHUNKS - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle, - mng_uint32 iChunkseq, - mng_iteratechunk fProc) -{ - mng_uint32 iSeq; - mng_chunkid iChunkname; - mng_datap pData; - mng_chunkp pChunk; - mng_bool bCont; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - iSeq = 0; - bCont = MNG_TRUE; - pChunk = pData->pFirstchunk; /* get the first chunk */ - /* as long as there are some more */ - while ((pChunk) && (bCont)) /* and the app didn't signal a stop */ - { - if (iSeq >= iChunkseq) /* reached the first target ? */ - { /* then call this and next ones back in... */ - iChunkname = ((mng_chunk_headerp)pChunk)->iChunkname; - bCont = fProc (hHandle, (mng_handle)pChunk, iChunkname, iSeq); - } - - iSeq++; /* next one */ - pChunk = ((mng_chunk_headerp)pChunk)->pNext; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_copy_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_handle hHandleOut) -{ - mng_datap pDataOut; - mng_chunkp pChunk; - mng_chunkp pChunkOut; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handles */ - MNG_VALIDHANDLE (hHandleOut) - - pDataOut = (mng_datap)hHandleOut; /* make outhandle addressable */ - pChunk = (mng_chunkp)hChunk; /* address the chunk */ - - if (!pDataOut->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pDataOut, MNG_FUNCTIONINVALID) - /* create a new chunk */ - iRetcode = ((mng_createchunk)((mng_chunk_headerp)pChunk)->fCreate) - (pDataOut, ((mng_chunk_headerp)pChunk), &pChunkOut); - if (!iRetcode) /* assign the chunk-specific data */ - iRetcode = ((mng_assignchunk)((mng_chunk_headerp)pChunk)->fAssign) - (pDataOut, pChunkOut, pChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pDataOut, pChunkOut); /* and put it in the output-stream */ - - /* could it be the end of the chain ? */ - if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_IEND) - { -#ifdef MNG_INCLUDE_JNG - if ((pDataOut->iFirstchunkadded == MNG_UINT_IHDR) || - (pDataOut->iFirstchunkadded == MNG_UINT_JHDR) ) -#else - if (pDataOut->iFirstchunkadded == MNG_UINT_IHDR) -#endif - pDataOut->bCreating = MNG_FALSE; /* right; this should be the last chunk !!! */ - } - - if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_MEND) - pDataOut->bCreating = MNG_FALSE; /* definitely this should be the last !!! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace) -{ - mng_datap pData; - mng_ihdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ihdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iBitdepth = pChunk->iBitdepth; - *iColortype = pChunk->iColortype; - *iCompression = pChunk->iCompression; - *iFilter = pChunk->iFilter; - *iInterlace = pChunk->iInterlace; - - /* fill the chunk */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_palette8 *aPalette) -{ - mng_datap pData; - mng_pltep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_pltep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PLTE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iEntrycount; /* fill the fields */ - - MNG_COPY (*aPalette, pChunk->aEntries, sizeof (mng_palette8)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_idatp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_idatp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_IDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRawlen = pChunk->iDatasize; /* fill the fields */ - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_bool *bGlobal, - mng_uint8 *iType, - mng_uint32 *iCount, - mng_uint8arr *aAlphas, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint32 *iRawlen, - mng_uint8arr *aRawdata) -{ - mng_datap pData; - mng_trnsp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_trnsp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_tRNS) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *bGlobal = pChunk->bGlobal; - *iType = pChunk->iType; - *iCount = pChunk->iCount; - *iGray = pChunk->iGray; - *iRed = pChunk->iRed; - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - *iRawlen = pChunk->iRawlen; - - MNG_COPY (*aAlphas, pChunk->aEntries, sizeof (mng_uint8arr)); - MNG_COPY (*aRawdata, pChunk->aRawdata, sizeof (mng_uint8arr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iGamma) -{ - mng_datap pData; - mng_gamap pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_gamap)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_gAMA) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iGamma = pChunk->iGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iWhitepointx, - mng_uint32 *iWhitepointy, - mng_uint32 *iRedx, - mng_uint32 *iRedy, - mng_uint32 *iGreenx, - mng_uint32 *iGreeny, - mng_uint32 *iBluex, - mng_uint32 *iBluey) -{ - mng_datap pData; - mng_chrmp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_chrmp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_cHRM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iWhitepointx = pChunk->iWhitepointx; - *iWhitepointy = pChunk->iWhitepointy; - *iRedx = pChunk->iRedx; - *iRedy = pChunk->iRedy; - *iGreenx = pChunk->iGreenx; - *iGreeny = pChunk->iGreeny; - *iBluex = pChunk->iBluex; - *iBluey = pChunk->iBluey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iRenderingintent) -{ - mng_datap pData; - mng_srgbp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_srgbp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_sRGB) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iRenderingintent = pChunk->iRenderingintent; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iCompression, - mng_uint32 *iProfilesize, - mng_ptr *pProfile) -{ - mng_datap pData; - mng_iccpp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_iccpp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_iCCP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - *iCompression = pChunk->iCompression; - *iProfilesize = pChunk->iProfilesize; - *pProfile = pChunk->pProfile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint32 *iTextsize, - mng_pchar *zText) -{ - mng_datap pData; - mng_textp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_textp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_tEXt) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordsize = pChunk->iKeywordsize; - *zKeyword = pChunk->zKeyword; - *iTextsize = pChunk->iTextsize; - *zText = pChunk->zText; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompression, - mng_uint32 *iTextsize, - mng_pchar *zText) -{ - mng_datap pData; - mng_ztxtp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ztxtp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_zTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordsize = pChunk->iKeywordsize; - *zKeyword = pChunk->zKeyword; - *iCompression = pChunk->iCompression; - *iTextsize = pChunk->iTextsize; - *zText = pChunk->zText; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompressionflag, - mng_uint8 *iCompressionmethod, - mng_uint32 *iLanguagesize, - mng_pchar *zLanguage, - mng_uint32 *iTranslationsize, - mng_pchar *zTranslation, - mng_uint32 *iTextsize, - mng_pchar *zText) -{ - mng_datap pData; - mng_itxtp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_itxtp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_iTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordsize = pChunk->iKeywordsize; - *zKeyword = pChunk->zKeyword; - *iCompressionflag = pChunk->iCompressionflag; - *iCompressionmethod = pChunk->iCompressionmethod; - *iLanguagesize = pChunk->iLanguagesize; - *zLanguage = pChunk->zLanguage; - *iTranslationsize = pChunk->iTranslationsize; - *zTranslation = pChunk->zTranslation; - *iTextsize = pChunk->iTextsize; - *zText = pChunk->zText; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8 *iIndex, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue) -{ - mng_datap pData; - mng_bkgdp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_bkgdp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_bKGD) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iType = pChunk->iType; - *iIndex = pChunk->iIndex; - *iGray = pChunk->iGray; - *iRed = pChunk->iRed; - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit) -{ - mng_datap pData; - mng_physp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_physp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_pHYs) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iSizex = pChunk->iSizex; - *iSizey = pChunk->iSizey; - *iUnit = pChunk->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8arr4 *aBits) -{ - mng_datap pData; - mng_sbitp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_sbitp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_sBIT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; - *iType = pChunk->iType; - (*aBits)[0] = pChunk->aBits[0]; - (*aBits)[1] = pChunk->aBits[1]; - (*aBits)[2] = pChunk->aBits[2]; - (*aBits)[3] = pChunk->aBits[3]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iSampledepth, - mng_uint32 *iEntrycount, - mng_ptr *pEntries) -{ - mng_datap pData; - mng_spltp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_spltp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_sPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - *iSampledepth = pChunk->iSampledepth; - *iEntrycount = pChunk->iEntrycount; - *pEntries = pChunk->pEntries; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iEntrycount, - mng_uint16arr *aEntries) -{ - mng_datap pData; - mng_histp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_histp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_hIST) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iEntrycount = pChunk->iEntrycount; /* fill the fields */ - - MNG_COPY (*aEntries, pChunk->aEntries, sizeof (mng_uint16arr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iYear, - mng_uint8 *iMonth, - mng_uint8 *iDay, - mng_uint8 *iHour, - mng_uint8 *iMinute, - mng_uint8 *iSecond) -{ - mng_datap pData; - mng_timep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_timep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_tIME) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iYear = pChunk->iYear; /* fill the fields */ - *iMonth = pChunk->iMonth; - *iDay = pChunk->iDay; - *iHour = pChunk->iHour; - *iMinute = pChunk->iMinute; - *iSecond = pChunk->iSecond; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint32 *iTicks, - mng_uint32 *iLayercount, - mng_uint32 *iFramecount, - mng_uint32 *iPlaytime, - mng_uint32 *iSimplicity) -{ - mng_datap pData; - mng_mhdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_mhdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iTicks = pChunk->iTicks; - *iLayercount = pChunk->iLayercount; - *iFramecount = pChunk->iFramecount; - *iPlaytime = pChunk->iPlaytime; - *iSimplicity = pChunk->iSimplicity; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel, - mng_uint32 *iRepeat, - mng_uint8 *iTermination, - mng_uint32 *iItermin, - mng_uint32 *iItermax, - mng_uint32 *iCount, - mng_uint32p *pSignals) -{ - mng_datap pData; - mng_loopp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_loopp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_LOOP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iLevel = pChunk->iLevel; /* fill teh fields */ - *iRepeat = pChunk->iRepeat; - *iTermination = pChunk->iTermination; - *iItermin = pChunk->iItermin; - *iItermax = pChunk->iItermax; - *iCount = pChunk->iCount; - *pSignals = pChunk->pSignals; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel) -{ - mng_datap pData; - mng_endlp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_endlp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_ENDL) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iLevel = pChunk->iLevel; /* fill the field */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_int32 *iXlocation, - mng_int32 *iYlocation, - mng_bool *bHasclip, - mng_int32 *iLeftcb, - mng_int32 *iRightcb, - mng_int32 *iTopcb, - mng_int32 *iBottomcb) -{ - mng_datap pData; - mng_defip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_defip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DEFI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iObjectid = pChunk->iObjectid; /* fill the fields */ - *iDonotshow = pChunk->iDonotshow; - *iConcrete = pChunk->iConcrete; - *bHasloca = pChunk->bHasloca; - *iXlocation = pChunk->iXlocation; - *iYlocation = pChunk->iYlocation; - *bHasclip = pChunk->bHasclip; - *iLeftcb = pChunk->iLeftcb; - *iRightcb = pChunk->iRightcb; - *iTopcb = pChunk->iTopcb; - *iBottomcb = pChunk->iBottomcb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_uint8 *iViewable) -{ - mng_datap pData; - mng_basip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_basip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_BASI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iBitdepth = pChunk->iBitdepth; - *iColortype = pChunk->iColortype; - *iCompression = pChunk->iCompression; - *iFilter = pChunk->iFilter; - *iInterlace = pChunk->iInterlace; - *iRed = pChunk->iRed; - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - *iAlpha = pChunk->iAlpha; - *iViewable = pChunk->iViewable; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSourceid, - mng_uint16 *iCloneid, - mng_uint8 *iClonetype, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_uint8 *iLocationtype, - mng_int32 *iLocationx, - mng_int32 *iLocationy) -{ - mng_datap pData; - mng_clonp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_clonp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_CLON) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iSourceid = pChunk->iSourceid; /* fill the fields */ - *iCloneid = pChunk->iCloneid; - *iClonetype = pChunk->iClonetype; - *iDonotshow = pChunk->iDonotshow; - *iConcrete = pChunk->iConcrete; - *bHasloca = pChunk->bHasloca; - *iLocationtype = pChunk->iLocationtype; - *iLocationx = pChunk->iLocationx; - *iLocationy = pChunk->iLocationy; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iDestid, - mng_uint8 *iTargettype, - mng_int32 *iTargetx, - mng_int32 *iTargety, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_pastp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_pastp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iDestid = pChunk->iDestid; /* fill the fields */ - *iTargettype = pChunk->iTargettype; - *iTargetx = pChunk->iTargetx; - *iTargety = pChunk->iTargety; - *iCount = pChunk->iCount; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iSourceid, - mng_uint8 *iComposition, - mng_uint8 *iOrientation, - mng_uint8 *iOffsettype, - mng_int32 *iOffsetx, - mng_int32 *iOffsety, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb) -{ - mng_datap pData; - mng_pastp pChunk; - mng_past_sourcep pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_pastp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address the entry */ - pEntry = pChunk->pSources + iEntry; - - *iSourceid = pEntry->iSourceid; /* fill the fields */ - *iComposition = pEntry->iComposition; - *iOrientation = pEntry->iOrientation; - *iOffsettype = pEntry->iOffsettype; - *iOffsetx = pEntry->iOffsetx; - *iOffsety = pEntry->iOffsety; - *iBoundarytype = pEntry->iBoundarytype; - *iBoundaryl = pEntry->iBoundaryl; - *iBoundaryr = pEntry->iBoundaryr; - *iBoundaryt = pEntry->iBoundaryt; - *iBoundaryb = pEntry->iBoundaryb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_uint16p *pObjectids) -{ - mng_datap pData; - mng_discp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_discp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DISC) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the fields */ - *pObjectids = pChunk->pObjectids; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint8 *iMandatory, - mng_uint16 *iImageid, - mng_uint8 *iTile) -{ - mng_datap pData; - mng_backp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_backp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_BACK) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRed = pChunk->iRed; /* fill the fields */ - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - *iMandatory = pChunk->iMandatory; - *iImageid = pChunk->iImageid; - *iTile = pChunk->iTile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iMode, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iChangedelay, - mng_uint8 *iChangetimeout, - mng_uint8 *iChangeclipping, - mng_uint8 *iChangesyncid, - mng_uint32 *iDelay, - mng_uint32 *iTimeout, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb, - mng_uint32 *iCount, - mng_uint32p *pSyncids) -{ - mng_datap pData; - mng_framp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_framp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_FRAM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iMode = pChunk->iMode; - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - *iChangedelay = pChunk->iChangedelay; - *iChangetimeout = pChunk->iChangetimeout; - *iChangeclipping = pChunk->iChangeclipping; - *iChangesyncid = pChunk->iChangesyncid; - *iDelay = pChunk->iDelay; - *iTimeout = pChunk->iTimeout; - *iBoundarytype = pChunk->iBoundarytype; - *iBoundaryl = pChunk->iBoundaryl; - *iBoundaryr = pChunk->iBoundaryr; - *iBoundaryt = pChunk->iBoundaryt; - *iBoundaryb = pChunk->iBoundaryb; - *iCount = pChunk->iCount; - *pSyncids = pChunk->pSyncids; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMovetype, - mng_int32 *iMovex, - mng_int32 *iMovey) -{ - mng_datap pData; - mng_movep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_movep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_MOVE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iFirstid = pChunk->iFirstid; /* fill the fields */ - *iLastid = pChunk->iLastid; - *iMovetype = pChunk->iMovetype; - *iMovex = pChunk->iMovex; - *iMovey = pChunk->iMovey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iCliptype, - mng_int32 *iClipl, - mng_int32 *iClipr, - mng_int32 *iClipt, - mng_int32 *iClipb) -{ - mng_datap pData; - mng_clipp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_clipp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_CLIP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iFirstid = pChunk->iFirstid; /* fill the fields */ - *iLastid = pChunk->iLastid; - *iCliptype = pChunk->iCliptype; - *iClipl = pChunk->iClipl; - *iClipr = pChunk->iClipr; - *iClipt = pChunk->iClipt; - *iClipb = pChunk->iClipb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMode) -{ - mng_datap pData; - mng_showp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_showp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SHOW) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iFirstid = pChunk->iFirstid; - *iLastid = pChunk->iLastid; - *iMode = pChunk->iMode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iTermaction, - mng_uint8 *iIteraction, - mng_uint32 *iDelay, - mng_uint32 *iItermax) -{ - mng_datap pData; - mng_termp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_termp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_TERM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iTermaction = pChunk->iTermaction; /* fill the fields */ - *iIteraction = pChunk->iIteraction; - *iDelay = pChunk->iDelay; - *iItermax = pChunk->iItermax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iOffsettype, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_savep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_savep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iOffsettype = pChunk->iOffsettype; - *iCount = pChunk->iCount; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEntrytype, - mng_uint32arr2 *iOffset, - mng_uint32arr2 *iStarttime, - mng_uint32 *iLayernr, - mng_uint32 *iFramenr, - mng_uint32 *iNamesize, - mng_pchar *zName) -{ - mng_datap pData; - mng_savep pChunk; - mng_save_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_savep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = pChunk->pEntries + iEntry; /* address the entry */ - /* fill the fields */ - *iEntrytype = pEntry->iEntrytype; - (*iOffset)[0] = pEntry->iOffset[0]; - (*iOffset)[1] = pEntry->iOffset[1]; - (*iStarttime)[0] = pEntry->iStarttime[0]; - (*iStarttime)[1] = pEntry->iStarttime[1]; - *iLayernr = pEntry->iLayernr; - *iFramenr = pEntry->iFramenr; - *iNamesize = pEntry->iNamesize; - *zName = pEntry->zName; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iNamesize, - mng_pchar *zName) -{ - mng_datap pData; - mng_seekp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_seekp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SEEK) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iNamesize = pChunk->iNamesize; /* fill the fields */ - *zName = pChunk->zName; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSnapshotid, - mng_uint32 *iNamesize, - mng_pchar *zName) -{ - mng_datap pData; - mng_expip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_expip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_eXPI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iSnapshotid = pChunk->iSnapshotid; /* fill the fields */ - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint8 *iPriority) -{ - mng_datap pData; - mng_fprip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_fprip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_fPRI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iDeltatype = pChunk->iDeltatype; /* fill the fields */ - *iPriority = pChunk->iPriority; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords) -{ - mng_datap pData; - mng_needp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_needp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_nEED) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordssize = pChunk->iKeywordssize; - *zKeywords = pChunk->zKeywords; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit) -{ - mng_datap pData; - mng_phygp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_phygp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_pHYg) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iSizex = pChunk->iSizex; - *iSizey = pChunk->iSizey; - *iUnit = pChunk->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iColortype, - mng_uint8 *iImagesampledepth, - mng_uint8 *iImagecompression, - mng_uint8 *iImageinterlace, - mng_uint8 *iAlphasampledepth, - mng_uint8 *iAlphacompression, - mng_uint8 *iAlphafilter, - mng_uint8 *iAlphainterlace) -{ - mng_datap pData; - mng_jhdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_jhdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_JHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iColortype = pChunk->iColortype; - *iImagesampledepth = pChunk->iImagesampledepth; - *iImagecompression = pChunk->iImagecompression; - *iImageinterlace = pChunk->iImageinterlace; - *iAlphasampledepth = pChunk->iAlphasampledepth; - *iAlphacompression = pChunk->iAlphacompression; - *iAlphafilter = pChunk->iAlphafilter; - *iAlphainterlace = pChunk->iAlphainterlace; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_jdatp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_jdatp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_JDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRawlen = pChunk->iDatasize; /* fill the fields */ - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_getchunk_jdaa (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_jdaap pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_jdaap)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_JDAA) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRawlen = pChunk->iDatasize; /* fill the fields */ - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iImagetype, - mng_uint8 *iDeltatype, - mng_uint32 *iBlockwidth, - mng_uint32 *iBlockheight, - mng_uint32 *iBlockx, - mng_uint32 *iBlocky) -{ - mng_datap pData; - mng_dhdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_dhdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iObjectid = pChunk->iObjectid; /* fill the fields */ - *iImagetype = pChunk->iImagetype; - *iDeltatype = pChunk->iDeltatype; - *iBlockwidth = pChunk->iBlockwidth; - *iBlockheight = pChunk->iBlockheight; - *iBlockx = pChunk->iBlockx; - *iBlocky = pChunk->iBlocky; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iColortype, - mng_uint8 *iSampledepth, - mng_uint8 *iFilltype) -{ - mng_datap pData; - mng_promp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_promp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PROM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iColortype = pChunk->iColortype; /* fill the fields */ - *iSampledepth = pChunk->iSampledepth; - *iFilltype = pChunk->iFilltype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_ppltp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ppltp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iDeltatype = pChunk->iDeltatype; /* fill the fields */ - *iCount = pChunk->iCount; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_bool *bUsed) -{ - mng_datap pData; - mng_ppltp pChunk; - mng_pplt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ppltp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = &pChunk->aEntries[iEntry]; /* address the entry */ - - *iRed = pEntry->iRed; /* fill the fields */ - *iGreen = pEntry->iGreen; - *iBlue = pEntry->iBlue; - *iAlpha = pEntry->iAlpha; - *bUsed = pEntry->bUsed; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_chunkidp *pChunknames) -{ - mng_datap pData; - mng_dropp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_dropp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DROP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the fields */ - *pChunknames = pChunk->pChunknames; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint8 *iPolarity, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords) -{ - mng_datap pData; - mng_dbykp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_dbykp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DBYK) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iChunkname = pChunk->iChunkname; /* fill the fields */ - *iPolarity = pChunk->iPolarity; - *iKeywordssize = pChunk->iKeywordssize; - *zKeywords = pChunk->zKeywords; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_ordrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ordrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the field */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_chunkid *iChunkname, - mng_uint8 *iOrdertype) -{ - mng_datap pData; - mng_ordrp pChunk; - mng_ordr_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ordrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = pChunk->pEntries + iEntry; /* address the proper entry */ - - *iChunkname = pEntry->iChunkname; /* fill the fields */ - *iOrdertype = pEntry->iOrdertype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint16 *iMethodX, - mng_uint16 *iMX, - mng_uint16 *iMY, - mng_uint16 *iML, - mng_uint16 *iMR, - mng_uint16 *iMT, - mng_uint16 *iMB, - mng_uint16 *iMethodY) -{ - mng_datap pData; - mng_magnp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_magnp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_MAGN) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iFirstid = pChunk->iFirstid; /* fill the fields */ - *iLastid = pChunk->iLastid; - *iMethodX = (mng_uint16)pChunk->iMethodX; - *iMX = pChunk->iMX; - *iMY = pChunk->iMY; - *iML = pChunk->iML; - *iMR = pChunk->iMR; - *iMT = pChunk->iMT; - *iMB = pChunk->iMB; - *iMethodY = (mng_uint16)pChunk->iMethodY; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iFramewidth, - mng_uint32 *iFrameheight, - mng_uint16 *iNumplays, - mng_uint16 *iTickspersec, - mng_uint8 *iCompressionmethod, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_mpngp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_mpngp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iFramewidth = pChunk->iFramewidth; - *iFrameheight = pChunk->iFrameheight; - *iNumplays = pChunk->iNumplays; - *iTickspersec = pChunk->iTickspersec; - *iCompressionmethod = pChunk->iCompressionmethod; - *iCount = pChunk->iFramessize / sizeof (mng_mpng_frame); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng_frame (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint32 *iX, - mng_uint32 *iY, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_int32 *iXoffset, - mng_int32 *iYoffset, - mng_uint16 *iTicks) -{ - mng_datap pData; - mng_mpngp pChunk; - mng_mpng_framep pFrame; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_mpngp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* valid index ? */ - if (iEntry >= (pChunk->iFramessize / sizeof (mng_mpng_frame))) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pFrame = pChunk->pFrames + iEntry; /* address the entry */ - /* fill the fields */ - *iX = pFrame->iX; - *iY = pFrame->iY; - *iWidth = pFrame->iWidth; - *iHeight = pFrame->iHeight; - *iXoffset = pFrame->iXoffset; - *iYoffset = pFrame->iYoffset; - *iTicks = pFrame->iTicks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -mng_retcode MNG_DECL mng_getchunk_evnt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_evntp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_evntp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the fields */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_evnt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEventtype, - mng_uint8 *iMasktype, - mng_int32 *iLeft, - mng_int32 *iRight, - mng_int32 *iTop, - mng_int32 *iBottom, - mng_uint16 *iObjectid, - mng_uint8 *iIndex, - mng_uint32 *iSegmentnamesize, - mng_pchar *zSegmentname) -{ - mng_datap pData; - mng_evntp pChunk; - mng_evnt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_evntp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = pChunk->pEntries + iEntry; /* address the entry */ - /* fill the fields */ - *iEventtype = pEntry->iEventtype; - *iMasktype = pEntry->iMasktype; - *iLeft = pEntry->iLeft; - *iRight = pEntry->iRight; - *iTop = pEntry->iTop; - *iBottom = pEntry->iBottom; - *iObjectid = pEntry->iObjectid; - *iIndex = pEntry->iIndex; - *iSegmentnamesize = pEntry->iSegmentnamesize; - *zSegmentname = pEntry->zSegmentname; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_unknown_chunkp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_unknown_chunkp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.fCleanup != mng_free_unknown) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iChunkname = pChunk->sHeader.iChunkname; - *iRawlen = pChunk->iDatasize; - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -MNG_LOCAL mng_bool check_term (mng_datap pData, - mng_chunkid iChunkname) -{ - mng_chunk_headerp pChunk = (mng_chunk_headerp)pData->pLastchunk; - - if (!pChunk) /* nothing added yet ? */ - return MNG_TRUE; - /* last added chunk is TERM ? */ - if (pChunk->iChunkname != MNG_UINT_TERM) - return MNG_TRUE; - /* previous to last is MHDR ? */ - if ((pChunk->pPrev) && (((mng_chunk_headerp)pChunk->pPrev)->iChunkname == MNG_UINT_MHDR)) - return MNG_TRUE; - - if (iChunkname == MNG_UINT_SEEK) /* new chunk to be added is SEEK ? */ - return MNG_TRUE; - - return MNG_FALSE; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_ihdr, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr)}; -#else - {MNG_UINT_IHDR, mng_init_ihdr, mng_free_ihdr, mng_read_ihdr, mng_write_ihdr, mng_assign_ihdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ihdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - ((mng_ihdrp)pChunk)->iWidth = iWidth; - ((mng_ihdrp)pChunk)->iHeight = iHeight; - ((mng_ihdrp)pChunk)->iBitdepth = iBitdepth; - ((mng_ihdrp)pChunk)->iColortype = iColortype; - ((mng_ihdrp)pChunk)->iCompression = iCompression; - ((mng_ihdrp)pChunk)->iFilter = iFilter; - ((mng_ihdrp)pChunk)->iInterlace = iInterlace; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle, - mng_uint32 iCount, - mng_palette8 aPalette) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_plte, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte)}; -#else - {MNG_UINT_PLTE, mng_init_plte, mng_free_plte, mng_read_plte, mng_write_plte, mng_assign_plte, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PLTE)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_plte (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PLTE, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_pltep)pChunk)->iEntrycount = iCount; - ((mng_pltep)pChunk)->bEmpty = (mng_bool)(iCount == 0); - - MNG_COPY (((mng_pltep)pChunk)->aEntries, aPalette, sizeof (mng_palette8)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat)}; -#else - {MNG_UINT_IDAT, mng_init_idat, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IDAT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_idat (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IDAT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_idatp)pChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_idatp)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_idatp)pChunk)->pData, iRawlen); - MNG_COPY (((mng_idatp)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_iend, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend)}; -#else - {MNG_UINT_IEND, mng_init_iend, mng_free_iend, mng_read_iend, mng_write_iend, mng_assign_iend, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IEND)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_iend (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IEND, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_INCLUDE_JNG - if ((pData->iFirstchunkadded == MNG_UINT_IHDR) || - (pData->iFirstchunkadded == MNG_UINT_JHDR) ) -#else - if (pData->iFirstchunkadded == MNG_UINT_IHDR) -#endif - pData->bCreating = MNG_FALSE; /* should be last chunk !!! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle, - mng_bool bEmpty, - mng_bool bGlobal, - mng_uint8 iType, - mng_uint32 iCount, - mng_uint8arr aAlphas, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint32 iRawlen, - mng_uint8arr aRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_trns, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns)}; -#else - {MNG_UINT_tRNS, mng_init_trns, mng_free_trns, mng_read_trns, mng_write_trns, mng_assign_trns, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_tRNS)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_trns (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_tRNS, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_trnsp)pChunk)->bEmpty = bEmpty; - ((mng_trnsp)pChunk)->bGlobal = bGlobal; - ((mng_trnsp)pChunk)->iType = iType; - ((mng_trnsp)pChunk)->iCount = iCount; - ((mng_trnsp)pChunk)->iGray = iGray; - ((mng_trnsp)pChunk)->iRed = iRed; - ((mng_trnsp)pChunk)->iGreen = iGreen; - ((mng_trnsp)pChunk)->iBlue = iBlue; - ((mng_trnsp)pChunk)->iRawlen = iRawlen; - - MNG_COPY (((mng_trnsp)pChunk)->aEntries, aAlphas, sizeof (mng_uint8arr)); - MNG_COPY (((mng_trnsp)pChunk)->aRawdata, aRawdata, sizeof (mng_uint8arr)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iGamma) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_gama, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama)}; -#else - {MNG_UINT_gAMA, mng_init_gama, mng_free_gama, mng_read_gama, mng_write_gama, mng_assign_gama, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_gAMA)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_gama (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_gAMA, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_gamap)pChunk)->bEmpty = bEmpty; - ((mng_gamap)pChunk)->iGamma = iGamma; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_chrm, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm)}; -#else - {MNG_UINT_cHRM, mng_init_chrm, mng_free_chrm, mng_read_chrm, mng_write_chrm, mng_assign_chrm, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_cHRM)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_chrm (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_cHRM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_chrmp)pChunk)->bEmpty = bEmpty; - ((mng_chrmp)pChunk)->iWhitepointx = iWhitepointx; - ((mng_chrmp)pChunk)->iWhitepointy = iWhitepointy; - ((mng_chrmp)pChunk)->iRedx = iRedx; - ((mng_chrmp)pChunk)->iRedy = iRedy; - ((mng_chrmp)pChunk)->iGreenx = iGreenx; - ((mng_chrmp)pChunk)->iGreeny = iGreeny; - ((mng_chrmp)pChunk)->iBluex = iBluex; - ((mng_chrmp)pChunk)->iBluey = iBluey; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iRenderingintent) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)}; -#else - {MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_sRGB)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_srgb (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_sRGB, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_srgbp)pChunk)->bEmpty = bEmpty; - ((mng_srgbp)pChunk)->iRenderingintent = iRenderingintent; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iCompression, - mng_uint32 iProfilesize, - mng_ptr pProfile) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp)}; -#else - {MNG_UINT_iCCP, mng_init_iccp, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_iCCP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_iccp (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_iCCP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_iccpp)pChunk)->bEmpty = bEmpty; - ((mng_iccpp)pChunk)->iNamesize = iNamesize; - ((mng_iccpp)pChunk)->iCompression = iCompression; - ((mng_iccpp)pChunk)->iProfilesize = iProfilesize; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_iccpp)pChunk)->zName, zName, iNamesize); - } - - if (iProfilesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunk)->pProfile, iProfilesize); - MNG_COPY (((mng_iccpp)pChunk)->pProfile, pProfile, iProfilesize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint32 iTextsize, - mng_pchar zText) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text)}; -#else - {MNG_UINT_tEXt, mng_init_text, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_tEXt)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_text (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_tEXt, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_textp)pChunk)->iKeywordsize = iKeywordsize; - ((mng_textp)pChunk)->iTextsize = iTextsize; - - if (iKeywordsize) - { - MNG_ALLOC (pData, ((mng_textp)pChunk)->zKeyword, iKeywordsize + 1); - MNG_COPY (((mng_textp)pChunk)->zKeyword, zKeyword, iKeywordsize); - } - - if (iTextsize) - { - MNG_ALLOC (pData, ((mng_textp)pChunk)->zText, iTextsize + 1); - MNG_COPY (((mng_textp)pChunk)->zText, zText, iTextsize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompression, - mng_uint32 iTextsize, - mng_pchar zText) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt)}; -#else - {MNG_UINT_zTXt, mng_init_ztxt, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_zTXt)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ztxt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_zTXt, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_ztxtp)pChunk)->iKeywordsize = iKeywordsize; - ((mng_ztxtp)pChunk)->iCompression = iCompression; - ((mng_ztxtp)pChunk)->iTextsize = iTextsize; - - if (iKeywordsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zKeyword, iKeywordsize + 1); - MNG_COPY (((mng_ztxtp)pChunk)->zKeyword, zKeyword, iKeywordsize); - } - - if (iTextsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zText, iTextsize + 1); - MNG_COPY (((mng_ztxtp)pChunk)->zText, zText, iTextsize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompressionflag, - mng_uint8 iCompressionmethod, - mng_uint32 iLanguagesize, - mng_pchar zLanguage, - mng_uint32 iTranslationsize, - mng_pchar zTranslation, - mng_uint32 iTextsize, - mng_pchar zText) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt)}; -#else - {MNG_UINT_iTXt, mng_init_itxt, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_iTXt)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_itxt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_iTXt, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_itxtp)pChunk)->iKeywordsize = iKeywordsize; - ((mng_itxtp)pChunk)->iCompressionflag = iCompressionflag; - ((mng_itxtp)pChunk)->iCompressionmethod = iCompressionmethod; - ((mng_itxtp)pChunk)->iLanguagesize = iLanguagesize; - ((mng_itxtp)pChunk)->iTranslationsize = iTranslationsize; - ((mng_itxtp)pChunk)->iTextsize = iTextsize; - - if (iKeywordsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zKeyword, iKeywordsize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zKeyword, zKeyword, iKeywordsize); - } - - if (iLanguagesize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zLanguage, iLanguagesize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zLanguage, zLanguage, iLanguagesize); - } - - if (iTranslationsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zTranslation, iTranslationsize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zTranslation, zTranslation, iTranslationsize); - } - - if (iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zText, iTextsize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zText, zText, iTextsize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8 iIndex, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_bkgd, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd)}; -#else - {MNG_UINT_bKGD, mng_init_bkgd, mng_free_bkgd, mng_read_bkgd, mng_write_bkgd, mng_assign_bkgd, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_bKGD)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_bkgd (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_bKGD, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_bkgdp)pChunk)->bEmpty = bEmpty; - ((mng_bkgdp)pChunk)->iType = iType; - ((mng_bkgdp)pChunk)->iIndex = iIndex; - ((mng_bkgdp)pChunk)->iGray = iGray; - ((mng_bkgdp)pChunk)->iRed = iRed; - ((mng_bkgdp)pChunk)->iGreen = iGreen; - ((mng_bkgdp)pChunk)->iBlue = iBlue; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_phys, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys)}; -#else - {MNG_UINT_pHYs, mng_init_phys, mng_free_phys, mng_read_phys, mng_write_phys, mng_assign_phys, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_pHYs)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_phys (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_pHYs, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_physp)pChunk)->bEmpty = bEmpty; - ((mng_physp)pChunk)->iSizex = iSizex; - ((mng_physp)pChunk)->iSizey = iSizey; - ((mng_physp)pChunk)->iUnit = iUnit; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8arr4 aBits) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_sbit, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit)}; -#else - {MNG_UINT_sBIT, mng_init_sbit, mng_free_sbit, mng_read_sbit, mng_write_sbit, mng_assign_sbit, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_sBIT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_sbit (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_sBIT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_sbitp)pChunk)->bEmpty = bEmpty; - ((mng_sbitp)pChunk)->iType = iType; - ((mng_sbitp)pChunk)->aBits[0] = aBits[0]; - ((mng_sbitp)pChunk)->aBits[1] = aBits[1]; - ((mng_sbitp)pChunk)->aBits[2] = aBits[2]; - ((mng_sbitp)pChunk)->aBits[3] = aBits[3]; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iSampledepth, - mng_uint32 iEntrycount, - mng_ptr pEntries) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt)}; -#else - {MNG_UINT_sPLT, mng_init_splt, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_sPLT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_splt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_sPLT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_spltp)pChunk)->bEmpty = bEmpty; - ((mng_spltp)pChunk)->iNamesize = iNamesize; - ((mng_spltp)pChunk)->iSampledepth = iSampledepth; - ((mng_spltp)pChunk)->iEntrycount = iEntrycount; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_spltp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_spltp)pChunk)->zName, zName, iNamesize); - } - - if (iEntrycount) - { - mng_uint32 iSize = iEntrycount * ((iSampledepth >> 1) + 2); - - MNG_ALLOC (pData, ((mng_spltp)pChunk)->pEntries, iSize); - MNG_COPY (((mng_spltp)pChunk)->pEntries, pEntries, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle, - mng_uint32 iEntrycount, - mng_uint16arr aEntries) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_hist, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist)}; -#else - {MNG_UINT_hIST, mng_init_hist, mng_free_hist, mng_read_hist, mng_write_hist, mng_assign_hist, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_hIST)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_hist (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_hIST, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_histp)pChunk)->iEntrycount = iEntrycount; - - MNG_COPY (((mng_histp)pChunk)->aEntries, aEntries, sizeof (mng_uint16arr)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle, - mng_uint16 iYear, - mng_uint8 iMonth, - mng_uint8 iDay, - mng_uint8 iHour, - mng_uint8 iMinute, - mng_uint8 iSecond) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_time, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time)}; -#else - {MNG_UINT_tIME, mng_init_time, mng_free_time, mng_read_time, mng_write_time, mng_assign_time, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_tIME)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_time (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_tIME, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_timep)pChunk)->iYear = iYear; - ((mng_timep)pChunk)->iMonth = iMonth; - ((mng_timep)pChunk)->iDay = iDay; - ((mng_timep)pChunk)->iHour = iHour; - ((mng_timep)pChunk)->iMinute = iMinute; - ((mng_timep)pChunk)->iSecond = iSecond; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint32 iTicks, - mng_uint32 iLayercount, - mng_uint32 iFramecount, - mng_uint32 iPlaytime, - mng_uint32 iSimplicity) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_mhdr, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr)}; -#else - {MNG_UINT_MHDR, mng_init_mhdr, mng_free_mhdr, mng_read_mhdr, mng_write_mhdr, mng_assign_mhdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must be very first! */ - if (pData->iFirstchunkadded != 0) - MNG_ERROR (pData, MNG_SEQUENCEERROR) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_mhdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_mhdrp)pChunk)->iWidth = iWidth; - ((mng_mhdrp)pChunk)->iHeight = iHeight; - ((mng_mhdrp)pChunk)->iTicks = iTicks; - ((mng_mhdrp)pChunk)->iLayercount = iLayercount; - ((mng_mhdrp)pChunk)->iFramecount = iFramecount; - ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime; - ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_mend, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend)}; -#else - {MNG_UINT_MEND, mng_init_mend, mng_free_mend, mng_read_mend, mng_write_mend, mng_assign_mend, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MEND)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_mend (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MEND, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - - pData->bCreating = MNG_FALSE; /* should be last chunk !!! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle, - mng_uint8 iLevel, - mng_uint32 iRepeat, - mng_uint8 iTermination, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop)}; -#else - {MNG_UINT_LOOP, mng_init_loop, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_LOOP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_loop (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_LOOP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_loopp)pChunk)->iLevel = iLevel; - ((mng_loopp)pChunk)->iRepeat = iRepeat; - ((mng_loopp)pChunk)->iTermination = iTermination; - ((mng_loopp)pChunk)->iItermin = iItermin; - ((mng_loopp)pChunk)->iItermax = iItermax; - ((mng_loopp)pChunk)->iCount = iCount; - ((mng_loopp)pChunk)->pSignals = pSignals; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle, - mng_uint8 iLevel) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_endl, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl)}; -#else - {MNG_UINT_ENDL, mng_init_endl, mng_free_endl, mng_read_endl, mng_write_endl, mng_assign_endl, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_ENDL)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_endl (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_ENDL, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_endlp)pChunk)->iLevel = iLevel; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_int32 iXlocation, - mng_int32 iYlocation, - mng_bool bHasclip, - mng_int32 iLeftcb, - mng_int32 iRightcb, - mng_int32 iTopcb, - mng_int32 iBottomcb) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_defi, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi)}; -#else - {MNG_UINT_DEFI, mng_init_defi, mng_free_defi, mng_read_defi, mng_write_defi, mng_assign_defi, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DEFI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_defi (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DEFI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_defip)pChunk)->iObjectid = iObjectid; - ((mng_defip)pChunk)->iDonotshow = iDonotshow; - ((mng_defip)pChunk)->iConcrete = iConcrete; - ((mng_defip)pChunk)->bHasloca = bHasloca; - ((mng_defip)pChunk)->iXlocation = iXlocation; - ((mng_defip)pChunk)->iYlocation = iYlocation; - ((mng_defip)pChunk)->bHasclip = bHasclip; - ((mng_defip)pChunk)->iLeftcb = iLeftcb; - ((mng_defip)pChunk)->iRightcb = iRightcb; - ((mng_defip)pChunk)->iTopcb = iTopcb; - ((mng_defip)pChunk)->iBottomcb = iBottomcb; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha, - mng_uint8 iViewable) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_basi, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi)}; -#else - {MNG_UINT_BASI, mng_init_basi, mng_free_basi, mng_read_basi, mng_write_basi, mng_assign_basi, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_BASI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_basi (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_BASI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_basip)pChunk)->iWidth = iWidth; - ((mng_basip)pChunk)->iHeight = iHeight; - ((mng_basip)pChunk)->iBitdepth = iBitdepth; - ((mng_basip)pChunk)->iColortype = iColortype; - ((mng_basip)pChunk)->iCompression = iCompression; - ((mng_basip)pChunk)->iFilter = iFilter; - ((mng_basip)pChunk)->iInterlace = iInterlace; - ((mng_basip)pChunk)->iRed = iRed; - ((mng_basip)pChunk)->iGreen = iGreen; - ((mng_basip)pChunk)->iBlue = iBlue; - ((mng_basip)pChunk)->iAlpha = iAlpha; - ((mng_basip)pChunk)->iViewable = iViewable; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_clon, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon)}; -#else - {MNG_UINT_CLON, mng_init_clon, mng_free_clon, mng_read_clon, mng_write_clon, mng_assign_clon, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_CLON)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_clon (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_CLON, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_clonp)pChunk)->iSourceid = iSourceid; - ((mng_clonp)pChunk)->iCloneid = iCloneid; - ((mng_clonp)pChunk)->iClonetype = iClonetype; - ((mng_clonp)pChunk)->iDonotshow = iDonotshow; - ((mng_clonp)pChunk)->iConcrete = iConcrete; - ((mng_clonp)pChunk)->bHasloca = bHasloca; - ((mng_clonp)pChunk)->iLocationtype = iLocationtype; - ((mng_clonp)pChunk)->iLocationx = iLocationx; - ((mng_clonp)pChunk)->iLocationy = iLocationy; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle, - mng_uint16 iDestid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past)}; -#else - {MNG_UINT_PAST, mng_init_past, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PAST)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_past (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PAST, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_pastp)pChunk)->iDestid = iDestid; - ((mng_pastp)pChunk)->iTargettype = iTargettype; - ((mng_pastp)pChunk)->iTargetx = iTargetx; - ((mng_pastp)pChunk)->iTargety = iTargety; - ((mng_pastp)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_pastp)pChunk)->pSources, iCount * sizeof (mng_past_source)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iSourceid, - mng_uint8 iComposition, - mng_uint8 iOrientation, - mng_uint8 iOffsettype, - mng_int32 iOffsetx, - mng_int32 iOffsety, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_past_sourcep pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been PAST ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_pastp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_pastp)pChunk)->pSources + iEntry; - - pEntry->iSourceid = iSourceid; /* fill entry */ - pEntry->iComposition = iComposition; - pEntry->iOrientation = iOrientation; - pEntry->iOffsettype = iOffsettype; - pEntry->iOffsetx = iOffsetx; - pEntry->iOffsety = iOffsety; - pEntry->iBoundarytype = iBoundarytype; - pEntry->iBoundaryl = iBoundaryl; - pEntry->iBoundaryr = iBoundaryr; - pEntry->iBoundaryt = iBoundaryt; - pEntry->iBoundaryb = iBoundaryb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle, - mng_uint32 iCount, - mng_uint16p pObjectids) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc)}; -#else - {MNG_UINT_DISC, mng_init_disc, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DISC)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_disc (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DISC, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_discp)pChunk)->iCount = iCount; - - if (iCount) - { - mng_uint32 iSize = iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_discp)pChunk)->pObjectids, iSize); - MNG_COPY (((mng_discp)pChunk)->pObjectids, pObjectids, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_back, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back)}; -#else - {MNG_UINT_BACK, mng_init_back, mng_free_back, mng_read_back, mng_write_back, mng_assign_back, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_BACK)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_back (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_BACK, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_backp)pChunk)->iRed = iRed; - ((mng_backp)pChunk)->iGreen = iGreen; - ((mng_backp)pChunk)->iBlue = iBlue; - ((mng_backp)pChunk)->iMandatory = iMandatory; - ((mng_backp)pChunk)->iImageid = iImageid; - ((mng_backp)pChunk)->iTile = iTile; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iMode, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iChangedelay, - mng_uint8 iChangetimeout, - mng_uint8 iChangeclipping, - mng_uint8 iChangesyncid, - mng_uint32 iDelay, - mng_uint32 iTimeout, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb, - mng_uint32 iCount, - mng_uint32p pSyncids) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram)}; -#else - {MNG_UINT_FRAM, mng_init_fram, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_FRAM)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_fram (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_FRAM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_framp)pChunk)->bEmpty = bEmpty; - ((mng_framp)pChunk)->iMode = iMode; - ((mng_framp)pChunk)->iNamesize = iNamesize; - ((mng_framp)pChunk)->iChangedelay = iChangedelay; - ((mng_framp)pChunk)->iChangetimeout = iChangetimeout; - ((mng_framp)pChunk)->iChangeclipping = iChangeclipping; - ((mng_framp)pChunk)->iChangesyncid = iChangesyncid; - ((mng_framp)pChunk)->iDelay = iDelay; - ((mng_framp)pChunk)->iTimeout = iTimeout; - ((mng_framp)pChunk)->iBoundarytype = iBoundarytype; - ((mng_framp)pChunk)->iBoundaryl = iBoundaryl; - ((mng_framp)pChunk)->iBoundaryr = iBoundaryr; - ((mng_framp)pChunk)->iBoundaryt = iBoundaryt; - ((mng_framp)pChunk)->iBoundaryb = iBoundaryb; - ((mng_framp)pChunk)->iCount = iCount; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_framp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_framp)pChunk)->zName, zName, iNamesize); - } - - if (iCount) - { - mng_uint32 iSize = iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_framp)pChunk)->pSyncids, iSize); - MNG_COPY (((mng_framp)pChunk)->pSyncids, pSyncids, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_move, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move)}; -#else - {MNG_UINT_MOVE, mng_init_move, mng_free_move, mng_read_move, mng_write_move, mng_assign_move, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MOVE)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_move (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MOVE, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_movep)pChunk)->iFirstid = iFirstid; - ((mng_movep)pChunk)->iLastid = iLastid; - ((mng_movep)pChunk)->iMovetype = iMovetype; - ((mng_movep)pChunk)->iMovex = iMovex; - ((mng_movep)pChunk)->iMovey = iMovey; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_clip, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip)}; -#else - {MNG_UINT_CLIP, mng_init_clip, mng_free_clip, mng_read_clip, mng_write_clip, mng_assign_clip, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_CLIP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_clip (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_CLIP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_clipp)pChunk)->iFirstid = iFirstid; - ((mng_clipp)pChunk)->iLastid = iLastid; - ((mng_clipp)pChunk)->iCliptype = iCliptype; - ((mng_clipp)pChunk)->iClipl = iClipl; - ((mng_clipp)pChunk)->iClipr = iClipr; - ((mng_clipp)pChunk)->iClipt = iClipt; - ((mng_clipp)pChunk)->iClipb = iClipb; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle, - mng_bool bEmpty, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_show, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show)}; -#else - {MNG_UINT_SHOW, mng_init_show, mng_free_show, mng_read_show, mng_write_show, mng_assign_show, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_SHOW)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_show (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_SHOW, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_showp)pChunk)->bEmpty = bEmpty; - ((mng_showp)pChunk)->iFirstid = iFirstid; - ((mng_showp)pChunk)->iLastid = iLastid; - ((mng_showp)pChunk)->iMode = iMode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_term, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term)}; -#else - {MNG_UINT_TERM, mng_init_term, mng_free_term, mng_read_term, mng_write_term, mng_assign_term, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_term (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_TERM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_termp)pChunk)->iTermaction = iTermaction; - ((mng_termp)pChunk)->iIteraction = iIteraction; - ((mng_termp)pChunk)->iDelay = iDelay; - ((mng_termp)pChunk)->iItermax = iItermax; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iOffsettype, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save)}; -#else - {MNG_UINT_SAVE, mng_init_save, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_SAVE)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_save (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_SAVE, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_savep)pChunk)->bEmpty = bEmpty; - ((mng_savep)pChunk)->iOffsettype = iOffsettype; - ((mng_savep)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_savep)pChunk)->pEntries, iCount * sizeof (mng_save_entry)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEntrytype, - mng_uint32arr2 iOffset, - mng_uint32arr2 iStarttime, - mng_uint32 iLayernr, - mng_uint32 iFramenr, - mng_uint32 iNamesize, - mng_pchar zName) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_save_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been SAVE ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_savep)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_savep)pChunk)->pEntries + iEntry; - - pEntry->iEntrytype = iEntrytype; /* fill entry */ - pEntry->iOffset[0] = iOffset[0]; - pEntry->iOffset[1] = iOffset[1]; - pEntry->iStarttime[0] = iStarttime[0]; - pEntry->iStarttime[1] = iStarttime[1]; - pEntry->iLayernr = iLayernr; - pEntry->iFramenr = iFramenr; - pEntry->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zName, iNamesize + 1); - MNG_COPY (pEntry->zName, zName, iNamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle, - mng_uint32 iNamesize, - mng_pchar zName) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek)}; -#else - {MNG_UINT_SEEK, mng_init_seek, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_SEEK)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_seek (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_SEEK, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_seekp)pChunk)->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_seekp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_seekp)pChunk)->zName, zName, iNamesize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle, - mng_uint16 iSnapshotid, - mng_uint32 iNamesize, - mng_pchar zName) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_general, 0, 0, sizeof(mng_expi)}; -#else - {MNG_UINT_eXPI, mng_init_expi, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_eXPI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_expi (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_eXPI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_expip)pChunk)->iSnapshotid = iSnapshotid; - ((mng_expip)pChunk)->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_expip)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_expip)pChunk)->zName, zName, iNamesize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint8 iPriority) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_fpri, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri)}; -#else - {MNG_UINT_fPRI, mng_init_fpri, mng_free_fpri, mng_read_fpri, mng_write_fpri, mng_assign_fpri, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_fPRI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_fpri (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_fPRI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_fprip)pChunk)->iDeltatype = iDeltatype; - ((mng_fprip)pChunk)->iPriority = iPriority; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle, - mng_uint32 iKeywordssize, - mng_pchar zKeywords) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need)}; -#else - {MNG_UINT_nEED, mng_init_need, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_nEED)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_need (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_nEED, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_needp)pChunk)->iKeywordssize = iKeywordssize; - - if (iKeywordssize) - { - MNG_ALLOC (pData, ((mng_needp)pChunk)->zKeywords, iKeywordssize + 1); - MNG_COPY (((mng_needp)pChunk)->zKeywords, zKeywords, iKeywordssize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_phyg, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg)}; -#else - {MNG_UINT_pHYg, mng_init_phyg, mng_free_phyg, mng_read_phyg, mng_write_phyg, mng_assign_phyg, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_pHYg)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_phyg (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_pHYg, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_phygp)pChunk)->bEmpty = bEmpty; - ((mng_phygp)pChunk)->iSizex = iSizex; - ((mng_phygp)pChunk)->iSizey = iSizey; - ((mng_phygp)pChunk)->iUnit = iUnit; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iImagesampledepth, - mng_uint8 iImagecompression, - mng_uint8 iImageinterlace, - mng_uint8 iAlphasampledepth, - mng_uint8 iAlphacompression, - mng_uint8 iAlphafilter, - mng_uint8 iAlphainterlace) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_jhdr, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr)}; -#else - {MNG_UINT_JHDR, mng_init_jhdr, mng_free_jhdr, mng_read_jhdr, mng_write_jhdr, mng_assign_jhdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jhdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_jhdrp)pChunk)->iWidth = iWidth; - ((mng_jhdrp)pChunk)->iHeight = iHeight; - ((mng_jhdrp)pChunk)->iColortype = iColortype; - ((mng_jhdrp)pChunk)->iImagesampledepth = iImagesampledepth; - ((mng_jhdrp)pChunk)->iImagecompression = iImagecompression; - ((mng_jhdrp)pChunk)->iImageinterlace = iImageinterlace; - ((mng_jhdrp)pChunk)->iAlphasampledepth = iAlphasampledepth; - ((mng_jhdrp)pChunk)->iAlphacompression = iAlphacompression; - ((mng_jhdrp)pChunk)->iAlphafilter = iAlphafilter; - ((mng_jhdrp)pChunk)->iAlphainterlace = iAlphainterlace; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat)}; -#else - {MNG_UINT_JDAT, mng_init_jdat, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR or JHDR first! */ - if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && - (pData->iFirstchunkadded != MNG_UINT_JHDR) ) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JDAT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jdat (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JDAT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_jdatp)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_jdatp)pChunk)->pData, iRawlen); - MNG_COPY (((mng_jdatp)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jdaa (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)}; -#else - {MNG_UINT_JDAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR or JHDR first! */ - if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && - (pData->iFirstchunkadded != MNG_UINT_JHDR) ) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JDAA)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jdaa (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JDAA, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_jdaap)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_jdaap)pChunk)->pData, iRawlen); - MNG_COPY (((mng_jdaap)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_jsep, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep)}; -#else - {MNG_UINT_JSEP, mng_init_jsep, mng_free_jsep, mng_read_jsep, mng_write_jsep, mng_assign_jsep, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR or JHDR first! */ - if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && - (pData->iFirstchunkadded != MNG_UINT_JHDR) ) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JSEP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jsep (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JSEP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_dhdr, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr)}; -#else - {MNG_UINT_DHDR, mng_init_dhdr, mng_free_dhdr, mng_read_dhdr, mng_write_dhdr, mng_assign_dhdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_dhdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_dhdrp)pChunk)->iObjectid = iObjectid; - ((mng_dhdrp)pChunk)->iImagetype = iImagetype; - ((mng_dhdrp)pChunk)->iDeltatype = iDeltatype; - ((mng_dhdrp)pChunk)->iBlockwidth = iBlockwidth; - ((mng_dhdrp)pChunk)->iBlockheight = iBlockheight; - ((mng_dhdrp)pChunk)->iBlockx = iBlockx; - ((mng_dhdrp)pChunk)->iBlocky = iBlocky; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle, - mng_uint8 iColortype, - mng_uint8 iSampledepth, - mng_uint8 iFilltype) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_prom, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom)}; -#else - {MNG_UINT_PROM, mng_init_prom, mng_free_prom, mng_read_prom, mng_write_prom, mng_assign_prom, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PROM)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_prom (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PROM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_promp)pChunk)->iColortype = iColortype; - ((mng_promp)pChunk)->iSampledepth = iSampledepth; - ((mng_promp)pChunk)->iFilltype = iFilltype; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_ipng, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng)}; -#else - {MNG_UINT_IPNG, mng_init_ipng, mng_free_ipng, mng_read_ipng, mng_write_ipng, mng_assign_ipng, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IPNG)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ipng (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IPNG, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_pplt, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt)}; -#else - {MNG_UINT_PPLT, mng_init_pplt, mng_free_pplt, mng_read_pplt, mng_write_pplt, mng_assign_pplt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PPLT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_pplt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PPLT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_ppltp)pChunk)->iDeltatype = iDeltatype; - ((mng_ppltp)pChunk)->iCount = iCount; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_pplt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been PPLT ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - - /* index out of bounds ? */ - if (iEntry >= ((mng_ppltp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = (mng_pplt_entryp)(((mng_ppltp)pChunk)->aEntries) + iEntry; - - pEntry->iRed = (mng_uint8)iRed; /* fill the entry */ - pEntry->iGreen = (mng_uint8)iGreen; - pEntry->iBlue = (mng_uint8)iBlue; - pEntry->iAlpha = (mng_uint8)iAlpha; - pEntry->bUsed = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -mng_retcode MNG_DECL mng_putchunk_ijng (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_ijng, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng)}; -#else - {MNG_UINT_IJNG, mng_init_ijng, mng_free_ijng, mng_read_ijng, mng_write_ijng, mng_assign_ijng, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IJNG)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ijng (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IJNG, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle, - mng_uint32 iCount, - mng_chunkidp pChunknames) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop)}; -#else - {MNG_UINT_DROP, mng_init_drop, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DROP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_drop (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DROP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_dropp)pChunk)->iCount = iCount; - - if (iCount) - { - mng_uint32 iSize = iCount * sizeof (mng_chunkid); - - MNG_ALLOC (pData, ((mng_dropp)pChunk)->pChunknames, iSize); - MNG_COPY (((mng_dropp)pChunk)->pChunknames, pChunknames, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint8 iPolarity, - mng_uint32 iKeywordssize, - mng_pchar zKeywords) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk)}; -#else - {MNG_UINT_DBYK, mng_init_dbyk, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DBYK)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_dbyk (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DBYK, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_dbykp)pChunk)->iChunkname = iChunkname; - ((mng_dbykp)pChunk)->iPolarity = iPolarity; - ((mng_dbykp)pChunk)->iKeywordssize = iKeywordssize; - - if (iKeywordssize) - { - MNG_ALLOC (pData, ((mng_dbykp)pChunk)->zKeywords, iKeywordssize + 1); - MNG_COPY (((mng_dbykp)pChunk)->zKeywords, zKeywords, iKeywordssize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr)}; -#else - {MNG_UINT_ORDR, mng_init_ordr, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_ORDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ordr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_ORDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_ordrp)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_ordrp)pChunk)->pEntries, iCount * sizeof (mng_ordr_entry)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_chunkid iChunkname, - mng_uint8 iOrdertype) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_ordr_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been ORDR ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_ordrp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_ordrp)pChunk)->pEntries + iEntry; - - pEntry->iChunkname = iChunkname; /* fill the entry */ - pEntry->iOrdertype = iOrdertype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint16 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint16 iMethodY) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_magn, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn)}; -#else - {MNG_UINT_MAGN, mng_init_magn, mng_free_magn, mng_read_magn, mng_write_magn, mng_assign_magn, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MAGN)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_magn (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MAGN, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_magnp)pChunk)->iFirstid = iFirstid; - ((mng_magnp)pChunk)->iLastid = iLastid; - ((mng_magnp)pChunk)->iMethodX = (mng_uint8)iMethodX; - ((mng_magnp)pChunk)->iMX = iMX; - ((mng_magnp)pChunk)->iMY = iMY; - ((mng_magnp)pChunk)->iML = iML; - ((mng_magnp)pChunk)->iMR = iMR; - ((mng_magnp)pChunk)->iMT = iMT; - ((mng_magnp)pChunk)->iMB = iMB; - ((mng_magnp)pChunk)->iMethodY = (mng_uint8)iMethodY; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng (mng_handle hHandle, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint8 iCompressionmethod, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng)}; -#else - {MNG_UINT_mpNG, mng_init_mpng, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a IHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_mpng (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_mpNG, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_mpngp)pChunk)->iFramewidth = iFramewidth; - ((mng_mpngp)pChunk)->iFrameheight = iFrameheight; - ((mng_mpngp)pChunk)->iNumplays = iNumplays; - ((mng_mpngp)pChunk)->iTickspersec = iTickspersec; - ((mng_mpngp)pChunk)->iCompressionmethod = iCompressionmethod; - ((mng_mpngp)pChunk)->iFramessize = iCount * sizeof (mng_mpng_frame); - - if (iCount) - MNG_ALLOC (pData, ((mng_mpngp)pChunk)->pFrames, ((mng_mpngp)pChunk)->iFramessize); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng_frame (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_int32 iXoffset, - mng_int32 iYoffset, - mng_uint16 iTicks) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_mpng_framep pFrame; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a IHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been mpNG ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= (((mng_mpngp)pChunk)->iFramessize / sizeof (mng_mpng_frame))) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pFrame = ((mng_mpngp)pChunk)->pFrames + iEntry; - /* fill entry */ - pFrame->iX = iX; - pFrame->iY = iY; - pFrame->iWidth = iWidth; - pFrame->iHeight = iHeight; - pFrame->iXoffset = iXoffset; - pFrame->iYoffset = iYoffset; - pFrame->iTicks = iTicks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -mng_retcode MNG_DECL mng_putchunk_evnt (mng_handle hHandle, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt)}; -#else - {MNG_UINT_evNT, mng_init_evnt, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_evNT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_evnt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_evNT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_evntp)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_evntp)pChunk)->pEntries, iCount * sizeof (mng_evnt_entry)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_evnt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_evnt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been evNT ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_evntp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_evntp)pChunk)->pEntries + iEntry; - /* fill entry */ - pEntry->iEventtype = iEventtype; - pEntry->iMasktype = iMasktype; - pEntry->iLeft = iLeft; - pEntry->iRight = iRight; - pEntry->iTop = iTop; - pEntry->iBottom = iBottom; - pEntry->iObjectid = iObjectid; - pEntry->iIndex = iIndex; - pEntry->iSegmentnamesize = iSegmentnamesize; - - if (iSegmentnamesize) - { - MNG_ALLOC (pData, pEntry->zSegmentname, iSegmentnamesize + 1); - MNG_COPY (pEntry->zSegmentname, zSegmentname, iSegmentnamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_HUH, mng_init_general, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0, sizeof(mng_unknown_chunk)}; -#else - {MNG_UINT_HUH, mng_init_unknown, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, iChunkname)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_unknown (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_HUH, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_unknown_chunkp)pChunk)->sHeader.iChunkname = iChunkname; - ((mng_unknown_chunkp)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_unknown_chunkp)pChunk)->pData, iRawlen); - MNG_COPY (((mng_unknown_chunkp)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iInterlace, - mng_uint8 iAlphaBitdepth, - mng_uint8 iAlphaCompression, - mng_uint8 iAlphaFilter, - mng_uint8 iAlphaInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle, - mng_uint32 iFramecount, - mng_uint32 iLayercount, - mng_uint32 iPlaytime) -{ - mng_datap pData; - mng_chunkp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must be a MNG animation! */ - if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR)) - MNG_ERROR (pData, MNG_NOMHDR) - - pChunk = pData->pFirstchunk; /* get the first chunk */ - /* and update the variables */ - ((mng_mhdrp)pChunk)->iFramecount = iFramecount; - ((mng_mhdrp)pChunk)->iLayercount = iLayercount; - ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle, - mng_uint32 iSimplicity) -{ - mng_datap pData; - mng_chunkp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must be a MNG animation! */ - if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR)) - MNG_ERROR (pData, MNG_NOMHDR) - - pChunk = pData->pFirstchunk; /* get the first chunk */ - /* and update the variable */ - ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -#endif /* MNG_ACCESS_CHUNKS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_chunks.h b/Engine/lib/lmng/libmng_chunks.h deleted file mode 100644 index d10bf2dc7..000000000 --- a/Engine/lib/lmng/libmng_chunks.h +++ /dev/null @@ -1,1026 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunks.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk structures (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of known chunk structures * */ -/* * * */ -/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - put in some extra comments * */ -/* * 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - fixed layout for sBIT, PPLT * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed write callback definition * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - fixed layout for PPLT again (missed deltatype ?!?) * */ -/* * * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - removed useless definition (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 11/28/2002 - G.Juyn * */ -/* * - fixed definition of iMethodX/Y for MAGN chunk * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added conditional around MNG_NO_DELTA_PNG support * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunks_h_ -#define _libmng_chunks_h_ - -/* ************************************************************************** */ - -#ifdef MNG_SWAP_ENDIAN -#define PNG_SIG 0x474e5089L -#define JNG_SIG 0x474e4a8bL -#define MNG_SIG 0x474e4d8aL -#define POST_SIG 0x0a1a0a0dL -#else -#define PNG_SIG 0x89504e47L -#define JNG_SIG 0x8b4a4e47L -#define MNG_SIG 0x8a4d4e47L -#define POST_SIG 0x0d0a1a0aL -#endif - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER - -typedef mng_retcode (*mng_f_specialfunc) (mng_datap pData, - mng_chunkp pChunk, - mng_uint32* piRawlen, - mng_uint8p* ppRawdata); - -typedef mng_retcode (*mng_c_specialfunc) (mng_datap pData, - mng_chunkp pChunk); - -#define MNG_FIELD_OPTIONAL 0x0001 -#define MNG_FIELD_TERMINATOR 0x0002 -#define MNG_FIELD_REPETITIVE 0x0004 -#define MNG_FIELD_DEFLATED 0x0008 -#define MNG_FIELD_IFIMGTYPES 0x01F0 /* image-type mask */ -#define MNG_FIELD_IFIMGTYPE0 0x0010 -#define MNG_FIELD_IFIMGTYPE2 0x0020 -#define MNG_FIELD_IFIMGTYPE3 0x0040 -#define MNG_FIELD_IFIMGTYPE4 0x0080 -#define MNG_FIELD_IFIMGTYPE6 0x0100 -#define MNG_FIELD_PUTIMGTYPE 0x0200 -#define MNG_FIELD_NOHIGHBIT 0x0400 -#define MNG_FIELD_GROUPMASK 0x7000 -#define MNG_FIELD_GROUP1 0x1000 -#define MNG_FIELD_GROUP2 0x2000 -#define MNG_FIELD_GROUP3 0x3000 -#define MNG_FIELD_GROUP4 0x4000 -#define MNG_FIELD_GROUP5 0x5000 -#define MNG_FIELD_GROUP6 0x6000 -#define MNG_FIELD_GROUP7 0x7000 -#define MNG_FIELD_INT 0x8000 - -typedef struct { /* chunk-field descriptor */ - mng_f_specialfunc pSpecialfunc; - mng_uint16 iFlags; - mng_uint16 iMinvalue; - mng_uint16 iMaxvalue; - mng_uint16 iLengthmin; - mng_uint16 iLengthmax; - mng_uint16 iOffsetchunk; - mng_uint16 iOffsetchunkind; - mng_uint16 iOffsetchunklen; - } mng_field_descriptor; -typedef mng_field_descriptor * mng_field_descp; - -#define MNG_DESCR_GLOBAL 0x0001 -#define MNG_DESCR_EMPTY 0x0002 -#define MNG_DESCR_EMPTYEMBED 0x0006 -#define MNG_DESCR_EMPTYGLOBAL 0x000A - -#define MNG_DESCR_GenHDR 0x0001 /* IHDR/JHDR/BASI/DHDR */ -#define MNG_DESCR_JngHDR 0x0002 /* JHDR/DHDR */ -#define MNG_DESCR_MHDR 0x0004 -#define MNG_DESCR_IHDR 0x0008 -#define MNG_DESCR_JHDR 0x0010 -#define MNG_DESCR_DHDR 0x0020 -#define MNG_DESCR_LOOP 0x0040 -#define MNG_DESCR_PLTE 0x0080 -#define MNG_DESCR_SAVE 0x0100 - -#define MNG_DESCR_NOIHDR 0x0001 -#define MNG_DESCR_NOJHDR 0x0002 -#define MNG_DESCR_NOBASI 0x0004 -#define MNG_DESCR_NODHDR 0x0008 -#define MNG_DESCR_NOIDAT 0x0010 -#define MNG_DESCR_NOJDAT 0x0020 -#define MNG_DESCR_NOJDAA 0x0040 -#define MNG_DESCR_NOPLTE 0x0080 -#define MNG_DESCR_NOJSEP 0x0100 -#define MNG_DESCR_NOMHDR 0x0200 -#define MNG_DESCR_NOTERM 0x0400 -#define MNG_DESCR_NOLOOP 0x0800 -#define MNG_DESCR_NOSAVE 0x1000 - -typedef struct { /* chunk descriptor */ - mng_imgtype eImgtype; - mng_createobjtype eCreateobject; - mng_uint16 iObjsize; - mng_uint16 iOffsetempty; - mng_ptr pObjcleanup; - mng_ptr pObjprocess; - mng_c_specialfunc pSpecialfunc; - mng_field_descp pFielddesc; - mng_uint16 iFielddesc; - mng_uint16 iAllowed; - mng_uint16 iMusthaves; - mng_uint16 iMustNOThaves; - } mng_chunk_descriptor; -typedef mng_chunk_descriptor * mng_chunk_descp; - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -typedef mng_retcode (*mng_createchunk) (mng_datap pData, - mng_chunkp pHeader, - mng_chunkp* ppChunk); - -typedef mng_retcode (*mng_cleanupchunk) (mng_datap pData, - mng_chunkp pHeader); - -typedef mng_retcode (*mng_readchunk) (mng_datap pData, - mng_chunkp pHeader, - mng_uint32 iRawlen, - mng_uint8p pRawdata, - mng_chunkp* pChunk); - -typedef mng_retcode (*mng_writechunk) (mng_datap pData, - mng_chunkp pChunk); - -typedef mng_retcode (*mng_assignchunk) (mng_datap pData, - mng_chunkp pChunkto, - mng_chunkp pChunkfrom); - -/* ************************************************************************** */ - -typedef struct { /* generic header */ - mng_chunkid iChunkname; - mng_createchunk fCreate; - mng_cleanupchunk fCleanup; - mng_readchunk fRead; - mng_writechunk fWrite; - mng_assignchunk fAssign; - mng_chunkp pNext; /* for double-linked list */ - mng_chunkp pPrev; -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - mng_size_t iChunksize; -#endif -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_descp pChunkdescr; -#endif - } mng_chunk_header; -typedef mng_chunk_header * mng_chunk_headerp; - -/* ************************************************************************** */ - -typedef struct { /* IHDR */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - } mng_ihdr; -typedef mng_ihdr * mng_ihdrp; - -/* ************************************************************************** */ - -typedef struct { /* PLTE */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iEntrycount; - mng_rgbpaltab aEntries; - } mng_plte; -typedef mng_plte * mng_pltep; - -/* ************************************************************************** */ - -typedef struct { /* IDAT */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iDatasize; - mng_ptr pData; - } mng_idat; -typedef mng_idat * mng_idatp; - -/* ************************************************************************** */ - -typedef struct { /* IEND */ - mng_chunk_header sHeader; - } mng_iend; -typedef mng_iend * mng_iendp; - -/* ************************************************************************** */ - -typedef struct { /* tRNS */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_bool bGlobal; - mng_uint8 iType; /* colortype (0,2,3) */ - mng_uint32 iCount; - mng_uint8arr aEntries; - mng_uint16 iGray; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_uint32 iRawlen; - mng_uint8arr aRawdata; - } mng_trns; -typedef mng_trns * mng_trnsp; - -/* ************************************************************************** */ - -typedef struct { /* gAMA */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iGamma; - } mng_gama; -typedef mng_gama * mng_gamap; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -typedef struct { /* cHRM */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iWhitepointx; - mng_uint32 iWhitepointy; - mng_uint32 iRedx; - mng_uint32 iRedy; - mng_uint32 iGreenx; - mng_uint32 iGreeny; - mng_uint32 iBluex; - mng_uint32 iBluey; - } mng_chrm; -typedef mng_chrm * mng_chrmp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* sRGB */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iRenderingintent; - } mng_srgb; -typedef mng_srgb * mng_srgbp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -typedef struct { /* iCCP */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iCompression; - mng_uint32 iProfilesize; - mng_ptr pProfile; - } mng_iccp; -typedef mng_iccp * mng_iccpp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -typedef struct { /* tEXt */ - mng_chunk_header sHeader; - mng_uint32 iKeywordsize; - mng_pchar zKeyword; - mng_uint32 iTextsize; - mng_pchar zText; - } mng_text; -typedef mng_text * mng_textp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -typedef struct { /* zTXt */ - mng_chunk_header sHeader; - mng_uint32 iKeywordsize; - mng_pchar zKeyword; - mng_uint8 iCompression; - mng_uint32 iTextsize; - mng_pchar zText; - } mng_ztxt; -typedef mng_ztxt * mng_ztxtp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -typedef struct { /* iTXt */ - mng_chunk_header sHeader; - mng_uint32 iKeywordsize; - mng_pchar zKeyword; - mng_uint8 iCompressionflag; - mng_uint8 iCompressionmethod; - mng_uint32 iLanguagesize; - mng_pchar zLanguage; - mng_uint32 iTranslationsize; - mng_pchar zTranslation; - mng_uint32 iTextsize; - mng_pchar zText; - } mng_itxt; -typedef mng_itxt * mng_itxtp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -typedef struct { /* bKGD */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iType; /* 3=indexed, 0=gray, 2=rgb */ - mng_uint8 iIndex; - mng_uint16 iGray; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - } mng_bkgd; -typedef mng_bkgd * mng_bkgdp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -typedef struct { /* pHYs */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iSizex; - mng_uint32 iSizey; - mng_uint8 iUnit; - } mng_phys; -typedef mng_phys * mng_physp; -#endif - -/* ************************************************************************** */ -#ifndef MNG_SKIPCHUNK_sBIT - -typedef struct { /* sBIT */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iType; /* colortype (0,2,3,4,6,10,12,14,16) */ - mng_uint8arr4 aBits; - } mng_sbit; -typedef mng_sbit * mng_sbitp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -typedef struct { /* sPLT */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iSampledepth; - mng_uint32 iEntrycount; - mng_ptr pEntries; - } mng_splt; -typedef mng_splt * mng_spltp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -typedef struct { /* hIST */ - mng_chunk_header sHeader; - mng_uint32 iEntrycount; - mng_uint16arr aEntries; - } mng_hist; -typedef mng_hist * mng_histp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -typedef struct { /* tIME */ - mng_chunk_header sHeader; - mng_uint16 iYear; - mng_uint8 iMonth; - mng_uint8 iDay; - mng_uint8 iHour; - mng_uint8 iMinute; - mng_uint8 iSecond; - } mng_time; -typedef mng_time * mng_timep; -#endif - -/* ************************************************************************** */ - -typedef struct { /* MHDR */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint32 iTicks; - mng_uint32 iLayercount; - mng_uint32 iFramecount; - mng_uint32 iPlaytime; - mng_uint32 iSimplicity; - } mng_mhdr; -typedef mng_mhdr * mng_mhdrp; - -/* ************************************************************************** */ - -typedef struct { /* MEND */ - mng_chunk_header sHeader; - } mng_mend; -typedef mng_mend * mng_mendp; - -/* ************************************************************************** */ - -typedef struct { /* LOOP */ - mng_chunk_header sHeader; - mng_uint8 iLevel; - mng_uint32 iRepeat; - mng_uint8 iTermination; - mng_uint32 iItermin; - mng_uint32 iItermax; - mng_uint32 iCount; - mng_uint32p pSignals; - } mng_loop; -typedef mng_loop * mng_loopp; - -/* ************************************************************************** */ - -typedef struct { /* ENDL */ - mng_chunk_header sHeader; - mng_uint8 iLevel; - } mng_endl; -typedef mng_endl * mng_endlp; - -/* ************************************************************************** */ - -typedef struct { /* DEFI */ - mng_chunk_header sHeader; - mng_uint16 iObjectid; - mng_bool bHasdonotshow; - mng_uint8 iDonotshow; - mng_bool bHasconcrete; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_int32 iXlocation; - mng_int32 iYlocation; - mng_bool bHasclip; - mng_int32 iLeftcb; - mng_int32 iRightcb; - mng_int32 iTopcb; - mng_int32 iBottomcb; - } mng_defi; -typedef mng_defi * mng_defip; - -/* ************************************************************************** */ - -typedef struct { /* BASI */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasalpha; -#endif - mng_uint16 iAlpha; - mng_uint8 iViewable; - } mng_basi; -typedef mng_basi * mng_basip; - -/* ************************************************************************** */ - -typedef struct { /* CLON */ - mng_chunk_header sHeader; - mng_uint16 iSourceid; - mng_uint16 iCloneid; - mng_uint8 iClonetype; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasdonotshow; -#endif - mng_uint8 iDonotshow; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_uint8 iLocationtype; - mng_int32 iLocationx; - mng_int32 iLocationy; - } mng_clon; -typedef mng_clon * mng_clonp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -typedef struct { /* PAST source */ - mng_uint16 iSourceid; - mng_uint8 iComposition; - mng_uint8 iOrientation; - mng_uint8 iOffsettype; - mng_int32 iOffsetx; - mng_int32 iOffsety; - mng_uint8 iBoundarytype; - mng_int32 iBoundaryl; - mng_int32 iBoundaryr; - mng_int32 iBoundaryt; - mng_int32 iBoundaryb; - } mng_past_source; -typedef mng_past_source * mng_past_sourcep; - -typedef struct { /* PAST */ - mng_chunk_header sHeader; - mng_uint16 iDestid; - mng_uint8 iTargettype; - mng_int32 iTargetx; - mng_int32 iTargety; - mng_uint32 iCount; - mng_past_sourcep pSources; - } mng_past; -typedef mng_past * mng_pastp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* DISC */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_uint16p pObjectids; - } mng_disc; -typedef mng_disc * mng_discp; - -/* ************************************************************************** */ - -typedef struct { /* BACK */ - mng_chunk_header sHeader; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_uint8 iMandatory; - mng_uint16 iImageid; - mng_uint8 iTile; - } mng_back; -typedef mng_back * mng_backp; - -/* ************************************************************************** */ - -typedef struct { /* FRAM */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iMode; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iChangedelay; - mng_uint8 iChangetimeout; - mng_uint8 iChangeclipping; - mng_uint8 iChangesyncid; - mng_uint32 iDelay; - mng_uint32 iTimeout; - mng_uint8 iBoundarytype; - mng_int32 iBoundaryl; - mng_int32 iBoundaryr; - mng_int32 iBoundaryt; - mng_int32 iBoundaryb; - mng_uint32 iCount; - mng_uint32p pSyncids; - } mng_fram; -typedef mng_fram * mng_framp; - -/* ************************************************************************** */ - -typedef struct { /* MOVE */ - mng_chunk_header sHeader; - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMovetype; - mng_int32 iMovex; - mng_int32 iMovey; - } mng_move; -typedef mng_move * mng_movep; - -/* ************************************************************************** */ - -typedef struct { /* CLIP */ - mng_chunk_header sHeader; - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iCliptype; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_clip; -typedef mng_clip * mng_clipp; - -/* ************************************************************************** */ - -typedef struct { /* SHOW */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint16 iFirstid; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHaslastid; -#endif - mng_uint16 iLastid; - mng_uint8 iMode; - } mng_show; -typedef mng_show * mng_showp; - -/* ************************************************************************** */ - -typedef struct { /* TERM */ - mng_chunk_header sHeader; - mng_uint8 iTermaction; - mng_uint8 iIteraction; - mng_uint32 iDelay; - mng_uint32 iItermax; - } mng_term; -typedef mng_term * mng_termp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -typedef struct { /* SAVE entry */ - mng_uint8 iEntrytype; - mng_uint32arr2 iOffset; /* 0=MSI, 1=LSI */ - mng_uint32arr2 iStarttime; /* 0=MSI, 1=LSI */ - mng_uint32 iLayernr; - mng_uint32 iFramenr; - mng_uint32 iNamesize; - mng_pchar zName; - } mng_save_entry; -typedef mng_save_entry * mng_save_entryp; - -typedef struct { /* SAVE */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iOffsettype; - mng_uint32 iCount; - mng_save_entryp pEntries; - } mng_save; -typedef mng_save * mng_savep; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -typedef struct { /* SEEK */ - mng_chunk_header sHeader; - mng_uint32 iNamesize; - mng_pchar zName; - } mng_seek; -typedef mng_seek * mng_seekp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -typedef struct { /* eXPI */ - mng_chunk_header sHeader; - mng_uint16 iSnapshotid; - mng_uint32 iNamesize; - mng_pchar zName; - } mng_expi; -typedef mng_expi * mng_expip; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -typedef struct { /* fPRI */ - mng_chunk_header sHeader; - mng_uint8 iDeltatype; - mng_uint8 iPriority; - } mng_fpri; -typedef mng_fpri * mng_fprip; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -typedef struct { /* nEED */ - mng_chunk_header sHeader; - mng_uint32 iKeywordssize; - mng_pchar zKeywords; - } mng_need; -typedef mng_need * mng_needp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -typedef mng_phys mng_phyg; /* pHYg */ -typedef mng_phyg * mng_phygp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -typedef struct { /* JHDR */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint8 iColortype; - mng_uint8 iImagesampledepth; - mng_uint8 iImagecompression; - mng_uint8 iImageinterlace; - mng_uint8 iAlphasampledepth; - mng_uint8 iAlphacompression; - mng_uint8 iAlphafilter; - mng_uint8 iAlphainterlace; - } mng_jhdr; -typedef mng_jhdr * mng_jhdrp; - -/* ************************************************************************** */ - -typedef mng_idat mng_jdaa; /* JDAA */ -typedef mng_jdaa * mng_jdaap; - -/* ************************************************************************** */ - -typedef mng_idat mng_jdat; /* JDAT */ -typedef mng_jdat * mng_jdatp; - -/* ************************************************************************** */ - -typedef struct { /* JSEP */ - mng_chunk_header sHeader; - } mng_jsep; -typedef mng_jsep * mng_jsepp; - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG - -typedef struct { /* DHDR */ - mng_chunk_header sHeader; - mng_uint16 iObjectid; - mng_uint8 iImagetype; - mng_uint8 iDeltatype; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasblocksize; -#endif - mng_uint32 iBlockwidth; - mng_uint32 iBlockheight; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasblockloc; -#endif - mng_uint32 iBlockx; - mng_uint32 iBlocky; - } mng_dhdr; -typedef mng_dhdr * mng_dhdrp; - -/* ************************************************************************** */ - -typedef struct { /* PROM */ - mng_chunk_header sHeader; - mng_uint8 iColortype; - mng_uint8 iSampledepth; - mng_uint8 iFilltype; - } mng_prom; -typedef mng_prom * mng_promp; - -/* ************************************************************************** */ - -typedef struct { /* IPNG */ - mng_chunk_header sHeader; - } mng_ipng; -typedef mng_ipng *mng_ipngp; - -/* ************************************************************************** */ - -typedef struct { /* PPLT entry */ - mng_uint8 iRed; - mng_uint8 iGreen; - mng_uint8 iBlue; - mng_uint8 iAlpha; - mng_bool bUsed; - } mng_pplt_entry; -typedef mng_pplt_entry * mng_pplt_entryp; - -typedef struct { /* PPLT */ - mng_chunk_header sHeader; - mng_uint8 iDeltatype; - mng_uint32 iCount; - mng_pplt_entry aEntries [256]; - } mng_pplt; -typedef mng_pplt * mng_ppltp; - -/* ************************************************************************** */ - -typedef struct { /* IJNG */ - mng_chunk_header sHeader; - } mng_ijng; -typedef mng_ijng *mng_ijngp; - -/* ************************************************************************** */ - -typedef struct { /* DROP */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_chunkidp pChunknames; - } mng_drop; -typedef mng_drop * mng_dropp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DBYK -typedef struct { /* DBYK */ - mng_chunk_header sHeader; - mng_chunkid iChunkname; - mng_uint8 iPolarity; - mng_uint32 iKeywordssize; - mng_pchar zKeywords; - } mng_dbyk; -typedef mng_dbyk * mng_dbykp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_ORDR -typedef struct { /* ORDR entry */ - mng_chunkid iChunkname; - mng_uint8 iOrdertype; - } mng_ordr_entry; -typedef mng_ordr_entry * mng_ordr_entryp; - -typedef struct mng_ordr_struct { /* ORDR */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_ordr_entryp pEntries; - } mng_ordr; -typedef mng_ordr * mng_ordrp; -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -typedef struct { /* MAGN */ - mng_chunk_header sHeader; - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMethodX; - mng_uint16 iMX; - mng_uint16 iMY; - mng_uint16 iML; - mng_uint16 iMR; - mng_uint16 iMT; - mng_uint16 iMB; - mng_uint8 iMethodY; - } mng_magn; -typedef mng_magn * mng_magnp; - -/* ************************************************************************** */ - -typedef struct { /* evNT entry */ - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iSegmentnamesize; - mng_pchar zSegmentname; - } mng_evnt_entry; -typedef mng_evnt_entry * mng_evnt_entryp; - -typedef struct { /* evNT */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_evnt_entryp pEntries; - } mng_evnt; -typedef mng_evnt * mng_evntp; - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -typedef struct { /* mpNG frame */ - mng_uint32 iX; - mng_uint32 iY; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_int32 iXoffset; - mng_int32 iYoffset; - mng_uint16 iTicks; - } mng_mpng_frame; -typedef mng_mpng_frame * mng_mpng_framep; - -typedef struct { /* mpNG */ - mng_chunk_header sHeader; - mng_uint32 iFramewidth; - mng_uint32 iFrameheight; - mng_uint16 iNumplays; - mng_uint16 iTickspersec; - mng_uint8 iCompressionmethod; - mng_uint32 iFramessize; - mng_mpng_framep pFrames; - } mng_mpng; -typedef mng_mpng * mng_mpngp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -typedef struct { /* ahDR */ - mng_chunk_header sHeader; - mng_uint32 iNumframes; - mng_uint32 iTickspersec; - mng_uint32 iNumplays; - mng_uint32 iTilewidth; - mng_uint32 iTileheight; - mng_uint8 iInterlace; - mng_uint8 iStillused; - } mng_ahdr; -typedef mng_ahdr * mng_ahdrp; - -typedef struct { /* adAT tile */ - mng_uint32 iTicks; - mng_int32 iXoffset; - mng_int32 iYoffset; - mng_uint8 iTilesource; - } mng_adat_tile; -typedef mng_adat_tile * mng_adat_tilep; - -typedef struct { /* adAT */ - mng_chunk_header sHeader; - mng_uint32 iTilessize; - mng_adat_tilep pTiles; - } mng_adat; -typedef mng_adat * mng_adatp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* unknown chunk */ - mng_chunk_header sHeader; - mng_uint32 iDatasize; - mng_ptr pData; - } mng_unknown_chunk; -typedef mng_unknown_chunk * mng_unknown_chunkp; - -/* ************************************************************************** */ - -#endif /* _libmng_chunks_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_cms.c b/Engine/lib/lmng/libmng_cms.c deleted file mode 100644 index 999575f66..000000000 --- a/Engine/lib/lmng/libmng_cms.c +++ /dev/null @@ -1,758 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_cms.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : color management routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the color management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/01/2000 - G.Juyn * */ -/* * - B001(105795) - fixed a typo and misconception about * */ -/* * freeing allocated gamma-table. (reported by Marti Maria) * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/09/2000 - G.Juyn * */ -/* * - filled application-based color-management routines * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added creatememprofile * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 06/10/2000 - G.Juyn * */ -/* * - fixed some compilation-warnings (contrib Jason Morris) * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - fixed problem with color-correction for stored images * */ -/* * 0.5.3 - 06/23/2000 - G.Juyn * */ -/* * - fixed problem with incorrect gamma-correction * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/31/2000 - G.Juyn * */ -/* * - fixed sRGB precedence for gamma_only corection * */ -/* * * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * * */ -/* * 1.0.1 - 03/31/2001 - G.Juyn * */ -/* * - ignore gamma=0 (see png-list for more info) * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn (reported by Gregg Kelly) * */ -/* * - fixed problem with cms profile being created multiple * */ -/* * times when both iCCP & cHRM/gAMA are present * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - optimized color-correction routines * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 11/08/2002 - G.Juyn * */ -/* * - fixed issues in init_app_cms() * */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * 1.0.6 - 07/11/2003 - G. R-P * */ -/* * - added conditional MNG_SKIPCHUNK_cHRM/iCCP * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_cms.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ -/* * * */ -/* * Little CMS helper routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS - -#define MNG_CMS_FLAGS 0 - -/* ************************************************************************** */ - -void mnglcms_initlibrary () -{ - cmsErrorAction (LCMS_ERROR_IGNORE); /* LCMS should ignore errors! */ -} - -/* ************************************************************************** */ - -mng_cmsprof mnglcms_createfileprofile (mng_pchar zFilename) -{ - return cmsOpenProfileFromFile (zFilename, "r"); -} - -/* ************************************************************************** */ - -mng_cmsprof mnglcms_creatememprofile (mng_uint32 iProfilesize, - mng_ptr pProfile) -{ - return cmsOpenProfileFromMem (pProfile, iProfilesize); -} - -/* ************************************************************************** */ - -mng_cmsprof mnglcms_createsrgbprofile (void) -{ - cmsCIExyY D65; - cmsCIExyYTRIPLE Rec709Primaries = { - {0.6400, 0.3300, 1.0}, - {0.3000, 0.6000, 1.0}, - {0.1500, 0.0600, 1.0} - }; - LPGAMMATABLE Gamma24[3]; - mng_cmsprof hsRGB; - - cmsWhitePointFromTemp(6504, &D65); - Gamma24[0] = Gamma24[1] = Gamma24[2] = cmsBuildGamma(256, 2.4); - hsRGB = cmsCreateRGBProfile(&D65, &Rec709Primaries, Gamma24); - cmsFreeGamma(Gamma24[0]); - - return hsRGB; -} - -/* ************************************************************************** */ - -void mnglcms_freeprofile (mng_cmsprof hProf) -{ - cmsCloseProfile (hProf); - return; -} - -/* ************************************************************************** */ - -void mnglcms_freetransform (mng_cmstrans hTrans) -{ -/* B001 start */ - cmsDeleteTransform (hTrans); -/* B001 end */ - return; -} - -/* ************************************************************************** */ - -mng_retcode mng_clear_cms (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_START); -#endif - - if (pData->hTrans) /* transformation still active ? */ - mnglcms_freetransform (pData->hTrans); - - pData->hTrans = 0; - - if (pData->hProf1) /* file profile still active ? */ - mnglcms_freeprofile (pData->hProf1); - - pData->hProf1 = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ -/* * * */ -/* * Color-management initialization & correction routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS - -mng_retcode mng_init_full_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj) -{ - mng_cmsprof hProf; - mng_cmstrans hTrans; - mng_imagep pImage = MNG_NULL; - mng_imagedatap pBuf = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS, MNG_LC_START); -#endif - - if (bObject) /* use object if present ? */ - { /* current object ? */ - if ((mng_imagep)pData->pCurrentobj) - pImage = (mng_imagep)pData->pCurrentobj; - else /* if not; use object 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - if (bRetrobj) /* retrieving from an object ? */ - pImage = (mng_imagep)pData->pRetrieveobj; - - if (pImage) /* are we using an object ? */ - pBuf = pImage->pImgbuf; /* then address the buffer */ - - if ((!pBuf) || (!pBuf->bCorrected)) /* is the buffer already corrected ? */ - { -#ifndef MNG_SKIPCHUNK_iCCP - if (((pBuf) && (pBuf->bHasICCP)) || ((bGlobal) && (pData->bHasglobalICCP))) - { - if (!pData->hProf2) /* output profile not defined ? */ - { /* then assume sRGB !! */ - pData->hProf2 = mnglcms_createsrgbprofile (); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - } - - if ((pBuf) && (pBuf->bHasICCP)) /* generate a profile handle */ - hProf = cmsOpenProfileFromMem (pBuf->pProfile, pBuf->iProfilesize); - else - hProf = cmsOpenProfileFromMem (pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->hProf1 = hProf; /* save for future use */ - - if (!hProf) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->bIsRGBA16) /* 16-bit intermediates ? */ - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE, - pData->hProf2, TYPE_RGBA_16_SE, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - else -#endif - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8, - pData->hProf2, TYPE_RGBA_8, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - - pData->hTrans = hTrans; /* save for future use */ - - if (!hTrans) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOTRANS); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_full_cms; - - return MNG_NOERROR; /* and done */ - } - else -#endif - if (((pBuf) && (pBuf->bHasSRGB)) || ((bGlobal) && (pData->bHasglobalSRGB))) - { - mng_uint8 iIntent; - - if (pData->bIssRGB) /* sRGB system ? */ - return MNG_NOERROR; /* no conversion required */ - - if (!pData->hProf3) /* sRGB profile not defined ? */ - { /* then create it implicitly !! */ - pData->hProf3 = mnglcms_createsrgbprofile (); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - } - - hProf = pData->hProf3; /* convert from sRGB profile */ - - if ((pBuf) && (pBuf->bHasSRGB)) /* determine rendering intent */ - iIntent = pBuf->iRenderingintent; - else - iIntent = pData->iGlobalRendintent; - - if (pData->bIsRGBA16) /* 16-bit intermediates ? */ - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE, - pData->hProf2, TYPE_RGBA_16_SE, - iIntent, MNG_CMS_FLAGS); - else - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8, - pData->hProf2, TYPE_RGBA_8, - iIntent, MNG_CMS_FLAGS); - - pData->hTrans = hTrans; /* save for future use */ - - if (!hTrans) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOTRANS); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_full_cms; - - return MNG_NOERROR; /* and done */ - } - else - if ( (((pBuf) && (pBuf->bHasCHRM)) || ((bGlobal) && (pData->bHasglobalCHRM))) && - ( ((pBuf) && (pBuf->bHasGAMA) && (pBuf->iGamma > 0)) || - ((bGlobal) && (pData->bHasglobalGAMA) && (pData->iGlobalGamma > 0)) ) ) - { - mng_CIExyY sWhitepoint; - mng_CIExyYTRIPLE sPrimaries; - mng_gammatabp pGammatable[3]; - mng_float dGamma; - - if (!pData->hProf2) /* output profile not defined ? */ - { /* then assume sRGB !! */ - pData->hProf2 = mnglcms_createsrgbprofile (); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - } - -#ifndef MNG_SKIPCHUNK_cHRM - if ((pBuf) && (pBuf->bHasCHRM)) /* local cHRM ? */ - { - sWhitepoint.x = (mng_float)pBuf->iWhitepointx / 100000; - sWhitepoint.y = (mng_float)pBuf->iWhitepointy / 100000; - sPrimaries.Red.x = (mng_float)pBuf->iPrimaryredx / 100000; - sPrimaries.Red.y = (mng_float)pBuf->iPrimaryredy / 100000; - sPrimaries.Green.x = (mng_float)pBuf->iPrimarygreenx / 100000; - sPrimaries.Green.y = (mng_float)pBuf->iPrimarygreeny / 100000; - sPrimaries.Blue.x = (mng_float)pBuf->iPrimarybluex / 100000; - sPrimaries.Blue.y = (mng_float)pBuf->iPrimarybluey / 100000; - } - else - { - sWhitepoint.x = (mng_float)pData->iGlobalWhitepointx / 100000; - sWhitepoint.y = (mng_float)pData->iGlobalWhitepointy / 100000; - sPrimaries.Red.x = (mng_float)pData->iGlobalPrimaryredx / 100000; - sPrimaries.Red.y = (mng_float)pData->iGlobalPrimaryredy / 100000; - sPrimaries.Green.x = (mng_float)pData->iGlobalPrimarygreenx / 100000; - sPrimaries.Green.y = (mng_float)pData->iGlobalPrimarygreeny / 100000; - sPrimaries.Blue.x = (mng_float)pData->iGlobalPrimarybluex / 100000; - sPrimaries.Blue.y = (mng_float)pData->iGlobalPrimarybluey / 100000; - } -#endif - - sWhitepoint.Y = /* Y component is always 1.0 */ - sPrimaries.Red.Y = - sPrimaries.Green.Y = - sPrimaries.Blue.Y = 1.0; - - if ((pBuf) && (pBuf->bHasGAMA)) /* get the gamma value */ - dGamma = (mng_float)pBuf->iGamma / 100000; - else - dGamma = (mng_float)pData->iGlobalGamma / 100000; - - dGamma = pData->dViewgamma / dGamma; - - pGammatable [0] = /* and build the lookup tables */ - pGammatable [1] = - pGammatable [2] = cmsBuildGamma (256, dGamma); - - if (!pGammatable [0]) /* enough memory ? */ - MNG_ERRORL (pData, MNG_LCMS_NOMEM); - /* create the profile */ - hProf = cmsCreateRGBProfile (&sWhitepoint, &sPrimaries, pGammatable); - - cmsFreeGamma (pGammatable [0]); /* free the temporary gamma tables ? */ - /* yes! but just the one! */ - - pData->hProf1 = hProf; /* save for future use */ - - if (!hProf) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - - if (pData->bIsRGBA16) /* 16-bit intermediates ? */ - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE, - pData->hProf2, TYPE_RGBA_16_SE, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - else - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8, - pData->hProf2, TYPE_RGBA_8, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - - pData->hTrans = hTrans; /* save for future use */ - - if (!hTrans) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOTRANS); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_full_cms; - - return MNG_NOERROR; /* and done */ - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS, MNG_LC_END); -#endif - /* if we get here, we'll only do gamma */ - return mng_init_gamma_only (pData, bGlobal, bObject, bRetrobj); -} -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS -mng_retcode mng_correct_full_cms (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_FULL_CMS, MNG_LC_START); -#endif - - cmsDoTransform (pData->hTrans, pData->pRGBArow, pData->pRGBArow, pData->iRowsamples); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_FULL_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ - -#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS) -mng_retcode mng_init_gamma_only (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj) -{ - mng_float dGamma; - mng_imagep pImage = MNG_NULL; - mng_imagedatap pBuf = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_START); -#endif - - if (bObject) /* use object if present ? */ - { /* current object ? */ - if ((mng_imagep)pData->pCurrentobj) - pImage = (mng_imagep)pData->pCurrentobj; - else /* if not; use object 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - if (bRetrobj) /* retrieving from an object ? */ - pImage = (mng_imagep)pData->pRetrieveobj; - - if (pImage) /* are we using an object ? */ - pBuf = pImage->pImgbuf; /* then address the buffer */ - - if ((!pBuf) || (!pBuf->bCorrected)) /* is the buffer already corrected ? */ - { - if ((pBuf) && (pBuf->bHasSRGB)) /* get the gamma value */ - dGamma = 0.45455; - else - if ((pBuf) && (pBuf->bHasGAMA)) - dGamma = (mng_float)pBuf->iGamma / 100000; - else - if ((bGlobal) && (pData->bHasglobalSRGB)) - dGamma = 0.45455; - else - if ((bGlobal) && (pData->bHasglobalGAMA)) - dGamma = (mng_float)pData->iGlobalGamma / 100000; - else - dGamma = pData->dDfltimggamma; - - if (dGamma > 0) /* ignore gamma=0 */ - { - dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma); - - if (dGamma != pData->dLastgamma) /* lookup table needs to be computed ? */ - { - mng_int32 iX; - - pData->aGammatab [0] = 0; - - for (iX = 1; iX <= 255; iX++) - pData->aGammatab [iX] = (mng_uint8)(pow (iX / 255.0, dGamma) * 255 + 0.5); - - pData->dLastgamma = dGamma; /* keep for next time */ - } - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_gamma_only; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS || MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS) -mng_retcode mng_correct_gamma_only (mng_datap pData) -{ - mng_uint8p pWork; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_START); -#endif - - pWork = pData->pRGBArow; /* address intermediate row */ - - if (pData->bIsRGBA16) /* 16-bit intermediate row ? */ - { - - - /* TODO: 16-bit precision gamma processing */ - /* we'll just do the high-order byte for now */ - - - /* convert all samples in the row */ - for (iX = 0; iX < pData->iRowsamples; iX++) - { /* using the precalculated gamma lookup table */ - *pWork = pData->aGammatab [*pWork]; - *(pWork+2) = pData->aGammatab [*(pWork+2)]; - *(pWork+4) = pData->aGammatab [*(pWork+4)]; - - pWork += 8; - } - } - else - { /* convert all samples in the row */ - for (iX = 0; iX < pData->iRowsamples; iX++) - { /* using the precalculated gamma lookup table */ - *pWork = pData->aGammatab [*pWork]; - *(pWork+1) = pData->aGammatab [*(pWork+1)]; - *(pWork+2) = pData->aGammatab [*(pWork+2)]; - - pWork += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS || MNG_APP_CMS */ - -/* ************************************************************************** */ - -#ifdef MNG_APP_CMS -mng_retcode mng_init_app_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj) -{ - mng_imagep pImage = MNG_NULL; - mng_imagedatap pBuf = MNG_NULL; - mng_bool bDone = MNG_FALSE; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_START); -#endif - - if (bObject) /* use object if present ? */ - { /* current object ? */ - if ((mng_imagep)pData->pCurrentobj) - pImage = (mng_imagep)pData->pCurrentobj; - else /* if not; use object 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - if (bRetrobj) /* retrieving from an object ? */ - pImage = (mng_imagep)pData->pRetrieveobj; - - if (pImage) /* are we using an object ? */ - pBuf = pImage->pImgbuf; /* then address the buffer */ - - if ((!pBuf) || (!pBuf->bCorrected)) /* is the buffer already corrected ? */ - { -#ifndef MNG_SKIPCHUNK_iCCP - if ( (pData->fProcessiccp) && - (((pBuf) && (pBuf->bHasICCP)) || ((bGlobal) && (pData->bHasglobalICCP))) ) - { - mng_uint32 iProfilesize; - mng_ptr pProfile; - - if ((pBuf) && (pBuf->bHasICCP)) /* get the right profile */ - { - iProfilesize = pBuf->iProfilesize; - pProfile = pBuf->pProfile; - } - else - { - iProfilesize = pData->iGlobalProfilesize; - pProfile = pData->pGlobalProfile; - } - /* inform the app */ - if (!pData->fProcessiccp ((mng_handle)pData, iProfilesize, pProfile)) - MNG_ERROR (pData, MNG_APPCMSERROR); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - bDone = MNG_TRUE; - } -#endif - - if ( (pData->fProcesssrgb) && - (((pBuf) && (pBuf->bHasSRGB)) || ((bGlobal) && (pData->bHasglobalSRGB))) ) - { - mng_uint8 iIntent; - - if ((pBuf) && (pBuf->bHasSRGB)) /* determine rendering intent */ - iIntent = pBuf->iRenderingintent; - else - iIntent = pData->iGlobalRendintent; - /* inform the app */ - if (!pData->fProcesssrgb ((mng_handle)pData, iIntent)) - MNG_ERROR (pData, MNG_APPCMSERROR); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - bDone = MNG_TRUE; - } - -#ifndef MNG_SKIPCHUNK_cHRM - if ( (pData->fProcesschroma) && - (((pBuf) && (pBuf->bHasCHRM)) || ((bGlobal) && (pData->bHasglobalCHRM))) ) - { - mng_uint32 iWhitepointx, iWhitepointy; - mng_uint32 iPrimaryredx, iPrimaryredy; - mng_uint32 iPrimarygreenx, iPrimarygreeny; - mng_uint32 iPrimarybluex, iPrimarybluey; - - if ((pBuf) && (pBuf->bHasCHRM)) /* local cHRM ? */ - { - iWhitepointx = pBuf->iWhitepointx; - iWhitepointy = pBuf->iWhitepointy; - iPrimaryredx = pBuf->iPrimaryredx; - iPrimaryredy = pBuf->iPrimaryredy; - iPrimarygreenx = pBuf->iPrimarygreenx; - iPrimarygreeny = pBuf->iPrimarygreeny; - iPrimarybluex = pBuf->iPrimarybluex; - iPrimarybluey = pBuf->iPrimarybluey; - } - else - { - iWhitepointx = pData->iGlobalWhitepointx; - iWhitepointy = pData->iGlobalWhitepointy; - iPrimaryredx = pData->iGlobalPrimaryredx; - iPrimaryredy = pData->iGlobalPrimaryredy; - iPrimarygreenx = pData->iGlobalPrimarygreenx; - iPrimarygreeny = pData->iGlobalPrimarygreeny; - iPrimarybluex = pData->iGlobalPrimarybluex; - iPrimarybluey = pData->iGlobalPrimarybluey; - } - /* inform the app */ - if (!pData->fProcesschroma ((mng_handle)pData, iWhitepointx, iWhitepointy, - iPrimaryredx, iPrimaryredy, - iPrimarygreenx, iPrimarygreeny, - iPrimarybluex, iPrimarybluey)) - MNG_ERROR (pData, MNG_APPCMSERROR); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - bDone = MNG_TRUE; - } -#endif - - if ( (pData->fProcessgamma) && - (((pBuf) && (pBuf->bHasGAMA)) || ((bGlobal) && (pData->bHasglobalGAMA))) ) - { - mng_uint32 iGamma; - - if ((pBuf) && (pBuf->bHasGAMA)) /* get the gamma value */ - iGamma = pBuf->iGamma; - else - iGamma = pData->iGlobalGamma; - /* inform the app */ - if (!pData->fProcessgamma ((mng_handle)pData, iGamma)) - { /* app wants us to use internal routines ! */ - iRetcode = mng_init_gamma_only (pData, bGlobal, bObject, bRetrobj); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - } - - bDone = MNG_TRUE; - } - - if (!bDone) /* no color-info at all ? */ - { - /* then use default image gamma ! */ - if (!pData->fProcessgamma ((mng_handle)pData, - (mng_uint32)((pData->dDfltimggamma * 100000) + 0.5))) - { /* app wants us to use internal routines ! */ - iRetcode = mng_init_gamma_only (pData, bGlobal, bObject, bRetrobj); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_APP_CMS */ - -/* ************************************************************************** */ - -#ifdef MNG_APP_CMS -mng_retcode mng_correct_app_cms (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_START); -#endif - - if (pData->fProcessarow) /* let the app do something with our row */ - if (!pData->fProcessarow ((mng_handle)pData, pData->iRowsamples, - pData->bIsRGBA16, pData->pRGBArow)) - MNG_ERROR (pData, MNG_APPCMSERROR); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_APP_CMS */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_cms.h b/Engine/lib/lmng/libmng_cms.h deleted file mode 100644 index 4459f805f..000000000 --- a/Engine/lib/lmng/libmng_cms.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_cms.h copyright (c) 2000-2003 G.Juyn * */ -/* * version : 1.0.6 * */ -/* * * */ -/* * purpose : color management routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of color management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added creatememprofile * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - optimized color-correction routines * */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_cms_h_ -#define _libmng_cms_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS -void mnglcms_initlibrary (void); -mng_cmsprof mnglcms_createfileprofile (mng_pchar zFilename); -mng_cmsprof mnglcms_creatememprofile (mng_uint32 iProfilesize, - mng_ptr pProfile ); -mng_cmsprof mnglcms_createsrgbprofile (void); -void mnglcms_freeprofile (mng_cmsprof hProf ); -void mnglcms_freetransform (mng_cmstrans hTrans ); - -mng_retcode mng_clear_cms (mng_datap pData ); -#endif - -/* ************************************************************************** */ - -#ifdef MNG_FULL_CMS -mng_retcode mng_init_full_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj); -mng_retcode mng_correct_full_cms (mng_datap pData); -#endif - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_retcode mng_init_gamma_only (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj); -mng_retcode mng_correct_gamma_only (mng_datap pData); -#endif - -#ifdef MNG_APP_CMS -mng_retcode mng_init_app_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj); -mng_retcode mng_correct_app_cms (mng_datap pData); -#endif - -/* ************************************************************************** */ - -#endif /* _libmng_cms_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_conf.h b/Engine/lib/lmng/libmng_conf.h deleted file mode 100644 index 8441ee087..000000000 --- a/Engine/lib/lmng/libmng_conf.h +++ /dev/null @@ -1,295 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_conf.h copyright (c) G.Juyn 2000-2004 * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : main configuration file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : The configuration file. Change this to include/exclude * */ -/* * the options you want or do not want in libmng. * */ -/* * * */ -/* * changes : 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - separated configuration-options into this file * */ -/* * - changed to most likely configuration (?) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - changed options to create a standard so-library * */ -/* * with everything enabled * */ -/* * 0.5.2 - 06/04/2000 - G.Juyn * */ -/* * - changed options to create a standard win32-dll * */ -/* * with everything enabled * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 09/16/2000 - G.Juyn * */ -/* * - removed trace-options from default SO/DLL builds * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B526138 - returned IJGSRC6B calling convention to * */ -/* * default for MSVC * */ -/* * * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * - added 'supports' call to check function availability * */ -/* * * */ -/* * 1.0.6 - 06/22/2002 - G.R-P * */ -/* * - added MNG_NO_INCLUDE_JNG conditional * */ -/* * - added MNG_SKIPCHUNK_evNT conditional * */ -/* * 1.0.6 - 07/14/2002 - G.R-P * */ -/* * - added MNG_NO_SUPPORT_FUNCQUERY conditional * */ -/* * * */ -/* * 1.0.7 - 03/07/2004 - G.R-P * */ -/* * - added MNG_VERSION_QUERY_SUPPORT_ conditional * */ -/* * * */ -/* * 1.0.9 - 05/12/2004 - G.Juyn * */ -/* * - clearified MNG_BIGENDIAN_SUPPORTED conditional * */ -/* * - added MNG_LITTLEENDIAN_SUPPORTED conditional * */ -/* * * */ -/* ************************************************************************** */ - - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_conf_h_ -#define _libmng_conf_h_ - -#ifdef MNG_MOZILLA_CFG -#include "special\mozcfg\mozlibmngconf.h" -#endif - -/* ************************************************************************** */ -/* * * */ -/* * User-selectable compile-time options * */ -/* * * */ -/* ************************************************************************** */ - -/* enable exactly one(1) of the MNG-(sub)set selectors */ -/* use this to select which (sub)set of the MNG specification you wish - to support */ -/* generally you'll want full support as the library provides it automatically - for you! if you're really strung on memory-requirements you can opt - to enable less support (but it's just NOT a good idea!) */ -/* NOTE that this isn't actually implemented yet */ - -#if !defined(MNG_SUPPORT_FULL) && !defined(MNG_SUPPORT_LC) && !defined(MNG_SUPPORT_VLC) -#define MNG_SUPPORT_FULL -/* #define MNG_SUPPORT_LC */ -/* #define MNG_SUPPORT_VLC */ -#endif - -/* ************************************************************************** */ - -/* enable JPEG support if required */ -/* use this to enable the JNG support routines */ -/* this requires an external jpeg package; - currently only IJG's jpgsrc6b is supported! */ -/* NOTE that the IJG code can be either 8- or 12-bit (eg. not both); - so choose the one you've defined in jconfig.h; if you don't know what - the heck I'm talking about, just leave it at 8-bit support (thank you!) */ - -#ifndef MNG_NO_INCLUDE_JNG -#ifdef MNG_SUPPORT_FULL /* full support includes JNG */ -#define MNG_SUPPORT_IJG6B -#endif - -#ifndef MNG_SUPPORT_IJG6B -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_IJG6B -#endif -#endif - -#if defined(MNG_SUPPORT_IJG6B) && !defined(MNG_SUPPORT_JPEG8) && !defined(MNG_SUPPORT_JPEG12) -#define MNG_SUPPORT_JPEG8 -/* #define MNG_SUPPORT_JPEG12 */ -#endif - -/* The following is required to export the IJG routines from the DLL in - the Windows-standard calling convention; - currently this only works for Borland C++ !!! */ - -#if defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#if defined(MNG_SUPPORT_IJG6B) && defined(__BORLANDC__) -#define MNG_DEFINE_JPEG_STDCALL -#endif -#endif -#endif - -/* ************************************************************************** */ - -/* enable required high-level functions */ -/* use this to select the high-level functions you require */ -/* if you only need to display a MNG, disable write support! */ -/* if you only need to examine a MNG, disable write & display support! */ -/* if you only need to copy a MNG, disable display support! */ -/* if you only need to create a MNG, disable read & display support! */ -/* NOTE that turning all options off will be very unuseful! */ - -#if !defined(MNG_SUPPORT_READ) && !defined(MNG_SUPPORT_WRITE) && !defined(MNG_SUPPORT_DISPLAY) -#define MNG_SUPPORT_READ -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_WRITE -#endif -#define MNG_SUPPORT_DISPLAY -#endif - -/* ************************************************************************** */ - -/* enable chunk access functions */ -/* use this to select whether you need access to the individual chunks */ -/* useful if you want to examine a read MNG (you'll also need MNG_STORE_CHUNKS !)*/ -/* required if you need to create & write a new MNG! */ - -#ifndef MNG_ACCESS_CHUNKS -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_ACCESS_CHUNKS -#endif -#endif - -/* ************************************************************************** */ - -/* enable exactly one(1) of the color-management functionality selectors */ -/* use this to select the level of automatic color support */ -/* MNG_FULL_CMS requires the lcms (little cms) external package ! */ -/* if you want your own app (or the OS) to handle color-management - select MNG_APP_CMS */ - -#define MNG_GAMMA_ONLY -/* #define MNG_FULL_CMS */ -/* #define MNG_APP_CMS */ - -/* ************************************************************************** */ - -/* enable automatic dithering */ -/* use this if you need dithering support to convert high-resolution - images to a low-resolution output-device */ -/* NOTE that this is not supported yet */ - -/* #define MNG_AUTO_DITHER */ - -/* ************************************************************************** */ - -/* enable whether chunks should be stored for reference later */ -/* use this if you need to examine the chunks of a MNG you have read, - or (re-)write a MNG you have read */ -/* turn this off if you want to reduce memory-consumption */ - -#ifndef MNG_STORE_CHUNKS -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_STORE_CHUNKS -#endif -#endif - -/* ************************************************************************** */ - -/* enable internal memory management (if your compiler supports it) */ -/* use this if your compiler supports the 'standard' memory functions - (calloc & free), and you want the library to use these functions and not - bother your app with memory-callbacks */ - -/* #define MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -/* enable internal tracing-functionality (manual debugging purposes) */ -/* use this if you have trouble location bugs or problems */ -/* NOTE that you'll need to specify the trace callback function! */ - -/* #define MNG_SUPPORT_TRACE */ - -/* ************************************************************************** */ - -/* enable extended error- and trace-telltaling */ -/* use this if you need explanatory messages with errors and/or tracing */ - -#if !defined(MNG_ERROR_TELLTALE) && !defined(MNG_TRACE_TELLTALE) -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_ERROR_TELLTALE -#define MNG_TRACE_TELLTALE -#endif -#endif - -/* ************************************************************************** */ - -/* enable BIG/LITTLE endian optimizations */ -/* enable BIG if you're on an architecture that supports big-endian reads - and writes that aren't word-aligned */ -/* according to reliable sources this only works for PowerPC (bigendian mode) - and 680x0 */ -/* enable LITTLE if you're on an architecture that supports little-endian */ -/* when in doubt leave both off !!! */ - -/* #define MNG_BIGENDIAN_SUPPORTED */ -/* #define MNG_LITTLEENDIAN_SUPPORTED */ - -/* ************************************************************************** */ -/* enable 'version' functions */ -#if !defined(MNG_VERSION_QUERY_SUPPORT) && \ - !defined(MNG_NO_VERSION_QUERY_SUPPORT) -#define MNG_VERSION_QUERY_SUPPORT -#endif - -/* enable 'supports' function */ -/* use this if you need to query the availability of functions at runtime; - useful for apps that dynamically load the library and that need specific - functions */ - -#if !defined(MNG_NO_SUPPORT_FUNCQUERY) && !defined(MNG_SUPPORT_FUNCQUERY) -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || \ - defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_FUNCQUERY -#endif -#endif - -/* ************************************************************************** */ - -/* enable dynamic MNG features */ -/* use this if you would like to have dynamic support for specifically - designed MNGs; eg. this is useful for 'rollover' effects such as common - on the world wide web */ - -#ifndef MNG_SUPPORT_DYNAMICMNG -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_DYNAMICMNG -#endif -#endif -#ifndef MNG_SUPPORT_DYNAMICMNG -#ifndef MNG_SKIPCHUNK_evNT -#define MNG_SKIPCHUNK_evNT -#endif -#endif - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_NO_ACCESS_JPEG -#ifndef MNG_ACCESS_JPEG -#define MNG_ACCESS_JPEG -#endif -#endif -#endif - -#ifdef MNG_INCLUDE_ZLIB -#ifndef MNG_NO_ACCESS_ZLIB -#ifndef MNG_ACCESS_ZLIB -#define MNG_ACCESS_ZLIB -#endif -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * End of user-selectable compile-time options * */ -/* * * */ -/* ************************************************************************** */ - -#endif /* _libmng_conf_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_data.h b/Engine/lib/lmng/libmng_data.h deleted file mode 100644 index 430dca96b..000000000 --- a/Engine/lib/lmng/libmng_data.h +++ /dev/null @@ -1,1029 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_data.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : main data structure definition * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the library main data structure * */ -/* * * */ -/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - added CRC table to main structure (for thread-safety) * */ -/* * 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added iPLTEentries for checking hIST-length * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed palette definition to exported palette-type * */ -/* * - removed frozen indicator * */ -/* * - added create/write indicators * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * - added saved-data structure for SAVE/SEEK processing * */ -/* * * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - added fields for JNG support (IJG-based) * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - changed global tRNS definition * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added delta-image fields * */ -/* * 0.5.2 - 06/01/2000 - G.Juyn * */ -/* * - added internal delta-image processing callbacks * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED * */ -/* * (contributed by Tim Rowley) * */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added parameter for delayed buffer-processing * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - added update-region parms for refresh calback * */ -/* * - added Needrefresh parameter * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - added Deltaimmediate parm for faster delta-processing * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added Speed parameter to facilitate testing * */ -/* * - added Imagelevel parameter for processtext callback * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added variables for go_xxxx processing * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added variables for improved timing support * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * - added variable for NEEDSECTIONWAIT breaks * */ -/* * - added variable for freeze & reset processing * */ -/* * 0.9.1 - 07/17/2000 - G.Juyn * */ -/* * - fixed suspension-buffering for 32K+ chunks * */ -/* * * */ -/* * 0.9.2 - 07/29/2000 - G.Juyn * */ -/* * - removed Nextbackxxx fields (no longer used) * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - fixed wrapping of suspension parameters * */ -/* * 0.9.2 - 08/04/2000 - G.Juyn * */ -/* * - B111096 - fixed large-buffer read-suspension * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 02/13/2001 - G.Juyn * */ -/* * - fixed first FRAM_MODE=4 timing problem * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 07/16/2002 - G.Juyn * */ -/* * - B581625 - large chunks fail with suspension reads * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - finished support for BACK image & tiling * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * - completed support for condition=2 in TERM chunk * */ -/* * 1.0.5 - 10/20/2002 - G.Juyn * */ -/* * - fixed processing for multiple objects in MAGN * */ -/* * - fixed display of visible target of PAST operation * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * 1.0.5 - 24/02/2003 - G.Juyn * */ -/* * - B683152 - libjpeg suspension not always honored correctly* */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * 1.0.6 - 07/05/2003 - G. R-P * */ -/* * - optionally use zlib's crc32() function * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added iPNGdepth member to pData structure * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/10/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_data_h_ -#define _libmng_data_h_ - -/* ************************************************************************** */ - -#define MNG_MAGIC 0x52530a0aL - -/* ************************************************************************** */ -/* * * */ -/* * Internal structures * */ -/* * * */ -/* ************************************************************************** */ - -typedef mng_palette8 mng_rgbpaltab; - -/* ************************************************************************** */ -/* * * */ -/* * The saved_data structure * */ -/* * * */ -/* * This contains the saved data after a SAVE chunk has been processed. * */ -/* * The data is saved from the main data structure during SAVE processing, * */ -/* * and restored to the main data structure during SEEK processing. * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct mng_savedata_struct { - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - mng_bool bHasglobalPLTE; /* global PLTE chunk processed */ - mng_bool bHasglobalTRNS; /* global tRNS chunk processed */ - mng_bool bHasglobalGAMA; /* global gAMA chunk processed */ - mng_bool bHasglobalCHRM; /* global cHRM chunk processed */ - mng_bool bHasglobalSRGB; /* global sRGB chunk processed */ - mng_bool bHasglobalICCP; /* global iCCP chunk processed */ - mng_bool bHasglobalBKGD; /* global bKGD chunk processed */ -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_DISPLAY - mng_uint16 iBACKred; /* BACK fields */ - mng_uint16 iBACKgreen; - mng_uint16 iBACKblue; - mng_uint8 iBACKmandatory; - mng_uint16 iBACKimageid; - mng_uint8 iBACKtile; - - mng_uint8 iFRAMmode; /* FRAM fields (global) */ - mng_uint32 iFRAMdelay; - mng_uint32 iFRAMtimeout; - mng_bool bFRAMclipping; - mng_int32 iFRAMclipl; - mng_int32 iFRAMclipr; - mng_int32 iFRAMclipt; - mng_int32 iFRAMclipb; - - mng_uint32 iGlobalPLTEcount; /* global PLTE fields */ - mng_rgbpaltab aGlobalPLTEentries; - - mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */ - mng_uint8arr aGlobalTRNSrawdata; - - mng_uint32 iGlobalGamma; /* global gAMA fields */ - -#ifndef MNG_SKIPCHUNK_cHRM - mng_uint32 iGlobalWhitepointx; /* global cHRM fields */ - mng_uint32 iGlobalWhitepointy; - mng_uint32 iGlobalPrimaryredx; - mng_uint32 iGlobalPrimaryredy; - mng_uint32 iGlobalPrimarygreenx; - mng_uint32 iGlobalPrimarygreeny; - mng_uint32 iGlobalPrimarybluex; - mng_uint32 iGlobalPrimarybluey; -#endif - - mng_uint8 iGlobalRendintent; /* global sRGB fields */ - - mng_uint32 iGlobalProfilesize; /* global iCCP fields */ - mng_ptr pGlobalProfile; - - mng_uint16 iGlobalBKGDred; /* global bKGD fields */ - mng_uint16 iGlobalBKGDgreen; - mng_uint16 iGlobalBKGDblue; -#endif /* MNG_SUPPORT_DISPLAY */ - - } mng_savedata; - -typedef mng_savedata * mng_savedatap; - -/* ************************************************************************** */ -/* * * */ -/* * Internal buffer structure for data push mechanisms * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct { - mng_ptr pNext; /* for linked list */ - mng_ptr pData; /* used for chunks & data */ - mng_uint32 iLength; - mng_bool bOwned; - mng_uint8p pDatanext; /* only used for data */ - mng_uint32 iRemaining; - } mng_pushdata; -typedef mng_pushdata * mng_pushdatap; - -/* ************************************************************************** */ -/* * * */ -/* * The main libmng data structure * */ -/* * * */ -/* * The handle used in all functions points to this structure which * */ -/* * contains all volatile data necessary to process the network graphic. * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct mng_data_struct { - - mng_uint32 iMagic; /* magic number to validate - a given handle */ - mng_ptr pUserdata; /* application workdata */ - - mng_imgtype eSigtype; /* image information */ - mng_imgtype eImagetype; /* initially zeroed */ - mng_uint32 iWidth; /* filled after header is processed */ - mng_uint32 iHeight; - mng_uint32 iTicks; /* these only after MHDR */ - mng_uint32 iLayercount; - mng_uint32 iFramecount; - mng_uint32 iPlaytime; - mng_uint32 iSimplicity; - mng_uint8 iAlphadepth; /* indicates expected alpha-depth */ - - mng_uint32 iImagelevel; /* level of image inside a stream */ - - mng_uint32 iCanvasstyle; /* layout of the drawing-canvas */ - mng_uint32 iBkgdstyle; /* layout of the background-canvas */ - - mng_int8 iMagnify; /* magnification factor (not used yet) */ - mng_uint32 iOffsetx; /* x-offset for extremely large image */ - mng_uint32 iOffsety; /* y-offset for extremely large image */ - mng_uint32 iCanvaswidth; /* real canvas size */ - mng_uint32 iCanvasheight; /* must be set by processheader callback */ - - mng_uint16 iBGred; /* default background color */ - mng_uint16 iBGgreen; /* initially "black" */ - mng_uint16 iBGblue; - mng_bool bUseBKGD; /* preferred use of bKGD for PNG */ - - mng_bool bIssRGB; /* indicates sRGB system */ - -#ifdef MNG_FULL_CMS /* little CMS variables */ - mng_cmsprof hProf1; /* image input profile */ - mng_cmsprof hProf2; /* default output profile */ - mng_cmsprof hProf3; /* default sRGB profile */ - mng_cmstrans hTrans; /* current transformation handle */ -#endif - - mng_float dViewgamma; /* gamma calculation variables */ - mng_float dDisplaygamma; /* initially set for sRGB conditions */ - mng_float dDfltimggamma; - - mng_bool bStorechunks; /* switch for storing chunkdata */ - mng_bool bSectionbreaks; /* indicate NEEDSECTIONWAIT breaks */ - mng_bool bCacheplayback; /* switch to cache playback info */ - mng_bool bDoProgressive; /* progressive refresh for large images */ - mng_uint32 iCrcmode; /* CRC existence & checking flags */ - - mng_speedtype iSpeed; /* speed-modifier for animations */ - - mng_uint32 iMaxwidth; /* maximum canvas size */ - mng_uint32 iMaxheight; /* initially set to 1024 x 1024 */ - - mng_int32 iErrorcode; /* error reporting fields */ - mng_int8 iSeverity; - mng_int32 iErrorx1; - mng_int32 iErrorx2; - mng_pchar zErrortext; - - mng_memalloc fMemalloc; /* callback pointers */ - mng_memfree fMemfree; /* initially nulled */ - mng_releasedata fReleasedata; -#ifndef MNG_NO_OPEN_CLOSE_STREAM - mng_openstream fOpenstream; - mng_closestream fClosestream; -#endif - mng_readdata fReaddata; - mng_writedata fWritedata; - mng_errorproc fErrorproc; - mng_traceproc fTraceproc; - mng_processheader fProcessheader; - mng_processtext fProcesstext; - mng_processsave fProcesssave; - mng_processseek fProcessseek; - mng_processneed fProcessneed; - mng_processmend fProcessmend; - mng_processunknown fProcessunknown; - mng_processterm fProcessterm; - mng_getcanvasline fGetcanvasline; - mng_getbkgdline fGetbkgdline; - mng_getalphaline fGetalphaline; - mng_refresh fRefresh; - mng_gettickcount fGettickcount; - mng_settimer fSettimer; - mng_processgamma fProcessgamma; - mng_processchroma fProcesschroma; - mng_processsrgb fProcesssrgb; - mng_processiccp fProcessiccp; - mng_processarow fProcessarow; - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OLD_VERSIONS - mng_bool bPreDraft48; /* flags ancient style draft */ -#endif - - mng_chunkid iChunkname; /* read/write-state variables */ - mng_uint32 iChunkseq; - mng_chunkp pFirstchunk; /* double-linked list of */ - mng_chunkp pLastchunk; /* stored chunk-structures */ - - mng_bool bHasheader; /* first header chunk processed */ - mng_bool bHasMHDR; /* inside a MHDR-MEND sequence */ - mng_bool bHasIHDR; /* inside a IHDR-IEND sequence */ - mng_bool bHasBASI; /* inside a BASI-IEND sequence */ - mng_bool bHasDHDR; /* inside a DHDR-IEND sequence */ -#ifdef MNG_INCLUDE_JNG - mng_bool bHasJHDR; /* inside a JHDR-IEND sequence */ - mng_bool bHasJSEP; /* passed the JSEP separator */ - mng_bool bHasJDAA; /* at least 1 JDAA processed */ - mng_bool bHasJDAT; /* at least 1 JDAT processed */ -#endif - mng_bool bHasPLTE; /* PLTE chunk processed */ - mng_bool bHasTRNS; /* tRNS chunk processed */ - mng_bool bHasGAMA; /* gAMA chunk processed */ - mng_bool bHasCHRM; /* cHRM chunk processed */ - mng_bool bHasSRGB; /* sRGB chunk processed */ - mng_bool bHasICCP; /* iCCP chunk processed */ - mng_bool bHasBKGD; /* bKGD chunk processed */ - mng_bool bHasIDAT; /* at least 1 IDAT processed */ - - mng_bool bHasSAVE; /* SAVE chunk processed */ - mng_bool bHasBACK; /* BACK chunk processed */ - mng_bool bHasFRAM; /* FRAM chunk processed */ - mng_bool bHasTERM; /* TERM chunk processed */ - mng_bool bHasLOOP; /* at least 1 LOOP open */ - - mng_bool bHasglobalPLTE; /* global PLTE chunk processed */ - mng_bool bHasglobalTRNS; /* global tRNS chunk processed */ - mng_bool bHasglobalGAMA; /* global gAMA chunk processed */ - mng_bool bHasglobalCHRM; /* global cHRM chunk processed */ - mng_bool bHasglobalSRGB; /* global sRGB chunk processed */ - mng_bool bHasglobalICCP; /* global iCCP chunk processed */ - mng_bool bHasglobalBKGD; /* global bKGD chunk processed */ - - mng_uint32 iDatawidth; /* IHDR/BASI/DHDR fields */ - mng_uint32 iDataheight; /* valid if inside IHDR-IEND, */ - mng_uint8 iBitdepth; /* BASI-IEND or DHDR-IEND */ - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - - mng_uint32 iPLTEcount; /* PLTE fields */ - -#ifdef MNG_INCLUDE_JNG - mng_uint8 iJHDRcolortype; /* JHDR fields */ - mng_uint8 iJHDRimgbitdepth; /* valid if inside JHDR-IEND */ - mng_uint8 iJHDRimgcompression; - mng_uint8 iJHDRimginterlace; - mng_uint8 iJHDRalphabitdepth; - mng_uint8 iJHDRalphacompression; - mng_uint8 iJHDRalphafilter; - mng_uint8 iJHDRalphainterlace; -#endif - -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_READ - mng_bool bReading; /* read processing variables */ - mng_bool bHavesig; - mng_bool bEOF; - mng_uint32 iReadbufsize; - mng_uint8p pReadbuf; - - mng_uint32 iLargebufsize; /* temp for very large chunks */ - mng_uint8p pLargebuf; - - mng_uint32 iSuspendtime; /* tickcount at last suspension */ - mng_bool bSuspended; /* input-reading has been suspended; - we're expecting a call to - mng_read_resume! */ - mng_uint8 iSuspendpoint; /* indicates at which point the flow - was broken to suspend input-reading */ - - mng_bool bSuspensionmode; /* I/O-suspension variables */ - mng_uint32 iSuspendbufsize; - mng_uint8p pSuspendbuf; - mng_uint8p pSuspendbufnext; - mng_uint32 iSuspendbufleft; - mng_uint32 iChunklen; /* chunk length */ - mng_uint8p pReadbufnext; /* 32K+ suspension-processing */ - mng_uint8p pLargebufnext; - - mng_pushdatap pFirstpushchunk; /* variables for push mechanisms */ - mng_pushdatap pLastpushchunk; - mng_pushdatap pFirstpushdata; - mng_pushdatap pLastpushdata; -#endif /* MNG_SUPPORT_READ */ - -#ifdef MNG_SUPPORT_WRITE - mng_bool bCreating; /* create/write processing variables */ - mng_bool bWriting; - mng_chunkid iFirstchunkadded; - mng_uint32 iWritebufsize; - mng_uint8p pWritebuf; -#endif - -#ifdef MNG_SUPPORT_DISPLAY - mng_bool bDisplaying; /* display-state variables */ - mng_bool bFramedone; - mng_uint32 iFrameseq; - mng_uint32 iLayerseq; - mng_uint32 iFrametime; /* millisecs */ - - mng_uint32 iTotalframes; /* end-totals after mng_read() */ - mng_uint32 iTotallayers; - mng_uint32 iTotalplaytime; /* millisecs */ - - mng_bool bSkipping; /* LOOP iteration=0 */ - -#ifdef MNG_SUPPORT_DYNAMICMNG - mng_bool bDynamic; /* MNG is dynamic (eg. has events) */ - mng_bool bRunningevent; /* currently processing an event */ - mng_bool bStopafterseek; /* stop after next SEEK */ - mng_int32 iEventx; /* X/Y of current event */ - mng_int32 iEventy; - mng_objectp pLastmousemove; /* last event triggered */ -#endif - - mng_uint32 iRequestframe; /* go_xxxx variables */ - mng_uint32 iRequestlayer; - mng_uint32 iRequesttime; - mng_bool bSearching; - - mng_bool bRestorebkgd; /* flags restore required before IDAT/JDAT */ - - mng_uint32 iRuntime; /* millisecs since start */ - mng_uint32 iSynctime; /* tickcount at last framesync */ - mng_uint32 iStarttime; /* tickcount at start */ - mng_uint32 iEndtime; /* tickcount at end */ - mng_bool bRunning; /* animation is active */ - mng_bool bTimerset; /* the timer has been set; - we're expecting a call to - mng_display_resume! */ - mng_uint8 iBreakpoint; /* indicates at which point the - flow was broken to run the timer */ - mng_bool bSectionwait; /* indicates a section break */ - mng_bool bFreezing; /* indicates app requested a freeze */ - mng_bool bResetting; /* indicates app requested a reset */ - mng_bool bNeedrefresh; /* indicates screen-refresh is needed */ - mng_bool bMisplacedTERM; /* indicates TERM is out of place */ - mng_bool bOnlyfirstframe; /* show first frame after TERM and stop */ - mng_uint32 iFramesafterTERM; /* determines frame-count after TERM */ - mng_objectp pCurrentobj; /* current "object" */ - mng_objectp pCurraniobj; /* current animation object - "to be"/"being" processed */ - mng_objectp pTermaniobj; /* TERM animation object */ - mng_uint32 iIterations; /* TERM/MEND iteration count */ - mng_objectp pObjzero; /* "on-the-fly" image (object = 0) */ - mng_objectp pLastclone; /* last clone */ - mng_objectp pStoreobj; /* current store object for row routines */ - mng_objectp pStorebuf; /* current store object-buffer for row routines */ - mng_objectp pRetrieveobj; /* current retrieve object for row routines */ - mng_savedatap pSavedata; /* pointer to saved data (after SAVE) */ - - mng_uint32 iUpdateleft; /* update region for refresh */ - mng_uint32 iUpdateright; - mng_uint32 iUpdatetop; - mng_uint32 iUpdatebottom; - - mng_int8 iPass; /* current interlacing pass; - negative value means no interlace */ - mng_int32 iRow; /* current row counter */ - mng_int32 iRowinc; /* row increment for this pass */ - mng_int32 iCol; /* current starting column */ - mng_int32 iColinc; /* column increment for this pass */ - mng_int32 iRowsamples; /* nr. of samples in current workrow */ - mng_int32 iSamplemul; /* needed to calculate rowsize */ - mng_int32 iSampleofs; /* from rowsamples */ - mng_int32 iSamplediv; - mng_int32 iRowsize; /* size of actual data in work row */ - mng_int32 iRowmax; /* maximum size of data in work row */ - mng_int32 iFilterofs; /* offset to filter-byte in work row */ - mng_int32 iPixelofs; /* offset to pixel-bytes in work row */ - mng_uint32 iLevel0; /* leveling variables */ - mng_uint32 iLevel1; - mng_uint32 iLevel2; - mng_uint32 iLevel3; - mng_uint8p pWorkrow; /* working row of pixel-data */ - mng_uint8p pPrevrow; /* previous row of pixel-data */ - mng_uint8p pRGBArow; /* intermediate row of RGBA8 or RGBA16 data */ - mng_bool bIsRGBA16; /* indicates intermediate row is RGBA16 */ - mng_bool bIsOpaque; /* indicates intermediate row is fully opaque */ - mng_int32 iFilterbpp; /* bpp index for filtering routines */ - - mng_int32 iSourcel; /* variables for showing objects */ - mng_int32 iSourcer; - mng_int32 iSourcet; - mng_int32 iSourceb; - mng_int32 iDestl; - mng_int32 iDestr; - mng_int32 iDestt; - mng_int32 iDestb; - - mng_objectp pFirstimgobj; /* double-linked list of */ - mng_objectp pLastimgobj; /* image-object structures */ - mng_objectp pFirstaniobj; /* double-linked list of */ - mng_objectp pLastaniobj; /* animation-object structures */ -#ifdef MNG_SUPPORT_DYNAMICMNG - mng_objectp pFirstevent; /* double-linked list of */ - mng_objectp pLastevent; /* event-object structures */ -#endif - -#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS) - mng_uint8 aGammatab[256]; /* precomputed gamma lookup table */ - mng_float dLastgamma; /* last gamma used to compute table */ -#endif - - mng_fptr fDisplayrow; /* internal callback to display an - uncompressed/unfiltered/ - color-corrected row */ - mng_fptr fRestbkgdrow; /* internal callback for restore- - background processing of a row */ - mng_fptr fCorrectrow; /* internal callback to color-correct an - uncompressed/unfiltered row */ - mng_fptr fRetrieverow; /* internal callback to retrieve an - uncompressed/unfiltered row of data */ - mng_fptr fStorerow; /* internal callback to store an - uncompressed/unfiltered row of data */ - mng_fptr fProcessrow; /* internal callback to process an - uncompressed row of data */ - mng_fptr fDifferrow; /* internal callback to perform - added filter leveling and - differing on an unfiltered row */ - mng_fptr fScalerow; /* internal callback to scale a - delta-row to the bitdepth of its target */ - mng_fptr fDeltarow; /* internal callback to execute a - delta-row onto a target */ -#ifndef MNG_SKIPCHUNK_PAST - mng_fptr fFliprow; /* internal callback to flip a row of pixels - left<->right for a PAST operation */ - mng_fptr fTilerow; /* internal callback to tile a row of pixels - during a PAST operation */ -#endif - mng_fptr fInitrowproc; /* internal callback to initialize - the row processing */ - - mng_uint16 iDEFIobjectid; /* DEFI fields */ - mng_bool bDEFIhasdonotshow; - mng_uint8 iDEFIdonotshow; - mng_bool bDEFIhasconcrete; - mng_uint8 iDEFIconcrete; - mng_bool bDEFIhasloca; - mng_int32 iDEFIlocax; - mng_int32 iDEFIlocay; - mng_bool bDEFIhasclip; - mng_int32 iDEFIclipl; - mng_int32 iDEFIclipr; - mng_int32 iDEFIclipt; - mng_int32 iDEFIclipb; - - mng_uint16 iBACKred; /* BACK fields */ - mng_uint16 iBACKgreen; - mng_uint16 iBACKblue; - mng_uint8 iBACKmandatory; - mng_uint16 iBACKimageid; - mng_uint8 iBACKtile; - - mng_int32 iBackimgoffsx; /* temp variables for restore_bkgd */ - mng_int32 iBackimgoffsy; - mng_uint32 iBackimgwidth; - mng_uint32 iBackimgheight; - -#ifndef MNG_SKIPCHUNK_FRAM - mng_uint8 iFRAMmode; /* FRAM fields (global) */ - mng_uint32 iFRAMdelay; - mng_uint32 iFRAMtimeout; - mng_bool bFRAMclipping; - mng_int32 iFRAMclipl; - mng_int32 iFRAMclipr; - mng_int32 iFRAMclipt; - mng_int32 iFRAMclipb; - - mng_uint8 iFramemode; /* current subframe variables */ - mng_uint32 iFramedelay; - mng_uint32 iFrametimeout; - mng_bool bFrameclipping; - mng_int32 iFrameclipl; - mng_int32 iFrameclipr; - mng_int32 iFrameclipt; - mng_int32 iFrameclipb; - - mng_uint32 iNextdelay; /* delay *after* next image */ -#endif - -#ifndef MNG_SKIPCHUNK_SHOW - mng_uint8 iSHOWmode; /* SHOW fields */ - mng_uint16 iSHOWfromid; - mng_uint16 iSHOWtoid; - mng_uint16 iSHOWnextid; - mng_int16 iSHOWskip; -#endif - - mng_uint32 iGlobalPLTEcount; /* global PLTE fields */ - mng_rgbpaltab aGlobalPLTEentries; - - mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */ - mng_uint8arr aGlobalTRNSrawdata; - - mng_uint32 iGlobalGamma; /* global gAMA fields */ - -#ifndef MNG_SKIPCHUNK_cHRM - mng_uint32 iGlobalWhitepointx; /* global cHRM fields */ - mng_uint32 iGlobalWhitepointy; - mng_uint32 iGlobalPrimaryredx; - mng_uint32 iGlobalPrimaryredy; - mng_uint32 iGlobalPrimarygreenx; - mng_uint32 iGlobalPrimarygreeny; - mng_uint32 iGlobalPrimarybluex; - mng_uint32 iGlobalPrimarybluey; -#endif - - mng_uint8 iGlobalRendintent; /* global sRGB fields */ - -#ifndef MNG_SKIPCHUNK_iCCP - mng_uint32 iGlobalProfilesize; /* global iCCP fields */ - mng_ptr pGlobalProfile; -#endif - - mng_uint16 iGlobalBKGDred; /* global bKGD fields */ - mng_uint16 iGlobalBKGDgreen; - mng_uint16 iGlobalBKGDblue; - - mng_ptr pDeltaImage; /* delta-image fields */ - mng_uint8 iDeltaImagetype; -#endif /* MNG_SUPPORT_DISPLAY */ - mng_uint8 iDeltatype; /* need this one in read processing !! */ -#ifdef MNG_SUPPORT_DISPLAY - mng_uint32 iDeltaBlockwidth; - mng_uint32 iDeltaBlockheight; - mng_uint32 iDeltaBlockx; - mng_uint32 iDeltaBlocky; - mng_bool bDeltaimmediate; - - mng_fptr fDeltagetrow; /* internal delta-proc callbacks */ - mng_fptr fDeltaaddrow; - mng_fptr fDeltareplacerow; - mng_fptr fDeltaputrow; - -#ifndef MNG_SKIPCHUNK_PROM - mng_fptr fPromoterow; /* internal PROM fields */ - mng_fptr fPromBitdepth; - mng_ptr pPromBuf; - mng_uint8 iPromColortype; - mng_uint8 iPromBitdepth; - mng_uint8 iPromFilltype; - mng_uint32 iPromWidth; - mng_ptr pPromSrc; - mng_ptr pPromDst; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - mng_uint16 iMAGNfromid; - mng_uint16 iMAGNcurrentid; - mng_uint16 iMAGNtoid; -#endif - -#ifndef MNG_SKIPCHUNK_PAST - mng_uint16 iPASTid; - mng_int32 iPastx; /* target x/y of last PAST */ - mng_int32 iPasty; -#endif - - mng_objectp pLastseek; /* last processed ani_seek object */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - mng_objectp pMPNG; /* mpNG object if available */ -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - mng_objectp pANG; /* ANG object if available */ -#endif - -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_INCLUDE_ZLIB - z_stream sZlib; /* zlib (de)compression variables */ - - mng_int32 iZlevel; /* zlib compression parameters */ - mng_int32 iZmethod; - mng_int32 iZwindowbits; - mng_int32 iZmemlevel; - mng_int32 iZstrategy; - - mng_uint32 iMaxIDAT; /* maximum size of IDAT data */ - - mng_bool bInflating; /* indicates "inflate" in progress */ - mng_bool bDeflating; /* indicates "deflate" in progress */ -#endif /* MNG_INCLUDE_ZLIB */ - -#ifdef MNG_INCLUDE_JNG - mngjpeg_dctmethod eJPEGdctmethod; /* IJG compression variables */ - mng_int32 iJPEGquality; - mng_int32 iJPEGsmoothing; - mng_bool bJPEGcompressprogr; - mng_bool bJPEGcompressopt; - - mng_uint32 iMaxJDAT; /* maximum size of JDAT/JDAA data */ - - mngjpeg_compp pJPEGcinfo; /* compression structure */ - mngjpeg_errorp pJPEGcerr; /* error-manager compress */ - - mngjpeg_decompp pJPEGdinfo; /* decompression structure (JDAT) */ - mngjpeg_errorp pJPEGderr; /* error-manager decompress (JDAT) */ - mngjpeg_sourcep pJPEGdsrc; /* source-manager decompress (JDAT) */ - - mngjpeg_decompp pJPEGdinfo2; /* decompression structure (JDAA) */ - mngjpeg_errorp pJPEGderr2; /* error-manager decompress (JDAA) */ - mngjpeg_sourcep pJPEGdsrc2; /* source-manager decompress (JDAA) */ - - mng_uint8p pJPEGbuf; /* buffer for JPEG (de)compression (JDAT) */ - mng_uint32 iJPEGbufmax; /* allocated space for buffer (JDAT) */ - mng_uint8p pJPEGcurrent; /* current pointer into buffer (JDAT) */ - mng_uint32 iJPEGbufremain; /* remaining bytes in buffer (JDAT) */ - mng_uint32 iJPEGtoskip; /* bytes to skip on next input-block (JDAT) */ - - mng_uint8p pJPEGbuf2; /* buffer for JPEG (de)compression (JDAA) */ - mng_uint32 iJPEGbufmax2; /* allocated space for buffer (JDAA) */ - mng_uint8p pJPEGcurrent2; /* current pointer into buffer (JDAA) */ - mng_uint32 iJPEGbufremain2; /* remaining bytes in buffer (JDAA) */ - mng_uint32 iJPEGtoskip2; /* bytes to skip on next input-block (JDAA) */ - - mng_uint8p pJPEGrow; /* buffer for a JPEG row of samples (JDAT) */ - mng_uint32 iJPEGrowlen; - - mng_uint8p pJPEGrow2; /* buffer for a JPEG row of samples (JDAA) */ - mng_uint32 iJPEGrowlen2; - - mng_bool bJPEGcompress; /* indicates "compress" initialized */ - - mng_bool bJPEGdecompress; /* indicates "decompress" initialized (JDAT) */ - mng_bool bJPEGhasheader; /* indicates "readheader" succeeded (JDAT) */ - mng_bool bJPEGdecostarted; /* indicates "decompress" started (JDAT) */ - mng_bool bJPEGscanstarted; /* indicates "first scan" started (JDAT) */ - mng_bool bJPEGscanending; /* indicates "finish_output" suspended (JDAT) */ - mng_bool bJPEGprogressive; /* indicates a progressive image (JDAT) */ - - mng_bool bJPEGdecompress2; /* indicates "decompress" initialized (JDAA) */ - mng_bool bJPEGhasheader2; /* indicates "readheader" succeeded (JDAA) */ - mng_bool bJPEGdecostarted2; /* indicates "decompress" started (JDAA) */ - mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */ - mng_bool bJPEGprogressive2; /* indicates a progressive image (JDAA) */ - - mng_fptr fStorerow2; /* internal callback to store an - uncompressed/unfiltered row of JPEG-data (JDAT) */ - - mng_fptr fStorerow3; /* internal callback to store an - uncompressed/unfiltered row of JPEG-data (JDAA) */ - - mng_uint32 iJPEGrow; /* row-number for current JPEG row */ - mng_uint32 iJPEGalpharow; /* nr. of rows filled with alpha */ - mng_uint32 iJPEGrgbrow; /* nr. of rows filled with 'color'-info */ - mng_uint32 iJPEGdisprow; /* nr. of rows already displayed "on-the-fly" */ - -#if defined(MNG_USE_SETJMP) && defined (MNG_INCLUDE_IJG6B) - jmp_buf sErrorbuf; /* setjmp/longjmp buffer (error-recovery) */ -#endif - -#endif /* MNG_INCLUDE_JNG */ - -#ifndef MNG_USE_ZLIB_CRC - mng_uint32 aCRCtable [256]; /* CRC prefab table */ - mng_bool bCRCcomputed; /* "has been built" indicator */ -#endif - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - png_imgtype ePng_imgtype; -#endif - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - mng_uint8 iPNGdepth; /* Real input depth */ - mng_uint8 iPNGmult; -#endif - -#ifdef MNG_OPTIMIZE_DISPLAYCALLS - mng_uint32 iRawlen; /* temp vars for display processing */ - mng_uint8p pRawdata; -#ifndef MNG_SKIPCHUNK_BASI - mng_uint16 iBASIred; - mng_uint16 iBASIgreen; - mng_uint16 iBASIblue; - mng_bool bBASIhasalpha; - mng_uint16 iBASIalpha; - mng_uint8 iBASIviewable; -#endif -#ifndef MNG_SKIPCHUNK_CLON - mng_uint16 iCLONsourceid; - mng_uint16 iCLONcloneid; - mng_uint8 iCLONclonetype; - mng_bool bCLONhasdonotshow; - mng_uint8 iCLONdonotshow; - mng_uint8 iCLONconcrete; - mng_bool bCLONhasloca; - mng_uint8 iCLONlocationtype; - mng_int32 iCLONlocationx; - mng_int32 iCLONlocationy; -#endif -#ifndef MNG_SKIPCHUNK_DISC - mng_uint32 iDISCcount; - mng_uint16p pDISCids; -#endif -#ifndef MNG_SKIPCHUNK_FRAM - mng_uint8 iTempFramemode; - mng_uint8 iTempChangedelay; - mng_uint32 iTempDelay; - mng_uint8 iTempChangetimeout; - mng_uint32 iTempTimeout; - mng_uint8 iTempChangeclipping; - mng_uint8 iTempCliptype; - mng_int32 iTempClipl; - mng_int32 iTempClipr; - mng_int32 iTempClipt; - mng_int32 iTempClipb; -#endif -#ifndef MNG_SKIPCHUNK_MOVE - mng_uint16 iMOVEfromid; - mng_uint16 iMOVEtoid; - mng_uint8 iMOVEmovetype; - mng_int32 iMOVEmovex; - mng_int32 iMOVEmovey; -#endif -#ifndef MNG_SKIPCHUNK_CLIP - mng_uint16 iCLIPfromid; - mng_uint16 iCLIPtoid; - mng_uint8 iCLIPcliptype; - mng_int32 iCLIPclipl; - mng_int32 iCLIPclipr; - mng_int32 iCLIPclipt; - mng_int32 iCLIPclipb; -#endif -#ifndef MNG_NO_DELTA_PNG - mng_uint16 iDHDRobjectid; - mng_uint8 iDHDRimagetype; - mng_uint8 iDHDRdeltatype; - mng_uint32 iDHDRblockwidth; - mng_uint32 iDHDRblockheight; - mng_uint32 iDHDRblockx; - mng_uint32 iDHDRblocky; - mng_uint8 iPROMbitdepth; - mng_uint8 iPROMcolortype; - mng_uint8 iPROMfilltype; - mng_uint8 iPPLTtype; - mng_uint32 iPPLTcount; - mng_palette8ep paPPLTindexentries; - mng_uint8p paPPLTalphaentries; - mng_uint8p paPPLTusedentries; -#endif -#ifndef MNG_SKIPCHUNK_MAGN - mng_uint16 iMAGNfirstid; - mng_uint16 iMAGNlastid; - mng_uint8 iMAGNmethodX; - mng_uint16 iMAGNmX; - mng_uint16 iMAGNmY; - mng_uint16 iMAGNmL; - mng_uint16 iMAGNmR; - mng_uint16 iMAGNmT; - mng_uint16 iMAGNmB; - mng_uint8 iMAGNmethodY; -#endif -#ifndef MNG_SKIPCHUNK_PAST - mng_uint16 iPASTtargetid; - mng_uint8 iPASTtargettype; - mng_int32 iPASTtargetx; - mng_int32 iPASTtargety; - mng_uint32 iPASTcount; - mng_ptr pPASTsources; -#endif -#endif /* MNG_OPTIMIZE_DISPLAYCALLS */ - - } mng_data; - -typedef mng_data * mng_datap; - -/* ************************************************************************** */ -/* * * */ -/* * Internal Callback-Function prototypes * */ -/* * * */ -/* ************************************************************************** */ - -typedef mng_retcode(*mng_displayrow) (mng_datap pData); -typedef mng_retcode(*mng_restbkgdrow) (mng_datap pData); -typedef mng_retcode(*mng_correctrow) (mng_datap pData); -typedef mng_retcode(*mng_retrieverow) (mng_datap pData); -typedef mng_retcode(*mng_storerow) (mng_datap pData); -typedef mng_retcode(*mng_processrow) (mng_datap pData); -typedef mng_retcode(*mng_initrowproc) (mng_datap pData); -typedef mng_retcode(*mng_differrow) (mng_datap pData); -typedef mng_retcode(*mng_scalerow) (mng_datap pData); -typedef mng_retcode(*mng_deltarow) (mng_datap pData); -typedef mng_retcode(*mng_promoterow) (mng_datap pData); -typedef mng_retcode(*mng_fliprow) (mng_datap pData); -typedef mng_retcode(*mng_tilerow) (mng_datap pData); - -typedef mng_uint8 (*mng_bitdepth_8) (mng_uint8 iB); -typedef mng_uint16 (*mng_bitdepth_16) (mng_uint8 iB); - -typedef mng_retcode(*mng_magnify_x) (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p iSrcline, - mng_uint8p iDstline); -typedef mng_retcode(*mng_magnify_y) (mng_datap pData, - mng_int32 iM, - mng_int32 iS, - mng_uint32 iWidth, - mng_uint8p iSrcline1, - mng_uint8p iSrcline2, - mng_uint8p iDstline); - -/* ************************************************************************** */ -/* * * */ -/* * Routines for swapping byte-order from and to graphic files * */ -/* * (This code is adapted from the libpng package) * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_BIGENDIAN_SUPPORTED -mng_uint32 mng_get_uint32 (mng_uint8p pBuf); -mng_int32 mng_get_int32 (mng_uint8p pBuf); -mng_uint16 mng_get_uint16 (mng_uint8p pBuf); -void mng_put_uint32 (mng_uint8p pBuf, - mng_uint32 i); -void mng_put_int32 (mng_uint8p pBuf, - mng_int32 i); -void mng_put_uint16 (mng_uint8p pBuf, - mng_uint16 i); -#else /* MNG_BIGENDIAN_SUPPORTED */ -#define mng_get_uint32(P) *(mng_uint32p)(P) -#define mng_get_int32(P) *(mng_int32p)(P) -#define mng_get_uint16(P) *(mng_uint16p)(P) -#define mng_put_uint32(P,I) *(mng_uint32p)(P) = (I) -#define mng_put_int32(P,I) *(mng_int32p)(P) = (I) -#define mng_put_uint16(P,I) *(mng_uint16p)(P) = (I) -#endif /* MNG_BIGENDIAN_SUPPORTED */ - -/* ************************************************************************** */ -/* * * */ -/* * Some handy(?) macro definitions * */ -/* * * */ -/* ************************************************************************** */ - -#define MAX_COORD(a, b) (((a) > (b)) ? (a) : (b)) -#define MIN_COORD(a, b) (((a) < (b)) ? (a) : (b)) - -/* ************************************************************************** */ - -#endif /* _libmng_data_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_display.c b/Engine/lib/lmng/libmng_display.c deleted file mode 100644 index adfb91d0e..000000000 --- a/Engine/lib/lmng/libmng_display.c +++ /dev/null @@ -1,7135 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_display.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Display management (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the display management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * - fixed frame_delay misalignment * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - added sanity check for frozen status * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - changed display_mend to reset state to initial or SAVE * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * - added process_save & process_seek routines * */ -/* * 0.5.1 - 05/14/2000 - G.Juyn * */ -/* * - added save_state and restore_state for SAVE/SEEK/TERM * */ -/* * processing * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG support (JHDR/JDAT) * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - fixed problem with DEFI clipping * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added delta-image support (DHDR,PROM,IPNG,IJNG) * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed pointer confusion (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/09/2000 - G.Juyn * */ -/* * - fixed timer-handling to run with Mozilla (Tim Rowley) * */ -/* * 0.5.2 - 06/10/2000 - G.Juyn * */ -/* * - fixed some compilation-warnings (contrib Jason Morris) * */ -/* * * */ -/* * 0.5.3 - 06/12/2000 - G.Juyn * */ -/* * - fixed display of stored JNG images * */ -/* * 0.5.3 - 06/13/2000 - G.Juyn * */ -/* * - fixed problem with BASI-IEND as object 0 * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed delta-image processing * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed some minor stuff * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added speed-modifier to timing routine * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for PPLT chunk processing * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - swapped refresh parameters * */ -/* * * */ -/* * 0.9.0 - 06/30/2000 - G.Juyn * */ -/* * - changed refresh parameters to 'x,y,width,height' * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - implemented support for freeze/reset/resume & go_xxxx * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added support for improved timing * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed EOF processing behavior * */ -/* * - fixed TERM delay processing * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - fixed freeze & reset processing * */ -/* * 0.9.1 - 07/16/2000 - G.Juyn * */ -/* * - fixed storage of images during mng_read() * */ -/* * - fixed support for mng_display() after mng_read() * */ -/* * 0.9.1 - 07/24/2000 - G.Juyn * */ -/* * - fixed reading of still-images * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/21/2000 - G.Juyn * */ -/* * - fixed TERM processing delay of 0 msecs * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed problem with no refresh after TERM * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 09/16/2000 - G.Juyn * */ -/* * - fixed timing & refresh behavior for single PNG/JNG * */ -/* * 0.9.3 - 09/19/2000 - G.Juyn * */ -/* * - refixed timing & refresh behavior for single PNG/JNG * */ -/* * 0.9.3 - 10/02/2000 - G.Juyn * */ -/* * - fixed timing again (this is getting boring...) * */ -/* * - refixed problem with no refresh after TERM * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - fixed delta-processing behavior * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - added storage for pixel-/alpha-sampledepth for delta's * */ -/* * 0.9.3 - 10/27/2000 - G.Juyn * */ -/* * - fixed separate read() & display() processing * */ -/* * * */ -/* * 0.9.4 - 10/31/2000 - G.Juyn * */ -/* * - fixed possible loop in display_resume() (Thanks Vova!) * */ -/* * 0.9.4 - 11/20/2000 - G.Juyn * */ -/* * - fixed unwanted repetition in mng_readdisplay() * */ -/* * 0.9.4 - 11/24/2000 - G.Juyn * */ -/* * - moved restore of object 0 to libmng_display * */ -/* * - added restore of object 0 to TERM processing !!! * */ -/* * - fixed TERM delay processing * */ -/* * - fixed TERM end processing (count = 0) * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * - set default level-set for filtertype=64 to all zeroes * */ -/* * * */ -/* * 0.9.5 - 1/20/2001 - G.Juyn * */ -/* * - fixed compiler-warnings Mozilla (thanks Tim) * */ -/* * 0.9.5 - 1/23/2001 - G.Juyn * */ -/* * - fixed timing-problem with switching framing_modes * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 02/13/2001 - G.Juyn * */ -/* * - fixed first FRAM_MODE=4 timing problem * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn * */ -/* * - fixed memory-leak for JNGs with alpha (Thanks Gregg!) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - fixed memory-leak with delta-images (Thanks Michael!) * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - fixed color-correction for restore-background handling * */ -/* * - optimized restore-background for bKGD cases * */ -/* * - cleaned up some old stuff * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - finished support for BACK image & tiling * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 10/05/2002 - G.Juyn * */ -/* * - fixed dropping mix of frozen/unfrozen objects * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added proposed change in handling of TERM- & if-delay * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * - completed support for condition=2 in TERM chunk * */ -/* * 1.0.5 - 10/18/2002 - G.Juyn * */ -/* * - fixed clipping-problem with BACK tiling (Thanks Sakura!) * */ -/* * 1.0.5 - 10/20/2002 - G.Juyn * */ -/* * - fixed processing for multiple objects in MAGN * */ -/* * - fixed display of visible target of PAST operation * */ -/* * 1.0.5 - 10/30/2002 - G.Juyn * */ -/* * - modified TERM/MEND processing for max(1, TERM_delay, * */ -/* * interframe_delay) * */ -/* * 1.0.5 - 11/04/2002 - G.Juyn * */ -/* * - fixed layer- & frame-counting during read() * */ -/* * - fixed goframe/golayer/gotime processing * */ -/* * 1.0.5 - 01/19/2003 - G.Juyn * */ -/* * - B654627 - fixed SEGV when no gettickcount callback * */ -/* * - B664383 - fixed typo * */ -/* * - finalized changes in TERM/final_delay to elected proposal* */ -/* * * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around some JNG-supporting code * */ -/* * - added conditionals around 16-bit supporting code * */ -/* * - reversed some loops to use decrementing counter * */ -/* * - combined init functions into one function * */ -/* * 1.0.6 - 07/10/2003 - G.R-P * */ -/* * - replaced nested switches with simple init setup function * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * * */ -/* * 1.0.8 - 03/31/2004 - G.Juyn * */ -/* * - fixed problem with PAST usage where source > dest * */ -/* * 1.0.8 - 05/04/2004 - G.R-P. * */ -/* * - fixed misplaced 16-bit conditionals * */ -/* * * */ -/* * 1.0.9 - 09/18/2004 - G.R-P. * */ -/* * - revised some SKIPCHUNK conditionals * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 07/06/2005 - G.R-P. * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * 1.0.10 - 12/28/2005 - G.R-P. * */ -/* * - added missing SKIPCHUNK_MAGN conditional * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - fixed several compiler warnings * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_chunks.h" -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_memory.h" -#include "libmng_zlib.h" -#include "libmng_jpeg.h" -#include "libmng_cms.h" -#include "libmng_pixels.h" -#include "libmng_display.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode set_delay (mng_datap pData, - mng_uint32 iInterval) -{ - if (!iInterval) /* at least 1 msec please! */ - iInterval = 1; - - if (pData->bRunning) /* only when really displaying */ - if (!pData->fSettimer ((mng_handle)pData, iInterval)) - MNG_ERROR (pData, MNG_APPTIMERERROR); - -#ifdef MNG_SUPPORT_DYNAMICMNG - if ((!pData->bDynamic) || (pData->bRunning)) -#else - if (pData->bRunning) -#endif - pData->bTimerset = MNG_TRUE; /* and indicate so */ - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_uint32 calculate_delay (mng_datap pData, - mng_uint32 iDelay) -{ - mng_uint32 iTicks = pData->iTicks; - mng_uint32 iWaitfor = 1; /* default non-MNG delay */ - - if (!iTicks) /* tick_count not specified ? */ - if (pData->eImagetype == mng_it_mng) - iTicks = 1000; - - if (iTicks) - { - switch (pData->iSpeed) /* honor speed modifier */ - { - case mng_st_fast : - { - iWaitfor = (mng_uint32)(( 500 * iDelay) / iTicks); - break; - } - case mng_st_slow : - { - iWaitfor = (mng_uint32)((3000 * iDelay) / iTicks); - break; - } - case mng_st_slowest : - { - iWaitfor = (mng_uint32)((8000 * iDelay) / iTicks); - break; - } - default : - { - iWaitfor = (mng_uint32)((1000 * iDelay) / iTicks); - } - } - } - - return iWaitfor; -} - -/* ************************************************************************** */ -/* * * */ -/* * Progressive display refresh - does the call to the refresh callback * */ -/* * and sets the timer to allow the app to perform the actual refresh to * */ -/* * the screen (eg. process its main message-loop) * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_refresh (mng_datap pData, - mng_uint32 iInterval) -{ - { /* let the app refresh first ? */ - if ((pData->bRunning) && (!pData->bSkipping) && - (pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright)) - { - if (!pData->fRefresh (((mng_handle)pData), - pData->iUpdateleft, pData->iUpdatetop, - pData->iUpdateright - pData->iUpdateleft, - pData->iUpdatebottom - pData->iUpdatetop)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iUpdateleft = 0; /* reset update-region */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; /* reset refreshneeded indicator */ - pData->bNeedrefresh = MNG_FALSE; - /* interval requested ? */ - if ((!pData->bFreezing) && (iInterval)) - { /* setup the timer */ - mng_retcode iRetcode = set_delay (pData, iInterval); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Generic display routines * */ -/* * * */ -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode interframe_delay (mng_datap pData) -{ - mng_uint32 iWaitfor = 0; - mng_uint32 iInterval; - mng_uint32 iRuninterval; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_START); -#endif - - { -#ifndef MNG_SKIPCHUNK_FRAM - if (pData->iFramedelay > 0) /* real delay ? */ - { /* let the app refresh first ? */ - if ((pData->bRunning) && (!pData->bSkipping) && - (pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright)) - if (!pData->fRefresh (((mng_handle)pData), - pData->iUpdateleft, pData->iUpdatetop, - pData->iUpdateright - pData->iUpdateleft, - pData->iUpdatebottom - pData->iUpdatetop)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iUpdateleft = 0; /* reset update-region */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; /* reset refreshneeded indicator */ - pData->bNeedrefresh = MNG_FALSE; - -#ifndef MNG_SKIPCHUNK_TERM - if (pData->bOnlyfirstframe) /* only processing first frame after TERM ? */ - { - pData->iFramesafterTERM++; - /* did we do a frame yet ? */ - if (pData->iFramesafterTERM > 1) - { /* then that's it; just stop right here ! */ - pData->pCurraniobj = MNG_NULL; - pData->bRunning = MNG_FALSE; - - return MNG_NOERROR; - } - } -#endif - - if (pData->fGettickcount) - { /* get current tickcount */ - pData->iRuntime = pData->fGettickcount ((mng_handle)pData); - /* calculate interval since last sync-point */ - if (pData->iRuntime < pData->iSynctime) - iRuninterval = pData->iRuntime + ~pData->iSynctime + 1; - else - iRuninterval = pData->iRuntime - pData->iSynctime; - /* calculate actual run-time */ - if (pData->iRuntime < pData->iStarttime) - pData->iRuntime = pData->iRuntime + ~pData->iStarttime + 1; - else - pData->iRuntime = pData->iRuntime - pData->iStarttime; - } - else - { - iRuninterval = 0; - } - - iWaitfor = calculate_delay (pData, pData->iFramedelay); - - if (iWaitfor > iRuninterval) /* delay necessary ? */ - iInterval = iWaitfor - iRuninterval; - else - iInterval = 1; /* force app to process messageloop */ - /* set the timer ? */ - if (((pData->bRunning) || (pData->bSearching) || (pData->bReading)) && - (!pData->bSkipping)) - { - iRetcode = set_delay (pData, iInterval); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - - if (!pData->bSkipping) /* increase frametime in advance */ - pData->iFrametime = pData->iFrametime + iWaitfor; - /* setup for next delay */ - pData->iFramedelay = pData->iNextdelay; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL void set_display_routine (mng_datap pData) -{ /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - switch (pData->iCanvasstyle) /* determine display routine */ - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb8; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGBA8 - case MNG_CANVAS_RGBA8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba8; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGBA8_PM - case MNG_CANVAS_RGBA8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_rgba8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_ARGB8 - case MNG_CANVAS_ARGB8 : { pData->fDisplayrow = (mng_fptr)mng_display_argb8; break; } -#endif -#ifndef MNG_SKIPCANVAS_ARGB8_PM - case MNG_CANVAS_ARGB8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_argb8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB8_A8 - case MNG_CANVAS_RGB8_A8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb8_a8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgrx8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRA8 - case MNG_CANVAS_BGRA8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRA8_PM - case MNG_CANVAS_BGRA8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_bgra8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_ABGR8 - case MNG_CANVAS_ABGR8 : { pData->fDisplayrow = (mng_fptr)mng_display_abgr8; break; } -#endif -#ifndef MNG_SKIPCANVAS_ABGR8_PM - case MNG_CANVAS_ABGR8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_abgr8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb565; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGBA565 - case MNG_CANVAS_RGBA565 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba565; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr565; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRA565 - case MNG_CANVAS_BGRA565 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra565; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR565_A8 - case MNG_CANVAS_BGR565_A8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr565_a8; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB555 - case MNG_CANVAS_RGB555 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb555; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR555 - case MNG_CANVAS_BGR555 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr555; break; } -#endif - -#ifndef MNG_NO_16BIT_SUPPORT -/* case MNG_CANVAS_RGB16 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb16; break; } */ -/* case MNG_CANVAS_RGBA16 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba16; break; } */ -/* case MNG_CANVAS_ARGB16 : { pData->fDisplayrow = (mng_fptr)mng_display_argb16; break; } */ -/* case MNG_CANVAS_BGR16 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr16; break; } */ -/* case MNG_CANVAS_BGRA16 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra16; break; } */ -/* case MNG_CANVAS_ABGR16 : { pData->fDisplayrow = (mng_fptr)mng_display_abgr16; break; } */ -#endif -/* case MNG_CANVAS_INDEX8 : { pData->fDisplayrow = (mng_fptr)mng_display_index8; break; } */ -/* case MNG_CANVAS_INDEXA8 : { pData->fDisplayrow = (mng_fptr)mng_display_indexa8; break; } */ -/* case MNG_CANVAS_AINDEX8 : { pData->fDisplayrow = (mng_fptr)mng_display_aindex8; break; } */ -/* case MNG_CANVAS_GRAY8 : { pData->fDisplayrow = (mng_fptr)mng_display_gray8; break; } */ -/* case MNG_CANVAS_AGRAY8 : { pData->fDisplayrow = (mng_fptr)mng_display_agray8; break; } */ -/* case MNG_CANVAS_GRAYA8 : { pData->fDisplayrow = (mng_fptr)mng_display_graya8; break; } */ -#ifndef MNG_NO_16BIT_SUPPORT -/* case MNG_CANVAS_GRAY16 : { pData->fDisplayrow = (mng_fptr)mng_display_gray16; break; } */ -/* case MNG_CANVAS_GRAYA16 : { pData->fDisplayrow = (mng_fptr)mng_display_graya16; break; } */ -/* case MNG_CANVAS_AGRAY16 : { pData->fDisplayrow = (mng_fptr)mng_display_agray16; break; } */ -#endif -/* case MNG_CANVAS_DX15 : { pData->fDisplayrow = (mng_fptr)mng_display_dx15; break; } */ -/* case MNG_CANVAS_DX16 : { pData->fDisplayrow = (mng_fptr)mng_display_dx16; break; } */ - } - } - - return; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode load_bkgdlayer (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_START); -#endif - /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - mng_int32 iY; - mng_retcode iRetcode; - mng_bool bColorcorr = MNG_FALSE; - /* save values */ - mng_int32 iDestl = pData->iDestl; - mng_int32 iDestr = pData->iDestr; - mng_int32 iDestt = pData->iDestt; - mng_int32 iDestb = pData->iDestb; - mng_int32 iSourcel = pData->iSourcel; - mng_int32 iSourcer = pData->iSourcer; - mng_int32 iSourcet = pData->iSourcet; - mng_int32 iSourceb = pData->iSourceb; - mng_int8 iPass = pData->iPass; - mng_int32 iRow = pData->iRow; - mng_int32 iRowinc = pData->iRowinc; - mng_int32 iCol = pData->iCol; - mng_int32 iColinc = pData->iColinc; - mng_int32 iRowsamples = pData->iRowsamples; - mng_int32 iRowsize = pData->iRowsize; - mng_uint8p pPrevrow = pData->pPrevrow; - mng_uint8p pRGBArow = pData->pRGBArow; - mng_bool bIsRGBA16 = pData->bIsRGBA16; - mng_bool bIsOpaque = pData->bIsOpaque; - mng_fptr fCorrectrow = pData->fCorrectrow; - mng_fptr fDisplayrow = pData->fDisplayrow; - mng_fptr fRetrieverow = pData->fRetrieverow; - mng_objectp pCurrentobj = pData->pCurrentobj; - mng_objectp pRetrieveobj = pData->pRetrieveobj; - - pData->iDestl = 0; /* determine clipping region */ - pData->iDestt = 0; - pData->iDestr = pData->iWidth; - pData->iDestb = pData->iHeight; - -#ifndef MNG_SKIPCHUNK_FRAM - if (pData->bFrameclipping) /* frame clipping specified ? */ - { - pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl); - pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt); - pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb); - } -#endif - /* anything to clear ? */ - if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt)) - { - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */ - pData->bIsOpaque = MNG_TRUE; - - pData->iSourcel = 0; /* source relative to destination */ - pData->iSourcer = pData->iDestr - pData->iDestl; - pData->iSourcet = 0; - pData->iSourceb = pData->iDestb - pData->iDestt; - - set_display_routine (pData); /* determine display routine */ - /* default restore using preset BG color */ - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgcolor; - -#ifndef MNG_SKIPCHUNK_bKGD - if (((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng)) && - (pData->bUseBKGD)) - { /* prefer bKGD in PNG/JNG */ - if (!pData->pCurrentobj) - pData->pCurrentobj = pData->pObjzero; - - if (((mng_imagep)pData->pCurrentobj)->pImgbuf->bHasBKGD) - { - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bkgd; - bColorcorr = MNG_TRUE; - } - } -#endif - - if (pData->fGetbkgdline) /* background-canvas-access callback set ? */ - { - switch (pData->iBkgdstyle) - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgrx8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr565; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb565; break; } -#endif -#ifndef MNG_NO_16BIT_SUPPORT - /* case MNG_CANVAS_RGB16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb16; break; } */ - /* case MNG_CANVAS_BGR16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr16; break; } */ -#endif - /* case MNG_CANVAS_INDEX8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_index8; break; } */ - /* case MNG_CANVAS_GRAY8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_gray8; break; } */ -#ifndef MNG_NO_16BIT_SUPPORT - /* case MNG_CANVAS_GRAY16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_gray16; break; } */ -#endif - /* case MNG_CANVAS_DX15 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_dx15; break; } */ - /* case MNG_CANVAS_DX16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_dx16; break; } */ - } - } - -#ifndef MNG_SKIPCHUNK_BACK - if (pData->bHasBACK) - { /* background image ? */ - if ((pData->iBACKmandatory & 0x02) && (pData->iBACKimageid)) - { - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_backcolor; - bColorcorr = MNG_TRUE; - } - else /* background color ? */ - if (pData->iBACKmandatory & 0x01) - { - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_backcolor; - bColorcorr = MNG_TRUE; - } - } -#endif - - pData->fCorrectrow = MNG_NULL; /* default no color-correction */ - - if (bColorcorr) /* do we have to do color-correction ? */ - { -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - } - /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iDestt; /* this is where we start */ - iRetcode = MNG_NOERROR; /* so far, so good */ - - while ((!iRetcode) && (iY < pData->iDestb)) - { /* restore a background row */ - iRetcode = ((mng_restbkgdrow)pData->fRestbkgdrow) (pData); - /* color correction ? */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* so... display it */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - if (bColorcorr) /* did we do color-correction ? */ - { - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif -#ifndef MNG_SKIPCHUNK_BACK - /* background image ? */ - if ((pData->bHasBACK) && (pData->iBACKmandatory & 0x02) && (pData->iBACKimageid)) - { - mng_imagep pImage; - /* let's find that object then */ - pData->pRetrieveobj = mng_find_imageobject (pData, pData->iBACKimageid); - pImage = (mng_imagep)pData->pRetrieveobj; - /* exists, viewable and visible ? */ - if ((pImage) && (pImage->bViewable) && (pImage->bVisible)) - { /* will it fall within the target region ? */ - if ((pImage->iPosx < pData->iDestr) && (pImage->iPosy < pData->iDestb) && - ((pData->iBACKtile) || - ((pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth >= pData->iDestl) && - (pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight >= pData->iDestt) )) && - ((!pImage->bClipped) || - ((pImage->iClipl <= pImage->iClipr) && (pImage->iClipt <= pImage->iClipb) && - (pImage->iClipl < pData->iDestr) && (pImage->iClipr >= pData->iDestl) && - (pImage->iClipt < pData->iDestb) && (pImage->iClipb >= pData->iDestt) ))) - { /* right; we've got ourselves something to do */ - if (pImage->bClipped) /* clip output region with image's clipping region ? */ - { - if (pImage->iClipl > pData->iDestl) - pData->iDestl = pImage->iClipl; - if (pImage->iClipr < pData->iDestr) - pData->iDestr = pImage->iClipr; - if (pImage->iClipt > pData->iDestt) - pData->iDestt = pImage->iClipt; - if (pImage->iClipb < pData->iDestb) - pData->iDestb = pImage->iClipb; - } - /* image offset does some extra clipping too ! */ - if (pImage->iPosx > pData->iDestl) - pData->iDestl = pImage->iPosx; - if (pImage->iPosy > pData->iDestt) - pData->iDestt = pImage->iPosy; - - if (!pData->iBACKtile) /* without tiling further clipping is needed */ - { - if (pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth < pData->iDestr) - pData->iDestr = pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth; - if (pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight < pData->iDestb) - pData->iDestb = pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight; - } - - pData->iSourcel = 0; /* source relative to destination */ - pData->iSourcer = pData->iDestr - pData->iDestl; - pData->iSourcet = 0; - pData->iSourceb = pData->iDestb - pData->iDestt; - /* 16-bit background ? */ - -#ifdef MNG_NO_16BIT_SUPPORT - pData->bIsRGBA16 = MNG_FALSE; -#else - pData->bIsRGBA16 = (mng_bool)(pImage->pImgbuf->iBitdepth > 8); -#endif - /* let restore routine know the offsets !!! */ - pData->iBackimgoffsx = pImage->iPosx; - pData->iBackimgoffsy = pImage->iPosy; - pData->iBackimgwidth = pImage->pImgbuf->iWidth; - pData->iBackimgheight = pImage->pImgbuf->iHeight; - pData->iRow = 0; /* start at the top again !! */ - /* determine background object retrieval routine */ - switch (pImage->pImgbuf->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8; - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - } - -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - /* get temporary row-buffers */ - MNG_ALLOC (pData, pData->pPrevrow, pData->iRowsize); - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iDestt; /* this is where we start */ - iRetcode = MNG_NOERROR; /* so far, so good */ - - while ((!iRetcode) && (iY < pData->iDestb)) - { /* restore a background row */ - iRetcode = mng_restore_bkgd_backimage (pData); - /* color correction ? */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* so... display it */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop temporary row-buffers */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - MNG_FREE (pData, pData->pPrevrow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - } - } -#endif - } - - pData->iDestl = iDestl; /* restore values */ - pData->iDestr = iDestr; - pData->iDestt = iDestt; - pData->iDestb = iDestb; - pData->iSourcel = iSourcel; - pData->iSourcer = iSourcer; - pData->iSourcet = iSourcet; - pData->iSourceb = iSourceb; - pData->iPass = iPass; - pData->iRow = iRow; - pData->iRowinc = iRowinc; - pData->iCol = iCol; - pData->iColinc = iColinc; - pData->iRowsamples = iRowsamples; - pData->iRowsize = iRowsize; - pData->pPrevrow = pPrevrow; - pData->pRGBArow = pRGBArow; - pData->bIsRGBA16 = bIsRGBA16; - pData->bIsOpaque = bIsOpaque; - pData->fCorrectrow = fCorrectrow; - pData->fDisplayrow = fDisplayrow; - pData->fRetrieverow = fRetrieverow; - pData->pCurrentobj = pCurrentobj; - pData->pRetrieveobj = pRetrieveobj; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode clear_canvas (mng_datap pData) -{ - mng_int32 iY; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_START); -#endif - - pData->iDestl = 0; /* clipping region is full canvas! */ - pData->iDestt = 0; - pData->iDestr = pData->iWidth; - pData->iDestb = pData->iHeight; - - pData->iSourcel = 0; /* source is same as destination */ - pData->iSourcer = pData->iWidth; - pData->iSourcet = 0; - pData->iSourceb = pData->iHeight; - - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */ - pData->bIsOpaque = MNG_TRUE; - - set_display_routine (pData); /* determine display routine */ - /* get a temporary row-buffer */ - /* it's transparent black by default!! */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iDestt; /* this is where we start */ - iRetcode = MNG_NOERROR; /* so far, so good */ - - while ((!iRetcode) && (iY < pData->iDestb)) - { /* clear a row then */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) - iRetcode = mng_next_row (pData); /* adjust variables for next row */ - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode next_frame (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_START); -#endif - - if (!pData->iBreakpoint) /* no previous break here ? */ - { -#ifndef MNG_SKIPCHUNK_FRAM - mng_uint8 iOldmode = pData->iFramemode; - /* interframe delay required ? */ - if ((iOldmode == 2) || (iOldmode == 4)) - { - if ((pData->iFrameseq) && (iFramemode != 1) && (iFramemode != 3)) - iRetcode = interframe_delay (pData); - else - pData->iFramedelay = pData->iNextdelay; - } - else - { /* delay before inserting background layer? */ - if ((pData->bFramedone) && (iFramemode == 4)) - iRetcode = interframe_delay (pData); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* now we'll assume we're in the next frame! */ - if (iFramemode) /* save the new framing mode ? */ - { - pData->iFRAMmode = iFramemode; - pData->iFramemode = iFramemode; - } - else /* reload default */ - pData->iFramemode = pData->iFRAMmode; - - if (iChangedelay) /* delay changed ? */ - { - pData->iNextdelay = iDelay; /* for *after* next subframe */ - - if ((iOldmode == 2) || (iOldmode == 4)) - pData->iFramedelay = pData->iFRAMdelay; - - if (iChangedelay == 2) /* also overall ? */ - pData->iFRAMdelay = iDelay; - } - else - { /* reload default */ - pData->iNextdelay = pData->iFRAMdelay; - } - - if (iChangetimeout) /* timeout changed ? */ - { /* for next subframe */ - pData->iFrametimeout = iTimeout; - - if ((iChangetimeout == 2) || /* also overall ? */ - (iChangetimeout == 4) || - (iChangetimeout == 6) || - (iChangetimeout == 8)) - pData->iFRAMtimeout = iTimeout; - } - else /* reload default */ - pData->iFrametimeout = pData->iFRAMtimeout; - - if (iChangeclipping) /* clipping changed ? */ - { - pData->bFrameclipping = MNG_TRUE; - - if (!iCliptype) /* absolute ? */ - { - pData->iFrameclipl = iClipl; - pData->iFrameclipr = iClipr; - pData->iFrameclipt = iClipt; - pData->iFrameclipb = iClipb; - } - else /* relative */ - { - pData->iFrameclipl = pData->iFrameclipl + iClipl; - pData->iFrameclipr = pData->iFrameclipr + iClipr; - pData->iFrameclipt = pData->iFrameclipt + iClipt; - pData->iFrameclipb = pData->iFrameclipb + iClipb; - } - - if (iChangeclipping == 2) /* also overall ? */ - { - pData->bFRAMclipping = MNG_TRUE; - - if (!iCliptype) /* absolute ? */ - { - pData->iFRAMclipl = iClipl; - pData->iFRAMclipr = iClipr; - pData->iFRAMclipt = iClipt; - pData->iFRAMclipb = iClipb; - } - else /* relative */ - { - pData->iFRAMclipl = pData->iFRAMclipl + iClipl; - pData->iFRAMclipr = pData->iFRAMclipr + iClipr; - pData->iFRAMclipt = pData->iFRAMclipt + iClipt; - pData->iFRAMclipb = pData->iFRAMclipb + iClipb; - } - } - } - else - { /* reload defaults */ - pData->bFrameclipping = pData->bFRAMclipping; - pData->iFrameclipl = pData->iFRAMclipl; - pData->iFrameclipr = pData->iFRAMclipr; - pData->iFrameclipt = pData->iFRAMclipt; - pData->iFrameclipb = pData->iFRAMclipb; - } -#endif - } - - if (!pData->bTimerset) /* timer still off ? */ - { - if ( -#ifndef MNG_SKIPCHUNK_FRAM - (pData->iFramemode == 4) || /* insert background layer after a new frame */ -#endif - (!pData->iLayerseq)) /* and certainly before the very first layer */ - iRetcode = load_bkgdlayer (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->iFrameseq++; /* count the frame ! */ - pData->bFramedone = MNG_TRUE; /* and indicate we've done one */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode next_layer (mng_datap pData) -{ - mng_imagep pImage; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - if (!pData->iBreakpoint) /* no previous break here ? */ - { /* interframe delay required ? */ - if ((pData->eImagetype == mng_it_mng) && (pData->iLayerseq) && - ((pData->iFramemode == 1) || (pData->iFramemode == 3))) - iRetcode = interframe_delay (pData); - else - pData->iFramedelay = pData->iNextdelay; - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - - if (!pData->bTimerset) /* timer still off ? */ - { - if (!pData->iLayerseq) /* restore background for the very first layer ? */ - { /* wait till IDAT/JDAT for PNGs & JNGs !!! */ - if ((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng)) - pData->bRestorebkgd = MNG_TRUE; - else - { /* for MNG we do it right away */ - iRetcode = load_bkgdlayer (pData); - pData->iLayerseq++; /* and it counts as a layer then ! */ - } - } -#ifndef MNG_SKIPCHUNK_FRAM - else - if (pData->iFramemode == 3) /* restore background for each layer ? */ - iRetcode = load_bkgdlayer (pData); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing a delta-image ? */ - pImage = (mng_imagep)pData->pDeltaImage; - else -#endif - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* not an active object ? */ - pImage = (mng_imagep)pData->pObjzero; - /* determine display rectangle */ - pData->iDestl = MAX_COORD ((mng_int32)0, pImage->iPosx); - pData->iDestt = MAX_COORD ((mng_int32)0, pImage->iPosy); - /* is it a valid buffer ? */ - if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight)) - { - pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth, - pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth ); - pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight, - pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight); - } - else /* it's a single image ! */ - { - pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth, - (mng_int32)pData->iDatawidth ); - pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight, - (mng_int32)pData->iDataheight); - } - -#ifndef MNG_SKIPCHUNK_FRAM - if (pData->bFrameclipping) /* frame clipping specified ? */ - { - pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl); - pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt); - pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb); - } -#endif - - if (pImage->bClipped) /* is the image clipped itself ? */ - { - pData->iDestl = MAX_COORD (pData->iDestl, pImage->iClipl); - pData->iDestt = MAX_COORD (pData->iDestt, pImage->iClipt); - pData->iDestr = MIN_COORD (pData->iDestr, pImage->iClipr); - pData->iDestb = MIN_COORD (pData->iDestb, pImage->iClipb); - } - /* determine source starting point */ - pData->iSourcel = MAX_COORD ((mng_int32)0, pData->iDestl - pImage->iPosx); - pData->iSourcet = MAX_COORD ((mng_int32)0, pData->iDestt - pImage->iPosy); - - if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight)) - { /* and maximum size */ - pData->iSourcer = MIN_COORD ((mng_int32)pImage->pImgbuf->iWidth, - pData->iSourcel + pData->iDestr - pData->iDestl); - pData->iSourceb = MIN_COORD ((mng_int32)pImage->pImgbuf->iHeight, - pData->iSourcet + pData->iDestb - pData->iDestt); - } - else /* it's a single image ! */ - { - pData->iSourcer = pData->iSourcel + pData->iDestr - pData->iDestl; - pData->iSourceb = pData->iSourcet + pData->iDestb - pData->iDestt; - } - - pData->iLayerseq++; /* count the layer ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_display_image (mng_datap pData, - mng_imagep pImage, - mng_bool bLayeradvanced) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_START); -#endif - /* actively running ? */ -#ifndef MNG_SKIPCHUNK_MAGN - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - if ( (!pData->iBreakpoint) && /* needs magnification ? */ - ( (pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY) ) ) - { - iRetcode = mng_magnify_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif - - pData->pRetrieveobj = pImage; /* so retrieve-row and color-correction can find it */ - - if (!bLayeradvanced) /* need to advance the layer ? */ - { - mng_imagep pSave = pData->pCurrentobj; - pData->pCurrentobj = pImage; - next_layer (pData); /* advance to next layer */ - pData->pCurrentobj = pSave; - } - /* need to restore the background ? */ - if ((!pData->bTimerset) && (pData->bRestorebkgd)) - { - mng_imagep pSave = pData->pCurrentobj; - pData->pCurrentobj = pImage; - pData->bRestorebkgd = MNG_FALSE; - iRetcode = load_bkgdlayer (pData); - pData->pCurrentobj = pSave; - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->iLayerseq++; /* and it counts as a layer then ! */ - } - /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - if (!pData->bTimerset) /* all systems still go ? */ - { - pData->iBreakpoint = 0; /* let's make absolutely sure... */ - /* anything to display ? */ - if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt)) - { - mng_int32 iY; - - set_display_routine (pData); /* determine display routine */ - /* and image-buffer retrieval routine */ - switch (pImage->pImgbuf->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - - case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8; - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - } - - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = pData->iSourcet; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pImage->pImgbuf->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->bIsRGBA16 = MNG_FALSE; - /* adjust for 16-bit object ? */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - { - pData->bIsRGBA16 = MNG_TRUE; - pData->iRowsize = pData->iRowsamples << 3; - } -#endif - - pData->fCorrectrow = MNG_NULL; /* default no color-correction */ - -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iSourcet; /* this is where we start */ - - while ((!iRetcode) && (iY < pData->iSourceb)) - { /* get a row */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* color correction ? */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* so... display it */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* whehehe, this is good ! */ -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_execute_delta_image (mng_datap pData, - mng_imagep pTarget, - mng_imagep pDelta) -{ - mng_imagedatap pBuftarget = pTarget->pImgbuf; - mng_imagedatap pBufdelta = pDelta->pImgbuf; - mng_uint32 iY; - mng_retcode iRetcode; - mng_ptr pSaveRGBA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_START); -#endif - /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - if (pBufdelta->bHasPLTE) /* palette in delta ? */ - { - mng_uint32 iX; - /* new palette larger than old one ? */ - if ((!pBuftarget->bHasPLTE) || (pBuftarget->iPLTEcount < pBufdelta->iPLTEcount)) - pBuftarget->iPLTEcount = pBufdelta->iPLTEcount; - /* it's definitely got a PLTE now */ - pBuftarget->bHasPLTE = MNG_TRUE; - - for (iX = 0; iX < pBufdelta->iPLTEcount; iX++) - { - pBuftarget->aPLTEentries[iX].iRed = pBufdelta->aPLTEentries[iX].iRed; - pBuftarget->aPLTEentries[iX].iGreen = pBufdelta->aPLTEentries[iX].iGreen; - pBuftarget->aPLTEentries[iX].iBlue = pBufdelta->aPLTEentries[iX].iBlue; - } - } - - if (pBufdelta->bHasTRNS) /* cheap transparency in delta ? */ - { - switch (pData->iColortype) /* drop it into the target */ - { - case 0: { /* gray */ - pBuftarget->iTRNSgray = pBufdelta->iTRNSgray; - pBuftarget->iTRNSred = 0; - pBuftarget->iTRNSgreen = 0; - pBuftarget->iTRNSblue = 0; - pBuftarget->iTRNScount = 0; - break; - } - case 2: { /* rgb */ - pBuftarget->iTRNSgray = 0; - pBuftarget->iTRNSred = pBufdelta->iTRNSred; - pBuftarget->iTRNSgreen = pBufdelta->iTRNSgreen; - pBuftarget->iTRNSblue = pBufdelta->iTRNSblue; - pBuftarget->iTRNScount = 0; - break; - } - case 3: { /* indexed */ - pBuftarget->iTRNSgray = 0; - pBuftarget->iTRNSred = 0; - pBuftarget->iTRNSgreen = 0; - pBuftarget->iTRNSblue = 0; - /* existing range smaller than new one ? */ - if ((!pBuftarget->bHasTRNS) || (pBuftarget->iTRNScount < pBufdelta->iTRNScount)) - pBuftarget->iTRNScount = pBufdelta->iTRNScount; - - MNG_COPY (pBuftarget->aTRNSentries, pBufdelta->aTRNSentries, pBufdelta->iTRNScount); - break; - } - } - - pBuftarget->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */ - } - -#ifndef MNG_SKIPCHUNK_bKGD - if (pBufdelta->bHasBKGD) /* bkgd in source ? */ - { /* drop it onto the target */ - pBuftarget->bHasBKGD = MNG_TRUE; - pBuftarget->iBKGDindex = pBufdelta->iBKGDindex; - pBuftarget->iBKGDgray = pBufdelta->iBKGDgray; - pBuftarget->iBKGDred = pBufdelta->iBKGDred; - pBuftarget->iBKGDgreen = pBufdelta->iBKGDgreen; - pBuftarget->iBKGDblue = pBufdelta->iBKGDblue; - } -#endif - - if (pBufdelta->bHasGAMA) /* gamma in source ? */ - { - pBuftarget->bHasGAMA = MNG_TRUE; /* drop it onto the target */ - pBuftarget->iGamma = pBufdelta->iGamma; - } - -#ifndef MNG_SKIPCHUNK_cHRM - if (pBufdelta->bHasCHRM) /* chroma in delta ? */ - { /* drop it onto the target */ - pBuftarget->bHasCHRM = MNG_TRUE; - pBuftarget->iWhitepointx = pBufdelta->iWhitepointx; - pBuftarget->iWhitepointy = pBufdelta->iWhitepointy; - pBuftarget->iPrimaryredx = pBufdelta->iPrimaryredx; - pBuftarget->iPrimaryredy = pBufdelta->iPrimaryredy; - pBuftarget->iPrimarygreenx = pBufdelta->iPrimarygreenx; - pBuftarget->iPrimarygreeny = pBufdelta->iPrimarygreeny; - pBuftarget->iPrimarybluex = pBufdelta->iPrimarybluex; - pBuftarget->iPrimarybluey = pBufdelta->iPrimarybluey; - } -#endif - -#ifndef MNG_SKIPCHUNK_sRGB - if (pBufdelta->bHasSRGB) /* sRGB in delta ? */ - { /* drop it onto the target */ - pBuftarget->bHasSRGB = MNG_TRUE; - pBuftarget->iRenderingintent = pBufdelta->iRenderingintent; - } -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBufdelta->bHasICCP) /* ICC profile in delta ? */ - { - pBuftarget->bHasICCP = MNG_TRUE; /* drop it onto the target */ - - if (pBuftarget->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pBuftarget->pProfile, pBuftarget->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pBuftarget->pProfile, pBufdelta->iProfilesize); - MNG_COPY (pBuftarget->pProfile, pBufdelta->pProfile, pBufdelta->iProfilesize); - /* store its length as well */ - pBuftarget->iProfilesize = pBufdelta->iProfilesize; - } -#endif - /* need to execute delta pixels ? */ - if ((!pData->bDeltaimmediate) && (pData->iDeltatype != MNG_DELTATYPE_NOCHANGE)) - { - pData->fScalerow = MNG_NULL; /* not needed by default */ - - switch (pBufdelta->iBitdepth) /* determine scaling routine */ - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - switch (pBuftarget->iBitdepth) - { - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g2; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g4; break; } - - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g16; break; } -#endif - } - break; - } - - case 2 : { - switch (pBuftarget->iBitdepth) - { - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g1; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g4; break; } - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g16; break; } -#endif - } - break; - } - - case 4 : { - switch (pBuftarget->iBitdepth) - { - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g1; break; } - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g2; break; } - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g16; break; } -#endif - } - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - - case 8 : { - switch (pBufdelta->iColortype) - { - case 0 : ; - case 3 : ; - case 8 : { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g1; break; } - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g2; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g16; break; } -#endif - } - break; - } - case 2 : ; - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuftarget->iBitdepth == 16) - pData->fScalerow = (mng_fptr)mng_scale_rgb8_rgb16; -#endif - break; - } - case 4 : ; - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuftarget->iBitdepth == 16) - pData->fScalerow = (mng_fptr)mng_scale_ga8_ga16; -#endif - break; - } - case 6 : ; - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuftarget->iBitdepth == 16) - pData->fScalerow = (mng_fptr)mng_scale_rgba8_rgba16; -#endif - break; - } - } - break; - } - -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - switch (pBufdelta->iColortype) - { - case 0 : ; - case 3 : ; - case 8 : { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g1; break; } - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g2; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g8; break; } - } - break; - } - case 2 : ; - case 10 : { - if (pBuftarget->iBitdepth == 8) - pData->fScalerow = (mng_fptr)mng_scale_rgb16_rgb8; - break; - } - case 4 : ; - case 12 : { - if (pBuftarget->iBitdepth == 8) - pData->fScalerow = (mng_fptr)mng_scale_ga16_ga8; - break; - } - case 6 : ; - case 14 : { - if (pBuftarget->iBitdepth == 8) - pData->fScalerow = (mng_fptr)mng_scale_rgba16_rgba8; - break; - } - } - break; - } -#endif - - } - - pData->fDeltarow = MNG_NULL; /* let's assume there's nothing to do */ - - switch (pBuftarget->iColortype) /* determine delta processing routine */ - { - case 0 : ; - case 8 : { /* gray */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) || - (pBufdelta->iColortype == 8)) - { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fDeltarow = (mng_fptr)mng_delta_g1_g1; break; } - case 2 : { pData->fDeltarow = (mng_fptr)mng_delta_g2_g2; break; } - case 4 : { pData->fDeltarow = (mng_fptr)mng_delta_g4_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_g8_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_g16_g16; break; } -#endif - } - } - } - - break; - } - - case 2 : ; - case 10 : { /* rgb */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgb8_rgb8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgb16_rgb16; break; } -#endif - } - } - } - - break; - } - - case 3 : { /* indexed; abuse gray routines */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3)) - { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fDeltarow = (mng_fptr)mng_delta_g1_g1; break; } - case 2 : { pData->fDeltarow = (mng_fptr)mng_delta_g2_g2; break; } - case 4 : { pData->fDeltarow = (mng_fptr)mng_delta_g4_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_g8_g8; break; } - } - } - } - - break; - } - - case 4 : ; - case 12 : { /* gray + alpha */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 4) || (pBufdelta->iColortype == 12)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_ga8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_ga16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) || - (pBufdelta->iColortype == 8)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_g16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_a16; break; } -#endif - } - } - } - - break; - } - - case 6 : ; - case 14 : { /* rgb + alpha */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 6) || (pBufdelta->iColortype == 14)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgba8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgba16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - { - if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgb8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgb16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_a16; break; } -#endif - } - } - } - - break; - } - - } - - if (pData->fDeltarow) /* do we need to take action ? */ - { - pData->iPass = -1; /* setup row dimensions and stuff */ - pData->iRow = pData->iDeltaBlocky; - pData->iRowinc = 1; - pData->iCol = pData->iDeltaBlockx; - pData->iColinc = 1; - pData->iRowsamples = pBufdelta->iWidth; - pData->iRowsize = pBuftarget->iRowsize; - /* indicate where to retrieve & where to store */ - pData->pRetrieveobj = (mng_objectp)pDelta; - pData->pStoreobj = (mng_objectp)pTarget; - - pSaveRGBA = pData->pRGBArow; /* save current temp-buffer! */ - /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, (pBufdelta->iRowsize << 1)); - - iY = 0; /* this is where we start */ - iRetcode = MNG_NOERROR; /* still oke for now */ - - while ((!iRetcode) && (iY < pBufdelta->iHeight)) - { /* get a row */ - mng_uint8p pWork = pBufdelta->pImgdata + (iY * pBufdelta->iRowsize); - - MNG_COPY (pData->pRGBArow, pWork, pBufdelta->iRowsize); - - if (pData->fScalerow) /* scale it (if necessary) */ - iRetcode = ((mng_scalerow)pData->fScalerow) (pData); - - if (!iRetcode) /* and... execute it */ - iRetcode = ((mng_deltarow)pData->fDeltarow) (pData); - - if (!iRetcode) /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, (pBufdelta->iRowsize << 1)); - pData->pRGBArow = pSaveRGBA; /* restore saved temp-buffer! */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - else - MNG_ERROR (pData, MNG_INVALIDDELTA); - - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_retcode save_state (mng_datap pData) -{ - mng_savedatap pSave; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_START); -#endif - - if (pData->pSavedata) /* sanity check */ - MNG_ERROR (pData, MNG_INTERNALERROR); - /* get a buffer for saving */ - MNG_ALLOC (pData, pData->pSavedata, sizeof (mng_savedata)); - - pSave = pData->pSavedata; /* address it more directly */ - /* and copy global data from the main struct */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - pSave->bHasglobalPLTE = pData->bHasglobalPLTE; - pSave->bHasglobalTRNS = pData->bHasglobalTRNS; - pSave->bHasglobalGAMA = pData->bHasglobalGAMA; - pSave->bHasglobalCHRM = pData->bHasglobalCHRM; - pSave->bHasglobalSRGB = pData->bHasglobalSRGB; - pSave->bHasglobalICCP = pData->bHasglobalICCP; - pSave->bHasglobalBKGD = pData->bHasglobalBKGD; -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifndef MNG_SKIPCHUNK_BACK - pSave->iBACKred = pData->iBACKred; - pSave->iBACKgreen = pData->iBACKgreen; - pSave->iBACKblue = pData->iBACKblue; - pSave->iBACKmandatory = pData->iBACKmandatory; - pSave->iBACKimageid = pData->iBACKimageid; - pSave->iBACKtile = pData->iBACKtile; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pSave->iFRAMmode = pData->iFRAMmode; - pSave->iFRAMdelay = pData->iFRAMdelay; - pSave->iFRAMtimeout = pData->iFRAMtimeout; - pSave->bFRAMclipping = pData->bFRAMclipping; - pSave->iFRAMclipl = pData->iFRAMclipl; - pSave->iFRAMclipr = pData->iFRAMclipr; - pSave->iFRAMclipt = pData->iFRAMclipt; - pSave->iFRAMclipb = pData->iFRAMclipb; -#endif - - pSave->iGlobalPLTEcount = pData->iGlobalPLTEcount; - - MNG_COPY (pSave->aGlobalPLTEentries, pData->aGlobalPLTEentries, sizeof (mng_rgbpaltab)); - - pSave->iGlobalTRNSrawlen = pData->iGlobalTRNSrawlen; - MNG_COPY (pSave->aGlobalTRNSrawdata, pData->aGlobalTRNSrawdata, 256); - - pSave->iGlobalGamma = pData->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - pSave->iGlobalWhitepointx = pData->iGlobalWhitepointx; - pSave->iGlobalWhitepointy = pData->iGlobalWhitepointy; - pSave->iGlobalPrimaryredx = pData->iGlobalPrimaryredx; - pSave->iGlobalPrimaryredy = pData->iGlobalPrimaryredy; - pSave->iGlobalPrimarygreenx = pData->iGlobalPrimarygreenx; - pSave->iGlobalPrimarygreeny = pData->iGlobalPrimarygreeny; - pSave->iGlobalPrimarybluex = pData->iGlobalPrimarybluex; - pSave->iGlobalPrimarybluey = pData->iGlobalPrimarybluey; -#endif - -#ifndef MNG_SKIPCHUNK_sRGB - pSave->iGlobalRendintent = pData->iGlobalRendintent; -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - pSave->iGlobalProfilesize = pData->iGlobalProfilesize; - - if (pSave->iGlobalProfilesize) /* has a profile ? */ - { /* then copy that ! */ - MNG_ALLOC (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize); - MNG_COPY (pSave->pGlobalProfile, pData->pGlobalProfile, pSave->iGlobalProfilesize); - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pSave->iGlobalBKGDred = pData->iGlobalBKGDred; - pSave->iGlobalBKGDgreen = pData->iGlobalBKGDgreen; - pSave->iGlobalBKGDblue = pData->iGlobalBKGDblue; -#endif - - /* freeze current image objects */ - pImage = (mng_imagep)pData->pFirstimgobj; - - while (pImage) - { /* freeze the object AND its buffer */ - pImage->bFrozen = MNG_TRUE; - pImage->pImgbuf->bFrozen = MNG_TRUE; - /* neeeext */ - pImage = (mng_imagep)pImage->sHeader.pNext; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_reset_objzero (mng_datap pData) -{ - mng_imagep pImage = (mng_imagep)pData->pObjzero; - mng_retcode iRetcode = mng_reset_object_details (pData, pImage, 0, 0, 0, - 0, 0, 0, 0, MNG_TRUE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pImage->bVisible = MNG_TRUE; - pImage->bViewable = MNG_TRUE; - pImage->iPosx = 0; - pImage->iPosy = 0; - pImage->bClipped = MNG_FALSE; - pImage->iClipl = 0; - pImage->iClipr = 0; - pImage->iClipt = 0; - pImage->iClipb = 0; -#ifndef MNG_SKIPCHUNK_MAGN - pImage->iMAGN_MethodX = 0; - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode restore_state (mng_datap pData) -{ -#ifndef MNG_SKIPCHUNK_SAVE - mng_savedatap pSave; -#endif - mng_imagep pImage; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_START); -#endif - /* restore object 0 status !!! */ - iRetcode = mng_reset_objzero (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fresh cycle; fake no frames done yet */ - pData->bFramedone = MNG_FALSE; - -#ifndef MNG_SKIPCHUNK_SAVE - if (pData->pSavedata) /* do we have a saved state ? */ - { - pSave = pData->pSavedata; /* address it more directly */ - /* and copy it back to the main struct */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - pData->bHasglobalPLTE = pSave->bHasglobalPLTE; - pData->bHasglobalTRNS = pSave->bHasglobalTRNS; - pData->bHasglobalGAMA = pSave->bHasglobalGAMA; - pData->bHasglobalCHRM = pSave->bHasglobalCHRM; - pData->bHasglobalSRGB = pSave->bHasglobalSRGB; - pData->bHasglobalICCP = pSave->bHasglobalICCP; - pData->bHasglobalBKGD = pSave->bHasglobalBKGD; -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifndef MNG_SKIPCHUNK_BACK - pData->iBACKred = pSave->iBACKred; - pData->iBACKgreen = pSave->iBACKgreen; - pData->iBACKblue = pSave->iBACKblue; - pData->iBACKmandatory = pSave->iBACKmandatory; - pData->iBACKimageid = pSave->iBACKimageid; - pData->iBACKtile = pSave->iBACKtile; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = pSave->iFRAMmode; -/* pData->iFRAMdelay = pSave->iFRAMdelay; */ - pData->iFRAMtimeout = pSave->iFRAMtimeout; - pData->bFRAMclipping = pSave->bFRAMclipping; - pData->iFRAMclipl = pSave->iFRAMclipl; - pData->iFRAMclipr = pSave->iFRAMclipr; - pData->iFRAMclipt = pSave->iFRAMclipt; - pData->iFRAMclipb = pSave->iFRAMclipb; - /* NOOOOOOOOOOOO */ -/* pData->iFramemode = pSave->iFRAMmode; - pData->iFramedelay = pSave->iFRAMdelay; - pData->iFrametimeout = pSave->iFRAMtimeout; - pData->bFrameclipping = pSave->bFRAMclipping; - pData->iFrameclipl = pSave->iFRAMclipl; - pData->iFrameclipr = pSave->iFRAMclipr; - pData->iFrameclipt = pSave->iFRAMclipt; - pData->iFrameclipb = pSave->iFRAMclipb; */ - -/* pData->iNextdelay = pSave->iFRAMdelay; */ - pData->iNextdelay = pData->iFramedelay; -#endif - - pData->iGlobalPLTEcount = pSave->iGlobalPLTEcount; - MNG_COPY (pData->aGlobalPLTEentries, pSave->aGlobalPLTEentries, sizeof (mng_rgbpaltab)); - - pData->iGlobalTRNSrawlen = pSave->iGlobalTRNSrawlen; - MNG_COPY (pData->aGlobalTRNSrawdata, pSave->aGlobalTRNSrawdata, 256); - - pData->iGlobalGamma = pSave->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = pSave->iGlobalWhitepointx; - pData->iGlobalWhitepointy = pSave->iGlobalWhitepointy; - pData->iGlobalPrimaryredx = pSave->iGlobalPrimaryredx; - pData->iGlobalPrimaryredy = pSave->iGlobalPrimaryredy; - pData->iGlobalPrimarygreenx = pSave->iGlobalPrimarygreenx; - pData->iGlobalPrimarygreeny = pSave->iGlobalPrimarygreeny; - pData->iGlobalPrimarybluex = pSave->iGlobalPrimarybluex; - pData->iGlobalPrimarybluey = pSave->iGlobalPrimarybluey; -#endif - - pData->iGlobalRendintent = pSave->iGlobalRendintent; - -#ifndef MNG_SKIPCHUNK_iCCP - pData->iGlobalProfilesize = pSave->iGlobalProfilesize; - - if (pData->iGlobalProfilesize) /* has a profile ? */ - { /* then copy that ! */ - MNG_ALLOC (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - MNG_COPY (pData->pGlobalProfile, pSave->pGlobalProfile, pData->iGlobalProfilesize); - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = pSave->iGlobalBKGDred; - pData->iGlobalBKGDgreen = pSave->iGlobalBKGDgreen; - pData->iGlobalBKGDblue = pSave->iGlobalBKGDblue; -#endif - } - else /* no saved-data; so reset the lot */ -#endif /* SKIPCHUNK_SAVE */ - { -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - pData->bHasglobalPLTE = MNG_FALSE; - pData->bHasglobalTRNS = MNG_FALSE; - pData->bHasglobalGAMA = MNG_FALSE; - pData->bHasglobalCHRM = MNG_FALSE; - pData->bHasglobalSRGB = MNG_FALSE; - pData->bHasglobalICCP = MNG_FALSE; - pData->bHasglobalBKGD = MNG_FALSE; -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifndef MNG_SKIPCHUNK_TERM - if (!pData->bMisplacedTERM) /* backward compatible ugliness !!! */ - { - pData->iBACKred = 0; - pData->iBACKgreen = 0; - pData->iBACKblue = 0; - pData->iBACKmandatory = 0; - pData->iBACKimageid = 0; - pData->iBACKtile = 0; - } -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = 1; -/* pData->iFRAMdelay = 1; */ - pData->iFRAMtimeout = 0x7fffffffl; - pData->bFRAMclipping = MNG_FALSE; - pData->iFRAMclipl = 0; - pData->iFRAMclipr = 0; - pData->iFRAMclipt = 0; - pData->iFRAMclipb = 0; - /* NOOOOOOOOOOOO */ -/* pData->iFramemode = 1; - pData->iFramedelay = 1; - pData->iFrametimeout = 0x7fffffffl; - pData->bFrameclipping = MNG_FALSE; - pData->iFrameclipl = 0; - pData->iFrameclipr = 0; - pData->iFrameclipt = 0; - pData->iFrameclipb = 0; */ - -/* pData->iNextdelay = 1; */ - pData->iNextdelay = pData->iFramedelay; -#endif - - pData->iGlobalPLTEcount = 0; - - pData->iGlobalTRNSrawlen = 0; - - pData->iGlobalGamma = 0; - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = 0; - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; -#endif - - pData->iGlobalRendintent = 0; - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->iGlobalProfilesize) /* free a previous profile ? */ - MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = 0; - pData->iGlobalBKGDgreen = 0; - pData->iGlobalBKGDblue = 0; -#endif - } - -#ifndef MNG_SKIPCHUNK_TERM - if (!pData->bMisplacedTERM) /* backward compatible ugliness !!! */ - { - pImage = (mng_imagep)pData->pFirstimgobj; - /* drop un-frozen image objects */ - while (pImage) - { - mng_imagep pNext = (mng_imagep)pImage->sHeader.pNext; - - if (!pImage->bFrozen) /* is it un-frozen ? */ - { - mng_imagep pPrev = (mng_imagep)pImage->sHeader.pPrev; - - if (pPrev) /* unlink it */ - pPrev->sHeader.pNext = pNext; - else - pData->pFirstimgobj = pNext; - - if (pNext) - pNext->sHeader.pPrev = pPrev; - else - pData->pLastimgobj = pPrev; - - if (pImage->pImgbuf->bFrozen) /* buffer frozen ? */ - { - if (pImage->pImgbuf->iRefcount < 2) - MNG_ERROR (pData, MNG_INTERNALERROR); - /* decrease ref counter */ - pImage->pImgbuf->iRefcount--; - /* just cleanup the object then */ - MNG_FREEX (pData, pImage, sizeof (mng_image)); - } - else - { /* free the image buffer */ - iRetcode = mng_free_imagedataobject (pData, pImage->pImgbuf); - /* and cleanup the object */ - MNG_FREEX (pData, pImage, sizeof (mng_image)); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - - pImage = pNext; /* neeeext */ - } - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * General display processing routine * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_process_display (mng_datap pData) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_START); -#endif - - if (!pData->iBreakpoint) /* not broken previously ? */ - { - if ((pData->iRequestframe) || (pData->iRequestlayer) || (pData->iRequesttime)) - { - pData->bSearching = MNG_TRUE; /* indicate we're searching */ - - iRetcode = clear_canvas (pData); /* make the canvas virgin black ?!? */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* let's start from the top, shall we */ - pData->pCurraniobj = pData->pFirstaniobj; - } - } - - do /* process the objects */ - { - if (pData->bSearching) /* clear timer-flag when searching !!! */ - pData->bTimerset = MNG_FALSE; - /* do we need to finish something first ? */ - if ((pData->iBreakpoint) && (pData->iBreakpoint < 99)) - { - switch (pData->iBreakpoint) /* return to broken display routine */ - { -#ifndef MNG_SKIPCHUNK_FRAM - case 1 : { iRetcode = mng_process_display_fram2 (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_SHOW - case 3 : ; /* same as 4 !!! */ - case 4 : { iRetcode = mng_process_display_show (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_CLON - case 5 : { iRetcode = mng_process_display_clon2 (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_MAGN - case 9 : { iRetcode = mng_process_display_magn2 (pData); break; } - case 10 : { iRetcode = mng_process_display_mend2 (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_PAST - case 11 : { iRetcode = mng_process_display_past2 (pData); break; } -#endif - default : MNG_ERROR (pData, MNG_INTERNALERROR); - } - } - else - { - if (pData->pCurraniobj) - iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj); - } - - if (!pData->bTimerset) /* reset breakpoint flag ? */ - pData->iBreakpoint = 0; - /* can we advance to next object ? */ - if ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait)) - { - pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext; - /* MEND processing to be done ? */ - if ((pData->eImagetype == mng_it_mng) && (!pData->pCurraniobj)) - iRetcode = mng_process_display_mend (pData); - - if (!pData->pCurraniobj) /* refresh after last image ? */ - pData->bNeedrefresh = MNG_TRUE; - } - - if (pData->bSearching) /* are we looking for something ? */ - { - if ((pData->iRequestframe) && (pData->iRequestframe <= pData->iFrameseq)) - { - pData->iRequestframe = 0; /* found the frame ! */ - pData->bSearching = MNG_FALSE; - } - else - if ((pData->iRequestlayer) && (pData->iRequestlayer <= pData->iLayerseq)) - { - pData->iRequestlayer = 0; /* found the layer ! */ - pData->bSearching = MNG_FALSE; - } - else - if ((pData->iRequesttime) && (pData->iRequesttime <= pData->iFrametime)) - { - pData->iRequesttime = 0; /* found the playtime ! */ - pData->bSearching = MNG_FALSE; - } - } - } /* until error or a break or no more objects */ - while ((!iRetcode) && (pData->pCurraniobj) && - (((pData->bRunning) && (!pData->bTimerset)) || (pData->bSearching)) && - (!pData->bSectionwait) && (!pData->bFreezing)); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* refresh needed ? */ - if ((!pData->bTimerset) && (pData->bNeedrefresh)) - { - iRetcode = mng_display_progressive_refresh (pData, 1); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - /* timer break ? */ - if ((pData->bTimerset) && (!pData->iBreakpoint)) - pData->iBreakpoint = 99; - else - if (!pData->bTimerset) - pData->iBreakpoint = 0; /* reset if no timer break */ - - if ((!pData->bTimerset) && (!pData->pCurraniobj)) - pData->bRunning = MNG_FALSE; /* all done now ! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Chunk display processing routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT -png_imgtype mng_png_imgtype(mng_uint8 colortype, mng_uint8 bitdepth) -{ - png_imgtype ret; - switch (bitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1: - { - png_imgtype imgtype[]={png_g1,png_none,png_none,png_idx1}; - ret=imgtype[colortype]; - break; - } - case 2: - { - png_imgtype imgtype[]={png_g2,png_none,png_none,png_idx2}; - ret=imgtype[colortype]; - break; - } - case 4: - { - png_imgtype imgtype[]={png_g4,png_none,png_none,png_idx4}; - ret=imgtype[colortype]; - break; - } -#endif - case 8: - { - png_imgtype imgtype[]={png_g8,png_none,png_rgb8,png_idx8,png_ga8, - png_none,png_rgba8}; - ret=imgtype[colortype]; - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16: - { - png_imgtype imgtype[]={png_g16,png_none,png_rgb16,png_none,png_ga16, - png_none,png_rgba16}; - ret=imgtype[colortype]; - break; - } -#endif - default: - ret=png_none; - break; - } - return (ret); -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - -/* ************************************************************************** */ - -mng_retcode mng_process_display_ihdr (mng_datap pData) -{ /* address the current "object" if any */ - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_START); -#endif - - if (!pData->bHasDHDR) - { - pData->fInitrowproc = MNG_NULL; /* do nothing by default */ - pData->fDisplayrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - pData->pStoreobj = MNG_NULL; - } - - if (!pData->iBreakpoint) /* not previously broken ? */ - { - mng_retcode iRetcode = MNG_NOERROR; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* is a delta-image ? */ - { - if (pData->iDeltatype == MNG_DELTATYPE_REPLACE) - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pDeltaImage, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth; - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth; - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth; - - if (!iRetcode) - { /* process immediately if bitdepth & colortype are equal */ - pData->bDeltaimmediate = - (mng_bool)((pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) && - (pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) ); - /* be sure to reset object 0 */ - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - } - } - else -#endif - { - if (pImage) /* update object buffer ? */ - iRetcode = mng_reset_object_details (pData, pImage, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - else - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifndef MNG_NO_DELTA_PNG - if (!pData->bHasDHDR) -#endif - { - if (pImage) /* real object ? */ - pData->pStoreobj = pImage; /* tell the row routines */ - else /* otherwise use object 0 */ - pData->pStoreobj = pData->pObjzero; - -#if !defined(MNG_INCLUDE_MPNG_PROPOSAL) && !defined(MNG_INCLUDE_ANG_PROPOSAL) - if ( /* display "on-the-fly" ? */ -#ifndef MNG_SKIPCHUNK_MAGN - (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) && - (((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) && -#endif - ( (pData->eImagetype == mng_it_png ) || - (((mng_imagep)pData->pStoreobj)->bVisible) ) ) - { - next_layer (pData); /* that's a new layer then ! */ - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 2; - else - { - pData->iBreakpoint = 0; - /* anything to display ? */ - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - } - } -#endif - } - - if (!pData->bTimerset) /* no timer break ? */ - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype=mng_png_imgtype(pData->iColortype,pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - { - switch (pData->iColortype) - { - case 0 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 1; - else - pData->iFilterofs = 2; - - break; - } - case 2 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 3; - else - pData->iFilterofs = 6; - - break; - } - case 3 : { - pData->iFilterofs = 1; - break; - } - case 4 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 2; - else - pData->iFilterofs = 4; - - break; - } - case 6 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 4; - else - pData->iFilterofs = 8; - - break; - } - } - } -#endif - -#ifdef FILTER193 /* no adaptive filtering ? */ - if (pData->iFilter == MNG_FILTER_NOFILTER) - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -mng_retcode mng_process_display_mpng (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MPNG, MNG_LC_START); -#endif - - pData->iAlphadepth = 8; /* assume transparency !! */ - - if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */ - { - pData->iWidth = ((mng_mpng_objp)pData->pMPNG)->iFramewidth; - pData->iHeight = ((mng_mpng_objp)pData->pMPNG)->iFrameheight; - - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - next_layer (pData); /* first mPNG layer then ! */ - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -mng_retcode mng_process_display_ang (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_ANG, MNG_LC_START); -#endif - - if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */ - { - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - next_layer (pData); /* first mPNG layer then ! */ - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_ANG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_idat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_process_display_idat (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_START); -#endif - -#if defined(MNG_INCLUDE_MPNG_PROPOSAL) || defined(MNG_INCLUDE_ANG_PROPOSAL) - if ((pData->eImagetype == mng_it_png) && (pData->iLayerseq <= 0)) - { - if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - next_layer (pData); /* first regular PNG layer then ! */ - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - } -#endif - - if (pData->bRestorebkgd) /* need to restore the background ? */ - { - pData->bRestorebkgd = MNG_FALSE; - iRetcode = load_bkgdlayer (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->iLayerseq++; /* and it counts as a layer then ! */ - } - - if (pData->fInitrowproc) /* need to initialize row processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - pData->fInitrowproc = MNG_NULL; /* only call this once !!! */ - } - - if ((!iRetcode) && (!pData->bInflating)) - /* initialize inflate */ - iRetcode = mngzlib_inflateinit (pData); - - if (!iRetcode) /* all ok? then inflate, my man */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mngzlib_inflaterows (pData, iRawlen, pRawdata); -#else - iRetcode = mngzlib_inflaterows (pData, pData->iRawlen, pData->pRawdata); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_iend (mng_datap pData) -{ - mng_retcode iRetcode, iRetcode2; - mng_bool bDodisplay = MNG_FALSE; - mng_bool bMagnify = MNG_FALSE; - mng_bool bCleanup = (mng_bool)(pData->iBreakpoint != 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_JNG /* progressive+alpha JNG can be displayed now */ - if ( (pData->bHasJHDR ) && - ( (pData->bJPEGprogressive) || (pData->bJPEGprogressive2)) && - ( (pData->eImagetype == mng_it_jng ) || - (((mng_imagep)pData->pStoreobj)->bVisible) ) && - ( (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) ) - bDodisplay = MNG_TRUE; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - if ( (pData->pStoreobj) && /* on-the-fly magnification ? */ - ( (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX) || - (((mng_imagep)pData->pStoreobj)->iMAGN_MethodY) ) ) - bMagnify = MNG_TRUE; -#endif - - if ((pData->bHasBASI) || /* was it a BASI stream */ - (bDodisplay) || /* or should we display the JNG */ -#ifndef MNG_SKIPCHUNK_MAGN - (bMagnify) || /* or should we magnify it */ -#endif - /* or did we get broken here last time ? */ - ((pData->iBreakpoint) && (pData->iBreakpoint != 8))) - { - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* or was it object 0 ? */ - pImage = (mng_imagep)pData->pObjzero; - /* display it now then ? */ - if ((pImage->bVisible) && (pImage->bViewable)) - { /* ok, so do it */ - iRetcode = mng_display_image (pData, pImage, bDodisplay); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 6; - } - } -#ifndef MNG_NO_DELTA_PNG - else - if ((pData->bHasDHDR) || /* was it a DHDR stream */ - (pData->iBreakpoint == 8)) /* or did we get broken here last time ? */ - { - mng_imagep pImage = (mng_imagep)pData->pDeltaImage; - - if (!pData->iBreakpoint) - { /* perform the delta operations needed */ - iRetcode = mng_execute_delta_image (pData, pImage, (mng_imagep)pData->pObjzero); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - /* display it now then ? */ - if ((pImage->bVisible) && (pImage->bViewable)) - { /* ok, so do it */ - iRetcode = mng_display_image (pData, pImage, MNG_FALSE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 8; - } - } -#endif - - if (!pData->bTimerset) /* can we continue ? */ - { - pData->iBreakpoint = 0; /* clear this flag now ! */ - - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - if (pData->eImagetype == mng_it_mpng) - { - pData->pCurraniobj = pData->pFirstaniobj; - } else -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - if (pData->eImagetype == mng_it_ang) - { - pData->pCurraniobj = pData->pFirstaniobj; - } else -#endif - { /* cleanup object 0 */ - mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - 0, 0, 0, 0, 0, 0, 0, MNG_TRUE); - } - - if (pData->bInflating) /* if we've been inflating */ - { /* cleanup row-processing, */ - iRetcode = mng_cleanup_rowproc (pData); - /* also cleanup inflate! */ - iRetcode2 = mngzlib_inflatefree (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - if (iRetcode2) - return iRetcode2; - } - -#ifdef MNG_INCLUDE_JNG - if (pData->bJPEGdecompress) /* if we've been decompressing JDAT */ - { /* cleanup row-processing, */ - iRetcode = mng_cleanup_rowproc (pData); - /* also cleanup decompress! */ - iRetcode2 = mngjpeg_decompressfree (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - if (iRetcode2) - return iRetcode2; - } - - if (pData->bJPEGdecompress2) /* if we've been decompressing JDAA */ - { /* cleanup row-processing, */ - iRetcode = mng_cleanup_rowproc (pData); - /* also cleanup decompress! */ - iRetcode2 = mngjpeg_decompressfree2 (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - if (iRetcode2) - return iRetcode2; - } -#endif - - if (bCleanup) /* if we got broken last time we need to cleanup */ - { - pData->bHasIHDR = MNG_FALSE; /* IEND signals the end for most ... */ - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; - } - /* if the image was displayed on the fly, */ - /* we'll have to make the app refresh */ - if ((pData->eImagetype != mng_it_mng) && (pData->fDisplayrow)) - pData->bNeedrefresh = MNG_TRUE; - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -/* change in the MNG spec with regards to TERM delay & interframe_delay - as proposed by Adam M. Costello (option 4) and finalized by official vote - during december 2002 / check the 'mng-list' archives for more details */ - -mng_retcode mng_process_display_mend (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DYNAMICMNG - if (pData->bStopafterseek) /* need to stop after this ? */ - { - pData->bFreezing = MNG_TRUE; /* stop processing on this one */ - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->bNeedrefresh = MNG_TRUE; /* make sure the last bit is displayed ! */ - } -#endif - -#ifndef MNG_SKIPCHUNK_TERM - /* TERM processed ? */ - if ((pData->bDisplaying) && (pData->bRunning) && - (pData->bHasTERM) && (pData->pTermaniobj)) - { - mng_retcode iRetcode; - mng_ani_termp pTERM; - /* get the right animation object ! */ - pTERM = (mng_ani_termp)pData->pTermaniobj; - - pData->iIterations++; /* increase iteration count */ - - switch (pTERM->iTermaction) /* determine what to do! */ - { - case 0 : { /* show last frame indefinitly */ - break; /* piece of cake, that is... */ - } - - case 1 : { /* cease displaying anything */ - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - iRetcode = interframe_delay (pData); - /* no interframe_delay? then fake it */ - if ((!iRetcode) && (!pData->bTimerset)) - iRetcode = set_delay (pData, 1); - - if (iRetcode) - return iRetcode; - - pData->iBreakpoint = 10; - break; - } - - case 2 : { /* show first image after TERM */ - iRetcode = restore_state (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* notify the app ? */ - if (pData->fProcessmend) - if (!pData->fProcessmend ((mng_handle)pData, pData->iIterations, 0)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - /* show first frame after TERM chunk */ - pData->pCurraniobj = pTERM; - pData->bOnlyfirstframe = MNG_TRUE; - pData->iFramesafterTERM = 0; - - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - break; - } - - case 3 : { /* repeat */ - if ((pTERM->iItermax) && (pTERM->iItermax < 0x7FFFFFFF)) - pTERM->iItermax--; - - if (pTERM->iItermax) /* go back to TERM ? */ - { /* restore to initial or SAVE state */ - iRetcode = restore_state (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* notify the app ? */ - if (pData->fProcessmend) - if (!pData->fProcessmend ((mng_handle)pData, - pData->iIterations, pTERM->iItermax)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - /* restart from TERM chunk */ - pData->pCurraniobj = pTERM; - - if (pTERM->iDelay) /* set the delay (?) */ - { - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - pData->bNeedrefresh = MNG_TRUE; - } - } - else - { - switch (pTERM->iIteraction) - { - case 0 : { /* show last frame indefinitly */ - break; /* piece of cake, that is... */ - } - - case 1 : { /* cease displaying anything */ - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - iRetcode = interframe_delay (pData); - /* no interframe_delay? then fake it */ - if ((!iRetcode) && (!pData->bTimerset)) - iRetcode = set_delay (pData, 1); - - if (iRetcode) - return iRetcode; - - pData->iBreakpoint = 10; - break; - } - - case 2 : { /* show first image after TERM */ - iRetcode = restore_state (pData); - /* on error bail out */ - if (iRetcode) - return iRetcode; - /* notify the app ? */ - if (pData->fProcessmend) - if (!pData->fProcessmend ((mng_handle)pData, - pData->iIterations, 0)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - /* show first frame after TERM chunk */ - pData->pCurraniobj = pTERM; - pData->bOnlyfirstframe = MNG_TRUE; - pData->iFramesafterTERM = 0; - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - break; - } - } - } - - break; - } - } - } -#endif /* MNG_SKIPCHUNK_TERM */ - /* just reading ? */ - if ((!pData->bDisplaying) && (pData->bReading)) - if (pData->fProcessmend) /* inform the app ? */ - if (!pData->fProcessmend ((mng_handle)pData, 0, 0)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - if (!pData->pCurraniobj) /* always let the app refresh at the end ! */ - pData->bNeedrefresh = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_mend2 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->bFrameclipping = MNG_FALSE; /* nothing to do but restore the app background */ -#endif - load_bkgdlayer (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode mng_process_display_defi (mng_datap pData) -{ - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_START); -#endif - - if (!pData->iDEFIobjectid) /* object id=0 ? */ - { - pImage = (mng_imagep)pData->pObjzero; - - if (pData->bDEFIhasdonotshow) - pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0); - - if (pData->bDEFIhasloca) - { - pImage->iPosx = pData->iDEFIlocax; - pImage->iPosy = pData->iDEFIlocay; - } - - if (pData->bDEFIhasclip) - { - pImage->bClipped = pData->bDEFIhasclip; - pImage->iClipl = pData->iDEFIclipl; - pImage->iClipr = pData->iDEFIclipr; - pImage->iClipt = pData->iDEFIclipt; - pImage->iClipb = pData->iDEFIclipb; - } - - pData->pCurrentobj = 0; /* not a real object ! */ - } - else - { /* already exists ? */ - pImage = (mng_imagep)mng_find_imageobject (pData, pData->iDEFIobjectid); - - if (!pImage) /* if not; create new */ - { - mng_retcode iRetcode = mng_create_imageobject (pData, pData->iDEFIobjectid, - (mng_bool)(pData->iDEFIconcrete == 1), - (mng_bool)(pData->iDEFIdonotshow == 0), - MNG_FALSE, 0, 0, 0, 0, 0, 0, 0, - pData->iDEFIlocax, pData->iDEFIlocay, - pData->bDEFIhasclip, - pData->iDEFIclipl, pData->iDEFIclipr, - pData->iDEFIclipt, pData->iDEFIclipb, - &pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* exists; then set new info */ - if (pData->bDEFIhasdonotshow) - pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0); - - pImage->bViewable = MNG_FALSE; - - if (pData->bDEFIhasloca) - { - pImage->iPosx = pData->iDEFIlocax; - pImage->iPosy = pData->iDEFIlocay; - } - - if (pData->bDEFIhasclip) - { - pImage->bClipped = pData->bDEFIhasclip; - pImage->iClipl = pData->iDEFIclipl; - pImage->iClipr = pData->iDEFIclipr; - pImage->iClipt = pData->iDEFIclipt; - pImage->iClipb = pData->iDEFIclipb; - } - - if (pData->bDEFIhasconcrete) - pImage->pImgbuf->bConcrete = (mng_bool)(pData->iDEFIconcrete == 1); - } - - pData->pCurrentobj = pImage; /* others may want to know this */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable) -#else -mng_retcode mng_process_display_basi (mng_datap pData) -#endif -{ /* address the current "object" if any */ - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_uint8p pWork; - mng_uint32 iX; - mng_imagedatap pBuf; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_START); -#endif - - if (!pImage) /* or is it an "on-the-fly" image ? */ - pImage = (mng_imagep)pData->pObjzero; - /* address the object-buffer */ - pBuf = pImage->pImgbuf; - - pData->fDisplayrow = MNG_NULL; /* do nothing by default */ - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - /* set parms now that they're known */ - iRetcode = mng_reset_object_details (pData, pImage, pData->iDatawidth, - pData->iDataheight, pData->iBitdepth, - pData->iColortype, pData->iCompression, - pData->iFilter, pData->iInterlace, MNG_FALSE); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* save the viewable flag */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->bViewable = (mng_bool)(iViewable == 1); -#else - pImage->bViewable = (mng_bool)(pData->iBASIviewable == 1); -#endif - pBuf->bViewable = pImage->bViewable; - pData->pStoreobj = pImage; /* let row-routines know which object */ - - pWork = pBuf->pImgdata; /* fill the object-buffer with the specified - "color" sample */ - switch (pData->iColortype) /* depending on color_type & bit_depth */ - { - case 0 : { /* gray */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed); -#else - mng_put_uint16 (pWork, pData->iBASIred); -#endif - pWork += 2; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; -#else - *pWork = (mng_uint8)pData->iBASIred; -#endif - pWork++; - } - } - /* force tRNS ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((bHasalpha) && (!iAlpha)) -#else - if ((pData->bBASIhasalpha) && (!pData->iBASIalpha)) -#endif - { - pBuf->bHasTRNS = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->iTRNSgray = iRed; -#else - pBuf->iTRNSgray = pData->iBASIred; -#endif - } - - break; - } - - case 2 : { /* rgb */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed ); - mng_put_uint16 (pWork+2, iGreen); - mng_put_uint16 (pWork+4, iBlue ); -#else - mng_put_uint16 (pWork, pData->iBASIred ); - mng_put_uint16 (pWork+2, pData->iBASIgreen); - mng_put_uint16 (pWork+4, pData->iBASIblue ); -#endif - pWork += 6; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; - *(pWork+1) = (mng_uint8)iGreen; - *(pWork+2) = (mng_uint8)iBlue; -#else - *pWork = (mng_uint8)pData->iBASIred; - *(pWork+1) = (mng_uint8)pData->iBASIgreen; - *(pWork+2) = (mng_uint8)pData->iBASIblue; -#endif - pWork += 3; - } - } - /* force tRNS ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((bHasalpha) && (!iAlpha)) -#else - if ((pData->bBASIhasalpha) && (!pData->iBASIalpha)) -#endif - { - pBuf->bHasTRNS = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->iTRNSred = iRed; - pBuf->iTRNSgreen = iGreen; - pBuf->iTRNSblue = iBlue; -#else - pBuf->iTRNSred = pData->iBASIred; - pBuf->iTRNSgreen = pData->iBASIgreen; - pBuf->iTRNSblue = pData->iBASIblue; -#endif - } - - break; - } - - case 3 : { /* indexed */ - pBuf->bHasPLTE = MNG_TRUE; - - switch (pData->iBitdepth) - { - case 1 : { pBuf->iPLTEcount = 2; break; } - case 2 : { pBuf->iPLTEcount = 4; break; } - case 4 : { pBuf->iPLTEcount = 16; break; } - case 8 : { pBuf->iPLTEcount = 256; break; } - default : { pBuf->iPLTEcount = 1; break; } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->aPLTEentries [0].iRed = (mng_uint8)iRed; - pBuf->aPLTEentries [0].iGreen = (mng_uint8)iGreen; - pBuf->aPLTEentries [0].iBlue = (mng_uint8)iBlue; -#else - pBuf->aPLTEentries [0].iRed = (mng_uint8)pData->iBASIred; - pBuf->aPLTEentries [0].iGreen = (mng_uint8)pData->iBASIgreen; - pBuf->aPLTEentries [0].iBlue = (mng_uint8)pData->iBASIblue; -#endif - - for (iX = 1; iX < pBuf->iPLTEcount; iX++) - { - pBuf->aPLTEentries [iX].iRed = 0; - pBuf->aPLTEentries [iX].iGreen = 0; - pBuf->aPLTEentries [iX].iBlue = 0; - } - /* force tRNS ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((bHasalpha) && (iAlpha < 255)) -#else - if ((pData->bBASIhasalpha) && (pData->iBASIalpha < 255)) -#endif - { - pBuf->bHasTRNS = MNG_TRUE; - pBuf->iTRNScount = 1; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->aTRNSentries [0] = (mng_uint8)iAlpha; -#else - pBuf->aTRNSentries [0] = (mng_uint8)pData->iBASIalpha; -#endif - } - - break; - } - - case 4 : { /* gray+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed); - mng_put_uint16 (pWork+2, iAlpha); -#else - mng_put_uint16 (pWork, pData->iBASIred); - mng_put_uint16 (pWork+2, pData->iBASIalpha); -#endif - pWork += 4; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; - *(pWork+1) = (mng_uint8)iAlpha; -#else - *pWork = (mng_uint8)pData->iBASIred; - *(pWork+1) = (mng_uint8)pData->iBASIalpha; -#endif - pWork += 2; - } - } - - break; - } - - case 6 : { /* rgb+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed); - mng_put_uint16 (pWork+2, iGreen); - mng_put_uint16 (pWork+4, iBlue); - mng_put_uint16 (pWork+6, iAlpha); -#else - mng_put_uint16 (pWork, pData->iBASIred); - mng_put_uint16 (pWork+2, pData->iBASIgreen); - mng_put_uint16 (pWork+4, pData->iBASIblue); - mng_put_uint16 (pWork+6, pData->iBASIalpha); -#endif - pWork += 8; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; - *(pWork+1) = (mng_uint8)iGreen; - *(pWork+2) = (mng_uint8)iBlue; - *(pWork+3) = (mng_uint8)iAlpha; -#else - *pWork = (mng_uint8)pData->iBASIred; - *(pWork+1) = (mng_uint8)pData->iBASIgreen; - *(pWork+2) = (mng_uint8)pData->iBASIblue; - *(pWork+3) = (mng_uint8)pData->iBASIalpha; -#endif - pWork += 4; - } - } - - break; - } - - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype=mng_png_imgtype(pData->iColortype,pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { /* just to accomodate IDAT if it arrives */ - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 - if (pData->iFilter == 0xC0) /* leveling & differing ? */ - { - switch (pData->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 1; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 2; -#endif - - break; - } - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 3; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 6; -#endif - - break; - } - case 3 : { - pData->iFilterofs = 1; - break; - } - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 2; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 4; -#endif - - break; - } - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 4; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 8; -#endif - - break; - } - } - } -#endif - -#ifdef FILTER193 - if (pData->iFilter == 0xC1) /* no adaptive filtering ? */ - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy) -#else -mng_retcode mng_process_display_clon (mng_datap pData) -#endif -{ - mng_imagep pSource, pClone; - mng_bool bVisible, bAbstract; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START); -#endif -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - /* locate the source object first */ - pSource = mng_find_imageobject (pData, iSourceid); - /* check if the clone exists */ - pClone = mng_find_imageobject (pData, iCloneid); -#else - /* locate the source object first */ - pSource = mng_find_imageobject (pData, pData->iCLONsourceid); - /* check if the clone exists */ - pClone = mng_find_imageobject (pData, pData->iCLONcloneid); -#endif - - if (!pSource) /* source must exist ! */ - MNG_ERROR (pData, MNG_OBJECTUNKNOWN); - - if (pClone) /* clone must not exist ! */ - MNG_ERROR (pData, MNG_OBJECTEXISTS); - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (bHasdonotshow) /* DoNotShow flag filled ? */ - bVisible = (mng_bool)(iDonotshow == 0); - else - bVisible = pSource->bVisible; -#else - if (pData->bCLONhasdonotshow) /* DoNotShow flag filled ? */ - bVisible = (mng_bool)(pData->iCLONdonotshow == 0); - else - bVisible = pSource->bVisible; -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - bAbstract = (mng_bool)(iConcrete == 1); -#else - bAbstract = (mng_bool)(pData->iCLONconcrete == 1); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iClonetype) /* determine action to take */ - { - case 0 : { /* full clone */ - iRetcode = mng_clone_imageobject (pData, iCloneid, MNG_FALSE, - bVisible, bAbstract, bHasloca, - iLocationtype, iLocationx, iLocationy, - pSource, &pClone); - break; - } - - case 1 : { /* partial clone */ - iRetcode = mng_clone_imageobject (pData, iCloneid, MNG_TRUE, - bVisible, bAbstract, bHasloca, - iLocationtype, iLocationx, iLocationy, - pSource, &pClone); - break; - } - - case 2 : { /* renumber object */ - iRetcode = mng_renum_imageobject (pData, pSource, iCloneid, - bVisible, bAbstract, bHasloca, - iLocationtype, iLocationx, iLocationy); - pClone = pSource; - break; - } - - } -#else - switch (pData->iCLONclonetype) /* determine action to take */ - { - case 0 : { /* full clone */ - iRetcode = mng_clone_imageobject (pData, pData->iCLONcloneid, MNG_FALSE, - bVisible, bAbstract, - pData->bCLONhasloca, pData->iCLONlocationtype, - pData->iCLONlocationx, pData->iCLONlocationy, - pSource, &pClone); - break; - } - - case 1 : { /* partial clone */ - iRetcode = mng_clone_imageobject (pData, pData->iCLONcloneid, MNG_TRUE, - bVisible, bAbstract, - pData->bCLONhasloca, pData->iCLONlocationtype, - pData->iCLONlocationx, pData->iCLONlocationy, - pSource, &pClone); - break; - } - - case 2 : { /* renumber object */ - iRetcode = mng_renum_imageobject (pData, pSource, pData->iCLONcloneid, - bVisible, bAbstract, - pData->bCLONhasloca, pData->iCLONlocationtype, - pData->iCLONlocationx, pData->iCLONlocationy); - pClone = pSource; - break; - } - - } -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - /* display on the fly ? */ - if ((pClone->bViewable) && (pClone->bVisible)) - { - pData->pLastclone = pClone; /* remember in case of timer break ! */ - /* display it */ - mng_display_image (pData, pClone, MNG_FALSE); - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 5; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_clon2 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START); -#endif - /* only called after timer break ! */ - mng_display_image (pData, (mng_imagep)pData->pLastclone, MNG_FALSE); - pData->iBreakpoint = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds) -#else -mng_retcode mng_process_display_disc (mng_datap pData) -#endif -{ - mng_uint32 iX; - mng_imagep pImage; - mng_uint32 iRetcode; -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iCount) /* specific list ? */ -#else - if (pData->iDISCcount) /* specific list ? */ -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_uint16p pWork = pIds; -#else - mng_uint16p pWork = pData->pDISCids; -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifdef MNG_DECREMENT_LOOPS /* iterate the list */ - for (iX = iCount; iX > 0; iX--) -#else - for (iX = 0; iX < iCount; iX++) -#endif -#else -#ifdef MNG_DECREMENT_LOOPS /* iterate the list */ - for (iX = pData->iDISCcount; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iDISCcount; iX++) -#endif -#endif - { - pImage = mng_find_imageobject (pData, *pWork++); - - if (pImage) /* found the object ? */ - { /* then drop it */ - iRetcode = mng_free_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } - else /* empty: drop all un-frozen objects */ - { - mng_imagep pNext = (mng_imagep)pData->pFirstimgobj; - - while (pNext) /* any left ? */ - { - pImage = pNext; - pNext = pImage->sHeader.pNext; - - if (!pImage->bFrozen) /* not frozen ? */ - { /* then drop it */ - iRetcode = mng_free_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_process_display_fram (mng_datap pData) -#endif -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START); -#endif - /* advance a frame then */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = next_frame (pData, iFramemode, iChangedelay, iDelay, - iChangetimeout, iTimeout, iChangeclipping, - iCliptype, iClipl, iClipr, iClipt, iClipb); -#else - iRetcode = next_frame (pData, pData->iTempFramemode, pData->iTempChangedelay, - pData->iTempDelay, pData->iTempChangetimeout, - pData->iTempTimeout, pData->iTempChangeclipping, - pData->iTempCliptype, pData->iTempClipl, pData->iTempClipr, - pData->iTempClipt, pData->iTempClipb); -#endif - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_fram2 (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START); -#endif - /* again; after the break */ - iRetcode = next_frame (pData, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - pData->iBreakpoint = 0; /* not again! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_move (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey) -#else -mng_retcode mng_process_display_move (mng_datap pData) -#endif -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_START); -#endif - /* iterate the list */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = iFromid; iX <= iToid; iX++) -#else - for (iX = pData->iMOVEfromid; iX <= pData->iMOVEtoid; iX++) -#endif - { - if (!iX) /* object id=0 ? */ - pImage = (mng_imagep)pData->pObjzero; - else - pImage = mng_find_imageobject (pData, iX); - - if (pImage) /* object exists ? */ - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iMovetype) -#else - switch (pData->iMOVEmovetype) -#endif - { - case 0 : { /* absolute */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iPosx = iMovex; - pImage->iPosy = iMovey; -#else - pImage->iPosx = pData->iMOVEmovex; - pImage->iPosy = pData->iMOVEmovey; -#endif - break; - } - case 1 : { /* relative */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iPosx = pImage->iPosx + iMovex; - pImage->iPosy = pImage->iPosy + iMovey; -#else - pImage->iPosx = pImage->iPosx + pData->iMOVEmovex; - pImage->iPosy = pImage->iPosy + pData->iMOVEmovey; -#endif - break; - } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_clip (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_process_display_clip (mng_datap pData) -#endif -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_START); -#endif - /* iterate the list */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = iFromid; iX <= iToid; iX++) -#else - for (iX = pData->iCLIPfromid; iX <= pData->iCLIPtoid; iX++) -#endif - { - if (!iX) /* object id=0 ? */ - pImage = (mng_imagep)pData->pObjzero; - else - pImage = mng_find_imageobject (pData, iX); - - if (pImage) /* object exists ? */ - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iCliptype) -#else - switch (pData->iCLIPcliptype) -#endif - { - case 0 : { /* absolute */ - pImage->bClipped = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iClipl = iClipl; - pImage->iClipr = iClipr; - pImage->iClipt = iClipt; - pImage->iClipb = iClipb; -#else - pImage->iClipl = pData->iCLIPclipl; - pImage->iClipr = pData->iCLIPclipr; - pImage->iClipt = pData->iCLIPclipt; - pImage->iClipb = pData->iCLIPclipb; -#endif - break; - } - case 1 : { /* relative */ - pImage->bClipped = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iClipl = pImage->iClipl + iClipl; - pImage->iClipr = pImage->iClipr + iClipr; - pImage->iClipt = pImage->iClipt + iClipt; - pImage->iClipb = pImage->iClipb + iClipb; -#else - pImage->iClipl = pImage->iClipl + pData->iCLIPclipl; - pImage->iClipr = pImage->iClipr + pData->iCLIPclipr; - pImage->iClipt = pImage->iClipt + pData->iCLIPclipt; - pImage->iClipb = pImage->iClipb + pData->iCLIPclipb; -#endif - break; - } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode mng_process_display_show (mng_datap pData) -{ - mng_int16 iX, iS, iFrom, iTo; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_START); -#endif - - /* TODO: optimization for the cases where "abs (iTo - iFrom)" is rather high; - especially where ((iFrom==1) && (iTo==65535)); eg. an empty SHOW !!! */ - - if (pData->iBreakpoint == 3) /* previously broken during cycle-mode ? */ - { - pImage = mng_find_imageobject (pData, pData->iSHOWnextid); - - if (pImage) /* still there ? */ - mng_display_image (pData, pImage, MNG_FALSE); - - pData->iBreakpoint = 0; /* let's not go through this again! */ - } - else - { - if (pData->iBreakpoint) /* previously broken at other point ? */ - { /* restore last parms */ - iFrom = (mng_int16)pData->iSHOWfromid; - iTo = (mng_int16)pData->iSHOWtoid; - iX = (mng_int16)pData->iSHOWnextid; - iS = (mng_int16)pData->iSHOWskip; - } - else - { /* regular sequence ? */ - if (pData->iSHOWtoid >= pData->iSHOWfromid) - iS = 1; - else /* reverse sequence ! */ - iS = -1; - - iFrom = (mng_int16)pData->iSHOWfromid; - iTo = (mng_int16)pData->iSHOWtoid; - iX = iFrom; - - pData->iSHOWfromid = (mng_uint16)iFrom; - pData->iSHOWtoid = (mng_uint16)iTo; - pData->iSHOWskip = iS; - } - /* cycle mode ? */ - if ((pData->iSHOWmode == 6) || (pData->iSHOWmode == 7)) - { - mng_uint16 iTrigger = 0; - mng_uint16 iFound = 0; - mng_uint16 iPass = 0; - mng_imagep pFound = 0; - - do - { - iPass++; /* lets prevent endless loops when there - are no potential candidates in the list! */ - - if (iS > 0) /* forward ? */ - { - for (iX = iFrom; iX <= iTo; iX += iS) - { - pImage = mng_find_imageobject (pData, (mng_uint16)iX); - - if (pImage) /* object exists ? */ - { - if (iFound) /* already found a candidate ? */ - pImage->bVisible = MNG_FALSE; - else - if (iTrigger) /* found the trigger ? */ - { - pImage->bVisible = MNG_TRUE; - iFound = iX; - pFound = pImage; - } - else - if (pImage->bVisible) /* ok, this is the trigger */ - { - pImage->bVisible = MNG_FALSE; - iTrigger = iX; - } - } - } - } - else - { - for (iX = iFrom; iX >= iTo; iX += iS) - { - pImage = mng_find_imageobject (pData, (mng_uint16)iX); - - if (pImage) /* object exists ? */ - { - if (iFound) /* already found a candidate ? */ - pImage->bVisible = MNG_FALSE; - else - if (iTrigger) /* found the trigger ? */ - { - pImage->bVisible = MNG_TRUE; - iFound = iX; - pFound = pImage; - } - else - if (pImage->bVisible) /* ok, this is the trigger */ - { - pImage->bVisible = MNG_FALSE; - iTrigger = iX; - } - } - } - } - - if (!iTrigger) /* did not find a trigger ? */ - iTrigger = 1; /* then fake it so the first image - gets nominated */ - } /* cycle back to beginning ? */ - while ((iPass < 2) && (iTrigger) && (!iFound)); - - pData->iBreakpoint = 0; /* just a sanity precaution */ - /* display it ? */ - if ((pData->iSHOWmode == 6) && (pFound)) - { - mng_display_image (pData, pFound, MNG_FALSE); - - if (pData->bTimerset) /* timer set ? */ - { - pData->iBreakpoint = 3; - pData->iSHOWnextid = iFound; /* save it for after the break */ - } - } - } - else - { - do - { - pImage = mng_find_imageobject (pData, iX); - - if (pImage) /* object exists ? */ - { - if (pData->iBreakpoint) /* did we get broken last time ? */ - { /* could only happen in the display routine */ - mng_display_image (pData, pImage, MNG_FALSE); - pData->iBreakpoint = 0; /* only once inside this loop please ! */ - } - else - { - switch (pData->iSHOWmode) /* do what ? */ - { - case 0 : { - pImage->bVisible = MNG_TRUE; - mng_display_image (pData, pImage, MNG_FALSE); - break; - } - case 1 : { - pImage->bVisible = MNG_FALSE; - break; - } - case 2 : { - if (pImage->bVisible) - mng_display_image (pData, pImage, MNG_FALSE); - break; - } - case 3 : { - pImage->bVisible = MNG_TRUE; - break; - } - case 4 : { - pImage->bVisible = (mng_bool)(!pImage->bVisible); - if (pImage->bVisible) - mng_display_image (pData, pImage, MNG_FALSE); - break; - } - case 5 : { - pImage->bVisible = (mng_bool)(!pImage->bVisible); - } - } - } - } - - if (!pData->bTimerset) /* next ? */ - iX += iS; - - } /* continue ? */ - while ((!pData->bTimerset) && (((iS > 0) && (iX <= iTo)) || - ((iS < 0) && (iX >= iTo)) )); - - if (pData->bTimerset) /* timer set ? */ - { - pData->iBreakpoint = 4; - pData->iSHOWnextid = iX; /* save for next time */ - } - else - pData->iBreakpoint = 0; - - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_display_save (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_START); -#endif - - iRetcode = save_state (pData); /* save the current state */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_display_seek (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DYNAMICMNG - if (pData->bStopafterseek) /* need to stop after this SEEK ? */ - { - pData->bFreezing = MNG_TRUE; /* stop processing on this one */ - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->bNeedrefresh = MNG_TRUE; /* make sure the last bit is displayed ! */ - } - else -#endif - { /* restore the initial or SAVE state */ - mng_retcode iRetcode = restore_state (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_DYNAMICMNG - /* stop after next SEEK ? */ - if ((pData->bDynamic) || (pData->bRunningevent)) - pData->bStopafterseek = MNG_TRUE; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_jhdr (mng_datap pData) -{ /* address the current "object" if any */ - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_START); -#endif - - if (!pData->bHasDHDR) - { - pData->fInitrowproc = MNG_NULL; /* do nothing by default */ - pData->fDisplayrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - pData->fStorerow2 = MNG_NULL; - pData->fStorerow3 = MNG_NULL; - - pData->pStoreobj = MNG_NULL; /* initialize important work-parms */ - - pData->iJPEGrow = 0; - pData->iJPEGalpharow = 0; - pData->iJPEGrgbrow = 0; - pData->iRowmax = 0; /* so init_rowproc does the right thing ! */ - } - - if (!pData->iBreakpoint) /* not previously broken ? */ - { -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* delta-image ? */ - { - if (pData->iDeltatype == MNG_DELTATYPE_REPLACE) - { - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pDeltaImage, - pData->iDatawidth, pData->iDataheight, - pData->iJHDRimgbitdepth, pData->iJHDRcolortype, - pData->iJHDRalphacompression, pData->iJHDRalphafilter, - pData->iJHDRalphainterlace, MNG_TRUE); - - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth; - - } - else -#endif /* MNG_NO_DELTA_PNG */ - { - if (pImage) /* update object buffer ? */ - { - iRetcode = mng_reset_object_details (pData, pImage, - pData->iDatawidth, pData->iDataheight, - pData->iJHDRimgbitdepth, pData->iJHDRcolortype, - pData->iJHDRalphacompression, pData->iJHDRalphafilter, - pData->iJHDRalphainterlace, MNG_TRUE); - - pImage->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth; - pImage->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression; - pImage->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace; - pImage->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - else /* update object 0 */ - { - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iJHDRimgbitdepth, pData->iJHDRcolortype, - pData->iJHDRalphacompression, pData->iJHDRalphafilter, - pData->iJHDRalphainterlace, MNG_TRUE); - - ((mng_imagep)pData->pObjzero)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth; - ((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression; - ((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace; - ((mng_imagep)pData->pObjzero)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (!pData->bHasDHDR) - { /* we're always storing a JPEG */ - if (pImage) /* real object ? */ - pData->pStoreobj = pImage; /* tell the row routines */ - else /* otherwise use object 0 */ - pData->pStoreobj = pData->pObjzero; - /* display "on-the-fly" ? */ - if ( -#ifndef MNG_SKIPCHUNK_MAGN - ( ((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) && - ( ((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) && -#endif - ( (pData->eImagetype == mng_it_jng ) || - (((mng_imagep)pData->pStoreobj)->bVisible) ) ) - { - next_layer (pData); /* that's a new layer then ! */ - - pData->iBreakpoint = 0; - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 7; - else - if (pData->bRunning) /* still running ? */ - { /* anything to display ? */ - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - { - set_display_routine (pData); /* then determine display routine */ - /* display from the object we store in */ - pData->pRetrieveobj = pData->pStoreobj; - } - } - } - } - - if (!pData->bTimerset) /* no timer break ? */ - { /* default row initialization ! */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->ePng_imgtype=png_none; -#endif - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - - if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_REPLACE)) - { /* 8-bit JPEG ? */ - if (pData->iJHDRimgbitdepth == 8) - { /* intermediate row is 8-bit deep */ - pData->bIsRGBA16 = MNG_FALSE; - pData->iRowsamples = pData->iDatawidth; - - switch (pData->iJHDRcolortype) /* determine pixel processing routines */ - { - case MNG_COLORTYPE_JPEGGRAY : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_g8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - pData->bIsOpaque = MNG_TRUE; - break; - } - case MNG_COLORTYPE_JPEGCOLOR : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_rgb8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - pData->bIsOpaque = MNG_TRUE; - break; - } - case MNG_COLORTYPE_JPEGGRAYA : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_ga8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - pData->bIsOpaque = MNG_FALSE; - break; - } - case MNG_COLORTYPE_JPEGCOLORA : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_rgba8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - pData->bIsOpaque = MNG_FALSE; - break; - } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - - /* TODO: 12-bit JPEG */ - /* TODO: 8- + 12-bit JPEG (eg. type=20) */ - - } -#endif - /* possible IDAT alpha-channel ? */ - if (pData->iJHDRalphacompression == MNG_COMPRESSION_DEFLATE) - { - /* determine alpha processing routine */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; -#endif - switch (pData->iJHDRalphabitdepth) - { -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a1_ni; break; } - case 2 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a2_ni; break; } - case 4 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a4_ni; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a8_ni; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a16_ni; break; } -#endif -#else -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->ePng_imgtype = png_jpeg_a1; break; } - case 2 : { pData->ePng_imgtype = png_jpeg_a2; break; } - case 4 : { pData->ePng_imgtype = png_jpeg_a4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->ePng_imgtype = png_jpeg_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->ePng_imgtype = png_jpeg_a16; break; } -#endif -#endif - } - } - else /* possible JDAA alpha-channel ? */ - if (pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG) - { /* 8-bit JPEG ? */ - if (pData->iJHDRimgbitdepth == 8) - { - if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) - pData->fStorerow3 = (mng_fptr)mng_store_jpeg_g8_alpha; - else - if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) - pData->fStorerow3 = (mng_fptr)mng_store_jpeg_rgb8_alpha; - } - else - { - /* TODO: 12-bit JPEG with 8-bit JDAA */ - } - } - /* initialize JPEG library */ - iRetcode = mngjpeg_initialize (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* must be alpha add/replace !! */ - if ((pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAADD ) && - (pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - MNG_ERROR (pData, MNG_INVDELTATYPE); - /* determine alpha processing routine */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; -#endif - switch (pData->iJHDRalphabitdepth) - { -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; break; } - case 2 : { pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; break; } - case 4 : { pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; break; } -#endif -#else -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->ePng_imgtype = png_jpeg_a1; break; } - case 2 : { pData->ePng_imgtype = png_jpeg_a2; break; } - case 4 : { pData->ePng_imgtype = png_jpeg_a4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->ePng_imgtype = png_jpeg_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->ePng_imgtype = png_jpeg_a16; break; } -#endif -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - } - } - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iJHDRalphafilter == 0xC0) - { - if (pData->iJHDRalphabitdepth <= 8) - pData->iFilterofs = 1; - else - pData->iFilterofs = 2; - - } -#endif -#ifdef FILTER193 /* no adaptive filtering ? */ - if (pData->iJHDRalphafilter == 0xC1) - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_jdaa (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_process_display_jdaa (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_START); -#endif - - if (!pData->bJPEGdecompress2) /* if we're not decompressing already */ - { - if (pData->fInitrowproc) /* initialize row-processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - pData->fInitrowproc = MNG_NULL; /* only call this once !!! */ - } - - if (!iRetcode) /* initialize decompress */ - iRetcode = mngjpeg_decompressinit2 (pData); - } - - if (!iRetcode) /* all ok? then decompress, my man */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mngjpeg_decompressdata2 (pData, iRawlen, pRawdata); -#else - iRetcode = mngjpeg_decompressdata2 (pData, pData->iRawlen, pData->pRawdata); -#endif - - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_jdat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_process_display_jdat (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_START); -#endif - - if (pData->bRestorebkgd) /* need to restore the background ? */ - { - pData->bRestorebkgd = MNG_FALSE; - iRetcode = load_bkgdlayer (pData); - - pData->iLayerseq++; /* and it counts as a layer then ! */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (!pData->bJPEGdecompress) /* if we're not decompressing already */ - { - if (pData->fInitrowproc) /* initialize row-processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - pData->fInitrowproc = MNG_NULL; /* only call this once !!! */ - } - - if (!iRetcode) /* initialize decompress */ - iRetcode = mngjpeg_decompressinit (pData); - } - - if (!iRetcode) /* all ok? then decompress, my man */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mngjpeg_decompressdata (pData, iRawlen, pRawdata); -#else - iRetcode = mngjpeg_decompressdata (pData, pData->iRawlen, pData->pRawdata); -#endif - - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky) -#else -mng_retcode mng_process_display_dhdr (mng_datap pData) -#endif -{ - mng_imagep pImage; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_START); -#endif - - pData->fInitrowproc = MNG_NULL; /* do nothing by default */ - pData->fDisplayrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->pStoreobj = MNG_NULL; - - pData->fDeltagetrow = MNG_NULL; - pData->fDeltaaddrow = MNG_NULL; - pData->fDeltareplacerow = MNG_NULL; - pData->fDeltaputrow = MNG_NULL; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage = mng_find_imageobject (pData, iObjectid); -#else - pImage = mng_find_imageobject (pData, pData->iDHDRobjectid); -#endif - - if (pImage) /* object exists ? */ - { - if (pImage->pImgbuf->bConcrete) /* is it concrete ? */ - { /* previous magnification to be done ? */ -#ifndef MNG_SKIPCHUNK_MAGN - if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY)) - { - iRetcode = mng_magnify_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - /* save delta fields */ - pData->pDeltaImage = (mng_ptr)pImage; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iDeltaImagetype = iImagetype; - pData->iDeltatype = iDeltatype; - pData->iDeltaBlockwidth = iBlockwidth; - pData->iDeltaBlockheight = iBlockheight; - pData->iDeltaBlockx = iBlockx; - pData->iDeltaBlocky = iBlocky; -#else - pData->iDeltaImagetype = pData->iDHDRimagetype; - pData->iDeltatype = pData->iDHDRdeltatype; - pData->iDeltaBlockwidth = pData->iDHDRblockwidth; - pData->iDeltaBlockheight = pData->iDHDRblockheight; - pData->iDeltaBlockx = pData->iDHDRblockx; - pData->iDeltaBlocky = pData->iDHDRblocky; -#endif - /* restore target-object fields */ - pData->iDatawidth = pImage->pImgbuf->iWidth; - pData->iDataheight = pImage->pImgbuf->iHeight; - pData->iBitdepth = pImage->pImgbuf->iBitdepth; - pData->iColortype = pImage->pImgbuf->iColortype; - pData->iCompression = pImage->pImgbuf->iCompression; - pData->iFilter = pImage->pImgbuf->iFilter; - pData->iInterlace = pImage->pImgbuf->iInterlace; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; - else - if ((iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iAlphasampledepth; - else - if ((iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; -#else - if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; - else - if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iAlphasampledepth; - else - if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; -#endif - -#ifdef MNG_INCLUDE_JNG - pData->iJHDRimgbitdepth = pImage->pImgbuf->iBitdepth; - pData->iJHDRcolortype = pImage->pImgbuf->iColortype; - pData->iJHDRimgcompression = pImage->pImgbuf->iJHDRcompression; - pData->iJHDRimginterlace = pImage->pImgbuf->iJHDRinterlace; - pData->iJHDRalphacompression = pImage->pImgbuf->iCompression; - pData->iJHDRalphafilter = pImage->pImgbuf->iFilter; - pData->iJHDRalphainterlace = pImage->pImgbuf->iInterlace; - pData->iJHDRalphabitdepth = pImage->pImgbuf->iAlphabitdepth; -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - /* block size specified ? */ - if (iDeltatype != MNG_DELTATYPE_NOCHANGE) - { /* block entirely within target ? */ - if (iDeltatype != MNG_DELTATYPE_REPLACE) - { - if (((iBlockx + iBlockwidth ) > pData->iDatawidth ) || - ((iBlocky + iBlockheight) > pData->iDataheight) ) - MNG_ERROR (pData, MNG_INVALIDBLOCK); - } - - pData->iDatawidth = iBlockwidth; - pData->iDataheight = iBlockheight; - } -#else - /* block size specified ? */ - if (pData->iDHDRdeltatype != MNG_DELTATYPE_NOCHANGE) - { /* block entirely within target ? */ - if (pData->iDHDRdeltatype != MNG_DELTATYPE_REPLACE) - { - if (((pData->iDHDRblockx + pData->iDHDRblockwidth ) > pData->iDatawidth ) || - ((pData->iDHDRblocky + pData->iDHDRblockheight) > pData->iDataheight) ) - MNG_ERROR (pData, MNG_INVALIDBLOCK); - } - - pData->iDatawidth = pData->iDHDRblockwidth; - pData->iDataheight = pData->iDHDRblockheight; - } -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iDeltatype) /* determine nr of delta-channels */ -#else - switch (pData->iDHDRdeltatype) /* determine nr of delta-channels */ -#endif - { - case MNG_DELTATYPE_BLOCKALPHAADD : ; - case MNG_DELTATYPE_BLOCKALPHAREPLACE : - { -#ifdef MNG_INCLUDE_JNG - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) - { - pData->iColortype = MNG_COLORTYPE_GRAY; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY; - } - else - if ((pData->iColortype == MNG_COLORTYPE_RGBA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - pData->iColortype = MNG_COLORTYPE_GRAY; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY; - } -#else - if (pData->iColortype == MNG_COLORTYPE_GRAYA) - pData->iColortype = MNG_COLORTYPE_GRAY; - else - if (pData->iColortype == MNG_COLORTYPE_RGBA) - pData->iColortype = MNG_COLORTYPE_GRAY; -#endif - else /* target has no alpha; that sucks! */ - MNG_ERROR (pData, MNG_TARGETNOALPHA); - - break; - } - - case MNG_DELTATYPE_BLOCKCOLORADD : ; - case MNG_DELTATYPE_BLOCKCOLORREPLACE : - { -#ifdef MNG_INCLUDE_JNG - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) - { - pData->iColortype = MNG_COLORTYPE_GRAY; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY; - } - else - if ((pData->iColortype == MNG_COLORTYPE_RGBA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - pData->iColortype = MNG_COLORTYPE_RGB; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGCOLOR; - } -#else - if (pData->iColortype == MNG_COLORTYPE_GRAYA) - pData->iColortype = MNG_COLORTYPE_GRAY; - else - if (pData->iColortype == MNG_COLORTYPE_RGBA) - pData->iColortype = MNG_COLORTYPE_RGB; -#endif - else /* target has no alpha; that sucks! */ - MNG_ERROR (pData, MNG_TARGETNOALPHA); - - break; - } - - } - /* full image replace ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iDeltatype == MNG_DELTATYPE_REPLACE) -#else - if (pData->iDHDRdeltatype == MNG_DELTATYPE_REPLACE) -#endif - { - iRetcode = mng_reset_object_details (pData, pImage, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_FALSE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->pStoreobj = pImage; /* and store straight into this object */ - } - else - { - mng_imagedatap pBufzero, pBuf; - /* we store in object 0 and process it later */ - pData->pStoreobj = pData->pObjzero; - /* make sure to initialize object 0 then */ - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pBuf = pImage->pImgbuf; /* copy possible palette & cheap transparency */ - pBufzero = ((mng_imagep)pData->pObjzero)->pImgbuf; - - pBufzero->bHasPLTE = pBuf->bHasPLTE; - pBufzero->bHasTRNS = pBuf->bHasTRNS; - - if (pBufzero->bHasPLTE) /* copy palette ? */ - { - mng_uint32 iX; - - pBufzero->iPLTEcount = pBuf->iPLTEcount; - - for (iX = 0; iX < pBuf->iPLTEcount; iX++) - { - pBufzero->aPLTEentries [iX].iRed = pBuf->aPLTEentries [iX].iRed; - pBufzero->aPLTEentries [iX].iGreen = pBuf->aPLTEentries [iX].iGreen; - pBufzero->aPLTEentries [iX].iBlue = pBuf->aPLTEentries [iX].iBlue; - } - } - - if (pBufzero->bHasTRNS) /* copy cheap transparency ? */ - { - pBufzero->iTRNSgray = pBuf->iTRNSgray; - pBufzero->iTRNSred = pBuf->iTRNSred; - pBufzero->iTRNSgreen = pBuf->iTRNSgreen; - pBufzero->iTRNSblue = pBuf->iTRNSblue; - pBufzero->iTRNScount = pBuf->iTRNScount; - - MNG_COPY (pBufzero->aTRNSentries, pBuf->aTRNSentries, - sizeof (pBufzero->aTRNSentries)); - } - /* process immediately if bitdepth & colortype are equal */ - pData->bDeltaimmediate = - (mng_bool)((pData->bDisplaying) && (!pData->bSkipping) && - ((pData->bRunning) || (pData->bSearching)) && - (pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) && - (pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) ); - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype = mng_png_imgtype (pData->iColortype, pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - } - else - MNG_ERROR (pData, MNG_OBJNOTCONCRETE); - - } - else - MNG_ERROR (pData, MNG_OBJECTUNKNOWN); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype) -#else -mng_retcode mng_process_display_prom (mng_datap pData) -#endif -{ - mng_imagep pImage; - mng_imagedatap pBuf; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_START); -#endif - - if (!pData->pDeltaImage) /* gotta have this now! */ - MNG_ERROR (pData, MNG_INVALIDDELTA); - - pImage = (mng_imagep)pData->pDeltaImage; - pBuf = pImage->pImgbuf; - /* can't demote bitdepth! */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iBitdepth < pBuf->iBitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ( ((pBuf->iColortype == MNG_COLORTYPE_GRAY ) && - (iColortype != MNG_COLORTYPE_GRAY ) && - (iColortype != MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGBA ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || -#ifdef MNG_INCLUDE_JNG - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY ) && - (iColortype != MNG_COLORTYPE_JPEGGRAY ) && - (iColortype != MNG_COLORTYPE_JPEGCOLOR ) && - (iColortype != MNG_COLORTYPE_JPEGGRAYA ) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR ) && - (iColortype != MNG_COLORTYPE_JPEGCOLOR ) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA ) && - (iColortype != MNG_COLORTYPE_JPEGGRAYA ) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || -#endif - ((pBuf->iColortype == MNG_COLORTYPE_INDEXED ) && - (iColortype != MNG_COLORTYPE_INDEXED ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - iRetcode = mng_promote_imageobject (pData, pImage, iBitdepth, iColortype, iFilltype); -#else - if (pData->iPROMbitdepth < pBuf->iBitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ( ((pBuf->iColortype == MNG_COLORTYPE_GRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_GRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_GRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_GRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_GRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGBA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || -#ifdef MNG_INCLUDE_JNG - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || -#endif - ((pBuf->iColortype == MNG_COLORTYPE_INDEXED ) && - (pData->iPROMcolortype != MNG_COLORTYPE_INDEXED ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - iRetcode = mng_promote_imageobject (pData, pImage, pData->iPROMbitdepth, - pData->iPROMcolortype, pData->iPROMfilltype); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_display_ipng (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_START); -#endif - /* indicate it for what it is now */ - pData->iDeltaImagetype = MNG_IMAGETYPE_PNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_ijng (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_START); -#endif - /* indicate it for what it is now */ - pData->iDeltaImagetype = MNG_IMAGETYPE_JNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries) -#else -mng_retcode mng_process_display_pplt (mng_datap pData) -#endif -{ - mng_uint32 iX; - mng_imagep pImage = (mng_imagep)pData->pObjzero; - mng_imagedatap pBuf = pImage->pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iX = iCount; -#else - iX = pData->iPPLTcount; -#endif -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iType) -#else - switch (pData->iPPLTtype) -#endif - { - case MNG_DELTATYPE_REPLACERGB : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue; - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = pData->paPPLTindexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = pData->paPPLTindexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = pData->paPPLTindexentries [iX].iBlue; - } -#endif - } - - break; - } - case MNG_DELTATYPE_DELTARGB : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - paIndexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - paIndexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - paIndexentries [iX].iBlue ); - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - pData->paPPLTindexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - pData->paPPLTindexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - pData->paPPLTindexentries [iX].iBlue ); - } -#endif - } - - break; - } - case MNG_DELTATYPE_REPLACEALPHA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - pBuf->aTRNSentries [iX] = paAlphaentries [iX]; - } -#else - if (pData->paPPLTusedentries [iX]) - pBuf->aTRNSentries [iX] = pData->paPPLTalphaentries [iX]; - } -#endif - - break; - } - case MNG_DELTATYPE_DELTAALPHA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - paAlphaentries [iX]); -#else - if (pData->paPPLTusedentries [iX]) - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - pData->paPPLTalphaentries [iX]); -#endif - } - - break; - } - case MNG_DELTATYPE_REPLACERGBA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue; - pBuf->aTRNSentries [iX] = paAlphaentries [iX]; - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = pData->paPPLTindexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = pData->paPPLTindexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = pData->paPPLTindexentries [iX].iBlue; - pBuf->aTRNSentries [iX] = pData->paPPLTalphaentries [iX]; - } -#endif - } - - break; - } - case MNG_DELTATYPE_DELTARGBA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - paIndexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - paIndexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - paIndexentries [iX].iBlue ); - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - paAlphaentries [iX]); - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - pData->paPPLTindexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - pData->paPPLTindexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - pData->paPPLTindexentries [iX].iBlue ); - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - pData->paPPLTalphaentries [iX]); - } -#endif - } - - break; - } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((iType != MNG_DELTATYPE_REPLACERGB) && (iType != MNG_DELTATYPE_DELTARGB)) -#else - if ((pData->iPPLTtype != MNG_DELTATYPE_REPLACERGB) && - (pData->iPPLTtype != MNG_DELTATYPE_DELTARGB ) ) -#endif - { - if (pBuf->bHasTRNS) - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iCount > pBuf->iTRNScount) - pBuf->iTRNScount = iCount; -#else - if (pData->iPPLTcount > pBuf->iTRNScount) - pBuf->iTRNScount = pData->iPPLTcount; -#endif - } - else - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->iTRNScount = iCount; - pBuf->bHasTRNS = MNG_TRUE; -#else - pBuf->iTRNScount = pData->iPPLTcount; - pBuf->bHasTRNS = MNG_TRUE; -#endif - } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((iType != MNG_DELTATYPE_REPLACEALPHA) && (iType != MNG_DELTATYPE_DELTAALPHA)) -#else - if ((pData->iPPLTtype != MNG_DELTATYPE_REPLACEALPHA) && - (pData->iPPLTtype != MNG_DELTATYPE_DELTAALPHA ) ) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iCount > pBuf->iPLTEcount) - pBuf->iPLTEcount = iCount; -#else - if (pData->iPPLTcount > pBuf->iPLTEcount) - pBuf->iPLTEcount = pData->iPPLTcount; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY) -#else -mng_retcode mng_process_display_magn (mng_datap pData) -#endif -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START); -#endif - /* iterate the object-ids */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = iFirstid; iX <= iLastid; iX++) -#else - for (iX = pData->iMAGNfirstid; iX <= pData->iMAGNlastid; iX++) -#endif - { - if (iX == 0) /* process object 0 ? */ - { - pImage = (mng_imagep)pData->pObjzero; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iMAGN_MethodX = iMethodX; - pImage->iMAGN_MethodY = iMethodY; - pImage->iMAGN_MX = iMX; - pImage->iMAGN_MY = iMY; - pImage->iMAGN_ML = iML; - pImage->iMAGN_MR = iMR; - pImage->iMAGN_MT = iMT; - pImage->iMAGN_MB = iMB; -#else - pImage->iMAGN_MethodX = pData->iMAGNmethodX; - pImage->iMAGN_MethodY = pData->iMAGNmethodY; - pImage->iMAGN_MX = pData->iMAGNmX; - pImage->iMAGN_MY = pData->iMAGNmY; - pImage->iMAGN_ML = pData->iMAGNmL; - pImage->iMAGN_MR = pData->iMAGNmR; - pImage->iMAGN_MT = pData->iMAGNmT; - pImage->iMAGN_MB = pData->iMAGNmB; -#endif - } - else - { - pImage = mng_find_imageobject (pData, iX); - /* object exists & is not frozen ? */ - if ((pImage) && (!pImage->bFrozen)) - { /* previous magnification to be done ? */ - if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY)) - { - mng_retcode iRetcode = mng_magnify_imageobject (pData, pImage); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iMAGN_MethodX = iMethodX; - pImage->iMAGN_MethodY = iMethodY; - pImage->iMAGN_MX = iMX; - pImage->iMAGN_MY = iMY; - pImage->iMAGN_ML = iML; - pImage->iMAGN_MR = iMR; - pImage->iMAGN_MT = iMT; - pImage->iMAGN_MB = iMB; -#else - pImage->iMAGN_MethodX = pData->iMAGNmethodX; - pImage->iMAGN_MethodY = pData->iMAGNmethodY; - pImage->iMAGN_MX = pData->iMAGNmX; - pImage->iMAGN_MY = pData->iMAGNmY; - pImage->iMAGN_ML = pData->iMAGNmL; - pImage->iMAGN_MR = pData->iMAGNmR; - pImage->iMAGN_MT = pData->iMAGNmT; - pImage->iMAGN_MB = pData->iMAGNmB; -#endif - } - } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iMAGNfromid = iFirstid; - pData->iMAGNtoid = iLastid; - iX = iFirstid; -#else - pData->iMAGNfromid = pData->iMAGNfirstid; - pData->iMAGNtoid = pData->iMAGNlastid; - iX = pData->iMAGNfirstid; -#endif - /* iterate again for showing */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - while ((iX <= iLastid) && (!pData->bTimerset)) -#else - while ((iX <= pData->iMAGNlastid) && (!pData->bTimerset)) -#endif - { - pData->iMAGNcurrentid = iX; - - if (iX) /* only real objects ! */ - { - pImage = mng_find_imageobject (pData, iX); - /* object exists & is not frozen & - is visible & is viewable ? */ - if ((pImage) && (!pImage->bFrozen) && - (pImage->bVisible) && (pImage->bViewable)) - { - mng_retcode iRetcode = mng_display_image (pData, pImage, MNG_FALSE); - if (iRetcode) - return iRetcode; - } - } - - iX++; - } - - if (pData->bTimerset) /* broken ? */ - pData->iBreakpoint = 9; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_magn2 (mng_datap pData) -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START); -#endif - - iX = pData->iMAGNcurrentid; - /* iterate again for showing */ - while ((iX <= pData->iMAGNtoid) && (!pData->bTimerset)) - { - pData->iMAGNcurrentid = iX; - - if (iX) /* only real objects ! */ - { - pImage = mng_find_imageobject (pData, iX); - /* object exists & is not frozen & - is visible & is viewable ? */ - if ((pImage) && (!pImage->bFrozen) && - (pImage->bVisible) && (pImage->bViewable)) - { - mng_retcode iRetcode = mng_display_image (pData, pImage, MNG_FALSE); - if (iRetcode) - return iRetcode; - } - } - - iX++; - } - - if (pData->bTimerset) /* broken ? */ - pData->iBreakpoint = 9; - else - pData->iBreakpoint = 0; /* not again ! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources) -#else -mng_retcode mng_process_display_past (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_imagep pTargetimg; - mng_imagep pSourceimg; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_past_sourcep pSource = (mng_past_sourcep)pSources; -#else - mng_past_sourcep pSource = (mng_past_sourcep)pData->pPASTsources; -#endif - mng_uint32 iX = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iTargetid) /* a real destination object ? */ -#else - if (pData->iPASTtargetid) /* a real destination object ? */ -#endif - { /* let's find it then */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pTargetimg = (mng_imagep)mng_find_imageobject (pData, iTargetid); -#else - pTargetimg = (mng_imagep)mng_find_imageobject (pData, pData->iPASTtargetid); -#endif - - if (!pTargetimg) /* if it doesn't exists; do a barf */ - MNG_ERROR (pData, MNG_OBJECTUNKNOWN); - /* it's gotta be abstract !!! */ - if (pTargetimg->pImgbuf->bConcrete) - MNG_ERROR (pData, MNG_OBJNOTABSTRACT); - /* we want 32-/64-bit RGBA to play with ! */ - if ((pTargetimg->pImgbuf->iBitdepth <= MNG_BITDEPTH_8) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAY) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_RGB) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_INDEXED) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAYA) ) - iRetcode = mng_promote_imageobject (pData, pTargetimg, MNG_BITDEPTH_8, - MNG_COLORTYPE_RGBA, - MNG_FILLMETHOD_LEFTBITREPLICATE); - else - if ((pTargetimg->pImgbuf->iBitdepth > MNG_BITDEPTH_8) && - ((pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAY) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_RGB) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAYA) ) ) - iRetcode = mng_promote_imageobject (pData, pTargetimg, MNG_BITDEPTH_16, - MNG_COLORTYPE_RGBA, - MNG_FILLMETHOD_LEFTBITREPLICATE); -#ifdef MNG_INCLUDE_JNG - else - if ((pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGGRAY) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) ) - iRetcode = mng_promote_imageobject (pData, pTargetimg, - pTargetimg->pImgbuf->iBitdepth, - MNG_COLORTYPE_JPEGCOLORA, - MNG_FILLMETHOD_LEFTBITREPLICATE); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* make it really abstract ? */ - if (!pTargetimg->pImgbuf->bCorrected) - { - iRetcode = mng_colorcorrect_object (pData, pTargetimg); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - else - { /* pasting into object 0 !!! */ - pTargetimg = (mng_imagep)pData->pObjzero; - /* is it usable ??? */ - if ((pTargetimg->bClipped) && - (pTargetimg->iClipr > pTargetimg->iPosx) && - (pTargetimg->iClipb > pTargetimg->iPosy)) - { - /* make it 32-bit RGBA please !!! */ - iRetcode = mng_reset_object_details (pData, pTargetimg, - pTargetimg->iClipr - pTargetimg->iPosx, - pTargetimg->iClipb - pTargetimg->iPosy, - MNG_BITDEPTH_8, MNG_COLORTYPE_RGBA, - 0, 0, 0, MNG_FALSE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - pTargetimg = MNG_NULL; /* clipped beyond visibility ! */ - } - - if (pTargetimg) /* usable destination ? */ - { - mng_int32 iSourceY; - mng_int32 iSourceYinc; - mng_int32 iSourcerowsize; - mng_int32 iSourcesamples; - mng_bool bSourceRGBA16; - mng_int32 iTargetY; - mng_int32 iTargetrowsize; - mng_int32 iTargetsamples; - mng_bool bTargetRGBA16 = MNG_FALSE; - mng_int32 iTemprowsize; - mng_imagedatap pBuf; -#ifndef MNG_SKIPCHUNK_MAGN - /* needs magnification ? */ - if ((pTargetimg->iMAGN_MethodX) || (pTargetimg->iMAGN_MethodY)) - iRetcode = mng_magnify_imageobject (pData, pTargetimg); -#endif - - if (!iRetcode) /* still ok ? */ - { - bTargetRGBA16 = (mng_bool)(pTargetimg->pImgbuf->iBitdepth > 8); - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iTargettype) /* determine target x/y */ -#else - switch (pData->iPASTtargettype) /* determine target x/y */ -#endif - { - case 0 : { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPastx = iTargetx; - pData->iPasty = iTargety; -#else - pData->iPastx = pData->iPASTtargetx; - pData->iPasty = pData->iPASTtargety; -#endif - break; - } - - case 1 : { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPastx = pTargetimg->iPastx + iTargetx; - pData->iPasty = pTargetimg->iPasty + iTargety; -#else - pData->iPastx = pTargetimg->iPastx + pData->iPASTtargetx; - pData->iPasty = pTargetimg->iPasty + pData->iPASTtargety; -#endif - break; - } - - case 2 : { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPastx += iTargetx; - pData->iPasty += iTargety; -#else - pData->iPastx += pData->iPASTtargetx; - pData->iPasty += pData->iPASTtargety; -#endif - break; - } - } - /* save for next time ... */ - pTargetimg->iPastx = pData->iPastx; - pTargetimg->iPasty = pData->iPasty; - /* address destination for row-routines */ - pData->pStoreobj = (mng_objectp)pTargetimg; - pData->pStorebuf = (mng_objectp)pTargetimg->pImgbuf; - } - /* process the sources one by one */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - while ((!iRetcode) && (iX < iCount)) -#else - while ((!iRetcode) && (iX < pData->iPASTcount)) -#endif - { /* find the little bastards first */ - pSourceimg = (mng_imagep)mng_find_imageobject (pData, pSource->iSourceid); - /* exists and viewable? */ - if ((pSourceimg) && (pSourceimg->bViewable)) - { /* needs magnification ? */ -#ifndef MNG_SKIPCHUNK_MAGN - if ((pSourceimg->iMAGN_MethodX) || (pSourceimg->iMAGN_MethodY)) - iRetcode = mng_magnify_imageobject (pData, pSourceimg); -#endif - - if (!iRetcode) /* still ok ? */ - { - pBuf = (mng_imagedatap)pSourceimg->pImgbuf; - /* address source for row-routines */ - pData->pRetrieveobj = (mng_objectp)pSourceimg; - - pData->iPass = -1; /* init row-processing variables */ - pData->iRowinc = 1; - pData->iColinc = 1; - pData->iPixelofs = 0; - iSourcesamples = (mng_int32)pBuf->iWidth; - iSourcerowsize = pBuf->iRowsize; - bSourceRGBA16 = (mng_bool)(pBuf->iBitdepth > 8); - /* make sure the delta-routines do the right thing */ - pData->iDeltatype = MNG_DELTATYPE_BLOCKPIXELREPLACE; - - switch (pBuf->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS); - break; - } - - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS); - break; - } - - - case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8; - pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS); - break; - } - - - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - } - /* determine scaling */ -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_DELTA_PNG - if ((!bSourceRGBA16) && (bTargetRGBA16)) - pData->fScalerow = (mng_fptr)mng_scale_rgba8_rgba16; - else - if ((bSourceRGBA16) && (!bTargetRGBA16)) - pData->fScalerow = (mng_fptr)mng_scale_rgba16_rgba8; - else -#endif -#endif - pData->fScalerow = MNG_NULL; - - /* default no color-correction */ - pData->fCorrectrow = MNG_NULL; - -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - } - - if (!iRetcode) /* still ok ? */ - { - pData->fFliprow = MNG_NULL; /* no flipping or tiling by default */ - pData->fTilerow = MNG_NULL; - /* but perhaps we do have to ... */ - switch (pSource->iOrientation) - { - case 2 : ; - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fFliprow = (mng_fptr)mng_flip_rgba16; - else -#endif - pData->fFliprow = (mng_fptr)mng_flip_rgba8; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fTilerow = (mng_fptr)mng_tile_rgba16; - else -#endif - pData->fTilerow = (mng_fptr)mng_tile_rgba8; - break; - } - } - /* determine composition routine */ - /* note that we're abusing the delta-routine setup !!! */ - switch (pSource->iComposition) - { - case 0 : { /* composite over */ -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fDeltarow = (mng_fptr)mng_composeover_rgba16; - else -#endif - pData->fDeltarow = (mng_fptr)mng_composeover_rgba8; - break; - } - - case 1 : { /* replace */ -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgba16; - else -#endif - pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgba8; - break; - } - - case 2 : { /* composite under */ -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fDeltarow = (mng_fptr)mng_composeunder_rgba16; - else -#endif - pData->fDeltarow = (mng_fptr)mng_composeunder_rgba8; - break; - } - } - /* determine offsets & clipping */ - if (pSource->iOffsettype == 1) - { - pData->iDestl = pData->iPastx + pSource->iOffsetx; - pData->iDestt = pData->iPasty + pSource->iOffsety; - } - else - { - pData->iDestl = pSource->iOffsetx; - pData->iDestt = pSource->iOffsety; - } - - pData->iDestr = (mng_int32)pTargetimg->pImgbuf->iWidth; - pData->iDestb = (mng_int32)pTargetimg->pImgbuf->iHeight; - /* take the source dimension into account ? */ - if (pSource->iOrientation != 8) - { - pData->iDestr = MIN_COORD (pData->iDestr, pData->iDestl + (mng_int32)pBuf->iWidth); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iDestt + (mng_int32)pBuf->iHeight); - } - /* source clipping */ - if (pSource->iBoundarytype == 1) - { - if (pData->iDestl < pData->iPastx + pSource->iBoundaryl) - pData->iSourcel = pData->iPastx + pSource->iBoundaryl - pData->iDestl; - else - pData->iSourcel = 0; - - if (pData->iDestt < pData->iPasty + pSource->iBoundaryt) - pData->iSourcet = pData->iPasty + pSource->iBoundaryt - pData->iDestt; - else - pData->iSourcet = 0; - - pData->iDestl = MAX_COORD (pData->iDestl, pData->iPastx + pSource->iBoundaryl); - pData->iDestt = MAX_COORD (pData->iDestt, pData->iPasty + pSource->iBoundaryt); - pData->iDestr = MIN_COORD (pData->iDestr, pData->iPastx + pSource->iBoundaryr); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iPasty + pSource->iBoundaryb); - } - else - { - if (pData->iDestl < pSource->iBoundaryl) - pData->iSourcel = pSource->iBoundaryl - pData->iDestl; - else - pData->iSourcel = 0; - - if (pData->iDestt < pSource->iBoundaryt) - pData->iSourcet = pSource->iBoundaryt - pData->iDestt; - else - pData->iSourcet = 0; - - pData->iDestl = MAX_COORD (pData->iDestl, pSource->iBoundaryl); - pData->iDestt = MAX_COORD (pData->iDestt, pSource->iBoundaryt); - pData->iDestr = MIN_COORD (pData->iDestr, pSource->iBoundaryr); - pData->iDestb = MIN_COORD (pData->iDestb, pSource->iBoundaryb); - } - - if (pData->iSourcel) /* indent source ? */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) /* abuse tiling routine to shift source-pixels */ - pData->fTilerow = (mng_fptr)mng_tile_rgba16; - else -#endif - pData->fTilerow = (mng_fptr)mng_tile_rgba8; - } - /* anything to display ? */ - if ((pData->iDestl <= pData->iDestr) && (pData->iDestt <= pData->iDestb)) - { /* init variables for the loop */ - if ((pSource->iOrientation == 2) || (pSource->iOrientation == 6)) - { - iSourceY = (mng_int32)pBuf->iHeight - 1 - pData->iSourcet; - iSourceYinc = -1; - } - else - { - iSourceY = pData->iSourcet; - iSourceYinc = 1; - } - - iTargetY = pData->iDestt; - pData->iCol = pData->iDestl; - - iTargetsamples = pData->iDestr - pData->iDestl; - -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - iTargetrowsize = (iTargetsamples << 3); - else -#endif - iTargetrowsize = (iTargetsamples << 2); - - /* get temporary work-buffers */ - if (iSourcerowsize > iTargetrowsize) - iTemprowsize = iSourcerowsize << 1; - else - iTemprowsize = iTargetrowsize << 1; - MNG_ALLOC (pData, pData->pRGBArow, iTemprowsize); - MNG_ALLOC (pData, pData->pWorkrow, iTemprowsize); - - while ((!iRetcode) && (iTargetY < pData->iDestb)) - { /* get a row */ - pData->iRow = iSourceY; - pData->iRowsamples = iSourcesamples; - pData->iRowsize = iSourcerowsize; - pData->bIsRGBA16 = bSourceRGBA16; - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* scale it (if necessary) */ - if ((!iRetcode) && (pData->fScalerow)) - iRetcode = ((mng_scalerow)pData->fScalerow) (pData); - - pData->bIsRGBA16 = bTargetRGBA16; - /* color correction (if necessary) */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - /* flipping (if necessary) */ - if ((!iRetcode) && (pData->fFliprow)) - iRetcode = ((mng_fliprow)pData->fFliprow) (pData); - /* tiling (if necessary) */ - if ((!iRetcode) && (pData->fTilerow)) - iRetcode = ((mng_tilerow)pData->fTilerow) (pData); - - if (!iRetcode) /* and paste..... */ - { - pData->iRow = iTargetY; - pData->iRowsamples = iTargetsamples; - pData->iRowsize = iTargetrowsize; - iRetcode = ((mng_deltarow)pData->fDeltarow) (pData); - } - - iSourceY += iSourceYinc; /* and next line */ - - if (iSourceY < 0) - iSourceY = (mng_int32)pBuf->iHeight - 1; - else - if (iSourceY >= (mng_int32)pBuf->iHeight) - iSourceY = 0; - - iTargetY++; - } - /* drop the temporary row-buffer */ - MNG_FREEX (pData, pData->pWorkrow, iTemprowsize); - MNG_FREEX (pData, pData->pRGBArow, iTemprowsize); - } - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - if (!iRetcode) - iRetcode = mng_clear_cms (pData); -#endif - } - - pSource++; /* neeeeext */ - iX++; - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (!iTargetid) /* did we paste into object 0 ? */ -#else - if (!pData->iPASTtargetid) /* did we paste into object 0 ? */ -#endif - { /* display it then ! */ - iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* target is visible & viewable ? */ - if ((pTargetimg->bVisible) && (pTargetimg->bViewable)) - { - iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE); - if (iRetcode) - return iRetcode; - } - } - } - - if (pData->bTimerset) /* broken ? */ - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPASTid = iTargetid; -#else - pData->iPASTid = pData->iPASTtargetid; -#endif - pData->iBreakpoint = 11; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCHUNK_PAST */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_display_past2 (mng_datap pData) -{ - mng_retcode iRetcode; - mng_imagep pTargetimg; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_START); -#endif - - if (pData->iPASTid) /* a real destination object ? */ - pTargetimg = (mng_imagep)mng_find_imageobject (pData, pData->iPASTid); - else /* otherwise object 0 */ - pTargetimg = (mng_imagep)pData->pObjzero; - - iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE); - if (iRetcode) - return iRetcode; - - pData->iBreakpoint = 0; /* only once */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCHUNK_PAST */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - diff --git a/Engine/lib/lmng/libmng_display.h b/Engine/lib/lmng/libmng_display.h deleted file mode 100644 index f394dd2f6..000000000 --- a/Engine/lib/lmng/libmng_display.h +++ /dev/null @@ -1,343 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_display.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Display management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the display managament routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG support stuff * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for delta-image processing * */ -/* * - added support for PPLT chunk processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * * */ -/* * 0.9.4 - 11/24/2000 - G.Juyn * */ -/* * - moved restore of object 0 to libmng_display * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added proposed change in handling of TERM- & if-delay * */ -/* * 1.0.5 - 10/20/2002 - G.Juyn * */ -/* * - fixed display of visible target of PAST operation * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P. * */ -/* * - added some SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_display_h_ -#define _libmng_display_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_refresh (mng_datap pData, - mng_uint32 iInterval); - -/* ************************************************************************** */ - -mng_retcode mng_reset_objzero (mng_datap pData); - -mng_retcode mng_display_image (mng_datap pData, - mng_imagep pImage, - mng_bool bLayeradvanced); - -mng_retcode mng_execute_delta_image (mng_datap pData, - mng_imagep pTarget, - mng_imagep pDelta); - -/* ************************************************************************** */ - -mng_retcode mng_process_display (mng_datap pData); - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT -png_imgtype mng_png_imgtype (mng_uint8 colortype, - mng_uint8 bitdepth); -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - -mng_retcode mng_process_display_ihdr (mng_datap pData); - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -mng_retcode mng_process_display_mpng (mng_datap pData); -#endif - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -mng_retcode mng_process_display_ang (mng_datap pData); -#endif - -mng_retcode mng_process_display_idat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -mng_retcode mng_process_display_iend (mng_datap pData); -mng_retcode mng_process_display_mend (mng_datap pData); -mng_retcode mng_process_display_mend2 (mng_datap pData); -mng_retcode mng_process_display_defi (mng_datap pData); - -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode mng_process_display_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable); -#endif - -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode mng_process_display_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy); -mng_retcode mng_process_display_clon2 (mng_datap pData); -#endif - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_process_display_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds); -#endif - -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode mng_process_display_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); -mng_retcode mng_process_display_fram2 (mng_datap pData); -#endif - -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode mng_process_display_move (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey); -#endif - -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode mng_process_display_clip (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); -#endif - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode mng_process_display_show (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_display_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_display_seek (mng_datap pData); -#endif -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_jhdr (mng_datap pData); - -mng_retcode mng_process_display_jdaa (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -mng_retcode mng_process_display_jdat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_display_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky); - -mng_retcode mng_process_display_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype); - -mng_retcode mng_process_display_ipng (mng_datap pData); -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_ijng (mng_datap pData); -#endif - -mng_retcode mng_process_display_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_process_display_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY); -mng_retcode mng_process_display_magn2 (mng_datap pData); -#endif - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_display_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources); -mng_retcode mng_process_display_past2 (mng_datap pData); -#endif - -#else /* MNG_OPTIMIZE_DISPLAYCALLS */ - -mng_retcode mng_process_display_ihdr (mng_datap pData); -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -mng_retcode mng_process_display_mpng (mng_datap pData); -#endif -mng_retcode mng_process_display_idat (mng_datap pData); -mng_retcode mng_process_display_iend (mng_datap pData); -mng_retcode mng_process_display_mend (mng_datap pData); -mng_retcode mng_process_display_mend2 (mng_datap pData); -mng_retcode mng_process_display_defi (mng_datap pData); -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode mng_process_display_basi (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode mng_process_display_clon (mng_datap pData); -mng_retcode mng_process_display_clon2 (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_process_display_disc (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode mng_process_display_fram (mng_datap pData); -mng_retcode mng_process_display_fram2 (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode mng_process_display_move (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode mng_process_display_clip (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode mng_process_display_show (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_display_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_display_seek (mng_datap pData); -#endif -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_jhdr (mng_datap pData); -mng_retcode mng_process_display_jdaa (mng_datap pData); -mng_retcode mng_process_display_jdat (mng_datap pData); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_display_dhdr (mng_datap pData); -mng_retcode mng_process_display_prom (mng_datap pData); -mng_retcode mng_process_display_ipng (mng_datap pData); -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_ijng (mng_datap pData); -#endif -mng_retcode mng_process_display_pplt (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_process_display_magn (mng_datap pData); -mng_retcode mng_process_display_magn2 (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_display_past (mng_datap pData); -mng_retcode mng_process_display_past2 (mng_datap pData); -#endif - -#endif /* MNG_OPTIMIZE_DISPLAYCALLS */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_display_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_dither.c b/Engine/lib/lmng/libmng_dither.c deleted file mode 100644 index e23850cef..000000000 --- a/Engine/lib/lmng/libmng_dither.c +++ /dev/null @@ -1,58 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_dither.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Dithering routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the dithering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_dither.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -mng_retcode mng_dither_a_row (mng_datap pData, - mng_uint8p pRow) -{ - - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_dither.h b/Engine/lib/lmng/libmng_dither.h deleted file mode 100644 index d9217c0ca..000000000 --- a/Engine/lib/lmng/libmng_dither.h +++ /dev/null @@ -1,45 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_dither.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : Dithering routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the dithering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_dither_h_ -#define _libmng_dither_h_ - -/* ************************************************************************** */ - -mng_retcode mng_dither_a_row (mng_datap pData, - mng_uint8p pRow); - -/* ************************************************************************** */ - -#endif /* _libmng_dither_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_error.c b/Engine/lib/lmng/libmng_error.c deleted file mode 100644 index 3a4da2063..000000000 --- a/Engine/lib/lmng/libmng_error.c +++ /dev/null @@ -1,326 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_error.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Error routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the general error handling routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added error telltaling * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added errorstrings for delta-image processing * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added errorstring for delayed buffer-processing * */ -/* * * */ -/* * 0.9.1 - 07/06/2000 - G.Juyn * */ -/* * - added MNG_NEEDTIMERWAIT errorstring * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added NEEDSECTIONWAIT errorstring * */ -/* * - added macro + routine to set returncode without * */ -/* * calling error callback * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added errorstring for updatemngheader if not a MNG * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/09/2000 - G.Juyn * */ -/* * - added check for simplicity-bits in MHDR * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - fixed processing of unknown critical chunks * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added errorcode for delayed delta-processing * */ -/* * * */ -/* * 0.9.4 - 01/18/2001 - G.Juyn * */ -/* * - added errorcode for MAGN methods * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * * */ -/* * 1.0.5 - 07/04/2002 - G.Juyn * */ -/* * - added errorcode for extreme chunk-sizes * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - warnings are ignored by default now! * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added check for TERM placement during create/write * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - added MNG_SKIPCHUNK_CHNK, MNG_NO_DELTA_PNG reductions. * */ -/* * - skipped more code when MNG_INCLUDE_JNG is not enabled. * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditional around evNT chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed typo on SKIPCHUNK_evNT (->PAST) * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ERROR_STRINGS -MNG_LOCAL mng_error_entry const error_table [] = - { - {MNG_NOERROR, "No error"}, - {MNG_OUTOFMEMORY, "Out of memory"}, - {MNG_INVALIDHANDLE, "The handle is invalid"}, - {MNG_NOCALLBACK, "A required callback is not defined"}, - {MNG_UNEXPECTEDEOF, "Encountered unexpected end-of-file"}, - {MNG_ZLIBERROR, "zlib encountered an error"}, -#ifdef MNG_INCLUDE_JNG - {MNG_JPEGERROR, "ijgsrc6b encountered an error"}, -#endif - {MNG_LCMSERROR, "lcms encountered an error"}, - {MNG_NOOUTPUTPROFILE, "No output-profile defined for CMS"}, - {MNG_NOSRGBPROFILE, "No sRGB-profile defined for CMS"}, - {MNG_BUFOVERFLOW, "Internal buffer-overflow"}, - {MNG_FUNCTIONINVALID, "Function is invalid at this point"}, - {MNG_OUTPUTERROR, "Writing was unsuccessful; disk full?"}, - {MNG_JPEGBUFTOOSMALL, "Internal buffer for JPEG processing too small"}, - {MNG_NEEDMOREDATA, "Reading suspended; waiting for I/O to catch up"}, - {MNG_NEEDTIMERWAIT, "Timer suspension; normal animation delay"}, - {MNG_NEEDSECTIONWAIT, "SEEK suspension; application decides"}, - {MNG_LOOPWITHCACHEOFF, "LOOP encountered when playback cache is turned off"}, - - {MNG_APPIOERROR, "Application signalled I/O error"}, - {MNG_APPTIMERERROR, "Application signalled timing error"}, - {MNG_APPCMSERROR, "Application signalled CMS error"}, - {MNG_APPMISCERROR, "Application signalled an error"}, - {MNG_APPTRACEABORT, "Application signalled error during trace-callback"}, - - {MNG_INTERNALERROR, "Internal error in libmng"}, - - {MNG_INVALIDSIG, "The signature is invalid"}, - {MNG_INVALIDCRC, "The CRC for this chunk is invalid"}, - {MNG_INVALIDLENGTH, "Chunk-length is invalid"}, - {MNG_SEQUENCEERROR, "Chunk out of sequence"}, - {MNG_CHUNKNOTALLOWED, "Chunk not allowed at this point"}, - {MNG_MULTIPLEERROR, "Chunk cannot occur multiple times"}, - {MNG_PLTEMISSING, "Missing PLTE chunk"}, - {MNG_IDATMISSING, "Missing IDAT chunk(s)"}, - {MNG_CANNOTBEEMPTY, "Chunk cannot be empty"}, - {MNG_GLOBALLENGTHERR, "Global data length invalid"}, - {MNG_INVALIDBITDEPTH, "The bit_depth is invalid"}, - {MNG_INVALIDCOLORTYPE, "The color_type is invalid"}, - {MNG_INVALIDCOMPRESS, "The compression_method is invalid"}, - {MNG_INVALIDFILTER, "The filter_method or filter_type is invalid"}, - {MNG_INVALIDINTERLACE, "The interlace_method is invalid"}, - {MNG_NOTENOUGHIDAT, "There is not enough data in the IDAT chunk(s)"}, - {MNG_PLTEINDEXERROR, "Palette-index out of bounds"}, - {MNG_NULLNOTFOUND, "NULL separator not found"}, - {MNG_KEYWORDNULL, "Keyword cannot be zero-length"}, - {MNG_OBJECTUNKNOWN, "Object does not exist"}, - {MNG_OBJECTEXISTS, "Object already exists"}, - {MNG_TOOMUCHIDAT, "Too much data in IDAT chunk(s)"}, - {MNG_INVSAMPLEDEPTH, "The sample_depth is invalid"}, - {MNG_INVOFFSETSIZE, "The offset_type is invalid"}, - {MNG_INVENTRYTYPE, "The entry_type is invalid"}, - {MNG_ENDWITHNULL, "Chunk must not end with NULL byte"}, - {MNG_INVIMAGETYPE, "The image_type is invalid"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_INVDELTATYPE, "The delta_type is invalid"}, -#endif - {MNG_INVALIDINDEX, "Index-value out of bounds"}, -#ifdef MNG_INCLUDE_JNG - {MNG_TOOMUCHJDAT, "Too much data in JDAT chunk(s)"}, - {MNG_JPEGPARMSERR, "JHDR parameters & JFIF-data do not match"}, -#endif - {MNG_INVFILLMETHOD, "The fill_method is invalid"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_OBJNOTCONCRETE, "Target object for DHDR must be concrete"}, -#endif - {MNG_TARGETNOALPHA, "Target object must have alpha-channel"}, - {MNG_MNGTOOCOMPLEX, "MHDR simplicity indicates unsupported feature(s)"}, - {MNG_UNKNOWNCRITICAL, "Unknown critical chunk encountered"}, -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UNSUPPORTEDNEED, "Requested nEED resources are not supported"}, -#endif - {MNG_INVALIDDELTA, "The delta operation is invalid (mismatched color_types?)"}, - {MNG_INVALIDMETHOD, "Method is invalid"}, - {MNG_IMPROBABLELENGTH, "Chunklength is incredibly large"}, - {MNG_INVALIDBLOCK, "Delta block width and or height invalid"}, - {MNG_INVALIDEVENT, "Event type is invalid"}, - {MNG_INVALIDMASK, "Mask type is invalid"}, - {MNG_NOMATCHINGLOOP, "ENDL without matching LOOP"}, -#ifndef MNG_SKIPCHUNK_evNT - {MNG_SEEKNOTFOUND, "evNT points to unknown SEEK"}, -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_OBJNOTABSTRACT, "Destination object for PAST must be abstract"}, -#endif - {MNG_TERMSEQERROR, "TERM misplaced during creation of MNG stream"}, - {MNG_INVALIDFIELDVAL, "invalid fieldvalue (generic)"}, - {MNG_INVALIDWIDTH, "invalid frame/image width"}, - {MNG_INVALIDHEIGHT, "invalid frame/image height"}, - - {MNG_INVALIDCNVSTYLE, "Canvas_style is invalid"}, - {MNG_WRONGCHUNK, "Attempt to access the wrong chunk"}, - {MNG_INVALIDENTRYIX, "Attempt to access an non-existing entry"}, - {MNG_NOHEADER, "No valid header-chunk"}, - {MNG_NOCORRCHUNK, "Parent chunk not found"}, - {MNG_NOMHDR, "No MNG header (MHDR) found"}, - - {MNG_IMAGETOOLARGE, "Image is larger than defined maximum"}, - {MNG_NOTANANIMATION, "Image is not an animation"}, - {MNG_FRAMENRTOOHIGH, "Framenr out of bounds"}, - {MNG_LAYERNRTOOHIGH, "Layernr out of bounds"}, - {MNG_PLAYTIMETOOHIGH, "Playtime out of bounds"}, - {MNG_FNNOTIMPLEMENTED, "Function not yet implemented"}, - {MNG_IMAGEFROZEN, "Image is frozen"}, - - {MNG_LCMS_NOHANDLE, "Handle could not be initialized"}, - {MNG_LCMS_NOMEM, "No memory for gamma-table(s)"}, - {MNG_LCMS_NOTRANS, "Transformation could not be initialized"} - }; -#endif /* MNG_INCLUDE_ERROR_STRINGS */ - -/* ************************************************************************** */ - -mng_bool mng_store_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_STORE_ERROR, MNG_LC_START); -#endif - - if (pData != 0) - { - pData->iErrorcode = iError; /* save also for getlasterror */ - pData->iErrorx1 = iExtra1; - pData->iErrorx2 = iExtra2; - -#ifdef MNG_INCLUDE_ERROR_STRINGS - { /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_error_entryp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (error_table) / sizeof (error_table [0])) - 1; - - iLower = 0; /* initialize binary search */ - iMiddle = iTop >> 1; /* start in the middle */ - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (error_table [iMiddle].iError < iError) - iLower = iMiddle + 1; - else if (error_table [iMiddle].iError > iError) - iUpper = iMiddle - 1; - else - { - pEntry = &error_table [iMiddle]; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (pEntry) /* found it ? */ - pData->zErrortext = pEntry->zErrortext; - else - pData->zErrortext = "Unknown error"; - } -#else /* MNG_INCLUDE_ERROR_STRINGS */ - pData->zErrortext = 0; -#endif /* MNG_INCLUDE_ERROR_STRINGS */ - - if (iError == 0) /* no error is not severe ! */ - { - pData->iSeverity = 0; - } - else - { - switch (iError&0x3C00) /* determine the severity */ - { - case 0x0800 : { pData->iSeverity = 5; break; } - case 0x1000 : { pData->iSeverity = 2; break; } - case 0x2000 : { pData->iSeverity = 1; break; } - default : { pData->iSeverity = 9; } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_STORE_ERROR, MNG_LC_END); -#endif - - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool mng_process_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_PROCESS_ERROR, MNG_LC_START); -#endif - - mng_store_error (pData, iError, iExtra1, iExtra2); - - if ((pData != MNG_NULL) && (pData->iMagic == MNG_MAGIC)) - { - if (pData->fErrorproc) /* callback defined ? */ - return pData->fErrorproc (((mng_handle)pData), iError, pData->iSeverity, - pData->iChunkname, pData->iChunkseq, - pData->iErrorx1, pData->iErrorx2, pData->zErrortext); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_PROCESS_ERROR, MNG_LC_END); -#endif - - return MNG_TRUE; /* warnings are ignored by default ! */ -} - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_error.h b/Engine/lib/lmng/libmng_error.h deleted file mode 100644 index b49ff7330..000000000 --- a/Engine/lib/lmng/libmng_error.h +++ /dev/null @@ -1,119 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_error.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : Error functions (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the generic error-codes and functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added some errorcodes * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added some errorcodes * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added application errorcodes (used with callbacks) * */ -/* * - moved chunk-access errorcodes to severity 5 * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG errorcodes * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added error tell-tale definition * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added errorcodes for delta-image processing * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added errorcode for delayed buffer-processing * */ -/* * - moved errorcodes to "libmng.h" * */ -/* * * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added macro + routine to set returncode without * */ -/* * calling error callback * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 08/20/2002 - G.Juyn * */ -/* * - added option for soft-handling of errors * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_error_h_ -#define _libmng_error_h_ - -/* ************************************************************************** */ -/* * * */ -/* * Default error routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_bool mng_store_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2); - -mng_bool mng_process_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2); - -/* ************************************************************************** */ -/* * * */ -/* * Error handling macros * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_SOFTERRORS -#define MNG_ERROR(D,C) { if (!mng_process_error (D, C, 0, 0)) return C; } -#define MNG_ERRORZ(D,Z) { if (!mng_process_error (D, MNG_ZLIBERROR, Z, 0)) return MNG_ZLIBERROR; } -#define MNG_ERRORJ(D,J) { if (!mng_process_error (D, MNG_JPEGERROR, J, 0)) return MNG_JPEGERROR; } -#define MNG_ERRORL(D,L) { if (!mng_process_error (D, MNG_LCMSERROR, L, 0)) return MNG_LCMSERROR; } -#else -#define MNG_ERROR(D,C) { mng_process_error (D, C, 0, 0); return C; } -#define MNG_ERRORZ(D,Z) { mng_process_error (D, MNG_ZLIBERROR, Z, 0); return MNG_ZLIBERROR; } -#define MNG_ERRORJ(D,J) { mng_process_error (D, MNG_JPEGERROR, J, 0); return MNG_JPEGERROR; } -#define MNG_ERRORL(D,L) { mng_process_error (D, MNG_LCMSERROR, L, 0); return MNG_LCMSERROR; } -#endif - -#define MNG_RETURN(D,C) { mng_store_error (D, C, 0, 0); return C; } - -#define MNG_WARNING(D,C) { if (!mng_process_error (D, C, 0, 0)) return C; } - -#define MNG_VALIDHANDLE(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \ - return MNG_INVALIDHANDLE; } -#define MNG_VALIDHANDLEX(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \ - return 0; } -#define MNG_VALIDCB(D,C) { if (!((mng_datap)D)->C) \ - MNG_ERROR (((mng_datap)D), MNG_NOCALLBACK) } - -/* ************************************************************************** */ -/* * * */ -/* * Error string-table entry * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct { - mng_retcode iError; - mng_pchar zErrortext; - } mng_error_entry; -typedef mng_error_entry const * mng_error_entryp; - -/* ************************************************************************** */ - -#endif /* _libmng_error_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_filter.c b/Engine/lib/lmng/libmng_filter.c deleted file mode 100644 index ed69a7534..000000000 --- a/Engine/lib/lmng/libmng_filter.c +++ /dev/null @@ -1,978 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_filter.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Filtering routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the filtering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - reversed some loops to use decrementing counter * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_filter.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_FILTERS - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_sub (mng_datap pData) -{ - mng_uint32 iBpp; - mng_uint8p pRawx; - mng_uint8p pRawx_prev; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_SUB, MNG_LC_START); -#endif - - iBpp = pData->iFilterbpp; - pRawx = pData->pWorkrow + pData->iPixelofs + iBpp; - pRawx_prev = pData->pWorkrow + pData->iPixelofs; - - for (iX = iBpp; iX < pData->iRowsize; iX++) - { - *pRawx = (mng_uint8)(*pRawx + *pRawx_prev); - pRawx++; - pRawx_prev++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_SUB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_up (mng_datap pData) -{ - mng_uint8p pRawx; - mng_uint8p pPriorx; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_UP, MNG_LC_START); -#endif - - pRawx = pData->pWorkrow + pData->iPixelofs; - pPriorx = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif - { - *pRawx = (mng_uint8)(*pRawx + *pPriorx); - pRawx++; - pPriorx++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_UP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_average (mng_datap pData) -{ - mng_int32 iBpp; - mng_uint8p pRawx; - mng_uint8p pRawx_prev; - mng_uint8p pPriorx; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_AVERAGE, MNG_LC_START); -#endif - - iBpp = pData->iFilterbpp; - pRawx = pData->pWorkrow + pData->iPixelofs; - pPriorx = pData->pPrevrow + pData->iPixelofs; - pRawx_prev = pData->pWorkrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = iBpp - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < iBpp; iX++) -#endif - { - *pRawx = (mng_uint8)(*pRawx + ((*pPriorx) >> 1)); - pRawx++; - pPriorx++; - } - - for (iX = iBpp; iX < pData->iRowsize; iX++) - { - *pRawx = (mng_uint8)(*pRawx + ((*pRawx_prev + *pPriorx) >> 1)); - pRawx++; - pPriorx++; - pRawx_prev++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_AVERAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_paeth (mng_datap pData) -{ - mng_int32 iBpp; - mng_uint8p pRawx; - mng_uint8p pRawx_prev; - mng_uint8p pPriorx; - mng_uint8p pPriorx_prev; - mng_int32 iX; - mng_uint32 iA, iB, iC; - mng_uint32 iP; - mng_uint32 iPa, iPb, iPc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_PAETH, MNG_LC_START); -#endif - - iBpp = pData->iFilterbpp; - pRawx = pData->pWorkrow + pData->iPixelofs; - pPriorx = pData->pPrevrow + pData->iPixelofs; - pRawx_prev = pData->pWorkrow + pData->iPixelofs; - pPriorx_prev = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = iBpp - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < iBpp; iX++) -#endif - { - *pRawx = (mng_uint8)(*pRawx + *pPriorx); - - pRawx++; - pPriorx++; - } - - for (iX = iBpp; iX < pData->iRowsize; iX++) - { - iA = (mng_uint32)*pRawx_prev; - iB = (mng_uint32)*pPriorx; - iC = (mng_uint32)*pPriorx_prev; - iP = iA + iB - iC; - iPa = abs (iP - iA); - iPb = abs (iP - iB); - iPc = abs (iP - iC); - - if ((iPa <= iPb) && (iPa <= iPc)) - *pRawx = (mng_uint8)(*pRawx + iA); - else - if (iPb <= iPc) - *pRawx = (mng_uint8)(*pRawx + iB); - else - *pRawx = (mng_uint8)(*pRawx + iC); - - pRawx++; - pPriorx++; - pRawx_prev++; - pPriorx_prev++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_PAETH, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_filter_a_row (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_START); -#endif - - switch (*(pData->pWorkrow + pData->iFilterofs)) - { - case 1 : { - iRetcode = filter_sub (pData); - break; - } - case 2 : { - iRetcode = filter_up (pData); - break; - } - case 3 : { - iRetcode = filter_average (pData); - break; - } - case 4 : { - iRetcode = filter_paeth (pData); - break; - } - - default : iRetcode = MNG_INVALIDFILTER; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef FILTER192 -mng_retcode mng_init_rowdiffering (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_START); -#endif - - if (pData->iFilter == 0xC0) /* has leveling parameters ? */ - { - switch (pData->iColortype) /* salvage leveling parameters */ - { - case 0 : { /* gray */ - if (pData->iBitdepth <= 8) - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - else - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - - break; - } - case 2 : { /* rgb */ - if (pData->iBitdepth <= 8) - { - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1); - pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2); - } - else - { - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2); - pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4); - } - - break; - } - case 3 : { /* indexed */ - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - break; - } - case 4 : { /* gray+alpha */ - if (pData->iBitdepth <= 8) - { - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1); - } - else - { - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2); - } - - break; - } - case 6 : { /* rgb+alpha */ - if (pData->iBitdepth <= 8) - { - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1); - pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2); - pData->iLevel3 = (mng_uint16)*(pData->pWorkrow+3); - } - else - { - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2); - pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4); - pData->iLevel3 = mng_get_uint16 (pData->pWorkrow+6); - } - - break; - } - } - } - /* shift the entire row back in place */ - pRawi = pData->pWorkrow + pData->iFilterofs; - pRawo = pData->pWorkrow; - - for (iX = 0; iX < pData->iRowsize + pData->iPixelofs - pData->iFilterofs; iX++) - *pRawo++ = *pRawi++; - - pData->iFilterofs = 0; /* indicate so ! */ - -#ifdef FILTER193 - if (pData->iFilter == 0xC1) /* no adaptive filtering ? */ - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g1 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_START); -#endif - - if (pData->iLevel0 & 0x01) /* is it uneven level ? */ - { - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - /* just invert every bit */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif - *pRawo++ = (mng_uint8)(~(*pRawi++)); - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g2 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 4; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 2; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03); - iN = (mng_uint8)((iN << 2) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g4 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 2; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 4; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F); - iN = (mng_uint8)((iN << 4) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF); - - pRawi++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo++ = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF); - - pRawi++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgb8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF); - *pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 + - (mng_uint16)*(pRawo+1)) & 0xFF); - *(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 + - (mng_uint16)*(pRawo+1)) & 0xFF); - - pRawi += 3; - pRawo += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgb16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF); - *pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - *(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - - pRawi += 3; - pRawo += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx1 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_START); -#endif - - if (pData->iLevel0 & 0x01) /* is it uneven level ? */ - { - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - /* just invert every bit */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif - *pRawo++ = (mng_uint8)(~(*pRawi++)); - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx2 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 4; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 2; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03); - iN = (mng_uint8)((iN << 2) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx4 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 2; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 4; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F); - iN = (mng_uint8)((iN << 4) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF); - - pRawi++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_ga8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF); - *(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF); - - pRawi += 2; - pRawo += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_ga16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF); - *(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF); - - pRawi += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgba8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF); - *pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 + - (mng_uint16)*(pRawo+1)) & 0xFF); - *(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 + - (mng_uint16)*(pRawo+1)) & 0xFF); - *(pRawo+3) = (mng_uint8)(((mng_uint16)*(pRawi+3) + pData->iLevel3) & 0xFF); - - pRawi += 4; - pRawo += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgba16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF); - *pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - *(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - *(pRawo+3) = (mng_uint16)(((mng_uint32)*(pRawi+3) + (mng_uint32)pData->iLevel3) & 0xFFFF); - - pRawi += 4; - pRawo += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* FILTER192 */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_FILTERS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_filter.h b/Engine/lib/lmng/libmng_filter.h deleted file mode 100644 index 9ac9c7f99..000000000 --- a/Engine/lib/lmng/libmng_filter.h +++ /dev/null @@ -1,69 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_filter.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : Filtering routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the filtering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_filter_h_ -#define _libmng_filter_h_ - -/* ************************************************************************** */ - -mng_retcode mng_filter_a_row (mng_datap pData); - -/* ************************************************************************** */ - -#ifdef FILTER192 -mng_retcode mng_init_rowdiffering (mng_datap pData); - -mng_retcode mng_differ_g1 (mng_datap pData); -mng_retcode mng_differ_g2 (mng_datap pData); -mng_retcode mng_differ_g4 (mng_datap pData); -mng_retcode mng_differ_g8 (mng_datap pData); -mng_retcode mng_differ_g16 (mng_datap pData); -mng_retcode mng_differ_rgb8 (mng_datap pData); -mng_retcode mng_differ_rgb16 (mng_datap pData); -mng_retcode mng_differ_idx1 (mng_datap pData); -mng_retcode mng_differ_idx2 (mng_datap pData); -mng_retcode mng_differ_idx4 (mng_datap pData); -mng_retcode mng_differ_idx8 (mng_datap pData); -mng_retcode mng_differ_ga8 (mng_datap pData); -mng_retcode mng_differ_ga16 (mng_datap pData); -mng_retcode mng_differ_rgba8 (mng_datap pData); -mng_retcode mng_differ_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ - -#endif /* _libmng_filter_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_hlapi.c b/Engine/lib/lmng/libmng_hlapi.c deleted file mode 100644 index 6199d593c..000000000 --- a/Engine/lib/lmng/libmng_hlapi.c +++ /dev/null @@ -1,2995 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_hlapi.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : high-level application API (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the high-level function interface * */ -/* * for applications. * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added init of iPLTEcount * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed calling-convention definition * */ -/* * - changed status-handling of display-routines * */ -/* * - added versioning-control routines * */ -/* * - filled the write routine * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * 0.5.1 - 05/14/2000 - G.Juyn * */ -/* * - added cleanup of saved-data (SAVE/SEEK processing) * */ -/* * 0.5.1 - 05/16/2000 - G.Juyn * */ -/* * - moved the actual write_graphic functionality from here * */ -/* * to its appropriate function in the mng_write module * */ -/* * * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - cleaned up some code regarding mixed support * */ -/* * - added JNG support * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - moved init of default zlib parms here from "mng_zlib.c" * */ -/* * - added init of default IJG parms * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - fixed inconsistancy with freeing global iCCP profile * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added delta-image field initialization * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added initialization of the buffer-suspend parameter * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - added initialization of update-region for refresh * */ -/* * - added initialization of Needrefresh parameter * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - added initialization of Deltaimmediate * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added initialization of Speed * */ -/* * - added initialization of Imagelevel * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed initialization routine for new mng_handle type * */ -/* * * */ -/* * 0.9.1 - 07/06/2000 - G.Juyn * */ -/* * - changed mng_display_resume to allow to be called after * */ -/* * a suspension return with MNG_NEEDMOREDATA * */ -/* * - added returncode MNG_NEEDTIMERWAIT for timer breaks * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - implemented support for freeze/reset/resume & go_xxxx * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added support for improved timing * */ -/* * - added support for improved I/O-suspension * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed EOF processing behavior * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * - added variable for NEEDSECTIONWAIT breaks * */ -/* * - added variable for freeze & reset processing * */ -/* * 0.9.1 - 07/17/2000 - G.Juyn * */ -/* * - added error cleanup processing * */ -/* * - fixed support for mng_display_reset() * */ -/* * - fixed suspension-buffering for 32K+ chunks * */ -/* * * */ -/* * 0.9.2 - 07/29/2000 - G.Juyn * */ -/* * - fixed small bugs in display processing * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - fixed wrapping of suspension parameters * */ -/* * 0.9.2 - 08/04/2000 - G.Juyn * */ -/* * - B111096 - fixed large-buffer read-suspension * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - raised initial maximum canvas size * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - fixed support for delta-images during read() / display() * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - added closestream() processing for mng_cleanup() * */ -/* * 0.9.3 - 10/27/2000 - G.Juyn * */ -/* * - fixed separate read() & display() processing * */ -/* * * */ -/* * 0.9.4 - 11/20/2000 - G.Juyn * */ -/* * - fixed unwanted repetition in mng_readdisplay() * */ -/* * 0.9.4 - 11/24/2000 - G.Juyn * */ -/* * - moved restore of object 0 to libmng_display * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 02/13/2001 - G.Juyn * */ -/* * - fixed first FRAM_MODE=4 timing problem * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn * */ -/* * - fixed bug with display_reset/display_resume (Thanks G!) * */ -/* * 1.0.1 - 04/22/2001 - G.Juyn * */ -/* * - fixed memory-leak (Thanks Gregg!) * */ -/* * 1.0.1 - 04/23/2001 - G.Juyn * */ -/* * - fixed reset_rundata to drop all objects * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 07/16/2002 - G.Juyn * */ -/* * - B581625 - large chunks fail with suspension reads * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * - completed support for condition=2 in TERM chunk * */ -/* * - added beta version function & constant * */ -/* * 1.0.5 - 10/11/2002 - G.Juyn * */ -/* * - added mng_status_dynamic to supports function * */ -/* * 1.0.5 - 11/04/2002 - G.Juyn * */ -/* * - changed FRAMECOUNT/LAYERCOUNT/PLAYTIME error to warning * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * 1.0.5 - 11/29/2002 - G.Juyn * */ -/* * - fixed goxxxxx() support for zero values * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/11/2003 - G.R-P * */ -/* * - added conditionals zlib and jpeg property accessors * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added conditionals around "mng_display_go*" and other * */ -/* * unused functions * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */ -/* * - put gamma, cms-related declarations inside #ifdef * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed zTXT -> zTXt typo * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/10/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 07/06/2004 - G.R-P * */ -/* * - defend against using undefined openstream function * */ -/* * 1.0.8 - 08/02/2004 - G.Juyn * */ -/* * - added conditional to allow easier writing of large MNG's * */ -/* * * */ -/* * 1.0.9 - 08/17/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 07/06/2005 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_chunks.h" -#include "libmng_memory.h" -#include "libmng_read.h" -#include "libmng_write.h" -#include "libmng_display.h" -#include "libmng_zlib.h" -#include "libmng_jpeg.h" -#include "libmng_cms.h" -#include "libmng_pixels.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * local routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -MNG_LOCAL mng_retcode mng_drop_objects (mng_datap pData, - mng_bool bDropaniobj) -{ - mng_objectp pObject; - mng_objectp pNext; - mng_cleanupobject fCleanup; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_START); -#endif - - pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */ - - while (pObject) /* more objects to discard ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - - pObject = pNext; /* neeeext */ - } - - pData->pFirstimgobj = MNG_NULL; /* clean this up!!! */ - pData->pLastimgobj = MNG_NULL; - - if (bDropaniobj) /* drop animation objects ? */ - { - pObject = pData->pFirstaniobj; /* get first stored animation-object (if any) */ - - while (pObject) /* more objects to discard ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - - pObject = pNext; /* neeeext */ - } - - pData->pFirstaniobj = MNG_NULL; /* clean this up!!! */ - pData->pLastaniobj = MNG_NULL; - -#ifdef MNG_SUPPORT_DYNAMICMNG - pObject = pData->pFirstevent; /* get first event-object (if any) */ - - while (pObject) /* more objects to discard ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - - pObject = pNext; /* neeeext */ - } - - pData->pFirstevent = MNG_NULL; /* clean this up!!! */ - pData->pLastevent = MNG_NULL; -#endif - } - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - if (pData->pMPNG) /* drop MPNG data (if any) */ - { - fCleanup = ((mng_object_headerp)pData->pMPNG)->fCleanup; - fCleanup (pData, pData->pMPNG); - pData->pMPNG = MNG_NULL; - } -#endif - -#ifdef MNG_INCLUDE_ANG_PROPOSAL - if (pData->pANG) /* drop ANG data (if any) */ - { - fCleanup = ((mng_object_headerp)pData->pANG)->fCleanup; - fCleanup (pData, pData->pANG); - pData->pANG = MNG_NULL; - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_retcode mng_drop_savedata (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_START); -#endif - - if (pData->pSavedata) /* sanity check */ - { /* address it more directly */ - mng_savedatap pSave = pData->pSavedata; - - if (pSave->iGlobalProfilesize) /* cleanup the profile ? */ - MNG_FREEX (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize); - /* cleanup the save structure */ - MNG_FREE (pData, pData->pSavedata, sizeof (mng_savedata)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -MNG_LOCAL mng_retcode mng_reset_rundata (mng_datap pData) -{ - mng_drop_invalid_objects (pData); /* drop invalidly stored objects */ -#ifndef MNG_SKIPCHUNK_SAVE - mng_drop_savedata (pData); /* drop stored savedata */ -#endif - mng_reset_objzero (pData); /* reset object 0 */ - /* drop stored objects (if any) */ - mng_drop_objects (pData, MNG_FALSE); - - pData->bFramedone = MNG_FALSE; - pData->iFrameseq = 0; /* reset counters & stuff */ - pData->iLayerseq = 0; - pData->iFrametime = 0; - - pData->bSkipping = MNG_FALSE; - -#ifdef MNG_SUPPORT_DYNAMICMNG - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->iEventx = 0; - pData->iEventy = 0; - pData->pLastmousemove = MNG_NULL; -#endif - - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - - pData->iRuntime = 0; - pData->iSynctime = 0; - pData->iStarttime = 0; - pData->iEndtime = 0; - pData->bRunning = MNG_FALSE; - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - pData->bSectionwait = MNG_FALSE; - pData->bFreezing = MNG_FALSE; - pData->bResetting = MNG_FALSE; - pData->bNeedrefresh = MNG_FALSE; - pData->bOnlyfirstframe = MNG_FALSE; - pData->iFramesafterTERM = 0; - - pData->iIterations = 0; - /* start of animation objects! */ - pData->pCurraniobj = MNG_NULL; - - pData->iUpdateleft = 0; /* reset region */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; - pData->iPLTEcount = 0; /* reset PLTE data */ - -#ifndef MNG_SKIPCHUNK_DEFI - pData->iDEFIobjectid = 0; /* reset DEFI data */ - pData->bDEFIhasdonotshow = MNG_FALSE; - pData->iDEFIdonotshow = 0; - pData->bDEFIhasconcrete = MNG_FALSE; - pData->iDEFIconcrete = 0; - pData->bDEFIhasloca = MNG_FALSE; - pData->iDEFIlocax = 0; - pData->iDEFIlocay = 0; - pData->bDEFIhasclip = MNG_FALSE; - pData->iDEFIclipl = 0; - pData->iDEFIclipr = 0; - pData->iDEFIclipt = 0; - pData->iDEFIclipb = 0; -#endif - -#ifndef MNG_SKIPCHUNK_BACK - pData->iBACKred = 0; /* reset BACK data */ - pData->iBACKgreen = 0; - pData->iBACKblue = 0; - pData->iBACKmandatory = 0; - pData->iBACKimageid = 0; - pData->iBACKtile = 0; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = 1; /* default global FRAM variables */ - pData->iFRAMdelay = 1; - pData->iFRAMtimeout = 0x7fffffffl; - pData->bFRAMclipping = MNG_FALSE; - pData->iFRAMclipl = 0; - pData->iFRAMclipr = 0; - pData->iFRAMclipt = 0; - pData->iFRAMclipb = 0; - - pData->iFramemode = 1; /* again for the current frame */ - pData->iFramedelay = 1; - pData->iFrametimeout = 0x7fffffffl; - pData->bFrameclipping = MNG_FALSE; - pData->iFrameclipl = 0; - pData->iFrameclipr = 0; - pData->iFrameclipt = 0; - pData->iFrameclipb = 0; - - pData->iNextdelay = 1; -#endif - -#ifndef MNG_SKIPCHUNK_SHOW - pData->iSHOWmode = 0; /* reset SHOW data */ - pData->iSHOWfromid = 0; - pData->iSHOWtoid = 0; - pData->iSHOWnextid = 0; - pData->iSHOWskip = 0; -#endif - - pData->iGlobalPLTEcount = 0; /* reset global PLTE data */ - - pData->iGlobalTRNSrawlen = 0; /* reset global tRNS data */ - - pData->iGlobalGamma = 0; /* reset global gAMA data */ - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = 0; /* reset global cHRM data */ - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; -#endif - -#ifndef MNG_SKIPCHUNK_sRGB - pData->iGlobalRendintent = 0; /* reset global sRGB data */ -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->iGlobalProfilesize) /* drop global profile (if any) */ - MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = 0; /* reset global bKGD data */ - pData->iGlobalBKGDgreen = 0; - pData->iGlobalBKGDblue = 0; -#endif -#ifndef MNG_NO_DELTA_PNG - /* reset delta-image */ - pData->pDeltaImage = MNG_NULL; - pData->iDeltaImagetype = 0; - pData->iDeltatype = 0; - pData->iDeltaBlockwidth = 0; - pData->iDeltaBlockheight = 0; - pData->iDeltaBlockx = 0; - pData->iDeltaBlocky = 0; - pData->bDeltaimmediate = MNG_FALSE; - - pData->fDeltagetrow = MNG_NULL; - pData->fDeltaaddrow = MNG_NULL; - pData->fDeltareplacerow = MNG_NULL; - pData->fDeltaputrow = MNG_NULL; - - pData->fPromoterow = MNG_NULL; - pData->fPromBitdepth = MNG_NULL; - pData->pPromBuf = MNG_NULL; - pData->iPromColortype = 0; - pData->iPromBitdepth = 0; - pData->iPromFilltype = 0; - pData->iPromWidth = 0; - pData->pPromSrc = MNG_NULL; - pData->pPromDst = MNG_NULL; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - pData->iMAGNfromid = 0; - pData->iMAGNtoid = 0; -#endif - -#ifndef MNG_SKIPCHUNK_PAST - pData->iPastx = 0; - pData->iPasty = 0; -#endif - - pData->pLastseek = MNG_NULL; - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -MNG_LOCAL void cleanup_errors (mng_datap pData) -{ - pData->iErrorcode = MNG_NOERROR; - pData->iSeverity = 0; - pData->iErrorx1 = 0; - pData->iErrorx2 = 0; - pData->zErrortext = MNG_NULL; - - return; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -MNG_LOCAL mng_retcode make_pushbuffer (mng_datap pData, - mng_ptr pPushdata, - mng_size_t iLength, - mng_bool bTakeownership, - mng_pushdatap * pPush) -{ - mng_pushdatap pTemp; - - MNG_ALLOC (pData, pTemp, sizeof(mng_pushdata)); - - pTemp->pNext = MNG_NULL; - - if (bTakeownership) /* are we going to own the buffer? */ - { /* then just copy the pointer */ - pTemp->pData = (mng_uint8p)pPushdata; - } - else - { /* otherwise create new buffer */ - MNG_ALLOCX (pData, pTemp->pData, iLength); - if (!pTemp->pData) /* succeeded? */ - { - MNG_FREEX (pData, pTemp, sizeof(mng_pushdata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* and copy the bytes across */ - MNG_COPY (pTemp->pData, pPushdata, iLength); - } - - pTemp->iLength = iLength; - pTemp->bOwned = bTakeownership; - pTemp->pDatanext = pTemp->pData; - pTemp->iRemaining = iLength; - - *pPush = pTemp; /* return it */ - - return MNG_NOERROR; /* and all's well */ -} -#endif - -#ifdef MNG_VERSION_QUERY_SUPPORT -/* ************************************************************************** */ -/* * * */ -/* * Versioning control * */ -/* * * */ -/* ************************************************************************** */ - -mng_pchar MNG_DECL mng_version_text (void) -{ - return MNG_VERSION_TEXT; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_so (void) -{ - return MNG_VERSION_SO; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_dll (void) -{ - return MNG_VERSION_DLL; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_major (void) -{ - return MNG_VERSION_MAJOR; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_minor (void) -{ - return MNG_VERSION_MINOR; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_release (void) -{ - return MNG_VERSION_RELEASE; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_version_beta (void) -{ - return MNG_VERSION_BETA; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * 'supports' function * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_FUNCQUERY -typedef struct { - mng_pchar zFunction; - mng_uint8 iMajor; /* Major == 0 means not implemented ! */ - mng_uint8 iMinor; - mng_uint8 iRelease; - } mng_func_entry; -typedef mng_func_entry const * mng_func_entryp; - -MNG_LOCAL mng_func_entry const func_table [] = - { /* keep it alphabetically sorted !!!!! */ - {"mng_cleanup", 1, 0, 0}, - {"mng_copy_chunk", 1, 0, 5}, - {"mng_create", 1, 0, 0}, - {"mng_display", 1, 0, 0}, - {"mng_display_freeze", 1, 0, 0}, -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED - {"mng_display_goframe", 1, 0, 0}, - {"mng_display_golayer", 1, 0, 0}, - {"mng_display_gotime", 1, 0, 0}, -#endif - {"mng_display_reset", 1, 0, 0}, - {"mng_display_resume", 1, 0, 0}, - {"mng_get_alphabitdepth", 1, 0, 0}, - {"mng_get_alphacompression", 1, 0, 0}, - {"mng_get_alphadepth", 1, 0, 0}, - {"mng_get_alphafilter", 1, 0, 0}, - {"mng_get_alphainterlace", 1, 0, 0}, - {"mng_get_bgcolor", 1, 0, 0}, - {"mng_get_bitdepth", 1, 0, 0}, - {"mng_get_bkgdstyle", 1, 0, 0}, - {"mng_get_cacheplayback", 1, 0, 2}, - {"mng_get_canvasstyle", 1, 0, 0}, - {"mng_get_colortype", 1, 0, 0}, - {"mng_get_compression", 1, 0, 0}, -#ifndef MNG_NO_CURRENT_INFO - {"mng_get_currentframe", 1, 0, 0}, - {"mng_get_currentlayer", 1, 0, 0}, - {"mng_get_currentplaytime", 1, 0, 0}, -#endif - {"mng_get_currframdelay", 1, 0, 9}, -#ifndef MNG_NO_DFLT_INFO - {"mng_get_dfltimggamma", 1, 0, 0}, - {"mng_get_dfltimggammaint", 1, 0, 0}, -#endif - {"mng_get_displaygamma", 1, 0, 0}, - {"mng_get_displaygammaint", 1, 0, 0}, - {"mng_get_doprogressive", 1, 0, 2}, - {"mng_get_filter", 1, 0, 0}, - {"mng_get_framecount", 1, 0, 0}, - {"mng_get_imageheight", 1, 0, 0}, - {"mng_get_imagelevel", 1, 0, 0}, - {"mng_get_imagetype", 1, 0, 0}, - {"mng_get_imagewidth", 1, 0, 0}, - {"mng_get_interlace", 1, 0, 0}, -#ifdef MNG_ACCESS_JPEG - {"mng_get_jpeg_dctmethod", 1, 0, 0}, - {"mng_get_jpeg_maxjdat", 1, 0, 0}, - {"mng_get_jpeg_optimized", 1, 0, 0}, - {"mng_get_jpeg_progressive", 1, 0, 0}, - {"mng_get_jpeg_quality", 1, 0, 0}, - {"mng_get_jpeg_smoothing", 1, 0, 0}, -#endif - {"mng_get_lastbackchunk", 1, 0, 3}, - {"mng_get_lastseekname", 1, 0, 5}, - {"mng_get_layercount", 1, 0, 0}, -#ifndef MNG_SKIP_MAXCANVAS - {"mng_get_maxcanvasheight", 1, 0, 0}, - {"mng_get_maxcanvaswidth", 1, 0, 0}, -#endif - {"mng_get_playtime", 1, 0, 0}, - {"mng_get_refreshpass", 1, 0, 0}, - {"mng_get_runtime", 1, 0, 0}, - {"mng_get_sectionbreaks", 1, 0, 0}, - {"mng_get_sigtype", 1, 0, 0}, - {"mng_get_simplicity", 1, 0, 0}, - {"mng_get_speed", 1, 0, 0}, - {"mng_get_srgb", 1, 0, 0}, - {"mng_get_starttime", 1, 0, 0}, - {"mng_get_storechunks", 1, 0, 0}, - {"mng_get_suspensionmode", 1, 0, 0}, - {"mng_get_ticks", 1, 0, 0}, -#ifndef MNG_NO_CURRENT_INFO - {"mng_get_totalframes", 1, 0, 5}, - {"mng_get_totallayers", 1, 0, 5}, - {"mng_get_totalplaytime", 1, 0, 5}, -#endif - {"mng_get_usebkgd", 1, 0, 0}, - {"mng_get_userdata", 1, 0, 0}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {"mng_get_viewgamma", 1, 0, 0}, - {"mng_get_viewgammaint", 1, 0, 0}, -#endif -#ifdef MNG_ACCESS_ZLIB - {"mng_get_zlib_level", 1, 0, 0}, - {"mng_get_zlib_maxidat", 1, 0, 0}, - {"mng_get_zlib_memlevel", 1, 0, 0}, - {"mng_get_zlib_method", 1, 0, 0}, - {"mng_get_zlib_strategy", 1, 0, 0}, - {"mng_get_zlib_windowbits", 1, 0, 0}, -#endif -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_getcb_closestream", 1, 0, 0}, -#endif - {"mng_getcb_errorproc", 1, 0, 0}, - {"mng_getcb_getalphaline", 1, 0, 0}, - {"mng_getcb_getbkgdline", 1, 0, 0}, - {"mng_getcb_getcanvasline", 1, 0, 0}, - {"mng_getcb_gettickcount", 1, 0, 0}, - {"mng_getcb_memalloc", 1, 0, 0}, - {"mng_getcb_memfree", 1, 0, 0}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_getcb_openstream", 1, 0, 0}, -#endif - {"mng_getcb_processarow", 1, 0, 0}, - {"mng_getcb_processchroma", 1, 0, 0}, - {"mng_getcb_processgamma", 1, 0, 0}, - {"mng_getcb_processheader", 1, 0, 0}, - {"mng_getcb_processiccp", 1, 0, 0}, - {"mng_getcb_processmend", 1, 0, 1}, - {"mng_getcb_processneed", 1, 0, 0}, - {"mng_getcb_processsave", 1, 0, 0}, - {"mng_getcb_processseek", 1, 0, 0}, - {"mng_getcb_processsrgb", 1, 0, 0}, - {"mng_getcb_processterm", 1, 0, 2}, - {"mng_getcb_processtext", 1, 0, 0}, - {"mng_getcb_processunknown", 1, 0, 0}, - {"mng_getcb_readdata", 1, 0, 0}, - {"mng_getcb_refresh", 1, 0, 0}, - {"mng_getcb_releasedata", 1, 0, 8}, - {"mng_getcb_settimer", 1, 0, 0}, - {"mng_getcb_traceproc", 1, 0, 0}, - {"mng_getcb_writedata", 1, 0, 0}, - {"mng_getchunk_back", 1, 0, 0}, - {"mng_getchunk_basi", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_bKGD - {"mng_getchunk_bkgd", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {"mng_getchunk_chrm", 1, 0, 0}, -#endif - {"mng_getchunk_clip", 1, 0, 0}, - {"mng_getchunk_clon", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_dBYK - {"mng_getchunk_dbyk", 1, 0, 0}, -#endif -#endif - {"mng_getchunk_defi", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_dhdr", 1, 0, 0}, -#endif - {"mng_getchunk_disc", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_drop", 1, 0, 0}, -#endif - {"mng_getchunk_endl", 1, 0, 0}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {"mng_getchunk_mpng", 1, 0, 10}, - {"mng_getchunk_mpng_frame", 1, 0, 10}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {"mng_getchunk_evnt", 1, 0, 5}, - {"mng_getchunk_evnt_entry", 1, 0, 5}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {"mng_getchunk_expi", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {"mng_getchunk_fpri", 1, 0, 0}, -#endif - {"mng_getchunk_fram", 1, 0, 0}, - {"mng_getchunk_gama", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_hIST - {"mng_getchunk_hist", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {"mng_getchunk_iccp", 1, 0, 0}, -#endif - {"mng_getchunk_idat", 1, 0, 0}, - {"mng_getchunk_iend", 1, 0, 0}, - {"mng_getchunk_ihdr", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {"mng_getchunk_ijng", 1, 0, 0}, -#endif - {"mng_getchunk_ipng", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {"mng_getchunk_itxt", 1, 0, 0}, -#endif -#ifdef MNG_INCLUDE_JNG - {"mng_getchunk_jdaa", 1, 0, 0}, - {"mng_getchunk_jdat", 1, 0, 0}, - {"mng_getchunk_jhdr", 1, 0, 0}, - {"mng_getchunk_jsep", 1, 0, 0}, -#endif - {"mng_getchunk_loop", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_MAGN - {"mng_getchunk_magn", 1, 0, 0}, -#endif - {"mng_getchunk_mend", 1, 0, 0}, - {"mng_getchunk_mhdr", 1, 0, 0}, - {"mng_getchunk_move", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_nEED - {"mng_getchunk_need", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_ORDR -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_ordr", 1, 0, 0}, - {"mng_getchunk_ordr_entry", 1, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {"mng_getchunk_past", 1, 0, 0}, - {"mng_getchunk_past_src", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {"mng_getchunk_phyg", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {"mng_getchunk_phys", 1, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_plte", 1, 0, 0}, - {"mng_getchunk_pplt", 1, 0, 0}, - {"mng_getchunk_pplt_entry", 1, 0, 0}, - {"mng_getchunk_prom", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {"mng_getchunk_save", 1, 0, 0}, - {"mng_getchunk_save_entry", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {"mng_getchunk_sbit", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {"mng_getchunk_seek", 1, 0, 0}, -#endif - {"mng_getchunk_show", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_sPLT - {"mng_getchunk_splt", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {"mng_getchunk_srgb", 1, 0, 0}, -#endif - {"mng_getchunk_term", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_tEXt - {"mng_getchunk_text", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {"mng_getchunk_time", 1, 0, 0}, -#endif - {"mng_getchunk_trns", 1, 0, 0}, - {"mng_getchunk_unkown", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_zTXt - {"mng_getchunk_ztxt", 1, 0, 0}, -#endif - {"mng_getimgdata_chunk", 0, 0, 0}, - {"mng_getimgdata_chunkseq", 0, 0, 0}, - {"mng_getimgdata_seq", 0, 0, 0}, - {"mng_getlasterror", 1, 0, 0}, - {"mng_initialize", 1, 0, 0}, - {"mng_iterate_chunks", 1, 0, 0}, - {"mng_putchunk_back", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_BASI - {"mng_putchunk_basi", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {"mng_putchunk_bkgd", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {"mng_putchunk_chrm", 1, 0, 0}, -#endif - {"mng_putchunk_clip", 1, 0, 0}, - {"mng_putchunk_clon", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {"mng_putchunk_dbyk", 1, 0, 0}, -#endif -#endif - {"mng_putchunk_defi", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_putchunk_dhdr", 1, 0, 0}, -#endif - {"mng_putchunk_disc", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_putchunk_drop", 1, 0, 0}, -#endif - {"mng_putchunk_endl", 1, 0, 0}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {"mng_putchunk_mpng", 1, 0, 10}, - {"mng_putchunk_mpng_frame", 1, 0, 10}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {"mng_putchunk_evnt", 1, 0, 5}, - {"mng_putchunk_evnt_entry", 1, 0, 5}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {"mng_putchunk_expi", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {"mng_putchunk_fpri", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {"mng_putchunk_fram", 1, 0, 0}, -#endif - {"mng_putchunk_gama", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_hIST - {"mng_putchunk_hist", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {"mng_putchunk_iccp", 1, 0, 0}, -#endif - {"mng_putchunk_idat", 1, 0, 0}, - {"mng_putchunk_iend", 1, 0, 0}, - {"mng_putchunk_ihdr", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {"mng_putchunk_ijng", 1, 0, 0}, -#endif - {"mng_putchunk_ipng", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {"mng_putchunk_itxt", 1, 0, 0}, -#endif -#ifdef MNG_INCLUDE_JNG - {"mng_putchunk_jdaa", 1, 0, 0}, - {"mng_putchunk_jdat", 1, 0, 0}, - {"mng_putchunk_jhdr", 1, 0, 0}, - {"mng_putchunk_jsep", 1, 0, 0}, -#endif - {"mng_putchunk_loop", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_MAGN - {"mng_putchunk_magn", 1, 0, 0}, -#endif - {"mng_putchunk_mend", 1, 0, 0}, - {"mng_putchunk_mhdr", 1, 0, 0}, - {"mng_putchunk_move", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_nEED - {"mng_putchunk_need", 1, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {"mng_putchunk_ordr", 1, 0, 0}, - {"mng_putchunk_ordr_entry", 1, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {"mng_putchunk_past", 1, 0, 0}, - {"mng_putchunk_past_src", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {"mng_putchunk_phyg", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {"mng_putchunk_phys", 1, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG - {"mng_putchunk_plte", 1, 0, 0}, - {"mng_putchunk_pplt", 1, 0, 0}, - {"mng_putchunk_pplt_entry", 1, 0, 0}, - {"mng_putchunk_prom", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {"mng_putchunk_save", 1, 0, 0}, - {"mng_putchunk_save_entry", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {"mng_putchunk_sbit", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {"mng_putchunk_seek", 1, 0, 0}, -#endif - {"mng_putchunk_show", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_sPLT - {"mng_putchunk_splt", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {"mng_putchunk_srgb", 1, 0, 0}, -#endif - {"mng_putchunk_term", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_tEXt - {"mng_putchunk_text", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {"mng_putchunk_time", 1, 0, 0}, -#endif - {"mng_putchunk_trns", 1, 0, 0}, - {"mng_putchunk_unkown", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_zTXt - {"mng_putchunk_ztxt", 1, 0, 0}, -#endif - {"mng_putimgdata_ihdr", 0, 0, 0}, - {"mng_putimgdata_jhdr", 0, 0, 0}, - {"mng_reset", 1, 0, 0}, - {"mng_read", 1, 0, 0}, - {"mng_read_pushchunk", 1, 0, 8}, - {"mng_read_pushdata", 1, 0, 8}, - {"mng_read_pushsig", 1, 0, 8}, - {"mng_read_resume", 1, 0, 0}, - {"mng_readdisplay", 1, 0, 0}, - {"mng_set_bgcolor", 1, 0, 0}, - {"mng_set_bkgdstyle", 1, 0, 0}, - {"mng_set_cacheplayback", 1, 0, 2}, - {"mng_set_canvasstyle", 1, 0, 0}, - {"mng_set_dfltimggamma", 1, 0, 0}, -#ifndef MNG_NO_DFLT_INFO - {"mng_set_dfltimggammaint", 1, 0, 0}, -#endif - {"mng_set_displaygamma", 1, 0, 0}, - {"mng_set_displaygammaint", 1, 0, 0}, - {"mng_set_doprogressive", 1, 0, 2}, -#ifdef MNG_ACCESS_JPEG - {"mng_set_jpeg_dctmethod", 1, 0, 0}, - {"mng_set_jpeg_maxjdat", 1, 0, 0}, - {"mng_set_jpeg_optimized", 1, 0, 0}, - {"mng_set_jpeg_progressive", 1, 0, 0}, - {"mng_set_jpeg_quality", 1, 0, 0}, - {"mng_set_jpeg_smoothing", 1, 0, 0}, -#endif -#ifndef MNG_SKIP_MAXCANVAS - {"mng_set_maxcanvasheight", 1, 0, 0}, - {"mng_set_maxcanvassize", 1, 0, 0}, - {"mng_set_maxcanvaswidth", 1, 0, 0}, -#endif - {"mng_set_outputprofile", 1, 0, 0}, - {"mng_set_outputprofile2", 1, 0, 0}, - {"mng_set_outputsrgb", 1, 0, 1}, - {"mng_set_sectionbreaks", 1, 0, 0}, - {"mng_set_speed", 1, 0, 0}, - {"mng_set_srgb", 1, 0, 0}, - {"mng_set_srgbimplicit", 1, 0, 1}, - {"mng_set_srgbprofile", 1, 0, 0}, - {"mng_set_srgbprofile2", 1, 0, 0}, - {"mng_set_storechunks", 1, 0, 0}, - {"mng_set_suspensionmode", 1, 0, 0}, - {"mng_set_usebkgd", 1, 0, 0}, - {"mng_set_userdata", 1, 0, 0}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {"mng_set_viewgamma", 1, 0, 0}, - {"mng_set_viewgammaint", 1, 0, 0}, -#endif -#ifdef MNG_ACCESS_ZLIB - {"mng_set_zlib_level", 1, 0, 0}, - {"mng_set_zlib_maxidat", 1, 0, 0}, - {"mng_set_zlib_memlevel", 1, 0, 0}, - {"mng_set_zlib_method", 1, 0, 0}, - {"mng_set_zlib_strategy", 1, 0, 0}, - {"mng_set_zlib_windowbits", 1, 0, 0}, -#endif -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_setcb_closestream", 1, 0, 0}, -#endif - {"mng_setcb_errorproc", 1, 0, 0}, - {"mng_setcb_getalphaline", 1, 0, 0}, - {"mng_setcb_getbkgdline", 1, 0, 0}, - {"mng_setcb_getcanvasline", 1, 0, 0}, - {"mng_setcb_gettickcount", 1, 0, 0}, - {"mng_setcb_memalloc", 1, 0, 0}, - {"mng_setcb_memfree", 1, 0, 0}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_setcb_openstream", 1, 0, 0}, -#endif - {"mng_setcb_processarow", 1, 0, 0}, - {"mng_setcb_processchroma", 1, 0, 0}, - {"mng_setcb_processgamma", 1, 0, 0}, - {"mng_setcb_processheader", 1, 0, 0}, - {"mng_setcb_processiccp", 1, 0, 0}, - {"mng_setcb_processmend", 1, 0, 1}, - {"mng_setcb_processneed", 1, 0, 0}, - {"mng_setcb_processsave", 1, 0, 0}, - {"mng_setcb_processseek", 1, 0, 0}, - {"mng_setcb_processsrgb", 1, 0, 0}, - {"mng_setcb_processterm", 1, 0, 2}, - {"mng_setcb_processtext", 1, 0, 0}, - {"mng_setcb_processunknown", 1, 0, 0}, - {"mng_setcb_readdata", 1, 0, 0}, - {"mng_setcb_refresh", 1, 0, 0}, - {"mng_setcb_releasedata", 1, 0, 8}, - {"mng_setcb_settimer", 1, 0, 0}, - {"mng_setcb_traceproc", 1, 0, 0}, - {"mng_setcb_writedata", 1, 0, 0}, - {"mng_status_creating", 1, 0, 0}, - {"mng_status_displaying", 1, 0, 0}, - {"mng_status_dynamic", 1, 0, 5}, - {"mng_status_error", 1, 0, 0}, - {"mng_status_reading", 1, 0, 0}, - {"mng_status_running", 1, 0, 0}, - {"mng_status_runningevent", 1, 0, 5}, - {"mng_status_suspendbreak", 1, 0, 0}, - {"mng_status_timerbreak", 1, 0, 0}, - {"mng_status_writing", 1, 0, 0}, - {"mng_supports_func", 1, 0, 5}, - {"mng_trapevent", 1, 0, 5}, - {"mng_updatemngheader", 1, 0, 0}, - {"mng_updatemngsimplicity", 1, 0, 0}, - {"mng_version_beta", 1, 0, 5}, - {"mng_version_dll", 1, 0, 0}, - {"mng_version_major", 1, 0, 0}, - {"mng_version_minor", 1, 0, 0}, - {"mng_version_release", 1, 0, 0}, - {"mng_version_so", 1, 0, 0}, - {"mng_version_text", 1, 0, 0}, - {"mng_write", 1, 0, 0}, - }; - -mng_bool MNG_DECL mng_supports_func (mng_pchar zFunction, - mng_uint8* iMajor, - mng_uint8* iMinor, - mng_uint8* iRelease) -{ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_func_entryp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (func_table) / sizeof (func_table [0])) - 1; - - iLower = 0; /* initialize binary search */ - iMiddle = iTop >> 1; /* start in the middle */ - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - mng_int32 iRslt = strcmp(func_table [iMiddle].zFunction, zFunction); - if (iRslt < 0) - iLower = iMiddle + 1; - else if (iRslt > 0) - iUpper = iMiddle - 1; - else - { - pEntry = &func_table [iMiddle]; - break; - }; - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (pEntry) /* found it ? */ - { - *iMajor = pEntry->iMajor; - *iMinor = pEntry->iMinor; - *iRelease = pEntry->iRelease; - return MNG_TRUE; - } - else - { - *iMajor = 0; - *iMinor = 0; - *iRelease = 0; - return MNG_FALSE; - } -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * HLAPI routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata, - mng_memalloc fMemalloc, - mng_memfree fMemfree, - mng_traceproc fTraceproc) -{ - mng_datap pData; -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode; - mng_imagep pImage; -#endif - -#ifdef MNG_INTERNAL_MEMMNGMT /* allocate the main datastruc */ - pData = (mng_datap)calloc (1, sizeof (mng_data)); -#else - pData = (mng_datap)fMemalloc (sizeof (mng_data)); -#endif - - if (!pData) - return MNG_NULL; /* error: out of memory?? */ - /* validate the structure */ - pData->iMagic = MNG_MAGIC; - /* save userdata field */ - pData->pUserdata = pUserdata; - /* remember trace callback */ - pData->fTraceproc = fTraceproc; - -#ifdef MNG_SUPPORT_TRACE - if (mng_trace (pData, MNG_FN_INITIALIZE, MNG_LC_INITIALIZE)) - { - MNG_FREEX (pData, pData, sizeof (mng_data)); - return MNG_NULL; - } -#endif - /* default canvas styles are 8-bit RGB */ - pData->iCanvasstyle = MNG_CANVAS_RGB8; - pData->iBkgdstyle = MNG_CANVAS_RGB8; - - pData->iBGred = 0; /* black */ - pData->iBGgreen = 0; - pData->iBGblue = 0; - - pData->bUseBKGD = MNG_TRUE; - -#ifdef MNG_FULL_CMS - pData->bIssRGB = MNG_TRUE; - pData->hProf1 = 0; /* no profiles yet */ - pData->hProf2 = 0; - pData->hProf3 = 0; - pData->hTrans = 0; -#endif - - pData->dViewgamma = 1.0; - pData->dDisplaygamma = 2.2; - pData->dDfltimggamma = 0.45455; - /* initially remember chunks */ - pData->bStorechunks = MNG_TRUE; - /* no breaks at section-borders */ - pData->bSectionbreaks = MNG_FALSE; - /* initially cache playback info */ - pData->bCacheplayback = MNG_TRUE; - /* progressive refresh for large images */ - pData->bDoProgressive = MNG_TRUE; - /* crc exists; should check; error for - critical chunks; warning for ancillery; - generate crc for output */ - pData->iCrcmode = MNG_CRC_DEFAULT; - /* normal animation-speed ! */ - pData->iSpeed = mng_st_normal; - /* initial image limits */ - pData->iMaxwidth = 10000; - pData->iMaxheight = 10000; - -#ifdef MNG_INTERNAL_MEMMNGMT /* internal management */ - pData->fMemalloc = MNG_NULL; - pData->fMemfree = MNG_NULL; -#else /* keep callbacks */ - pData->fMemalloc = fMemalloc; - pData->fMemfree = fMemfree; -#endif - /* no value (yet) */ - pData->fReleasedata = MNG_NULL; -#ifndef MNG_NO_OPEN_CLOSE_STREAM - pData->fOpenstream = MNG_NULL; - pData->fClosestream = MNG_NULL; -#endif - pData->fReaddata = MNG_NULL; - pData->fWritedata = MNG_NULL; - pData->fErrorproc = MNG_NULL; - pData->fProcessheader = MNG_NULL; - pData->fProcesstext = MNG_NULL; - pData->fProcesssave = MNG_NULL; - pData->fProcessseek = MNG_NULL; - pData->fProcessneed = MNG_NULL; - pData->fProcessmend = MNG_NULL; - pData->fProcessunknown = MNG_NULL; - pData->fProcessterm = MNG_NULL; - pData->fGetcanvasline = MNG_NULL; - pData->fGetbkgdline = MNG_NULL; - pData->fGetalphaline = MNG_NULL; - pData->fRefresh = MNG_NULL; - pData->fGettickcount = MNG_NULL; - pData->fSettimer = MNG_NULL; - pData->fProcessgamma = MNG_NULL; - pData->fProcesschroma = MNG_NULL; - pData->fProcesssrgb = MNG_NULL; - pData->fProcessiccp = MNG_NULL; - pData->fProcessarow = MNG_NULL; - -#if defined(MNG_SUPPORT_DISPLAY) && (defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)) - pData->dLastgamma = 0; /* lookup table needs first-time calc */ -#endif - -#ifdef MNG_SUPPORT_DISPLAY /* create object 0 */ - iRetcode = mng_create_imageobject (pData, 0, MNG_TRUE, MNG_TRUE, MNG_TRUE, - 0, 0, 0, 0, 0, 0, 0, 0, 0, MNG_FALSE, - 0, 0, 0, 0, &pImage); - - if (iRetcode) /* on error drop out */ - { - MNG_FREEX (pData, pData, sizeof (mng_data)); - return MNG_NULL; - } - - pData->pObjzero = pImage; -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_INCLUDE_LCMS) - mnglcms_initlibrary (); /* init lcms particulars */ -#endif - -#ifdef MNG_SUPPORT_READ - pData->bSuspensionmode = MNG_FALSE; - pData->iSuspendbufsize = 0; - pData->pSuspendbuf = MNG_NULL; - pData->pSuspendbufnext = MNG_NULL; - pData->iSuspendbufleft = 0; - pData->iChunklen = 0; - pData->pReadbufnext = MNG_NULL; - pData->pLargebufnext = MNG_NULL; - - pData->pFirstpushchunk = MNG_NULL; - pData->pLastpushchunk = MNG_NULL; - pData->pFirstpushdata = MNG_NULL; - pData->pLastpushdata = MNG_NULL; -#endif - -#ifdef MNG_INCLUDE_ZLIB - mngzlib_initialize (pData); /* initialize zlib structures and such */ - /* default zlib compression parameters */ - pData->iZlevel = MNG_ZLIB_LEVEL; - pData->iZmethod = MNG_ZLIB_METHOD; - pData->iZwindowbits = MNG_ZLIB_WINDOWBITS; - pData->iZmemlevel = MNG_ZLIB_MEMLEVEL; - pData->iZstrategy = MNG_ZLIB_STRATEGY; - /* default maximum IDAT data size */ - pData->iMaxIDAT = MNG_MAX_IDAT_SIZE; -#endif - -#ifdef MNG_INCLUDE_JNG /* default IJG compression parameters */ - pData->eJPEGdctmethod = MNG_JPEG_DCT; - pData->iJPEGquality = MNG_JPEG_QUALITY; - pData->iJPEGsmoothing = MNG_JPEG_SMOOTHING; - pData->bJPEGcompressprogr = MNG_JPEG_PROGRESSIVE; - pData->bJPEGcompressopt = MNG_JPEG_OPTIMIZED; - /* default maximum JDAT data size */ - pData->iMaxJDAT = MNG_MAX_JDAT_SIZE; -#endif - - mng_reset ((mng_handle)pData); - -#ifdef MNG_SUPPORT_TRACE - if (mng_trace (pData, MNG_FN_INITIALIZE, MNG_LC_END)) - { - MNG_FREEX (pData, pData, sizeof (mng_data)); - return MNG_NULL; - } -#endif - - return (mng_handle)pData; /* if we get here, we're in business */ -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_reset (mng_handle hHandle) -{ - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)(hHandle)); /* address main structure */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_SAVE - mng_drop_savedata (pData); /* cleanup saved-data from SAVE/SEEK */ -#endif -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS) - mng_clear_cms (pData); /* cleanup left-over cms stuff if any */ -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_INCLUDE_JNG) - mngjpeg_cleanup (pData); /* cleanup jpeg stuff */ -#endif - -#ifdef MNG_INCLUDE_ZLIB - if (pData->bInflating) /* if we've been inflating */ - { -#ifdef MNG_INCLUDE_DISPLAY_PROCS - mng_cleanup_rowproc (pData); /* cleanup row-processing, */ -#endif - mngzlib_inflatefree (pData); /* cleanup inflate! */ - } -#endif /* MNG_INCLUDE_ZLIB */ - -#ifdef MNG_SUPPORT_READ - if ((pData->bReading) && (!pData->bEOF)) - mng_process_eof (pData); /* cleanup app streaming */ - /* cleanup default read buffers */ - MNG_FREE (pData, pData->pReadbuf, pData->iReadbufsize); - MNG_FREE (pData, pData->pLargebuf, pData->iLargebufsize); - MNG_FREE (pData, pData->pSuspendbuf, pData->iSuspendbufsize); - - while (pData->pFirstpushdata) /* release any pushed data & chunks */ - mng_release_pushdata (pData); - while (pData->pFirstpushchunk) - mng_release_pushchunk (pData); -#endif - -#ifdef MNG_SUPPORT_WRITE /* cleanup default write buffer */ - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize); -#endif - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - mng_drop_chunks (pData); /* drop stored chunks (if any) */ -#endif - -#ifdef MNG_SUPPORT_DISPLAY - mng_drop_objects (pData, MNG_TRUE); /* drop stored objects (if any) */ - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->iGlobalProfilesize) /* drop global profile (if any) */ - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); -#endif -#endif - - pData->eSigtype = mng_it_unknown; - pData->eImagetype = mng_it_unknown; - pData->iWidth = 0; /* these are unknown yet */ - pData->iHeight = 0; - pData->iTicks = 0; - pData->iLayercount = 0; - pData->iFramecount = 0; - pData->iPlaytime = 0; - pData->iSimplicity = 0; - pData->iAlphadepth = 16; /* assume the worst! */ - - pData->iImagelevel = 0; /* no image encountered */ - - pData->iMagnify = 0; /* 1-to-1 display */ - pData->iOffsetx = 0; /* no offsets */ - pData->iOffsety = 0; - pData->iCanvaswidth = 0; /* let the app decide during processheader */ - pData->iCanvasheight = 0; - /* so far, so good */ - pData->iErrorcode = MNG_NOERROR; - pData->iSeverity = 0; - pData->iErrorx1 = 0; - pData->iErrorx2 = 0; - pData->zErrortext = MNG_NULL; - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - /* let's assume the best scenario */ -#ifndef MNG_NO_OLD_VERSIONS - pData->bPreDraft48 = MNG_FALSE; -#endif - /* the unknown chunk */ - pData->iChunkname = MNG_UINT_HUH; - pData->iChunkseq = 0; - pData->pFirstchunk = MNG_NULL; - pData->pLastchunk = MNG_NULL; - /* nothing processed yet */ - pData->bHasheader = MNG_FALSE; - pData->bHasMHDR = MNG_FALSE; - pData->bHasIHDR = MNG_FALSE; - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; - - pData->bHasSAVE = MNG_FALSE; - pData->bHasBACK = MNG_FALSE; - pData->bHasFRAM = MNG_FALSE; - pData->bHasTERM = MNG_FALSE; - pData->bHasLOOP = MNG_FALSE; - /* there's no global stuff yet either */ - pData->bHasglobalPLTE = MNG_FALSE; - pData->bHasglobalTRNS = MNG_FALSE; - pData->bHasglobalGAMA = MNG_FALSE; - pData->bHasglobalCHRM = MNG_FALSE; - pData->bHasglobalSRGB = MNG_FALSE; - pData->bHasglobalICCP = MNG_FALSE; - - pData->iDatawidth = 0; /* no IHDR/BASI/DHDR done yet */ - pData->iDataheight = 0; - pData->iBitdepth = 0; - pData->iColortype = 0; - pData->iCompression = 0; - pData->iFilter = 0; - pData->iInterlace = 0; - -#ifdef MNG_INCLUDE_JNG - pData->iJHDRcolortype = 0; /* no JHDR data */ - pData->iJHDRimgbitdepth = 0; - pData->iJHDRimgcompression = 0; - pData->iJHDRimginterlace = 0; - pData->iJHDRalphabitdepth = 0; - pData->iJHDRalphacompression = 0; - pData->iJHDRalphafilter = 0; - pData->iJHDRalphainterlace = 0; -#endif - -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_READ /* no reading done */ - pData->bReading = MNG_FALSE; - pData->bHavesig = MNG_FALSE; - pData->bEOF = MNG_FALSE; - pData->iReadbufsize = 0; - pData->pReadbuf = MNG_NULL; - - pData->iLargebufsize = 0; - pData->pLargebuf = MNG_NULL; - - pData->iSuspendtime = 0; - pData->bSuspended = MNG_FALSE; - pData->iSuspendpoint = 0; - - pData->pSuspendbufnext = pData->pSuspendbuf; - pData->iSuspendbufleft = 0; -#endif /* MNG_SUPPORT_READ */ - -#ifdef MNG_SUPPORT_WRITE /* no creating/writing done */ - pData->bCreating = MNG_FALSE; - pData->bWriting = MNG_FALSE; - pData->iFirstchunkadded = 0; - pData->iWritebufsize = 0; - pData->pWritebuf = MNG_NULL; -#endif /* MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_DISPLAY /* done nuttin' yet */ - pData->bDisplaying = MNG_FALSE; - pData->iFrameseq = 0; - pData->iLayerseq = 0; - pData->iFrametime = 0; - - pData->iTotallayers = 0; - pData->iTotalframes = 0; - pData->iTotalplaytime = 0; - - pData->bSkipping = MNG_FALSE; - -#ifdef MNG_SUPPORT_DYNAMICMNG - pData->bDynamic = MNG_FALSE; - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->iEventx = 0; - pData->iEventy = 0; - pData->pLastmousemove = MNG_NULL; -#endif - - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - - pData->bRestorebkgd = MNG_FALSE; - - pData->iRuntime = 0; - pData->iSynctime = 0; - pData->iStarttime = 0; - pData->iEndtime = 0; - pData->bRunning = MNG_FALSE; - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - pData->bSectionwait = MNG_FALSE; - pData->bFreezing = MNG_FALSE; - pData->bResetting = MNG_FALSE; - pData->bNeedrefresh = MNG_FALSE; - pData->bMisplacedTERM = MNG_FALSE; - pData->bOnlyfirstframe = MNG_FALSE; - pData->iFramesafterTERM = 0; - /* these don't exist yet */ - pData->pCurrentobj = MNG_NULL; - pData->pCurraniobj = MNG_NULL; - pData->pTermaniobj = MNG_NULL; - pData->pLastclone = MNG_NULL; - pData->pStoreobj = MNG_NULL; - pData->pStorebuf = MNG_NULL; - pData->pRetrieveobj = MNG_NULL; - /* no saved data ! */ - pData->pSavedata = MNG_NULL; - - pData->iUpdateleft = 0; /* no region updated yet */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; - - pData->iPass = -1; /* interlacing stuff and temp buffers */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = 0; - pData->iSamplemul = 0; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = 0; - pData->iRowmax = 0; - pData->iFilterofs = 0; - pData->iPixelofs = 1; - pData->iLevel0 = 0; - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - pData->pWorkrow = MNG_NULL; - pData->pPrevrow = MNG_NULL; - pData->pRGBArow = MNG_NULL; - pData->bIsRGBA16 = MNG_TRUE; - pData->bIsOpaque = MNG_TRUE; - pData->iFilterbpp = 1; - - pData->iSourcel = 0; /* always initialized just before */ - pData->iSourcer = 0; /* compositing the next layer */ - pData->iSourcet = 0; - pData->iSourceb = 0; - pData->iDestl = 0; - pData->iDestr = 0; - pData->iDestt = 0; - pData->iDestb = 0; - /* lists are empty */ - pData->pFirstimgobj = MNG_NULL; - pData->pLastimgobj = MNG_NULL; - pData->pFirstaniobj = MNG_NULL; - pData->pLastaniobj = MNG_NULL; -#ifdef MNG_SUPPORT_DYNAMICMNG - pData->pFirstevent = MNG_NULL; - pData->pLastevent = MNG_NULL; -#endif - /* no processing callbacks */ - pData->fDisplayrow = MNG_NULL; - pData->fRestbkgdrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fRetrieverow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - pData->fScalerow = MNG_NULL; - pData->fDeltarow = MNG_NULL; -#ifndef MNG_SKIPCHUNK_PAST - pData->fFliprow = MNG_NULL; - pData->fTilerow = MNG_NULL; -#endif - pData->fInitrowproc = MNG_NULL; - - pData->iPLTEcount = 0; /* no PLTE data */ - -#ifndef MNG_SKIPCHUNK_DEFI - pData->iDEFIobjectid = 0; /* no DEFI data */ - pData->bDEFIhasdonotshow = MNG_FALSE; - pData->iDEFIdonotshow = 0; - pData->bDEFIhasconcrete = MNG_FALSE; - pData->iDEFIconcrete = 0; - pData->bDEFIhasloca = MNG_FALSE; - pData->iDEFIlocax = 0; - pData->iDEFIlocay = 0; - pData->bDEFIhasclip = MNG_FALSE; - pData->iDEFIclipl = 0; - pData->iDEFIclipr = 0; - pData->iDEFIclipt = 0; - pData->iDEFIclipb = 0; -#endif - -#ifndef MNG_SKIPCHUNK_BACK - pData->iBACKred = 0; /* no BACK data */ - pData->iBACKgreen = 0; - pData->iBACKblue = 0; - pData->iBACKmandatory = 0; - pData->iBACKimageid = 0; - pData->iBACKtile = 0; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = 1; /* default global FRAM variables */ - pData->iFRAMdelay = 1; - pData->iFRAMtimeout = 0x7fffffffl; - pData->bFRAMclipping = MNG_FALSE; - pData->iFRAMclipl = 0; - pData->iFRAMclipr = 0; - pData->iFRAMclipt = 0; - pData->iFRAMclipb = 0; - - pData->iFramemode = 1; /* again for the current frame */ - pData->iFramedelay = 1; - pData->iFrametimeout = 0x7fffffffl; - pData->bFrameclipping = MNG_FALSE; - pData->iFrameclipl = 0; - pData->iFrameclipr = 0; - pData->iFrameclipt = 0; - pData->iFrameclipb = 0; - - pData->iNextdelay = 1; -#endif - -#ifndef MNG_SKIPCHUNK_SHOW - pData->iSHOWmode = 0; /* no SHOW data */ - pData->iSHOWfromid = 0; - pData->iSHOWtoid = 0; - pData->iSHOWnextid = 0; - pData->iSHOWskip = 0; -#endif - - pData->iGlobalPLTEcount = 0; /* no global PLTE data */ - - pData->iGlobalTRNSrawlen = 0; /* no global tRNS data */ - - pData->iGlobalGamma = 0; /* no global gAMA data */ - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = 0; /* no global cHRM data */ - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; -#endif - - pData->iGlobalRendintent = 0; /* no global sRGB data */ - -#ifndef MNG_SKIPCHUNK_iCCP - pData->iGlobalProfilesize = 0; /* no global iCCP data */ - pData->pGlobalProfile = MNG_NULL; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = 0; /* no global bKGD data */ - pData->iGlobalBKGDgreen = 0; - pData->iGlobalBKGDblue = 0; -#endif - /* no delta-image */ -#ifndef MNG_NO_DELTA_PNG - pData->pDeltaImage = MNG_NULL; - pData->iDeltaImagetype = 0; - pData->iDeltatype = 0; - pData->iDeltaBlockwidth = 0; - pData->iDeltaBlockheight = 0; - pData->iDeltaBlockx = 0; - pData->iDeltaBlocky = 0; - pData->bDeltaimmediate = MNG_FALSE; - - pData->fDeltagetrow = MNG_NULL; - pData->fDeltaaddrow = MNG_NULL; - pData->fDeltareplacerow = MNG_NULL; - pData->fDeltaputrow = MNG_NULL; - - pData->fPromoterow = MNG_NULL; - pData->fPromBitdepth = MNG_NULL; - pData->pPromBuf = MNG_NULL; - pData->iPromColortype = 0; - pData->iPromBitdepth = 0; - pData->iPromFilltype = 0; - pData->iPromWidth = 0; - pData->pPromSrc = MNG_NULL; - pData->pPromDst = MNG_NULL; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - pData->iMAGNfromid = 0; - pData->iMAGNtoid = 0; -#endif - -#ifndef MNG_SKIPCHUNK_PAST - pData->iPastx = 0; - pData->iPasty = 0; -#endif - - pData->pLastseek = MNG_NULL; -#endif - -#ifdef MNG_INCLUDE_ZLIB - pData->bInflating = 0; /* no inflating or deflating */ - pData->bDeflating = 0; /* going on at the moment */ -#endif - -#ifdef MNG_SUPPORT_DISPLAY /* reset object 0 */ - mng_reset_objzero (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle) -{ - mng_datap pData; /* local vars */ -#ifndef MNG_INTERNAL_MEMMNGMT - mng_memfree fFree; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)*hHandle), MNG_FN_CLEANUP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (*hHandle) /* check validity handle */ - pData = ((mng_datap)(*hHandle)); /* and address main structure */ - - mng_reset (*hHandle); /* do an implicit reset to cleanup most stuff */ - -#ifdef MNG_SUPPORT_DISPLAY /* drop object 0 */ - mng_free_imageobject (pData, (mng_imagep)pData->pObjzero); -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS) - if (pData->hProf2) /* output profile defined ? */ - mnglcms_freeprofile (pData->hProf2); - - if (pData->hProf3) /* sRGB profile defined ? */ - mnglcms_freeprofile (pData->hProf3); -#endif - -#ifdef MNG_INCLUDE_ZLIB - mngzlib_cleanup (pData); /* cleanup zlib stuff */ -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)*hHandle), MNG_FN_CLEANUP, MNG_LC_CLEANUP) -#endif - - pData->iMagic = 0; /* invalidate the actual memory */ - -#ifdef MNG_INTERNAL_MEMMNGMT - free ((void *)*hHandle); /* cleanup the data-structure */ -#else - fFree = ((mng_datap)*hHandle)->fMemfree; - fFree ((mng_ptr)*hHandle, sizeof (mng_data)); -#endif - - *hHandle = 0; /* wipe pointer to inhibit future use */ - - return MNG_NOERROR; /* and we're done */ -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - MNG_VALIDCB (hHandle, fOpenstream) - MNG_VALIDCB (hHandle, fClosestream) -#endif - MNG_VALIDCB (hHandle, fReaddata) - -#ifdef MNG_SUPPORT_DISPLAY /* valid at this point ? */ - if ((pData->bReading) || (pData->bDisplaying)) -#else - if (pData->bReading) -#endif - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - -#ifdef MNG_SUPPORT_WRITE - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bReading = MNG_TRUE; /* read only! */ - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fOpenstream && !pData->fOpenstream (hHandle)) - /* open it and start reading */ - iRetcode = MNG_APPIOERROR; - else -#endif - iRetcode = mng_read_graphic (pData); - - if (pData->bEOF) /* already at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - -#ifdef MNG_SUPPORT_DISPLAY - mng_reset_rundata (pData); /* reset rundata */ -#endif - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_pushdata (mng_handle hHandle, - mng_ptr pData, - mng_size_t iLength, - mng_bool bTakeownership) -{ - mng_datap pMyData; /* local vars */ - mng_pushdatap pPush; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pMyData = ((mng_datap)hHandle); /* and make it addressable */ - /* create a containing buffer */ - iRetcode = make_pushbuffer (pMyData, pData, iLength, bTakeownership, &pPush); - if (iRetcode) - return iRetcode; - - if (pMyData->pLastpushdata) /* and update the buffer chain */ - pMyData->pLastpushdata->pNext = pPush; - else - pMyData->pFirstpushdata = pPush; - - pMyData->pLastpushdata = pPush; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_pushsig (mng_handle hHandle, - mng_imgtype eSigtype) -{ - mng_datap pData; /* local vars */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHSIG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->bHavesig) /* can we expect this call ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - pData->eSigtype = eSigtype; - pData->bHavesig = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHSIG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_pushchunk (mng_handle hHandle, - mng_ptr pChunk, - mng_size_t iLength, - mng_bool bTakeownership) -{ - mng_datap pMyData; /* local vars */ - mng_pushdatap pPush; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHCHUNK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pMyData = ((mng_datap)hHandle); /* and make it addressable */ - /* create a containing buffer */ - iRetcode = make_pushbuffer (pMyData, pChunk, iLength, bTakeownership, &pPush); - if (iRetcode) - return iRetcode; - - if (pMyData->pLastpushchunk) /* and update the buffer chain */ - pMyData->pLastpushchunk->pNext = pPush; - else - pMyData->pFirstpushchunk = pPush; - - pMyData->pLastpushchunk = pPush; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHCHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_resume (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_RESUME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - /* can we expect this call ? */ - if ((!pData->bReading) || (!pData->bSuspended)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bSuspended = MNG_FALSE; /* reset the flag */ - -#ifdef MNG_SUPPORT_DISPLAY /* re-synchronize ? */ - if ((pData->bDisplaying) && (pData->bRunning)) - pData->iSynctime = pData->iSynctime - pData->iSuspendtime + - pData->fGettickcount (hHandle); -#endif - - iRetcode = mng_read_graphic (pData); /* continue reading now */ - - if (pData->bEOF) /* at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - -#ifdef MNG_SUPPORT_DISPLAY - mng_reset_rundata (pData); /* reset rundata */ -#endif - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_RESUME, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_write (mng_handle hHandle) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_WRITE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - MNG_VALIDCB (hHandle, fOpenstream) - MNG_VALIDCB (hHandle, fClosestream) -#endif - MNG_VALIDCB (hHandle, fWritedata) - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) /* valid at this point ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - cleanup_errors (pData); /* cleanup previous errors */ - - iRetcode = mng_write_graphic (pData);/* do the write */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_WRITE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_create (mng_handle hHandle) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_CREATE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) /* valid at this point ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - iRetcode = mng_reset (hHandle); /* clear any previous stuff */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bCreating = MNG_TRUE; /* indicate we're creating a new file */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_CREATE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_READ) -mng_retcode MNG_DECL mng_readdisplay (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READDISPLAY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - - MNG_VALIDCB (hHandle, fReaddata) - MNG_VALIDCB (hHandle, fGetcanvasline) - MNG_VALIDCB (hHandle, fRefresh) - MNG_VALIDCB (hHandle, fGettickcount) - MNG_VALIDCB (hHandle, fSettimer) - /* valid at this point ? */ - if ((pData->bReading) || (pData->bDisplaying)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - -#ifdef MNG_SUPPORT_WRITE - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bReading = MNG_TRUE; /* read & display! */ - pData->bDisplaying = MNG_TRUE; - pData->bRunning = MNG_TRUE; - pData->iFrameseq = 0; - pData->iLayerseq = 0; - pData->iFrametime = 0; - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - pData->iRuntime = 0; - pData->iSynctime = pData->fGettickcount (hHandle); - pData->iSuspendtime = 0; - pData->iStarttime = pData->iSynctime; - pData->iEndtime = 0; - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fOpenstream && !pData->fOpenstream (hHandle)) - /* open it and start reading */ - iRetcode = MNG_APPIOERROR; - else -#endif - iRetcode = mng_read_graphic (pData); - - if (pData->bEOF) /* already at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - mng_drop_invalid_objects (pData); /* drop invalidly stored objects */ - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - else - if (pData->bTimerset) /* indicate timer break ? */ - iRetcode = MNG_NEEDTIMERWAIT; - else - if (pData->bSectionwait) /* indicate section break ? */ - iRetcode = MNG_NEEDSECTIONWAIT; - else - { /* no breaks = end of run */ - pData->bRunning = MNG_FALSE; - - if (pData->bFreezing) /* dynamic MNG reached SEEK ? */ - pData->bFreezing = MNG_FALSE; /* reset it ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READDISPLAY, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - - MNG_VALIDCB (hHandle, fGetcanvasline) - MNG_VALIDCB (hHandle, fRefresh) - MNG_VALIDCB (hHandle, fGettickcount) - MNG_VALIDCB (hHandle, fSettimer) - - if (pData->bDisplaying) /* valid at this point ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - -#ifdef MNG_SUPPORT_WRITE - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bDisplaying = MNG_TRUE; /* display! */ - pData->bRunning = MNG_TRUE; - pData->iFrameseq = 0; - pData->iLayerseq = 0; - pData->iFrametime = 0; - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - pData->iRuntime = 0; - pData->iSynctime = pData->fGettickcount (hHandle); -#ifdef MNG_SUPPORT_READ - pData->iSuspendtime = 0; -#endif - pData->iStarttime = pData->iSynctime; - pData->iEndtime = 0; - pData->pCurraniobj = pData->pFirstaniobj; - /* go do it */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bTimerset) /* indicate timer break ? */ - iRetcode = MNG_NEEDTIMERWAIT; - else - { /* no breaks = end of run */ - pData->bRunning = MNG_FALSE; - - if (pData->bFreezing) /* dynamic MNG reached SEEK ? */ - pData->bFreezing = MNG_FALSE; /* reset it ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESUME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (!pData->bDisplaying) /* can we expect this call ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - /* was it running ? */ - if ((pData->bRunning) || (pData->bReading)) - { /* are we expecting this call ? */ - if ((pData->bTimerset) || (pData->bSuspended) || (pData->bSectionwait)) - { - pData->bTimerset = MNG_FALSE; /* reset the flags */ - pData->bSectionwait = MNG_FALSE; - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) /* set during read&display ? */ - { - if (pData->bSuspended) /* calculate proper synchronization */ - pData->iSynctime = pData->iSynctime - pData->iSuspendtime + - pData->fGettickcount (hHandle); - else - pData->iSynctime = pData->fGettickcount (hHandle); - - pData->bSuspended = MNG_FALSE; /* now reset this flag */ - /* and continue reading */ - iRetcode = mng_read_graphic (pData); - - if (pData->bEOF) /* already at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - /* drop invalidly stored objects */ - mng_drop_invalid_objects (pData); - } - } - else -#endif /* MNG_SUPPORT_READ */ - { /* synchronize timing */ - pData->iSynctime = pData->fGettickcount (hHandle); - /* resume display processing */ - iRetcode = mng_process_display (pData); - } - } - else - { - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - } - } - else - { /* synchronize timing */ - pData->iSynctime = pData->fGettickcount (hHandle); - pData->bRunning = MNG_TRUE; /* it's restarted again ! */ - /* resume display processing */ - iRetcode = mng_process_display (pData); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - else - if (pData->bTimerset) /* indicate timer break ? */ - iRetcode = MNG_NEEDTIMERWAIT; - else - if (pData->bSectionwait) /* indicate section break ? */ - iRetcode = MNG_NEEDSECTIONWAIT; - else - { /* no breaks = end of run */ - pData->bRunning = MNG_FALSE; - - if (pData->bFreezing) /* trying to freeze ? */ - pData->bFreezing = MNG_FALSE; /* then we're there */ - - if (pData->bResetting) /* trying to reset as well ? */ - { /* full stop!!! */ - pData->bDisplaying = MNG_FALSE; - - iRetcode = mng_reset_rundata (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESUME, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display_freeze (mng_handle hHandle) -{ - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_FREEZE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bReading)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->bRunning) /* is it running ? */ - { - mng_retcode iRetcode; - - pData->bFreezing = MNG_TRUE; /* indicate we need to freeze */ - /* continue "normal" processing */ - iRetcode = mng_display_resume (hHandle); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_FREEZE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display_reset (mng_handle hHandle) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESET, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bReading)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->bRunning) /* is it running ? */ - { - pData->bFreezing = MNG_TRUE; /* indicate we need to freeze */ - pData->bResetting = MNG_TRUE; /* indicate we're about to reset too */ - /* continue normal processing ? */ - iRetcode = mng_display_resume (hHandle); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* full stop!!! */ - pData->bDisplaying = MNG_FALSE; - - iRetcode = mng_reset_rundata (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESET, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -mng_retcode MNG_DECL mng_display_goframe (mng_handle hHandle, - mng_uint32 iFramenr) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOFRAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bRunning)) - MNG_ERROR ((mng_datap)hHandle, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (iFramenr > pData->iTotalframes) /* is the parameter within bounds ? */ - MNG_ERROR (pData, MNG_FRAMENRTOOHIGH); - /* within MHDR bounds ? */ - if ((pData->iFramecount) && (iFramenr > pData->iFramecount)) - MNG_WARNING (pData, MNG_FRAMENRTOOHIGH); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->iFrameseq > iFramenr) /* search from current or go back to start ? */ - { - iRetcode = mng_reset_rundata (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (iFramenr) - { - pData->iRequestframe = iFramenr; /* go find the requested frame then */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bTimerset = MNG_FALSE; /* reset just to be safe */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOFRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -mng_retcode MNG_DECL mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayernr) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOLAYER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bRunning)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (iLayernr > pData->iTotallayers) /* is the parameter within bounds ? */ - MNG_ERROR (pData, MNG_LAYERNRTOOHIGH); - /* within MHDR bounds ? */ - if ((pData->iLayercount) && (iLayernr > pData->iLayercount)) - MNG_WARNING (pData, MNG_LAYERNRTOOHIGH); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->iLayerseq > iLayernr) /* search from current or go back to start ? */ - { - iRetcode = mng_reset_rundata (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (iLayernr) - { - pData->iRequestlayer = iLayernr; /* go find the requested layer then */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bTimerset = MNG_FALSE; /* reset just to be safe */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOLAYER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -mng_retcode MNG_DECL mng_display_gotime (mng_handle hHandle, - mng_uint32 iPlaytime) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOTIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bRunning)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - /* is the parameter within bounds ? */ - if (iPlaytime > pData->iTotalplaytime) - MNG_ERROR (pData, MNG_PLAYTIMETOOHIGH); - /* within MHDR bounds ? */ - if ((pData->iPlaytime) && (iPlaytime > pData->iPlaytime)) - MNG_WARNING (pData, MNG_PLAYTIMETOOHIGH); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->iFrametime > iPlaytime) /* search from current or go back to start ? */ - { - iRetcode = mng_reset_rundata (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (iPlaytime) - { - pData->iRequesttime = iPlaytime; /* go find the requested playtime then */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bTimerset = MNG_FALSE; /* reset just to be safe */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOTIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) -mng_retcode MNG_DECL mng_trapevent (mng_handle hHandle, - mng_uint8 iEventtype, - mng_int32 iX, - mng_int32 iY) -{ - mng_datap pData; - mng_eventp pEvent; - mng_bool bFound = MNG_FALSE; - mng_retcode iRetcode; - mng_imagep pImage; - mng_uint8p pPixel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_TRAPEVENT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - - if (!pData->bDisplaying) /* can we expect this call ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - /* let's find a matching event object */ - pEvent = (mng_eventp)pData->pFirstevent; - - while ((pEvent) && (!bFound)) - { /* matching eventtype ? */ - if (pEvent->iEventtype == iEventtype) - { - switch (pEvent->iMasktype) /* check X/Y on basis of masktype */ - { - case MNG_MASK_NONE : /* no mask is easy */ - { - bFound = MNG_TRUE; - break; - } - - case MNG_MASK_BOX : /* inside the given box ? */ - { /* right- and bottom-border don't count ! */ - if ((iX >= pEvent->iLeft) && (iX < pEvent->iRight) && - (iY >= pEvent->iTop) && (iY < pEvent->iBottom)) - bFound = MNG_TRUE; - break; - } - - case MNG_MASK_OBJECT : /* non-zero pixel in the image object ? */ - { - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - ((mng_int32)pImage->pImgbuf->iWidth > iX) && - ((mng_int32)pImage->pImgbuf->iHeight > iY)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iY) + iX); - - if (*pPixel) /* non-zero ? */ - bFound = MNG_TRUE; - } - - break; - } - - case MNG_MASK_OBJECTIX : /* pixel in the image object matches index ? */ - { - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - ((mng_int32)pImage->pImgbuf->iWidth > iX) && (iX >= 0) && - ((mng_int32)pImage->pImgbuf->iHeight > iY) && (iY >= 0)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iY) + iX); - /* matching index ? */ - if (*pPixel == pEvent->iIndex) - bFound = MNG_TRUE; - } - - break; - } - - case MNG_MASK_BOXOBJECT : /* non-zero pixel in the image object ? */ - { - mng_int32 iTempx = iX - pEvent->iLeft; - mng_int32 iTempy = iY - pEvent->iTop; - - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - (iTempx < (mng_int32)pImage->pImgbuf->iWidth) && - (iTempx >= 0) && (iX < pEvent->iRight) && - (iTempy < (mng_int32)pImage->pImgbuf->iHeight) && - (iTempy >= 0) && (iY < pEvent->iBottom)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iTempy) + iTempx); - - if (*pPixel) /* non-zero ? */ - bFound = MNG_TRUE; - } - - break; - } - - case MNG_MASK_BOXOBJECTIX : /* pixel in the image object matches index ? */ - { - mng_int32 iTempx = iX - pEvent->iLeft; - mng_int32 iTempy = iY - pEvent->iTop; - - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - (iTempx < (mng_int32)pImage->pImgbuf->iWidth) && - (iTempx >= 0) && (iX < pEvent->iRight) && - (iTempy < (mng_int32)pImage->pImgbuf->iHeight) && - (iTempy >= 0) && (iY < pEvent->iBottom)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iTempy) + iTempx); - /* matching index ? */ - if (*pPixel == pEvent->iIndex) - bFound = MNG_TRUE; - } - - break; - } - - } - } - - if (!bFound) /* try the next one */ - pEvent = (mng_eventp)pEvent->sHeader.pNext; - } - /* found one that's not the last mousemove ? */ - if ((pEvent) && ((mng_objectp)pEvent != pData->pLastmousemove)) - { /* can we start an event process now ? */ - if ((!pData->bReading) && (!pData->bRunning)) - { - pData->iEventx = iX; /* save coordinates */ - pData->iEventy = iY; - /* do it then ! */ - iRetcode = pEvent->sHeader.fProcess (pData, pEvent); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* remember last mousemove event */ - if (pEvent->iEventtype == MNG_EVENT_MOUSEMOVE) - pData->pLastmousemove = (mng_objectp)pEvent; - else - pData->pLastmousemove = MNG_NULL; - } - else - { - - /* TODO: store unprocessed events or not ??? */ - - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_TRAPEVENT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getlasterror (mng_handle hHandle, - mng_int8* iSeverity, - mng_chunkid* iChunkname, - mng_uint32* iChunkseq, - mng_int32* iExtra1, - mng_int32* iExtra2, - mng_pchar* zErrortext) -{ - mng_datap pData; /* local vars */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETLASTERROR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - *iSeverity = pData->iSeverity; /* return the appropriate fields */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - *iChunkname = pData->iChunkname; - *iChunkseq = pData->iChunkseq; -#else - *iChunkname = MNG_UINT_HUH; - *iChunkseq = 0; -#endif - - *iExtra1 = pData->iErrorx1; - *iExtra2 = pData->iErrorx2; - *zErrortext = pData->zErrortext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETLASTERROR, MNG_LC_END); -#endif - - return pData->iErrorcode; /* and the errorcode */ -} - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - diff --git a/Engine/lib/lmng/libmng_jpeg.c b/Engine/lib/lmng/libmng_jpeg.c deleted file mode 100644 index 5042e1d55..000000000 --- a/Engine/lib/lmng/libmng_jpeg.c +++ /dev/null @@ -1,1088 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_jpeg.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : JPEG library interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the JPEG library interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/22/2000 - G.Juyn * */ -/* * - implemented all the JNG routines * */ -/* * * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - added tracing of JPEG calls * */ -/* * 0.5.3 - 06/24/2000 - G.Juyn * */ -/* * - fixed inclusion of IJG read/write code * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed some 64-bit warnings * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.1 - 04/19/2001 - G.Juyn * */ -/* * - added export of JPEG functions for DLL * */ -/* * 1.0.1 - 04/22/2001 - G.Juyn * */ -/* * - fixed memory-leaks (Thanks Gregg!) * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B526138 - returned IJGSRC6B calling convention to * */ -/* * default for MSVC * */ -/* * * */ -/* * 1.0.5 - 24/02/2003 - G.Juyn * */ -/* * - B683152 - libjpeg suspension not always honored correctly* */ -/* * * */ -/* * 1.0.6 - 03/04/2003 - G.Juyn * */ -/* * - fixed some compiler-warnings * */ -/* * * */ -/* * 1.0.8 - 08/01/2004 - G.Juyn * */ -/* * - added support for 3+byte pixelsize for JPEG's * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_pixels.h" -#include "libmng_jpeg.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#if defined(MNG_INCLUDE_JNG) && defined(MNG_INCLUDE_DISPLAY_PROCS) - -/* ************************************************************************** */ -/* * * */ -/* * Local IJG callback routines (source-manager, error-manager and such) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_IJG6B - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_init_source (j_decompress_ptr cinfo) -#else -void mng_init_source (j_decompress_ptr cinfo) -#endif -{ - return; /* nothing needed */ -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -boolean MNG_DECL mng_fill_input_buffer (j_decompress_ptr cinfo) -#else -boolean mng_fill_input_buffer (j_decompress_ptr cinfo) -#endif -{ - return FALSE; /* force IJG routine to return to caller */ -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes) -#else -void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes) -#endif -{ - if (num_bytes > 0) /* ignore fony calls */ - { /* address my generic structure */ - mng_datap pData = (mng_datap)cinfo->client_data; - /* address source manager */ - mngjpeg_sourcep pSrc = pData->pJPEGdinfo->src; - /* problem scenario ? */ - if (pSrc->bytes_in_buffer < (size_t)num_bytes) - { /* tell the boss we need to skip some data! */ - pData->iJPEGtoskip = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer); - - pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */ - pSrc->next_input_byte = MNG_NULL; - } - else - { /* simply advance in the buffer */ - pSrc->bytes_in_buffer -= num_bytes; - pSrc->next_input_byte += num_bytes; - } - } - - return; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes) -#else -void mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes) -#endif -{ - if (num_bytes > 0) /* ignore fony calls */ - { /* address my generic structure */ - mng_datap pData = (mng_datap)cinfo->client_data; - /* address source manager */ - mngjpeg_sourcep pSrc = pData->pJPEGdinfo2->src; - /* problem scenario ? */ - if (pSrc->bytes_in_buffer < (size_t)num_bytes) - { /* tell the boss we need to skip some data! */ - pData->iJPEGtoskip2 = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer); - - pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */ - pSrc->next_input_byte = MNG_NULL; - } - else - { /* simply advance in the buffer */ - pSrc->bytes_in_buffer -= num_bytes; - pSrc->next_input_byte += num_bytes; - } - } - - return; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_term_source (j_decompress_ptr cinfo) -#else -void mng_term_source (j_decompress_ptr cinfo) -#endif -{ - return; /* nothing needed */ -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_USE_SETJMP -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_error_exit (j_common_ptr cinfo) -#else -void mng_error_exit (j_common_ptr cinfo) -#endif -{ /* address my generic structure */ - mng_datap pData = (mng_datap)cinfo->client_data; - -#ifdef MNG_ERROR_TELLTALE /* fill the message text ??? */ - (*cinfo->err->output_message) (cinfo); -#endif - /* return to the point of no return... */ - longjmp (pData->sErrorbuf, cinfo->err->msg_code); -} -#endif /* MNG_USE_SETJMP */ - -/* ************************************************************************** */ - -#ifdef MNG_USE_SETJMP -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_output_message (j_common_ptr cinfo) -#else -void mng_output_message (j_common_ptr cinfo) -#endif -{ - return; /* just do nothing ! */ -} -#endif /* MNG_USE_SETJMP */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_IJG6B */ - -/* ************************************************************************** */ -/* * * */ -/* * Global JPEG routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mngjpeg_initialize (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_START); -#endif - /* allocate space for JPEG structures if necessary */ -#ifdef MNG_INCLUDE_JNG_READ - if (pData->pJPEGderr == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGderr, sizeof (mngjpeg_error )); - if (pData->pJPEGdsrc == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source)); - if (pData->pJPEGdinfo == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp)); - /* enable reverse addressing */ - pData->pJPEGdinfo->client_data = pData; - - if (pData->pJPEGderr2 == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGderr2, sizeof (mngjpeg_error )); - if (pData->pJPEGdsrc2 == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source)); - if (pData->pJPEGdinfo2 == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp)); - /* enable reverse addressing */ - pData->pJPEGdinfo2->client_data = pData; -#endif - -#ifdef MNG_INCLUDE_JNG_WRITE - if (pData->pJPEGcerr == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGcerr, sizeof (mngjpeg_error )); - if (pData->pJPEGcinfo == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp )); - /* enable reverse addressing */ - pData->pJPEGcinfo->client_data = pData; -#endif - - if (pData->pJPEGbuf == MNG_NULL) /* initialize temporary buffers */ - { - pData->iJPEGbufmax = MNG_JPEG_MAXBUF; - MNG_ALLOC (pData, pData->pJPEGbuf, pData->iJPEGbufmax); - } - - if (pData->pJPEGbuf2 == MNG_NULL) - { - pData->iJPEGbufmax2 = MNG_JPEG_MAXBUF; - MNG_ALLOC (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2); - } - - pData->pJPEGcurrent = pData->pJPEGbuf; - pData->iJPEGbufremain = 0; - pData->pJPEGrow = MNG_NULL; - pData->iJPEGrowlen = 0; - pData->iJPEGtoskip = 0; - - pData->pJPEGcurrent2 = pData->pJPEGbuf2; - pData->iJPEGbufremain2 = 0; - pData->pJPEGrow2 = MNG_NULL; - pData->iJPEGrowlen2 = 0; - pData->iJPEGtoskip2 = 0; - /* not doing anything yet ! */ - pData->bJPEGcompress = MNG_FALSE; - - pData->bJPEGdecompress = MNG_FALSE; - pData->bJPEGhasheader = MNG_FALSE; - pData->bJPEGdecostarted = MNG_FALSE; - pData->bJPEGscanstarted = MNG_FALSE; - pData->bJPEGscanending = MNG_FALSE; - - pData->bJPEGdecompress2 = MNG_FALSE; - pData->bJPEGhasheader2 = MNG_FALSE; - pData->bJPEGdecostarted2 = MNG_FALSE; - pData->bJPEGscanstarted2 = MNG_FALSE; - - pData->iJPEGrow = 0; /* zero input/output lines */ - pData->iJPEGalpharow = 0; - pData->iJPEGrgbrow = 0; - pData->iJPEGdisprow = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngjpeg_cleanup (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_CLEANUP, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B -#ifdef MNG_USE_SETJMP - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - -#ifdef MNG_INCLUDE_JNG_READ /* still decompressing something ? */ - if (pData->bJPEGdecompress) - jpeg_destroy_decompress (pData->pJPEGdinfo); - if (pData->bJPEGdecompress2) - jpeg_destroy_decompress (pData->pJPEGdinfo2); -#endif - -#ifdef MNG_INCLUDE_JNG_WRITE - if (pData->bJPEGcompress) /* still compressing something ? */ - jpeg_destroy_compress (pData->pJPEGcinfo); -#endif - -#endif /* MNG_INCLUDE_IJG6B */ - /* cleanup temporary buffers */ - MNG_FREE (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2); - MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax); - /* cleanup space for JPEG structures */ -#ifdef MNG_INCLUDE_JNG_WRITE - MNG_FREE (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp )); - MNG_FREE (pData, pData->pJPEGcerr, sizeof (mngjpeg_error )); -#endif - -#ifdef MNG_INCLUDE_JNG_READ - MNG_FREE (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp)); - MNG_FREE (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source)); - MNG_FREE (pData, pData->pJPEGderr, sizeof (mngjpeg_error )); - MNG_FREE (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp)); - MNG_FREE (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source)); - MNG_FREE (pData, pData->pJPEGderr2, sizeof (mngjpeg_error )); -#endif - - MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2); - MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen); - /* whatever we were doing ... */ - /* we don't anymore ... */ - pData->bJPEGcompress = MNG_FALSE; - - pData->bJPEGdecompress = MNG_FALSE; - pData->bJPEGhasheader = MNG_FALSE; - pData->bJPEGdecostarted = MNG_FALSE; - pData->bJPEGscanstarted = MNG_FALSE; - pData->bJPEGscanending = MNG_FALSE; - - pData->bJPEGdecompress2 = MNG_FALSE; - pData->bJPEGhasheader2 = MNG_FALSE; - pData->bJPEGdecostarted2 = MNG_FALSE; - pData->bJPEGscanstarted2 = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_CLEANUP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * JPEG decompression routines (JDAT) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressinit (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B - /* allocate and initialize a JPEG decompression object */ - pData->pJPEGdinfo->err = jpeg_std_error (pData->pJPEGderr); - -#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */ - pData->pJPEGderr->error_exit = mng_error_exit; - pData->pJPEGderr->output_message = mng_output_message; - - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif /* MNG_USE_SETJMP */ - - /* allocate and initialize a JPEG decompression object (continued) */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_JPEG_CREATE_DECOMPRESS) -#endif - jpeg_create_decompress (pData->pJPEGdinfo); - - pData->bJPEGdecompress = MNG_TRUE; /* indicate it's initialized */ - - /* specify the source of the compressed data (eg, a file) */ - /* no, not a file; we have buffered input */ - pData->pJPEGdinfo->src = pData->pJPEGdsrc; - /* use the default handler */ - pData->pJPEGdinfo->src->resync_to_restart = jpeg_resync_to_restart; - /* setup local source routine & parms */ - pData->pJPEGdinfo->src->init_source = mng_init_source; - pData->pJPEGdinfo->src->fill_input_buffer = mng_fill_input_buffer; - pData->pJPEGdinfo->src->skip_input_data = mng_skip_input_data; - pData->pJPEGdinfo->src->term_source = mng_term_source; - pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent; - pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain; - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressdata (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata) -{ - mng_retcode iRetcode; - mng_uint32 iRemain; - mng_uint8p pWork; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_START); -#endif - -#if defined (MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - iRetcode = setjmp (pData->sErrorbuf);/* initialize local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - - pWork = pRawdata; - iRemain = iRawsize; - - if (pData->iJPEGtoskip) /* JPEG-lib told us to skip some more data ? */ - { - if (iRemain > pData->iJPEGtoskip) /* enough data in this buffer ? */ - { - iRemain -= pData->iJPEGtoskip; /* skip enough to access the next byte */ - pWork += pData->iJPEGtoskip; - - pData->iJPEGtoskip = 0; /* no more to skip then */ - } - else - { - pData->iJPEGtoskip -= iRemain; /* skip all data in the buffer */ - iRemain = 0; /* and indicate this accordingly */ - } - /* the skip set current-pointer to NULL ! */ - pData->pJPEGcurrent = pData->pJPEGbuf; - } - - while (iRemain) /* repeat until no more input-bytes */ - { /* need to shift anything ? */ - if ((pData->pJPEGcurrent > pData->pJPEGbuf) && - (pData->pJPEGcurrent - pData->pJPEGbuf + pData->iJPEGbufremain + iRemain > pData->iJPEGbufmax)) - { - if (pData->iJPEGbufremain > 0) /* then do so */ - MNG_COPY (pData->pJPEGbuf, pData->pJPEGcurrent, pData->iJPEGbufremain); - - pData->pJPEGcurrent = pData->pJPEGbuf; - } - /* does the remaining input fit into the buffer ? */ - if (pData->iJPEGbufremain + iRemain <= pData->iJPEGbufmax) - { /* move the lot */ - MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iRemain); - - pData->iJPEGbufremain += iRemain;/* adjust remaining_bytes counter */ - iRemain = 0; /* and indicate there's no input left */ - } - else - { /* calculate what does fit */ - mng_uint32 iFits = pData->iJPEGbufmax - pData->iJPEGbufremain; - - if (iFits <= 0) /* no space is just bugger 'm all */ - MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL); - /* move that */ - MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iFits); - - pData->iJPEGbufremain += iFits; /* adjust remain_bytes counter */ - iRemain -= iFits; /* and the input-parms */ - pWork += iFits; - } - -#ifdef MNG_INCLUDE_IJG6B - pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent; - pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain; - - if (!pData->bJPEGhasheader) /* haven't got the header yet ? */ - { - /* call jpeg_read_header() to obtain image info */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_HEADER) -#endif - if (jpeg_read_header (pData->pJPEGdinfo, TRUE) != JPEG_SUSPENDED) - { /* indicate the header's oke */ - pData->bJPEGhasheader = MNG_TRUE; - /* let's do some sanity checks ! */ - if ((pData->pJPEGdinfo->image_width != pData->iDatawidth ) || - (pData->pJPEGdinfo->image_height != pData->iDataheight) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - - if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAY ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) && - (pData->pJPEGdinfo->jpeg_color_space != JCS_GRAYSCALE ) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - - if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLOR ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) && - (pData->pJPEGdinfo->jpeg_color_space != JCS_YCbCr ) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - /* indicate whether or not it's progressive */ - pData->bJPEGprogressive = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo); - /* progressive+alpha can't display "on-the-fly"!! */ - if ((pData->bJPEGprogressive) && - ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) )) - pData->fDisplayrow = MNG_NULL; - /* allocate a row of JPEG-samples */ - if (pData->pJPEGdinfo->jpeg_color_space == JCS_YCbCr) - pData->iJPEGrowlen = pData->pJPEGdinfo->image_width * RGB_PIXELSIZE; - else - pData->iJPEGrowlen = pData->pJPEGdinfo->image_width; - - MNG_ALLOC (pData, pData->pJPEGrow, pData->iJPEGrowlen); - - pData->iJPEGrgbrow = 0; /* quite empty up to now */ - } - - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - } - /* decompress not started ? */ - if ((pData->bJPEGhasheader) && (!pData->bJPEGdecostarted)) - { - /* set parameters for decompression */ - - if (pData->bJPEGprogressive) /* progressive display ? */ - pData->pJPEGdinfo->buffered_image = TRUE; - - /* jpeg_start_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS) -#endif - if (jpeg_start_decompress (pData->pJPEGdinfo) == TRUE) - /* indicate it started */ - pData->bJPEGdecostarted = MNG_TRUE; - - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - } - /* process some scanlines ? */ - if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) && - ((!jpeg_input_complete (pData->pJPEGdinfo)) || - (pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height) || - ((pData->bJPEGprogressive) && (pData->bJPEGscanending)))) - { - mng_int32 iLines = 0; - - /* for (each output pass) */ - do - { /* address the row output buffer */ - JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow; - - /* init new pass ? */ - if ((pData->bJPEGprogressive) && (!pData->bJPEGscanstarted)) - { - pData->bJPEGscanstarted = MNG_TRUE; - - /* adjust output decompression parameters if required */ - /* nop */ - - /* start a new output pass */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_OUTPUT) -#endif - jpeg_start_output (pData->pJPEGdinfo, pData->pJPEGdinfo->input_scan_number); - - pData->iJPEGrow = 0; /* start at row 0 in the image again */ - } - - /* while (scan lines remain to be read) */ - if ((!pData->bJPEGprogressive) || (!pData->bJPEGscanending)) - { - do - { - /* jpeg_read_scanlines(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES) -#endif - iLines = jpeg_read_scanlines (pData->pJPEGdinfo, (JSAMPARRAY)&pRow, 1); - - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - - if (iLines > 0) /* got something ? */ - { - if (pData->fStorerow2) /* store in object ? */ - { - iRetcode = ((mng_storerow)pData->fStorerow2) (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - } - } - while ((pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height) && - (iLines > 0)); /* until end-of-image or not enough input-data */ - } - - /* terminate output pass */ - if ((pData->bJPEGprogressive) && - (pData->pJPEGdinfo->output_scanline >= pData->pJPEGdinfo->output_height)) - { -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT) -#endif - if (jpeg_finish_output (pData->pJPEGdinfo) != JPEG_SUSPENDED) - { /* this scan has ended */ - pData->bJPEGscanstarted = MNG_FALSE; - pData->bJPEGscanending = MNG_FALSE; - } - else - { - pData->bJPEGscanending = MNG_TRUE; - } - } - } - while ((!jpeg_input_complete (pData->pJPEGdinfo)) && - (iLines > 0) && (!pData->bJPEGscanending)); - } - /* end of image ? */ - if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) && - (!pData->bJPEGscanending) && (jpeg_input_complete (pData->pJPEGdinfo)) && - (pData->pJPEGdinfo->input_scan_number == pData->pJPEGdinfo->output_scan_number)) - { - /* jpeg_finish_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS) -#endif - if (jpeg_finish_decompress (pData->pJPEGdinfo) == TRUE) - { /* indicate it's done */ - pData->bJPEGhasheader = MNG_FALSE; - pData->bJPEGdecostarted = MNG_FALSE; - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - /* remaining fluff is an error ! */ - if ((pData->iJPEGbufremain > 0) || (iRemain > 0)) - MNG_ERROR (pData, MNG_TOOMUCHJDAT); - } - } -#endif /* MNG_INCLUDE_IJG6B */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressfree (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B -#ifdef MNG_USE_SETJMP - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - /* free the row of JPEG-samples*/ - MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen); - - /* release the JPEG decompression object */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS) -#endif - jpeg_destroy_decompress (pData->pJPEGdinfo); - - pData->bJPEGdecompress = MNG_FALSE; /* indicate it's done */ - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ -/* * * */ -/* * JPEG decompression routines (JDAA) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressinit2 (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B - /* allocate and initialize a JPEG decompression object */ - pData->pJPEGdinfo2->err = jpeg_std_error (pData->pJPEGderr2); - -#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */ - pData->pJPEGderr2->error_exit = mng_error_exit; - pData->pJPEGderr2->output_message = mng_output_message; - - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif /* MNG_USE_SETJMP */ - - /* allocate and initialize a JPEG decompression object (continued) */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_JPEG_CREATE_DECOMPRESS) -#endif - jpeg_create_decompress (pData->pJPEGdinfo2); - - pData->bJPEGdecompress2 = MNG_TRUE; /* indicate it's initialized */ - - /* specify the source of the compressed data (eg, a file) */ - /* no, not a file; we have buffered input */ - pData->pJPEGdinfo2->src = pData->pJPEGdsrc2; - /* use the default handler */ - pData->pJPEGdinfo2->src->resync_to_restart = jpeg_resync_to_restart; - /* setup local source routine & parms */ - pData->pJPEGdinfo2->src->init_source = mng_init_source; - pData->pJPEGdinfo2->src->fill_input_buffer = mng_fill_input_buffer; - pData->pJPEGdinfo2->src->skip_input_data = mng_skip_input_data2; - pData->pJPEGdinfo2->src->term_source = mng_term_source; - pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2; - pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2; - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressdata2 (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata) -{ - mng_retcode iRetcode; - mng_uint32 iRemain; - mng_uint8p pWork; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_START); -#endif - -#if defined (MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - iRetcode = setjmp (pData->sErrorbuf);/* initialize local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - - pWork = pRawdata; - iRemain = iRawsize; - - if (pData->iJPEGtoskip2) /* JPEG-lib told us to skip some more data ? */ - { - if (iRemain > pData->iJPEGtoskip2) /* enough data in this buffer ? */ - { - iRemain -= pData->iJPEGtoskip2; /* skip enough to access the next byte */ - pWork += pData->iJPEGtoskip2; - - pData->iJPEGtoskip2 = 0; /* no more to skip then */ - } - else - { - pData->iJPEGtoskip2 -= iRemain; /* skip all data in the buffer */ - iRemain = 0; /* and indicate this accordingly */ - } - /* the skip set current-pointer to NULL ! */ - pData->pJPEGcurrent2 = pData->pJPEGbuf2; - } - - while (iRemain) /* repeat until no more input-bytes */ - { /* need to shift anything ? */ - if ((pData->pJPEGcurrent2 > pData->pJPEGbuf2) && - (pData->pJPEGcurrent2 - pData->pJPEGbuf2 + pData->iJPEGbufremain2 + iRemain > pData->iJPEGbufmax2)) - { - if (pData->iJPEGbufremain2 > 0) /* then do so */ - MNG_COPY (pData->pJPEGbuf2, pData->pJPEGcurrent2, pData->iJPEGbufremain2); - - pData->pJPEGcurrent2 = pData->pJPEGbuf2; - } - /* does the remaining input fit into the buffer ? */ - if (pData->iJPEGbufremain2 + iRemain <= pData->iJPEGbufmax2) - { /* move the lot */ - MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iRemain); - /* adjust remaining_bytes counter */ - pData->iJPEGbufremain2 += iRemain; - iRemain = 0; /* and indicate there's no input left */ - } - else - { /* calculate what does fit */ - mng_uint32 iFits = pData->iJPEGbufmax2 - pData->iJPEGbufremain2; - - if (iFits <= 0) /* no space is just bugger 'm all */ - MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL); - /* move that */ - MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iFits); - - pData->iJPEGbufremain2 += iFits; /* adjust remain_bytes counter */ - iRemain -= iFits; /* and the input-parms */ - pWork += iFits; - } - -#ifdef MNG_INCLUDE_IJG6B - pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2; - pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2; - - if (!pData->bJPEGhasheader2) /* haven't got the header yet ? */ - { - /* call jpeg_read_header() to obtain image info */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_HEADER) -#endif - if (jpeg_read_header (pData->pJPEGdinfo2, TRUE) != JPEG_SUSPENDED) - { /* indicate the header's oke */ - pData->bJPEGhasheader2 = MNG_TRUE; - /* let's do some sanity checks ! */ - if ((pData->pJPEGdinfo2->image_width != pData->iDatawidth ) || - (pData->pJPEGdinfo2->image_height != pData->iDataheight) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - - if (pData->pJPEGdinfo2->jpeg_color_space != JCS_GRAYSCALE) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - /* indicate whether or not it's progressive */ - pData->bJPEGprogressive2 = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo2); - - if (pData->bJPEGprogressive2) /* progressive alphachannel not allowed !!! */ - MNG_ERROR (pData, MNG_JPEGPARMSERR); - /* allocate a row of JPEG-samples */ - if (pData->pJPEGdinfo2->jpeg_color_space == JCS_YCbCr) - pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width * RGB_PIXELSIZE; - else - pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width; - - MNG_ALLOC (pData, pData->pJPEGrow2, pData->iJPEGrowlen2); - - pData->iJPEGalpharow = 0; /* quite empty up to now */ - } - - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - } - /* decompress not started ? */ - if ((pData->bJPEGhasheader2) && (!pData->bJPEGdecostarted2)) - { - /* set parameters for decompression */ - - if (pData->bJPEGprogressive2) /* progressive display ? */ - pData->pJPEGdinfo2->buffered_image = TRUE; - - /* jpeg_start_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS) -#endif - if (jpeg_start_decompress (pData->pJPEGdinfo2) == TRUE) - /* indicate it started */ - pData->bJPEGdecostarted2 = MNG_TRUE; - - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - } - /* process some scanlines ? */ - if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) && - ((!jpeg_input_complete (pData->pJPEGdinfo2)) || - (pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height))) - { - mng_int32 iLines; - - /* for (each output pass) */ - do - { /* address the row output buffer */ - JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow2; - - /* init new pass ? */ - if ((pData->bJPEGprogressive2) && - ((!pData->bJPEGscanstarted2) || - (pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height))) - { - pData->bJPEGscanstarted2 = MNG_TRUE; - - /* adjust output decompression parameters if required */ - /* nop */ - - /* start a new output pass */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_OUTPUT) -#endif - jpeg_start_output (pData->pJPEGdinfo2, pData->pJPEGdinfo2->input_scan_number); - - pData->iJPEGrow = 0; /* start at row 0 in the image again */ - } - - /* while (scan lines remain to be read) */ - do - { - /* jpeg_read_scanlines(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES) -#endif - iLines = jpeg_read_scanlines (pData->pJPEGdinfo2, (JSAMPARRAY)&pRow, 1); - - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - - if (iLines > 0) /* got something ? */ - { - if (pData->fStorerow3) /* store in object ? */ - { - iRetcode = ((mng_storerow)pData->fStorerow3) (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - } - } - while ((pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height) && - (iLines > 0)); /* until end-of-image or not enough input-data */ - - /* terminate output pass */ - if ((pData->bJPEGprogressive2) && - (pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height)) - { -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT) -#endif - if (jpeg_finish_output (pData->pJPEGdinfo2) == JPEG_SUSPENDED) - jpeg_finish_output (pData->pJPEGdinfo2); - /* this scan has ended */ - pData->bJPEGscanstarted2 = MNG_FALSE; - } - } - while ((!jpeg_input_complete (pData->pJPEGdinfo2)) && (iLines > 0)); - } - /* end of image ? */ - if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) && - (jpeg_input_complete (pData->pJPEGdinfo2)) && - (pData->pJPEGdinfo2->input_scan_number == pData->pJPEGdinfo2->output_scan_number)) - { - /* jpeg_finish_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS) -#endif - if (jpeg_finish_decompress (pData->pJPEGdinfo2) == TRUE) - { /* indicate it's done */ - pData->bJPEGhasheader2 = MNG_FALSE; - pData->bJPEGdecostarted2 = MNG_FALSE; - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - /* remaining fluff is an error ! */ - if ((pData->iJPEGbufremain2 > 0) || (iRemain > 0)) - MNG_ERROR (pData, MNG_TOOMUCHJDAT); - } - } -#endif /* MNG_INCLUDE_IJG6B */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressfree2 (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B -#ifdef MNG_USE_SETJMP - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - /* free the row of JPEG-samples*/ - MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2); - - /* release the JPEG decompression object */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS) -#endif - jpeg_destroy_decompress (pData->pJPEGdinfo2); - - pData->bJPEGdecompress2 = MNG_FALSE; /* indicate it's done */ - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG && MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_jpeg.h b/Engine/lib/lmng/libmng_jpeg.h deleted file mode 100644 index a072af9c9..000000000 --- a/Engine/lib/lmng/libmng_jpeg.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_jpeg.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : JPEG library interface (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the JPEG library interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_jpeg_h_ -#define _libmng_jpeg_h_ - -/* ************************************************************************** */ - -mng_retcode mngjpeg_initialize (mng_datap pData); -mng_retcode mngjpeg_cleanup (mng_datap pData); - -mng_retcode mngjpeg_decompressinit (mng_datap pData); -mng_retcode mngjpeg_decompressdata (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata); -mng_retcode mngjpeg_decompressfree (mng_datap pData); - -mng_retcode mngjpeg_decompressinit2 (mng_datap pData); -mng_retcode mngjpeg_decompressdata2 (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata); -mng_retcode mngjpeg_decompressfree2 (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_jpeg_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_memory.h b/Engine/lib/lmng/libmng_memory.h deleted file mode 100644 index b92d0c13d..000000000 --- a/Engine/lib/lmng/libmng_memory.h +++ /dev/null @@ -1,64 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_memory.h copyright (c) 2000-2003 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : Memory management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of memory management functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.3 - 06/12/2000 - G.Juyn * */ -/* * - swapped MNG_COPY parameter-names * */ -/* * 0.5.3 - 06/27/2000 - G.Juyn * */ -/* * - changed size parameter to mng_size_t * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_memory_h_ -#define _libmng_memory_h_ - -/* ************************************************************************** */ -/* * * */ -/* * Generic memory manager macros * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INTERNAL_MEMMNGMT -#define MNG_ALLOC(H,P,L) { P = calloc (1, (mng_size_t)(L)); \ - if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } } -#define MNG_ALLOCX(H,P,L) { P = calloc (1, (mng_size_t)(L)); } -#define MNG_FREE(H,P,L) { if (P) { free (P); P = 0; } } -#define MNG_FREEX(H,P,L) { if (P) free (P); } -#else -#define MNG_ALLOC(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); \ - if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } } -#define MNG_ALLOCX(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); } -#define MNG_FREE(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); P = 0; } } -#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); } } -#endif /* mng_internal_memmngmt */ - -#define MNG_COPY(D,S,L) { memcpy (D, S, (mng_size_t)(L)); } - -/* ************************************************************************** */ - -#endif /* _libmng_memory_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_object_prc.c b/Engine/lib/lmng/libmng_object_prc.c deleted file mode 100644 index f6691ff42..000000000 --- a/Engine/lib/lmng/libmng_object_prc.c +++ /dev/null @@ -1,6998 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_object_prc.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Object processing routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the internal object processing routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - fixed to support JNG objects * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for global color-chunks in animation * */ -/* * - added support for global PLTE,tRNS,bKGD in animation * */ -/* * - added SAVE & SEEK animation objects * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - added initialization of framenr/layernr/playtime * */ -/* * - changed ani_object create routines not to return the * */ -/* * created object (wasn't necessary) * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added object promotion routine (PROM handling) * */ -/* * - added ani-object routines for delta-image processing * */ -/* * - added compression/filter/interlace fields to * */ -/* * object-buffer for delta-image processing * */ -/* * * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed support for delta-image processing * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed some small things (as precaution) * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added processing of PLTE/tRNS & color-info for * */ -/* * delta-images in the ani_objects chain * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for PPLT chunk * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added support for freeze/restart/resume & go_xxxx * */ -/* * 0.9.1 - 07/16/2000 - G.Juyn * */ -/* * - fixed support for mng_display() after mng_read() * */ -/* * * */ -/* * 0.9.2 - 07/29/2000 - G.Juyn * */ -/* * - fixed small bugs in display processing * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added valid-flag to stored objects for read() / display()* */ -/* * - added routine to discard "invalid" objects * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - fixed delta-processing behavior * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - added storage for pixel-/alpha-sampledepth for delta's * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - removed "old" MAGN methods 3 & 4 * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 0.9.5 - 1/22/2001 - G.Juyn * */ -/* * - B129681 - fixed compiler warnings SGI/Irix * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * 1.0.5 - 08/16/2002 - G.Juyn * */ -/* * - completed MAGN support (16-bit functions) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - fixed reset_object_detail to clear old buffer * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 10/05/2002 - G.Juyn * */ -/* * - fixed problem with cloned objects marked as invalid * */ -/* * - fixed problem cloning frozen object_buffers * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * 1.0.5 - 11/04/2002 - G.Juyn * */ -/* * - fixed goframe/golayer/gotime processing * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - fixed magnification bug with object 0 * */ -/* * 1.0.5 - 01/19/2003 - G.Juyn * */ -/* * - B664911 - fixed buffer overflow during init * */ -/* * * */ -/* * 1.0.6 - 04/19/2003 - G.Juyn * */ -/* * - fixed problem with infinite loops during readdisplay() * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 06/09/2003 - G. R-P * */ -/* * - added conditionals around 8-bit magn routines * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around some JNG-supporting code * */ -/* * - removed conditionals around 8-bit magn routines * */ -/* * - added conditionals around delta-png and 16-bit code * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */ -/* * 1.0.6 - 07/29/2003 - G.Juyn * */ -/* * - fixed invalid test in promote_imageobject * */ -/* * 1.0.6 - 07/29/2003 - G.R-P. * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P. * */ -/* * - added conditionals around MAGN chunk support * */ -/* * * */ -/* * 1.0.7 - 03/21/2004 - G.Juyn * */ -/* * - fixed some 64-bit platform compiler warnings * */ -/* * * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT support * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * 1.0.9 - 12/31/2004 - G.R-P. * */ -/* * - fixed warnings about possible uninitialized pointers * */ -/* * 1.0.9 - 01/02/2005 - G.Juyn * */ -/* * - fixing some compiler-warnings * */ -/* * * */ -/* * 1.0.10 - 02/07/2005 - G.Juyn * */ -/* * - fixed some compiler-warnings * */ -/* * 1.0.10 - 07/30/2005 - G.Juyn * */ -/* * - fixed problem with CLON object during readdisplay() * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#include "libmng_objects.h" -#include "libmng_display.h" -#include "libmng_pixels.h" -#include "libmng_object_prc.h" -#include "libmng_cms.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ -/* * * */ -/* * Generic object routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_drop_invalid_objects (mng_datap pData) -{ - mng_objectp pObject; - mng_objectp pNext; - mng_cleanupobject fCleanup; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_START); -#endif - - pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */ - - while (pObject) /* more objects to check ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* invalid ? */ - if (!((mng_imagep)pObject)->bValid) - { /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - } - - pObject = pNext; /* neeeext */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_OBJCLEANUP -MNG_LOCAL mng_retcode create_obj_general (mng_datap pData, - mng_size_t iObjsize, - mng_cleanupobject fCleanup, - mng_processobject fProcess, - mng_ptr *ppObject) -{ - mng_object_headerp pWork; - - MNG_ALLOC (pData, pWork, iObjsize); - - pWork->fCleanup = fCleanup; - pWork->fProcess = fProcess; - pWork->iObjsize = iObjsize; - *ppObject = (mng_ptr)pWork; - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode mng_free_obj_general (mng_datap pData, - mng_objectp pObject) -{ - MNG_FREEX (pData, pObject, ((mng_object_headerp)pObject)->iObjsize); - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Image-data-object routines * */ -/* * * */ -/* * these handle the "object buffer" as defined by the MNG specification * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_create_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_imagedatap *ppObject) -{ - mng_imagedatap pImagedata; - mng_uint32 iSamplesize = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGDATAOBJECT, MNG_LC_START); -#endif - /* get a buffer */ -#ifdef MNG_OPTIMIZE_OBJCLEANUP - { - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_imagedata), - (mng_cleanupobject)mng_free_imagedataobject, - MNG_NULL, &pTemp); - if (iRetcode) - return iRetcode; - pImagedata = (mng_imagedatap)pTemp; - } -#else - MNG_ALLOC (pData, pImagedata, sizeof (mng_imagedata)); - /* fill the appropriate fields */ - pImagedata->sHeader.fCleanup = (mng_cleanupobject)mng_free_imagedataobject; - pImagedata->sHeader.fProcess = MNG_NULL; -#endif - pImagedata->iRefcount = 1; - pImagedata->bFrozen = MNG_FALSE; - pImagedata->bConcrete = bConcrete; - pImagedata->bViewable = bViewable; - pImagedata->iWidth = iWidth; - pImagedata->iHeight = iHeight; - pImagedata->iBitdepth = iBitdepth; - pImagedata->iColortype = iColortype; - pImagedata->iCompression = iCompression; - pImagedata->iFilter = iFilter; - pImagedata->iInterlace = iInterlace; - pImagedata->bCorrected = MNG_FALSE; - pImagedata->iAlphabitdepth = 0; - pImagedata->iJHDRcompression = 0; - pImagedata->iJHDRinterlace = 0; - pImagedata->iPixelsampledepth = iBitdepth; - pImagedata->iAlphasampledepth = iBitdepth; - /* determine samplesize from color_type/bit_depth */ - switch (iColortype) /* for < 8-bit samples we just reserve 8 bits */ - { - case 0 : ; /* gray */ - case 8 : { /* JPEG gray */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 2; - else -#endif - iSamplesize = 1; - - break; - } - case 2 : ; /* rgb */ - case 10 : { /* JPEG rgb */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 6; - else -#endif - iSamplesize = 3; - - break; - } - case 3 : { /* indexed */ - iSamplesize = 1; - break; - } - case 4 : ; /* gray+alpha */ - case 12 : { /* JPEG gray+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 4; - else -#endif - iSamplesize = 2; - - break; - } - case 6 : ; /* rgb+alpha */ - case 14 : { /* JPEG rgb+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 8; - else -#endif - iSamplesize = 4; - - break; - } - } - /* make sure we remember all this */ - pImagedata->iSamplesize = iSamplesize; - pImagedata->iRowsize = iSamplesize * iWidth; - pImagedata->iImgdatasize = pImagedata->iRowsize * iHeight; - - if (pImagedata->iImgdatasize) /* need a buffer ? */ - { /* so allocate it */ - MNG_ALLOCX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize); - - if (!pImagedata->pImgdata) /* enough memory ? */ - { - MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - } - /* check global stuff */ - pImagedata->bHasGAMA = pData->bHasglobalGAMA; -#ifndef MNG_SKIPCHUNK_cHRM - pImagedata->bHasCHRM = pData->bHasglobalCHRM; -#endif - pImagedata->bHasSRGB = pData->bHasglobalSRGB; -#ifndef MNG_SKIPCHUNK_iCCP - pImagedata->bHasICCP = pData->bHasglobalICCP; -#endif -#ifndef MNG_SKIPCHUNK_bKGD - pImagedata->bHasBKGD = pData->bHasglobalBKGD; -#endif - - if (pData->bHasglobalGAMA) /* global gAMA present ? */ - pImagedata->iGamma = pData->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - if (pData->bHasglobalCHRM) /* global cHRM present ? */ - { - pImagedata->iWhitepointx = pData->iGlobalWhitepointx; - pImagedata->iWhitepointy = pData->iGlobalWhitepointy; - pImagedata->iPrimaryredx = pData->iGlobalPrimaryredx; - pImagedata->iPrimaryredy = pData->iGlobalPrimaryredy; - pImagedata->iPrimarygreenx = pData->iGlobalPrimarygreenx; - pImagedata->iPrimarygreeny = pData->iGlobalPrimarygreeny; - pImagedata->iPrimarybluex = pData->iGlobalPrimarybluex; - pImagedata->iPrimarybluey = pData->iGlobalPrimarybluey; - } -#endif - - if (pData->bHasglobalSRGB) /* glbal sRGB present ? */ - pImagedata->iRenderingintent = pData->iGlobalRendintent; - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->bHasglobalICCP) /* glbal iCCP present ? */ - { - pImagedata->iProfilesize = pData->iGlobalProfilesize; - - if (pImagedata->iProfilesize) - { - MNG_ALLOCX (pData, pImagedata->pProfile, pImagedata->iProfilesize); - - if (!pImagedata->pProfile) /* enough memory ? */ - { - MNG_FREEX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize); - MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (pImagedata->pProfile, pData->pGlobalProfile, pImagedata->iProfilesize); - } - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - if (pData->bHasglobalBKGD) /* global bKGD present ? */ - { - pImagedata->iBKGDred = pData->iGlobalBKGDred; - pImagedata->iBKGDgreen = pData->iGlobalBKGDgreen; - pImagedata->iBKGDblue = pData->iGlobalBKGDblue; - } -#endif - - *ppObject = pImagedata; /* return it */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGDATAOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_imagedataobject (mng_datap pData, - mng_imagedatap pImagedata) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGDATAOBJECT, MNG_LC_START); -#endif - - if (pImagedata->iRefcount) /* decrease reference count */ - pImagedata->iRefcount--; - - if (!pImagedata->iRefcount) /* reached zero ? */ - { -#ifndef MNG_SKIPCHUNK_iCCP - if (pImagedata->iProfilesize) /* stored an iCCP profile ? */ - MNG_FREEX (pData, pImagedata->pProfile, pImagedata->iProfilesize); -#endif - if (pImagedata->iImgdatasize) /* sample-buffer present ? */ - MNG_FREEX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize); - /* drop the buffer */ - MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGDATAOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_clone_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_imagedatap pSource, - mng_imagedatap *ppClone) -{ - mng_imagedatap pNewdata; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGDATAOBJECT, MNG_LC_START); -#endif - /* get a buffer */ - MNG_ALLOC (pData, pNewdata, sizeof (mng_imagedata)); - /* blatently copy the original buffer */ - MNG_COPY (pNewdata, pSource, sizeof (mng_imagedata)); - - pNewdata->iRefcount = 1; /* only the reference count */ - pNewdata->bConcrete = bConcrete; /* and concrete-flag are different */ - pNewdata->bFrozen = MNG_FALSE; - - if (pNewdata->iImgdatasize) /* sample buffer present ? */ - { - MNG_ALLOCX (pData, pNewdata->pImgdata, pNewdata->iImgdatasize); - - if (!pNewdata->pImgdata) /* not enough memory ? */ - { - MNG_FREEX (pData, pNewdata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* make a copy */ - MNG_COPY (pNewdata->pImgdata, pSource->pImgdata, pNewdata->iImgdatasize); - } - -#ifndef MNG_SKIPCHUNK_iCCP - if (pNewdata->iProfilesize) /* iCCP profile present ? */ - { - MNG_ALLOCX (pData, pNewdata->pProfile, pNewdata->iProfilesize); - - if (!pNewdata->pProfile) /* enough memory ? */ - { - MNG_FREEX (pData, pNewdata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* make a copy */ - MNG_COPY (pNewdata->pProfile, pSource->pProfile, pNewdata->iProfilesize); - } -#endif - - *ppClone = pNewdata; /* return the clone */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGDATAOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Image-object routines * */ -/* * * */ -/* * these handle the "object" as defined by the MNG specification * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_create_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bConcrete, - mng_bool bVisible, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_int32 iPosx, - mng_int32 iPosy, - mng_bool bClipped, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb, - mng_imagep *ppObject) -{ - mng_imagep pImage; - mng_imagep pPrev, pNext; - mng_retcode iRetcode; - mng_imagedatap pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGOBJECT, MNG_LC_START); -#endif - /* get a buffer */ - MNG_ALLOC (pData, pImage, sizeof (mng_image)); - /* now get a new "object buffer" */ - iRetcode = mng_create_imagedataobject (pData, bConcrete, bViewable, - iWidth, iHeight, iBitdepth, iColortype, - iCompression, iFilter, iInterlace, - &pImgbuf); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pImage, sizeof (mng_image)); - return iRetcode; - } - /* fill the appropriate fields */ - pImage->sHeader.fCleanup = (mng_cleanupobject)mng_free_imageobject; - pImage->sHeader.fProcess = MNG_NULL; -#ifdef MNG_OPTIMIZE_OBJCLEANUP - pImage->sHeader.iObjsize = sizeof (mng_image); -#endif - pImage->iId = iId; - pImage->bFrozen = MNG_FALSE; - pImage->bVisible = bVisible; - pImage->bViewable = bViewable; - pImage->bValid = (mng_bool)((pData->bDisplaying) && - ((pData->bRunning) || (pData->bSearching)) && - (!pData->bFreezing)); - pImage->iPosx = iPosx; - pImage->iPosy = iPosy; - pImage->bClipped = bClipped; - pImage->iClipl = iClipl; - pImage->iClipr = iClipr; - pImage->iClipt = iClipt; - pImage->iClipb = iClipb; -#ifndef MNG_SKIPCHUNK_MAGN - pImage->iMAGN_MethodX = 0; - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; -#endif -#ifndef MNG_SKIPCHUNK_PAST - pImage->iPastx = 0; - pImage->iPasty = 0; -#endif - pImage->pImgbuf = pImgbuf; - - if (iId) /* only if not object 0 ! */ - { /* find previous lower object-id */ - pPrev = (mng_imagep)pData->pLastimgobj; - - while ((pPrev) && (pPrev->iId > iId)) - pPrev = (mng_imagep)pPrev->sHeader.pPrev; - - if (pPrev) /* found it ? */ - { - pImage->sHeader.pPrev = pPrev; /* than link it in place */ - pImage->sHeader.pNext = pPrev->sHeader.pNext; - pPrev->sHeader.pNext = pImage; - } - else /* if not found, it becomes the first ! */ - { - pImage->sHeader.pNext = pData->pFirstimgobj; - pData->pFirstimgobj = pImage; - } - - pNext = (mng_imagep)pImage->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pImage; - else - pData->pLastimgobj = pImage; - - } - - *ppObject = pImage; /* and return the new buffer */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* okido */ -} - -/* ************************************************************************** */ - -mng_retcode mng_free_imageobject (mng_datap pData, - mng_imagep pImage) -{ - mng_retcode iRetcode; - mng_imagep pPrev = pImage->sHeader.pPrev; - mng_imagep pNext = pImage->sHeader.pNext; - mng_imagedatap pImgbuf = pImage->pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGOBJECT, MNG_LC_START); -#endif - - if (pImage->iId) /* not for object 0 */ - { - if (pPrev) /* unlink from the list first ! */ - pPrev->sHeader.pNext = pImage->sHeader.pNext; - else - pData->pFirstimgobj = pImage->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pImage->sHeader.pPrev; - else - pData->pLastimgobj = pImage->sHeader.pPrev; - - } - /* unlink the image-data buffer */ - iRetcode = mng_free_imagedataobject (pData, pImgbuf); - /* drop its own buffer */ - MNG_FREEX (pData, pImage, sizeof (mng_image)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGOBJECT, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -mng_imagep mng_find_imageobject (mng_datap pData, - mng_uint16 iId) -{ - mng_imagep pImage = (mng_imagep)pData->pFirstimgobj; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (pData, MNG_FN_FIND_IMGOBJECT, MNG_LC_START); -#endif - /* look up the right id */ - while ((pImage) && (pImage->iId != iId)) - pImage = (mng_imagep)pImage->sHeader.pNext; - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - if ((!pImage) && (pData->eImagetype == mng_it_mpng)) - pImage = pData->pObjzero; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (pData, MNG_FN_FIND_IMGOBJECT, MNG_LC_END); -#endif - - return pImage; -} - -/* ************************************************************************** */ - -mng_retcode mng_clone_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bPartial, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy, - mng_imagep pSource, - mng_imagep *ppClone) -{ - mng_imagep pNew; - mng_imagep pPrev, pNext; - mng_retcode iRetcode; - mng_imagedatap pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGOBJECT, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - if ((pSource->iId) && /* needs magnification ? */ - ((pSource->iMAGN_MethodX) || (pSource->iMAGN_MethodY))) - { - iRetcode = mng_magnify_imageobject (pData, pSource); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - /* get a buffer */ -#ifdef MNG_OPTIMIZE_OBJCLEANUP - { - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_image), - (mng_cleanupobject)mng_free_imageobject, - MNG_NULL, &pTemp); - if (iRetcode) - return iRetcode; - pNew = (mng_imagep)pTemp; - } -#else - MNG_ALLOC (pData, pNew, sizeof (mng_image)); - /* fill or copy the appropriate fields */ - pNew->sHeader.fCleanup = (mng_cleanupobject)mng_free_imageobject; - pNew->sHeader.fProcess = MNG_NULL; -#endif - pNew->iId = iId; - pNew->bFrozen = MNG_FALSE; - pNew->bVisible = bVisible; - pNew->bViewable = pSource->bViewable; - pNew->bValid = MNG_TRUE; - - if (bHasloca) /* location info available ? */ - { - if (iLocationtype == 0) /* absolute position ? */ - { - pNew->iPosx = iLocationx; - pNew->iPosy = iLocationy; - } - else /* relative */ - { - pNew->iPosx = pSource->iPosx + iLocationx; - pNew->iPosy = pSource->iPosy + iLocationy; - } - } - else /* copy from source */ - { - pNew->iPosx = pSource->iPosx; - pNew->iPosy = pSource->iPosy; - } - /* copy clipping info */ - pNew->bClipped = pSource->bClipped; - pNew->iClipl = pSource->iClipl; - pNew->iClipr = pSource->iClipr; - pNew->iClipt = pSource->iClipt; - pNew->iClipb = pSource->iClipb; -#ifndef MNG_SKIPCHUNK_MAGN - /* copy magnification info */ -/* pNew->iMAGN_MethodX = pSource->iMAGN_MethodX; LET'S NOT !!!!!! - pNew->iMAGN_MethodY = pSource->iMAGN_MethodY; - pNew->iMAGN_MX = pSource->iMAGN_MX; - pNew->iMAGN_MY = pSource->iMAGN_MY; - pNew->iMAGN_ML = pSource->iMAGN_ML; - pNew->iMAGN_MR = pSource->iMAGN_MR; - pNew->iMAGN_MT = pSource->iMAGN_MT; - pNew->iMAGN_MB = pSource->iMAGN_MB; */ -#endif - -#ifndef MNG_SKIPCHUNK_PAST - pNew->iPastx = 0; /* initialize PAST info */ - pNew->iPasty = 0; -#endif - - if (iId) /* not for object 0 */ - { /* find previous lower object-id */ - pPrev = (mng_imagep)pData->pLastimgobj; - while ((pPrev) && (pPrev->iId > iId)) - pPrev = (mng_imagep)pPrev->sHeader.pPrev; - - if (pPrev) /* found it ? */ - { - pNew->sHeader.pPrev = pPrev; /* than link it in place */ - pNew->sHeader.pNext = pPrev->sHeader.pNext; - pPrev->sHeader.pNext = pNew; - } - else /* if not found, it becomes the first ! */ - { - pNew->sHeader.pNext = pData->pFirstimgobj; - pData->pFirstimgobj = pNew; - } - - pNext = (mng_imagep)pNew->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pNew; - else - pData->pLastimgobj = pNew; - - } - - if (bPartial) /* partial clone ? */ - { - pNew->pImgbuf = pSource->pImgbuf; /* use the same object buffer */ - pNew->pImgbuf->iRefcount++; /* and increase the reference count */ - } - else /* create a full clone ! */ - { - mng_bool bConcrete = MNG_FALSE; /* it's abstract by default (?) */ - - if (!bAbstract) /* determine concreteness from source ? */ - bConcrete = pSource->pImgbuf->bConcrete; - /* create a full clone ! */ - iRetcode = mng_clone_imagedataobject (pData, bConcrete, pSource->pImgbuf, &pImgbuf); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pNew, sizeof (mng_image)); - return iRetcode; - } - - pNew->pImgbuf = pImgbuf; /* and remember it */ - } - - *ppClone = pNew; /* return it */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_renum_imageobject (mng_datap pData, - mng_imagep pSource, - mng_uint16 iId, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy) -{ - mng_imagep pPrev, pNext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RENUM_IMGOBJECT, MNG_LC_START); -#endif - - pSource->bVisible = bVisible; /* store the new visibility */ - - if (bHasloca) /* location info available ? */ - { - if (iLocationtype == 0) /* absolute position ? */ - { - pSource->iPosx = iLocationx; - pSource->iPosy = iLocationy; - } - else /* relative */ - { - pSource->iPosx = pSource->iPosx + iLocationx; - pSource->iPosy = pSource->iPosy + iLocationy; - } - } - - if (iId) /* not for object 0 */ - { /* find previous lower object-id */ - pPrev = (mng_imagep)pData->pLastimgobj; - while ((pPrev) && (pPrev->iId > iId)) - pPrev = (mng_imagep)pPrev->sHeader.pPrev; - /* different from current ? */ - if (pPrev != (mng_imagep)pSource->sHeader.pPrev) - { - if (pSource->sHeader.pPrev) /* unlink from current position !! */ - ((mng_imagep)pSource->sHeader.pPrev)->sHeader.pNext = pSource->sHeader.pNext; - else - pData->pFirstimgobj = pSource->sHeader.pNext; - - if (pSource->sHeader.pNext) - ((mng_imagep)pSource->sHeader.pNext)->sHeader.pPrev = pSource->sHeader.pPrev; - else - pData->pLastimgobj = pSource->sHeader.pPrev; - - if (pPrev) /* found the previous ? */ - { /* than link it in place */ - pSource->sHeader.pPrev = pPrev; - pSource->sHeader.pNext = pPrev->sHeader.pNext; - pPrev->sHeader.pNext = pSource; - } - else /* if not found, it becomes the first ! */ - { - pSource->sHeader.pNext = pData->pFirstimgobj; - pData->pFirstimgobj = pSource; - } - - pNext = (mng_imagep)pSource->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pSource; - else - pData->pLastimgobj = pSource; - - } - } - - pSource->iId = iId; /* now set the new id! */ - - if (bAbstract) /* force it to abstract ? */ - pSource->pImgbuf->bConcrete = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RENUM_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_reset_object_details (mng_datap pData, - mng_imagep pImage, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_bool bResetall) -{ - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint32 iSamplesize = 0; - mng_uint32 iRowsize; - mng_uint32 iImgdatasize; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESET_OBJECTDETAILS, MNG_LC_START); -#endif - - pBuf->iWidth = iWidth; /* set buffer characteristics */ - pBuf->iHeight = iHeight; - pBuf->iBitdepth = iBitdepth; - pBuf->iColortype = iColortype; - pBuf->iCompression = iCompression; - pBuf->iFilter = iFilter; - pBuf->iInterlace = iInterlace; - pBuf->bCorrected = MNG_FALSE; - pBuf->iAlphabitdepth = 0; - /* determine samplesize from color_type/bit_depth */ - switch (iColortype) /* for < 8-bit samples we just reserve 8 bits */ - { - case 0 : ; /* gray */ - case 8 : { /* JPEG gray */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 2; - else -#endif - iSamplesize = 1; - - break; - } - case 2 : ; /* rgb */ - case 10 : { /* JPEG rgb */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 6; - else -#endif - iSamplesize = 3; - - break; - } - case 3 : { /* indexed */ - iSamplesize = 1; - break; - } - case 4 : ; /* gray+alpha */ - case 12 : { /* JPEG gray+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 4; - else -#endif - iSamplesize = 2; - - break; - } - case 6 : ; /* rgb+alpha */ - case 14 : { /* JPEG rgb+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 8; - else -#endif - iSamplesize = 4; - - break; - } - } - - iRowsize = iSamplesize * iWidth; - iImgdatasize = iRowsize * iHeight; - /* buffer size changed ? */ - if (iImgdatasize != pBuf->iImgdatasize) - { /* drop the old one */ - MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize); - - if (iImgdatasize) /* allocate new sample-buffer ? */ - MNG_ALLOC (pData, pBuf->pImgdata, iImgdatasize); - } - else - { - if (iImgdatasize) /* clear old buffer */ - { - mng_uint8p pTemp = pBuf->pImgdata; - mng_uint32 iX; - - for (iX = 0; iX < (iImgdatasize & (mng_uint32)(~3L)); iX += 4) - { - *((mng_uint32p)pTemp) = 0x00000000l; - pTemp += 4; - } - - while (pTemp < (pBuf->pImgdata + iImgdatasize)) - { - *pTemp = 0; - pTemp++; - } - } - } - - pBuf->iSamplesize = iSamplesize; /* remember new sizes */ - pBuf->iRowsize = iRowsize; - pBuf->iImgdatasize = iImgdatasize; - - if (!pBuf->iPixelsampledepth) /* set delta sampledepths if empty */ - pBuf->iPixelsampledepth = iBitdepth; - if (!pBuf->iAlphasampledepth) - pBuf->iAlphasampledepth = iBitdepth; - /* dimension set and clipping not ? */ - if ((iWidth) && (iHeight) && (!pImage->bClipped)) - { - pImage->iClipl = 0; /* set clipping to dimension by default */ - pImage->iClipr = iWidth; - pImage->iClipt = 0; - pImage->iClipb = iHeight; - } - -#ifndef MNG_SKIPCHUNK_MAGN - if (pImage->iId) /* reset magnification info ? */ - { - pImage->iMAGN_MethodX = 0; - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; - } -#endif - - if (bResetall) /* reset the other characteristics ? */ - { -#ifndef MNG_SKIPCHUNK_PAST - pImage->iPastx = 0; - pImage->iPasty = 0; -#endif - - pBuf->bHasPLTE = MNG_FALSE; - pBuf->bHasTRNS = MNG_FALSE; - pBuf->bHasGAMA = pData->bHasglobalGAMA; -#ifndef MNG_SKIPCHUNK_cHRM - pBuf->bHasCHRM = pData->bHasglobalCHRM; -#endif - pBuf->bHasSRGB = pData->bHasglobalSRGB; -#ifndef MNG_SKIPCHUNK_iCCP - pBuf->bHasICCP = pData->bHasglobalICCP; -#endif -#ifndef MNG_SKIPCHUNK_bKGD - pBuf->bHasBKGD = pData->bHasglobalBKGD; -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* drop possibly old ICC profile */ - { - MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize); - pBuf->iProfilesize = 0; - } -#endif - - if (pData->bHasglobalGAMA) /* global gAMA present ? */ - pBuf->iGamma = pData->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - if (pData->bHasglobalCHRM) /* global cHRM present ? */ - { - pBuf->iWhitepointx = pData->iGlobalWhitepointx; - pBuf->iWhitepointy = pData->iGlobalWhitepointy; - pBuf->iPrimaryredx = pData->iGlobalPrimaryredx; - pBuf->iPrimaryredy = pData->iGlobalPrimaryredy; - pBuf->iPrimarygreenx = pData->iGlobalPrimarygreenx; - pBuf->iPrimarygreeny = pData->iGlobalPrimarygreeny; - pBuf->iPrimarybluex = pData->iGlobalPrimarybluex; - pBuf->iPrimarybluey = pData->iGlobalPrimarybluey; - } -#endif - - if (pData->bHasglobalSRGB) /* global sRGB present ? */ - pBuf->iRenderingintent = pData->iGlobalRendintent; - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->bHasglobalICCP) /* global iCCP present ? */ - { - if (pData->iGlobalProfilesize) - { - MNG_ALLOC (pData, pBuf->pProfile, pData->iGlobalProfilesize); - MNG_COPY (pBuf->pProfile, pData->pGlobalProfile, pData->iGlobalProfilesize); - } - - pBuf->iProfilesize = pData->iGlobalProfilesize; - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - if (pData->bHasglobalBKGD) /* global bKGD present ? */ - { - pBuf->iBKGDred = pData->iGlobalBKGDred; - pBuf->iBKGDgreen = pData->iGlobalBKGDgreen; - pBuf->iBKGDblue = pData->iGlobalBKGDblue; - } -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESET_OBJECTDETAILS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#if !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN) -mng_retcode mng_promote_imageobject (mng_datap pData, - mng_imagep pImage, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype) -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint32 iW = pBuf->iWidth; - mng_uint32 iH = pBuf->iHeight; - mng_uint8p pNewbuf; - mng_uint32 iNewbufsize; - mng_uint32 iNewrowsize; - mng_uint32 iNewsamplesize = pBuf->iSamplesize; - mng_uint32 iY; - mng_uint8 iTempdepth; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_START); -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (iBitdepth < 8) - iBitdepth=8; - if (pBuf->iBitdepth < 8) - pBuf->iBitdepth=8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iBitdepth=8; - if (pBuf->iBitdepth > 8) - pBuf->iBitdepth=8; -#endif - - pData->fPromoterow = MNG_NULL; /* init promotion fields */ - pData->fPromBitdepth = MNG_NULL; - pData->iPromColortype = iColortype; - pData->iPromBitdepth = iBitdepth; - pData->iPromFilltype = iFilltype; - - if (iBitdepth != pBuf->iBitdepth) /* determine bitdepth promotion */ - { - if (pBuf->iColortype == MNG_COLORTYPE_INDEXED) - iTempdepth = 8; - else - iTempdepth = pBuf->iBitdepth; - -#ifndef MNG_NO_DELTA_PNG - if (iFilltype == MNG_FILLMETHOD_ZEROFILL) - { - switch (iTempdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - switch (iBitdepth) - { - case 2 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_2; break; } - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_16; break; } -#endif - } - break; - } - case 2 : { - switch (iBitdepth) - { - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_16; break; } -#endif - } - break; - } - case 4 : { - switch (iBitdepth) - { - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_4_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_4_16; break; } -#endif - } - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_8_16; -#endif - break; - } - } - } - else -#endif - { - switch (iTempdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - switch (iBitdepth) - { - case 2 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_2; break; } - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_16; break; } -#endif - } - break; - } - case 2 : { - switch (iBitdepth) - { - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_16; break; } -#endif - } - break; - } - case 4 : { - switch (iBitdepth) - { - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_4_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_4_16; break; } -#endif - } - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_8_16; -#endif - break; - } - } - } - } - /* g -> g */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_GRAY)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_g16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_g8; - } - - iNewsamplesize = 1; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 2; -#endif - } - else /* g -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_GRAYA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_ga16; -#endif - - iNewsamplesize = 2; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 4; -#endif - } - else /* g -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_RGB)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgb16; -#endif - - iNewsamplesize = 3; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 6; -#endif - } - else /* g -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* ga -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) && - (iColortype == MNG_COLORTYPE_GRAYA)) - { - iNewsamplesize = 2; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16; - if (iBitdepth == 16) - iNewsamplesize = 4; -#endif - } - else /* ga -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* rgb -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_RGB) && - (iColortype == MNG_COLORTYPE_RGB)) - { - iNewsamplesize = 3; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16; - if (iBitdepth == 16) - iNewsamplesize = 6; -#endif - } - else /* rgb -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_RGB) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16; -#endif - - iNewsamplesize = 4; -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* indexed -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) && - (iColortype == MNG_COLORTYPE_RGB)) - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb8; - - iNewsamplesize = 3; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 6; -#endif - } - else /* indexed -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) && - (iColortype == MNG_COLORTYPE_RGBA)) - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba8; - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* rgba -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_RGBA) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - iNewsamplesize = 4; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16; - } - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } -#ifdef MNG_INCLUDE_JNG - else /* JPEG g -> g */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGGRAY)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_g16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_g8; - } - - iNewsamplesize = 1; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 2; -#endif - } - else /* JPEG g -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGGRAYA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_ga16; -#endif - - iNewsamplesize = 2; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 4; -#endif - } - else /* JPEG g -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGCOLOR)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgb16; -#endif - - iNewsamplesize = 3; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 6; -#endif - } - else /* JPEG g -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* JPEG ga -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) && - (iColortype == MNG_COLORTYPE_JPEGGRAYA)) - { - iNewsamplesize = 2; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16; - if (iBitdepth == 16) - iNewsamplesize = 4; -#endif - - } - else /* JPEG ga -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* JPEG rgb -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) && - (iColortype == MNG_COLORTYPE_JPEGCOLOR)) - { - iNewsamplesize = 3; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16; - if (iBitdepth == 16) - iNewsamplesize = 6; -#endif - - } - else /* JPEG rgb -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* JPEG rgba -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - iNewsamplesize = 4; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16; - if (iBitdepth == 16) - iNewsamplesize = 8; -#endif - } -#endif /* JNG */ - - /* found a proper promotion ? */ - if (pData->fPromoterow) - { - pData->pPromBuf = (mng_ptr)pBuf; - pData->iPromWidth = pBuf->iWidth; - iNewrowsize = iW * iNewsamplesize; - iNewbufsize = iH * iNewrowsize; - - MNG_ALLOC (pData, pNewbuf, iNewbufsize); - - pData->pPromSrc = (mng_ptr)pBuf->pImgdata; - pData->pPromDst = (mng_ptr)pNewbuf; - iY = 0; - - while ((!iRetcode) && (iY < iH)) - { - iRetcode = ((mng_promoterow)pData->fPromoterow) (pData); - pData->pPromSrc = (mng_uint8p)pData->pPromSrc + pBuf->iRowsize; - pData->pPromDst = (mng_uint8p)pData->pPromDst + iNewrowsize; -/* pData->pPromSrc = (mng_ptr)((mng_uint32)pData->pPromSrc + pBuf->iRowsize); */ -/* pData->pPromDst = (mng_ptr)((mng_uint32)pData->pPromDst + iNewrowsize); */ - iY++; - } - - MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize); - - pBuf->iBitdepth = iBitdepth; - pBuf->iColortype = iColortype; - pBuf->iSamplesize = iNewsamplesize; - pBuf->iRowsize = iNewrowsize; - pBuf->iImgdatasize = iNewbufsize; - pBuf->pImgdata = pNewbuf; - pBuf->bHasPLTE = MNG_FALSE; - pBuf->iPLTEcount = 0; - pBuf->bHasTRNS = MNG_FALSE; - pBuf->iTRNScount = 0; - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_magnify_imageobject (mng_datap pData, - mng_imagep pImage) -{ - mng_uint8p pNewdata; - mng_uint8p pSrcline1; - mng_uint8p pSrcline2; - mng_uint8p pTempline; - mng_uint8p pDstline; - mng_uint32 iNewrowsize; - mng_uint32 iNewsize; - mng_uint32 iY; - mng_int32 iS, iM; - mng_retcode iRetcode; - - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint32 iNewW = pBuf->iWidth; - mng_uint32 iNewH = pBuf->iHeight; - mng_magnify_x fMagnifyX = MNG_NULL; - mng_magnify_y fMagnifyY = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_START); -#endif - - if (pBuf->iColortype == MNG_COLORTYPE_INDEXED) /* indexed color ? */ - { /* concrete buffer ? */ - if ((pBuf->bConcrete) && (pImage->iId)) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN - if (pBuf->iTRNScount) /* with transparency ? */ - iRetcode = mng_promote_imageobject (pData, pImage, 8, 6, 0); - else - iRetcode = mng_promote_imageobject (pData, pImage, 8, 2, 0); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_MAGN - /* Promote everything to RGBA, using fill method 0 (LBR) */ - iRetcode = mng_promote_imageobject (pData, pImage, 8, 6, 0); - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - - if (pImage->iMAGN_MethodX) /* determine new width */ - { - if (pImage->iMAGN_MethodX == 1) - { - iNewW = pImage->iMAGN_ML; - if (pBuf->iWidth > 1) - iNewW = iNewW + pImage->iMAGN_MR; - if (pBuf->iWidth > 2) - iNewW = iNewW + (pBuf->iWidth - 2) * (pImage->iMAGN_MX); - } - else - { - iNewW = pBuf->iWidth + pImage->iMAGN_ML - 1; - if (pBuf->iWidth > 2) - iNewW = iNewW + pImage->iMAGN_MR - 1; - if (pBuf->iWidth > 3) - iNewW = iNewW + (pBuf->iWidth - 3) * (pImage->iMAGN_MX - 1); - } - } - - if (pImage->iMAGN_MethodY) /* determine new height */ - { - if (pImage->iMAGN_MethodY == 1) - { - iNewH = pImage->iMAGN_MT; - if (pBuf->iHeight > 1) - iNewH = iNewH + pImage->iMAGN_ML; - if (pBuf->iHeight > 2) - iNewH = iNewH + (pBuf->iHeight - 2) * (pImage->iMAGN_MY); - } - else - { - iNewH = pBuf->iHeight + pImage->iMAGN_MT - 1; - if (pBuf->iHeight > 2) - iNewH = iNewH + pImage->iMAGN_MB - 1; - if (pBuf->iHeight > 3) - iNewH = iNewH + (pBuf->iHeight - 3) * (pImage->iMAGN_MY - 1); - } - } - /* get new buffer */ - iNewrowsize = iNewW * pBuf->iSamplesize; - iNewsize = iNewH * iNewrowsize; - - MNG_ALLOC (pData, pNewdata, iNewsize); - - switch (pBuf->iColortype) /* determine magnification routines */ - { -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN - case 0 : ; - case 8 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_g8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_g8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_g8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_g8_x2; break; } - case 5 : { fMagnifyX = mng_magnify_g8_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_g8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_g8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_g8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_g8_y2; break; } - case 5 : { fMagnifyY = mng_magnify_g8_y3; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_g16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_g16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_g16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_g16_x2; break; } - case 5 : { fMagnifyX = mng_magnify_g16_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_g16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_g16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_g16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_g16_y2; break; } - case 5 : { fMagnifyY = mng_magnify_g16_y3; break; } - } - } -#endif - - break; - } - - case 2 : ; - case 10 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgb8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgb8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgb8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgb8_x2; break; } - case 5 : { fMagnifyX = mng_magnify_rgb8_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgb8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgb8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgb8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgb8_y2; break; } - case 5 : { fMagnifyY = mng_magnify_rgb8_y3; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgb16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgb16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgb16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgb16_x2; break; } - case 5 : { fMagnifyX = mng_magnify_rgb16_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgb16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgb16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgb16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgb16_y2; break; } - case 5 : { fMagnifyY = mng_magnify_rgb16_y3; break; } - } - } -#endif - - break; - } - - case 4 : ; - case 12 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_ga8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_ga8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_ga8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_ga8_x4; break; } - case 5 : { fMagnifyX = mng_magnify_ga8_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_ga8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_ga8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_ga8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_ga8_y4; break; } - case 5 : { fMagnifyY = mng_magnify_ga8_y5; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_ga16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_ga16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_ga16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_ga16_x4; break; } - case 5 : { fMagnifyX = mng_magnify_ga16_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_ga16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_ga16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_ga16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_ga16_y4; break; } - case 5 : { fMagnifyY = mng_magnify_ga16_y5; break; } - } - } -#endif - - break; - } -#endif - - case 6 : ; - case 14 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgba8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgba8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgba8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgba8_x4; break; } - case 5 : { fMagnifyX = mng_magnify_rgba8_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgba8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgba8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgba8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgba8_y4; break; } - case 5 : { fMagnifyY = mng_magnify_rgba8_y5; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgba16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgba16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgba16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgba16_x4; break; } - case 5 : { fMagnifyX = mng_magnify_rgba16_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgba16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgba16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgba16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgba16_y4; break; } - case 5 : { fMagnifyY = mng_magnify_rgba16_y5; break; } - } - } -#endif -#endif - break; - } - } - - pSrcline1 = pBuf->pImgdata; /* initialize row-loop variables */ - pDstline = pNewdata; - /* allocate temporary row */ - MNG_ALLOC (pData, pTempline, iNewrowsize); - - for (iY = 0; iY < pBuf->iHeight; iY++) - { - pSrcline2 = pSrcline1 + pBuf->iRowsize; - - if (fMagnifyX) /* magnifying in X-direction ? */ - { - iRetcode = fMagnifyX (pData, pImage->iMAGN_MX, - pImage->iMAGN_ML, pImage->iMAGN_MR, - pBuf->iWidth, pSrcline1, pDstline); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pTempline, iNewrowsize); - MNG_FREEX (pData, pNewdata, iNewsize); - return iRetcode; - } - } - else - { - MNG_COPY (pDstline, pSrcline1, iNewrowsize); - } - - pDstline += iNewrowsize; - /* magnifying in Y-direction ? */ - if ((fMagnifyY) && - ((iY < pBuf->iHeight - 1) || (pBuf->iHeight == 1) || (pImage->iMAGN_MethodY == 1))) - { - if (iY == 0) /* first interval ? */ - { - if (pBuf->iHeight == 1) /* single row ? */ - pSrcline2 = MNG_NULL; - - iM = (mng_int32)pImage->iMAGN_MT; - } - else /* last interval ? */ - if (((pImage->iMAGN_MethodY == 1) && (iY == (pBuf->iHeight - 1))) || - ((pImage->iMAGN_MethodY != 1) && (iY == (pBuf->iHeight - 2))) ) - iM = (mng_int32)pImage->iMAGN_MB; - else /* middle interval */ - iM = (mng_int32)pImage->iMAGN_MY; - - for (iS = 1; iS < iM; iS++) - { - iRetcode = fMagnifyY (pData, iS, iM, pBuf->iWidth, - pSrcline1, pSrcline2, pTempline); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pTempline, iNewrowsize); - MNG_FREEX (pData, pNewdata, iNewsize); - return iRetcode; - } - - if (fMagnifyX) /* magnifying in X-direction ? */ - { - iRetcode = fMagnifyX (pData, pImage->iMAGN_MX, - pImage->iMAGN_ML, pImage->iMAGN_MR, - pBuf->iWidth, pTempline, pDstline); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pTempline, iNewrowsize); - MNG_FREEX (pData, pNewdata, iNewsize); - return iRetcode; - } - } - else - { - MNG_COPY (pDstline, pTempline, iNewrowsize); - } - - pDstline += iNewrowsize; - } - } - - pSrcline1 += pBuf->iRowsize; - } - /* drop temporary row */ - MNG_FREEX (pData, pTempline, iNewrowsize); - /* drop old pixel-data */ - MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize); - - pBuf->pImgdata = pNewdata; /* save new buffer dimensions */ - pBuf->iRowsize = iNewrowsize; - pBuf->iImgdatasize = iNewsize; - pBuf->iWidth = iNewW; - pBuf->iHeight = iNewH; - - if (pImage->iId) /* real object ? */ - { - pImage->iMAGN_MethodX = 0; /* it's done; don't do it again !!! */ - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_colorcorrect_object (mng_datap pData, - mng_imagep pImage) -{ - mng_imagedatap pBuf = pImage->pImgbuf; - mng_retcode iRetcode; - mng_uint32 iY; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COLORCORRECT_OBJECT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_JNG - if ((pBuf->iBitdepth < 8) || /* we need 8- or 16-bit RGBA !!! */ - ((pBuf->iColortype != MNG_COLORTYPE_RGBA ) && - (pBuf->iColortype != MNG_COLORTYPE_JPEGCOLORA) )) -#else - if (pBuf->iBitdepth < 8) /* we need 8- or 16-bit RGBA !!! */ -#endif - MNG_ERROR (pData, MNG_OBJNOTABSTRACT); - - if (!pBuf->bCorrected) /* only if not already done ! */ - { /* so the row routines now to find it */ - pData->pRetrieveobj = (mng_objectp)pImage; - pData->pStoreobj = (mng_objectp)pImage; - pData->pStorebuf = (mng_objectp)pImage->pImgbuf; - -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - { - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - pData->fStorerow = (mng_fptr)mng_store_rgba16; - } - else -#endif - { - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - pData->fStorerow = (mng_fptr)mng_store_rgba8; - } - - pData->bIsOpaque = MNG_FALSE; - - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pBuf->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->iPixelofs = 0; - pData->bIsRGBA16 = MNG_FALSE; - /* adjust for 16-bit object ? */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - { - pData->bIsRGBA16 = MNG_TRUE; - pData->iRowsize = pData->iRowsamples << 3; - } -#endif - - pData->fCorrectrow = MNG_NULL; /* default no color-correction */ - -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - - if (pData->fCorrectrow) /* really correct something ? */ - { /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - pData->pWorkrow = pData->pRGBArow; - iY = 0; /* start from the top */ - - while ((!iRetcode) && (iY < pBuf->iHeight)) - { /* get a row */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - - if (!iRetcode) /* color correct it */ - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* store it back ! */ - iRetcode = ((mng_storerow)pData->fStorerow) (pData); - - if (!iRetcode) /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREEX (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - - pBuf->bCorrected = MNG_TRUE; /* let's not go through that again ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COLORCORRECT_OBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Animation-object routines * */ -/* * * */ -/* * these handle the animation objects used to re-run parts of a MNG. * */ -/* * eg. during LOOP or TERM processing * */ -/* * * */ -/* ************************************************************************** */ - -void mng_add_ani_object (mng_datap pData, - mng_object_headerp pObject) -{ - mng_object_headerp pLast = (mng_object_headerp)pData->pLastaniobj; - - if (pLast) /* link it as last in the chain */ - { - pObject->pPrev = pLast; - pLast->pNext = pObject; - } - else - { - pObject->pPrev = MNG_NULL; /* be on the safe side */ - pData->pFirstaniobj = pObject; - } - - pObject->pNext = MNG_NULL; /* be on the safe side */ - pData->pLastaniobj = pObject; - /* keep track for jumping */ - pObject->iFramenr = pData->iFrameseq; - pObject->iLayernr = pData->iLayerseq; - pObject->iPlaytime = pData->iFrametime; - /* save restart object ? */ - if ((pData->bDisplaying) && (!pData->bRunning) && (!pData->pCurraniobj)) - pData->pCurraniobj = pObject; - - return; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -mng_retcode mng_create_ani_image (mng_datap pData) -{ - mng_ani_imagep pImage; - mng_imagep pCurrent; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IMAGE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - pCurrent = (mng_imagep)pData->pObjzero; - else /* get the current object */ -#endif - pCurrent = (mng_imagep)pData->pCurrentobj; - - if (!pCurrent) /* otherwise object 0 */ - pCurrent = (mng_imagep)pData->pObjzero; - /* now just clone the object !!! */ - iRetcode = mng_clone_imageobject (pData, 0, MNG_FALSE, pCurrent->bVisible, - MNG_FALSE, MNG_FALSE, 0, 0, 0, pCurrent, - &pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pImage->sHeader.fCleanup = mng_free_ani_image; - pImage->sHeader.fProcess = mng_process_ani_image; - - mng_add_ani_object (pData, (mng_object_headerp)pImage); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* okido */ -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_image (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_imagep pImage = (mng_ani_imagep)pObject; - mng_imagedatap pImgbuf = pImage->pImgbuf; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IMAGE, MNG_LC_START); -#endif - /* unlink the image-data buffer */ - iRetcode = mng_free_imagedataobject (pData, pImgbuf); - /* drop its own buffer */ - MNG_FREEX (pData, pImage, sizeof (mng_ani_image)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IMAGE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_image (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_ani_imagep pImage = (mng_imagep)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IMAGE, MNG_LC_START); -#endif - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { - mng_imagep pDelta = (mng_imagep)pData->pDeltaImage; - - if (!pData->iBreakpoint) /* only execute if not broken before */ - { /* make sure to process pixels as well */ - pData->bDeltaimmediate = MNG_FALSE; - /* execute the delta process */ - iRetcode = mng_execute_delta_image (pData, pDelta, (mng_imagep)pObject); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - /* now go and shoot it off (if required) */ - if ((pDelta->bVisible) && (pDelta->bViewable)) - iRetcode = mng_display_image (pData, pDelta, MNG_FALSE); - - if (!pData->bTimerset) - pData->bHasDHDR = MNG_FALSE; /* this image signifies IEND !! */ - - } - else -#endif - if (pData->pCurrentobj) /* active object ? */ - { - mng_imagep pCurrent = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf = pCurrent->pImgbuf; - - if (!pData->iBreakpoint) /* don't copy it again ! */ - { - if (pBuf->iImgdatasize) /* buffer present in active object ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize); - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize); -#endif - /* now blatently copy the animation buffer */ - MNG_COPY (pBuf, pImage->pImgbuf, sizeof (mng_imagedata)); - /* copy viewability */ - pCurrent->bViewable = pImage->bViewable; - - if (pBuf->iImgdatasize) /* sample buffer present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pImgdata, pBuf->iImgdatasize); - MNG_COPY (pBuf->pImgdata, pImage->pImgbuf->pImgdata, pBuf->iImgdatasize); - } - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pProfile, pBuf->iProfilesize); - MNG_COPY (pBuf->pProfile, pImage->pImgbuf->pProfile, pBuf->iProfilesize); - } -#endif - } - /* now go and shoot it off (if required) */ - if ((pCurrent->bVisible) && (pCurrent->bViewable)) - iRetcode = mng_display_image (pData, pCurrent, MNG_FALSE); - } - else - { - mng_imagep pObjzero = (mng_imagep)pData->pObjzero; - mng_imagedatap pBuf = pObjzero->pImgbuf; - - if (!pData->iBreakpoint) /* don't copy it again ! */ - { - if (pBuf->iImgdatasize) /* buffer present in active object ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize); - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize); -#endif - /* now blatently copy the animation buffer */ - MNG_COPY (pBuf, pImage->pImgbuf, sizeof (mng_imagedata)); - /* copy viewability */ - pObjzero->bViewable = pImage->bViewable; - - if (pBuf->iImgdatasize) /* sample buffer present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pImgdata, pBuf->iImgdatasize); - MNG_COPY (pBuf->pImgdata, pImage->pImgbuf->pImgdata, pBuf->iImgdatasize); - } - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pProfile, pBuf->iProfilesize); - MNG_COPY (pBuf->pProfile, pImage->pImgbuf->pProfile, pBuf->iProfilesize); - } -#endif - } - /* now go and show it */ - iRetcode = mng_display_image (pData, pObjzero, MNG_FALSE); - } - - if (!iRetcode) /* all's well ? */ - { - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 99; /* fictive number; no more processing needed! */ - else - pData->iBreakpoint = 0; /* else clear it */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IMAGE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_plte (mng_datap pData, - mng_uint32 iEntrycount, - mng_palette8ep paEntries) -#else -mng_retcode mng_create_ani_plte (mng_datap pData) -#endif -{ - mng_ani_pltep pPLTE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PLTE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_plte), - mng_free_obj_general, - mng_process_ani_plte, - &pTemp); - if (iRetcode) - return iRetcode; - pPLTE = (mng_ani_pltep)pTemp; -#else - MNG_ALLOC (pData, pPLTE, sizeof (mng_ani_plte)); - - pPLTE->sHeader.fCleanup = mng_free_ani_plte; - pPLTE->sHeader.fProcess = mng_process_ani_plte; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pPLTE); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pPLTE->iEntrycount = iEntrycount; - MNG_COPY (pPLTE->aEntries, paEntries, sizeof (pPLTE->aEntries)); -#else - pPLTE->iEntrycount = pData->iGlobalPLTEcount; - MNG_COPY (pPLTE->aEntries, pData->aGlobalPLTEentries, sizeof (pPLTE->aEntries)); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_plte (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PLTE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_plte)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_plte (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_pltep pPLTE = (mng_ani_pltep)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PLTE, MNG_LC_START); -#endif - - pData->bHasglobalPLTE = MNG_TRUE; - pData->iGlobalPLTEcount = pPLTE->iEntrycount; - - MNG_COPY (pData->aGlobalPLTEentries, pPLTE->aEntries, sizeof (pPLTE->aEntries)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_trns (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_create_ani_trns (mng_datap pData) -#endif -{ - mng_ani_trnsp pTRNS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TRNS, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_trns), - mng_free_obj_general, - mng_process_ani_trns, - &pTemp); - if (iRetcode) - return iRetcode; - pTRNS = (mng_ani_trnsp)pTemp; -#else - MNG_ALLOC (pData, pTRNS, sizeof (mng_ani_trns)); - - pTRNS->sHeader.fCleanup = mng_free_ani_trns; - pTRNS->sHeader.fProcess = mng_process_ani_trns; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pTRNS); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pTRNS->iRawlen = iRawlen; - MNG_COPY (pTRNS->aRawdata, pRawdata, sizeof (pTRNS->aRawdata)); -#else - pTRNS->iRawlen = pData->iGlobalTRNSrawlen; - MNG_COPY (pTRNS->aRawdata, pData->aGlobalTRNSrawdata, sizeof (pTRNS->aRawdata)); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_trns (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TRNS, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_trns)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_trns (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_trnsp pTRNS = (mng_ani_trnsp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TRNS, MNG_LC_START); -#endif - - pData->bHasglobalTRNS = MNG_TRUE; - pData->iGlobalTRNSrawlen = pTRNS->iRawlen; - - MNG_COPY (pData->aGlobalTRNSrawdata, pTRNS->aRawdata, sizeof (pTRNS->aRawdata)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iGamma) -#else -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_gamap pGAMA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_GAMA, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_gama), - mng_free_obj_general, - mng_process_ani_gama, - &pTemp); - if (iRetcode) - return iRetcode; - pGAMA = (mng_ani_gamap)pTemp; -#else - MNG_ALLOC (pData, pGAMA, sizeof (mng_ani_gama)); - - pGAMA->sHeader.fCleanup = mng_free_ani_gama; - pGAMA->sHeader.fProcess = mng_process_ani_gama; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pGAMA); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pGAMA->bEmpty = bEmpty; - pGAMA->iGamma = iGamma; -#else - pGAMA->bEmpty = ((mng_gamap)pChunk)->bEmpty; - pGAMA->iGamma = ((mng_gamap)pChunk)->iGamma; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_gama (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_GAMA, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_gama)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_gama (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_gamap pGAMA = (mng_ani_gamap)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_GAMA, MNG_LC_START); -#endif - - if (pGAMA->bEmpty) /* empty chunk ? */ - { /* clear global gAMA */ - pData->bHasglobalGAMA = MNG_FALSE; - pData->iGlobalGamma = 0; - } - else - { /* set global gAMA */ - pData->bHasglobalGAMA = MNG_TRUE; - pData->iGlobalGamma = pGAMA->iGamma; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) -#else -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ptr pTemp; - mng_ani_chrmp pCHRM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CHRM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_chrm), - mng_free_obj_general, - mng_process_ani_chrm, - &pTemp); - if (iRetcode) - return iRetcode; - pCHRM = (mng_ani_chrmp)pTemp; -#else - MNG_ALLOC (pData, pCHRM, sizeof (mng_ani_chrm)); - - pCHRM->sHeader.fCleanup = mng_free_ani_chrm; - pCHRM->sHeader.fProcess = mng_process_ani_chrm; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pCHRM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pCHRM->bEmpty = bEmpty; - pCHRM->iWhitepointx = iWhitepointx; - pCHRM->iWhitepointy = iWhitepointy; - pCHRM->iRedx = iRedx; - pCHRM->iRedy = iRedy; - pCHRM->iGreenx = iGreenx; - pCHRM->iGreeny = iGreeny; - pCHRM->iBluex = iBluex; - pCHRM->iBluey = iBluey; -#else - pCHRM->bEmpty = ((mng_chrmp)pChunk)->bEmpty; - pCHRM->iWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; - pCHRM->iWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; - pCHRM->iRedx = ((mng_chrmp)pChunk)->iRedx; - pCHRM->iRedy = ((mng_chrmp)pChunk)->iRedy; - pCHRM->iGreenx = ((mng_chrmp)pChunk)->iGreenx; - pCHRM->iGreeny = ((mng_chrmp)pChunk)->iGreeny; - pCHRM->iBluex = ((mng_chrmp)pChunk)->iBluex; - pCHRM->iBluey = ((mng_chrmp)pChunk)->iBluey; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_chrm (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CHRM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_chrm)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_chrm (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_chrmp pCHRM = (mng_ani_chrmp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CHRM, MNG_LC_START); -#endif - - if (pCHRM->bEmpty) /* empty chunk ? */ - { /* clear global cHRM */ - pData->bHasglobalCHRM = MNG_FALSE; - pData->iGlobalWhitepointx = 0; - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; - } - else - { /* set global cHRM */ - pData->bHasglobalCHRM = MNG_TRUE; - pData->iGlobalWhitepointx = pCHRM->iWhitepointx; - pData->iGlobalWhitepointy = pCHRM->iWhitepointy; - pData->iGlobalPrimaryredx = pCHRM->iRedx; - pData->iGlobalPrimaryredy = pCHRM->iRedy; - pData->iGlobalPrimarygreenx = pCHRM->iGreenx; - pData->iGlobalPrimarygreeny = pCHRM->iGreeny; - pData->iGlobalPrimarybluex = pCHRM->iBluex; - pData->iGlobalPrimarybluey = pCHRM->iBluey; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_bool bEmpty, - mng_uint8 iRenderingintent) -#else -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_srgbp pSRGB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SRGB, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_srgb), - mng_free_obj_general, - mng_process_ani_srgb, - &pTemp); - if (iRetcode) - return iRetcode; - pSRGB = (mng_ani_srgbp)pTemp; -#else - MNG_ALLOC (pData, pSRGB, sizeof (mng_ani_srgb)); - - pSRGB->sHeader.fCleanup = mng_free_ani_srgb; - pSRGB->sHeader.fProcess = mng_process_ani_srgb; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSRGB); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pSRGB->bEmpty = bEmpty; - pSRGB->iRenderingintent = iRenderingintent; -#else - pSRGB->bEmpty = ((mng_srgbp)pChunk)->bEmpty; - pSRGB->iRenderingintent = ((mng_srgbp)pChunk)->iRenderingintent; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_srgb (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SRGB, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_srgb)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_srgb (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_srgbp pSRGB = (mng_ani_srgbp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SRGB, MNG_LC_START); -#endif - - if (pSRGB->bEmpty) /* empty chunk ? */ - { /* clear global sRGB */ - pData->bHasglobalSRGB = MNG_FALSE; - pData->iGlobalRendintent = 0; - } - else - { /* set global sRGB */ - pData->bHasglobalSRGB = MNG_TRUE; - pData->iGlobalRendintent = pSRGB->iRenderingintent; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iProfilesize, - mng_ptr pProfile) -#else -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ptr pTemp; - mng_ani_iccpp pICCP; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ICCP, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_iccp), - mng_free_ani_iccp, - mng_process_ani_iccp, - &pTemp); - if (iRetcode) - return iRetcode; - pICCP = (mng_ani_iccpp)pTemp; -#else - MNG_ALLOC (pData, pICCP, sizeof (mng_ani_iccp)); - - pICCP->sHeader.fCleanup = mng_free_ani_iccp; - pICCP->sHeader.fProcess = mng_process_ani_iccp; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pICCP); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pICCP->bEmpty = bEmpty; - pICCP->iProfilesize = iProfilesize; - - if (iProfilesize) - { - MNG_ALLOC (pData, pICCP->pProfile, iProfilesize); - MNG_COPY (pICCP->pProfile, pProfile, iProfilesize); - } -#else - pICCP->bEmpty = ((mng_iccpp)pChunk)->bEmpty; - pICCP->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - - if (pICCP->iProfilesize) - { - MNG_ALLOC (pData, pICCP->pProfile, pICCP->iProfilesize); - MNG_COPY (pICCP->pProfile, ((mng_iccpp)pChunk)->pProfile, pICCP->iProfilesize); - } -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_iccp (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_iccpp pICCP = (mng_ani_iccpp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ICCP, MNG_LC_START); -#endif - - if (pICCP->iProfilesize) - MNG_FREEX (pData, pICCP->pProfile, pICCP->iProfilesize); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_iccp)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ICCP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_iccp (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_iccpp pICCP = (mng_ani_iccpp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ICCP, MNG_LC_START); -#endif - - if (pICCP->bEmpty) /* empty chunk ? */ - { /* clear global iCCP */ - pData->bHasglobalICCP = MNG_FALSE; - - if (pData->iGlobalProfilesize) - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; - pData->pGlobalProfile = MNG_NULL; - } - else - { /* set global iCCP */ - pData->bHasglobalICCP = MNG_TRUE; - pData->iGlobalProfilesize = pICCP->iProfilesize; - - if (pICCP->iProfilesize) - { - MNG_ALLOC (pData, pData->pGlobalProfile, pICCP->iProfilesize); - MNG_COPY (pData->pGlobalProfile, pICCP->pProfile, pICCP->iProfilesize); - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_bkgd (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue) -#else -mng_retcode mng_create_ani_bkgd (mng_datap pData) -#endif -{ - mng_ptr pTemp; - mng_ani_bkgdp pBKGD; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BKGD, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_bkgd), - mng_free_obj_general, - mng_process_ani_bkgd, - &pTemp); - if (iRetcode) - return iRetcode; - pBKGD = (mng_ani_bkgdp)pTemp; -#else - MNG_ALLOC (pData, pBKGD, sizeof (mng_ani_bkgd)); - - pBKGD->sHeader.fCleanup = mng_free_ani_bkgd; - pBKGD->sHeader.fProcess = mng_process_ani_bkgd; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pBKGD); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pBKGD->iRed = iRed; - pBKGD->iGreen = iGreen; - pBKGD->iBlue = iBlue; -#else - pBKGD->iRed = pData->iGlobalBKGDred; - pBKGD->iGreen = pData->iGlobalBKGDgreen; - pBKGD->iBlue = pData->iGlobalBKGDblue; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_bkgd (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BKGD, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_bkgd)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_bkgd (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_bkgdp pBKGD = (mng_ani_bkgdp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BKGD, MNG_LC_START); -#endif - - pData->bHasglobalBKGD = MNG_TRUE; - pData->iGlobalBKGDred = pBKGD->iRed; - pData->iGlobalBKGDgreen = pBKGD->iGreen; - pData->iGlobalBKGDblue = pBKGD->iBlue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_uint8 iLevel, - mng_uint32 iRepeatcount, - mng_uint8 iTermcond, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals) -#else -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_loopp pLOOP; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_LOOP, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_loop), - mng_free_ani_loop, - mng_process_ani_loop, - &pTemp); - if (iRetcode) - return iRetcode; - pLOOP = (mng_ani_loopp)pTemp; -#else - MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop)); - - pLOOP->sHeader.fCleanup = mng_free_ani_loop; - pLOOP->sHeader.fProcess = mng_process_ani_loop; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pLOOP); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pLOOP->iLevel = iLevel; - pLOOP->iRepeatcount = iRepeatcount; - pLOOP->iTermcond = iTermcond; - pLOOP->iItermin = iItermin; - pLOOP->iItermax = iItermax; - pLOOP->iCount = iCount; - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (iCount) - { - MNG_ALLOC (pData, pLOOP->pSignals, (iCount << 1)); - MNG_COPY (pLOOP->pSignals, pSignals, (iCount << 1)); - } -#endif -#else /* MNG_OPTIMIZE_CHUNKREADER */ - pLOOP->iLevel = ((mng_loopp)pChunk)->iLevel; - pLOOP->iRepeatcount = ((mng_loopp)pChunk)->iRepeat; - pLOOP->iTermcond = ((mng_loopp)pChunk)->iTermination; - pLOOP->iItermin = ((mng_loopp)pChunk)->iItermin; - pLOOP->iItermax = ((mng_loopp)pChunk)->iItermax; - pLOOP->iCount = ((mng_loopp)pChunk)->iCount; - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (pLOOP->iCount) - { - MNG_ALLOC (pData, pLOOP->pSignals, (pLOOP->iCount << 1)); - MNG_COPY (pLOOP->pSignals, ((mng_loopp)pChunk)->pSignals, (pLOOP->iCount << 1)); - } -#endif -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - /* running counter starts with repeat_count */ - pLOOP->iRunningcount = pLOOP->iRepeatcount; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_loop (mng_datap pData, - mng_objectp pObject) -{ -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - mng_ani_loopp pLOOP = (mng_ani_loopp)pObject; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_LOOP, MNG_LC_START); -#endif - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (pLOOP->iCount) /* drop signal buffer ? */ - MNG_FREEX (pData, pLOOP->pSignals, (pLOOP->iCount << 1)); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_loop)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_LOOP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_loop (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_loopp pLOOP = (mng_ani_loopp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_LOOP, MNG_LC_START); -#endif - /* just reset the running counter */ - pLOOP->iRunningcount = pLOOP->iRepeatcount; - /* iteration=0 means we're skipping ! */ - if ((!pData->bSkipping) && (pLOOP->iRepeatcount == 0)) - pData->bSkipping = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -mng_retcode mng_create_ani_endl (mng_datap pData, - mng_uint8 iLevel) -{ - mng_ani_endlp pENDL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ENDL, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { - mng_retcode iRetcode; -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_endl), - mng_free_obj_general, - mng_process_ani_endl, - &pTemp); - if (iRetcode) - return iRetcode; - pENDL = (mng_ani_endlp)pTemp; -#else - MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl)); - - pENDL->sHeader.fCleanup = mng_free_ani_endl; - pENDL->sHeader.fProcess = mng_process_ani_endl; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pENDL); - - pENDL->iLevel = iLevel; - - iRetcode = mng_process_ani_endl (pData, (mng_objectp)pENDL); - if (iRetcode) - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_endl (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ENDL, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_endl)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_endl (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_endlp pENDL = (mng_ani_endlp)pObject; - mng_ani_loopp pLOOP; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_START); -#endif - - if (((pData->bDisplaying) && ((pData->bRunning) || (pData->bSearching))) || - (pData->bReading) ) - { - pLOOP = pENDL->pLOOP; /* determine matching LOOP */ - - if (!pLOOP) /* haven't got it yet ? */ - { /* go and look back in the list */ - pLOOP = (mng_ani_loopp)pENDL->sHeader.pPrev; - - while ((pLOOP) && - ((pLOOP->sHeader.fCleanup != mng_free_ani_loop) || - (pLOOP->iLevel != pENDL->iLevel) )) - pLOOP = pLOOP->sHeader.pPrev; - } - /* got it now ? */ - if ((pLOOP) && (pLOOP->iLevel == pENDL->iLevel)) - { - pENDL->pLOOP = pLOOP; /* save for next time ! */ - /* decrease running counter ? */ - if ((pLOOP->iRunningcount) && (pLOOP->iRunningcount < 0x7fffffffL)) - pLOOP->iRunningcount--; - - if ((!pData->bDisplaying) && (pData->bReading) && - (pLOOP->iRunningcount >= 0x7fffffffL)) - { - pData->iTotalframes = 0x7fffffffL; - pData->iTotallayers = 0x7fffffffL; - pData->iTotalplaytime = 0x7fffffffL; - } - else - { - /* TODO: we're cheating out on the termination_condition, - iteration_min, iteration_max and possible signals; - the code is just not ready for that can of worms.... */ - - if (!pLOOP->iRunningcount) /* reached zero ? */ - { /* was this the outer LOOP ? */ - if (pData->pFirstaniobj == (mng_objectp)pLOOP) /* TODO: THIS IS WRONG!! */ - pData->bHasLOOP = MNG_FALSE; - } - else - { - if (pData->pCurraniobj) /* was we processing objects ? */ - pData->pCurraniobj = pLOOP;/* then restart with LOOP */ - else /* else restart behind LOOP !!! */ - pData->pCurraniobj = pLOOP->sHeader.pNext; - } - } - /* does this match a 'skipping' LOOP? */ - if ((pData->bSkipping) && (pLOOP->iRepeatcount == 0)) - pData->bSkipping = MNG_FALSE; - } - else - MNG_ERROR (pData, MNG_NOMATCHINGLOOP); - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode mng_create_ani_defi (mng_datap pData) -{ - mng_ani_defip pDEFI; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DEFI, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_defi), - mng_free_obj_general, - mng_process_ani_defi, - &pTemp); - if (iRetcode) - return iRetcode; - pDEFI = (mng_ani_defip)pTemp; -#else - MNG_ALLOC (pData, pDEFI, sizeof (mng_ani_defi)); - - pDEFI->sHeader.fCleanup = mng_free_ani_defi; - pDEFI->sHeader.fProcess = mng_process_ani_defi; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pDEFI); - - pDEFI->iId = pData->iDEFIobjectid; - pDEFI->bHasdonotshow = pData->bDEFIhasdonotshow; - pDEFI->iDonotshow = pData->iDEFIdonotshow; - pDEFI->bHasconcrete = pData->bDEFIhasconcrete; - pDEFI->iConcrete = pData->iDEFIconcrete; - pDEFI->bHasloca = pData->bDEFIhasloca; - pDEFI->iLocax = pData->iDEFIlocax; - pDEFI->iLocay = pData->iDEFIlocay; - pDEFI->bHasclip = pData->bDEFIhasclip; - pDEFI->iClipl = pData->iDEFIclipl; - pDEFI->iClipr = pData->iDEFIclipr; - pDEFI->iClipt = pData->iDEFIclipt; - pDEFI->iClipb = pData->iDEFIclipb; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_defi (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DEFI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_defi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_defi (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_defip pDEFI = (mng_ani_defip)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DEFI, MNG_LC_START); -#endif - - pData->iDEFIobjectid = pDEFI->iId; - pData->bDEFIhasdonotshow = pDEFI->bHasdonotshow; - pData->iDEFIdonotshow = pDEFI->iDonotshow; - pData->bDEFIhasconcrete = pDEFI->bHasconcrete; - pData->iDEFIconcrete = pDEFI->iConcrete; - pData->bDEFIhasloca = pDEFI->bHasloca; - pData->iDEFIlocax = pDEFI->iLocax; - pData->iDEFIlocay = pDEFI->iLocay; - pData->bDEFIhasclip = pDEFI->bHasclip; - pData->iDEFIclipl = pDEFI->iClipl; - pData->iDEFIclipr = pDEFI->iClipr; - pData->iDEFIclipt = pDEFI->iClipt; - pData->iDEFIclipb = pDEFI->iClipb; - - iRetcode = mng_process_display_defi (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable) -#else -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_basip pBASI; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BASI, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_basi), - mng_free_obj_general, - mng_process_ani_basi, - &pTemp); - if (iRetcode) - return iRetcode; - pBASI = (mng_ani_basip)pTemp; -#else - MNG_ALLOC (pData, pBASI, sizeof (mng_ani_basi)); - - pBASI->sHeader.fCleanup = mng_free_ani_basi; - pBASI->sHeader.fProcess = mng_process_ani_basi; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pBASI); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pBASI->iRed = iRed; - pBASI->iGreen = iGreen; - pBASI->iBlue = iBlue; - pBASI->bHasalpha = bHasalpha; - pBASI->iAlpha = iAlpha; - pBASI->iViewable = iViewable; -#else - pBASI->iRed = ((mng_basip)pChunk)->iRed; - pBASI->iGreen = ((mng_basip)pChunk)->iGreen; - pBASI->iBlue = ((mng_basip)pChunk)->iBlue; - pBASI->bHasalpha = ((mng_basip)pChunk)->bHasalpha; - pBASI->iAlpha = ((mng_basip)pChunk)->iAlpha; - pBASI->iViewable = ((mng_basip)pChunk)->iViewable; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_basi (pData, iRed, iGreen, iBlue, - bHasalpha, iAlpha, iViewable); -#else - iRetcode = mng_process_display_basi (pData, - ((mng_basip)pChunk)->iRed, - ((mng_basip)pChunk)->iGreen, - ((mng_basip)pChunk)->iBlue, - ((mng_basip)pChunk)->bHasalpha, - ((mng_basip)pChunk)->iAlpha, - ((mng_basip)pChunk)->iViewable); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iBASIred = iRed; - pData->iBASIgreen = iGreen; - pData->iBASIblue = iBlue; - pData->bBASIhasalpha = bHasalpha; - pData->iBASIalpha = iAlpha; - pData->iBASIviewable = iViewable; -#else - pData->iBASIred = ((mng_basip)pChunk)->iRed; - pData->iBASIgreen = ((mng_basip)pChunk)->iGreen; - pData->iBASIblue = ((mng_basip)pChunk)->iBlue; - pData->bBASIhasalpha = ((mng_basip)pChunk)->bHasalpha; - pData->iBASIalpha = ((mng_basip)pChunk)->iAlpha; - pData->iBASIviewable = ((mng_basip)pChunk)->iViewable; -#endif - - iRetcode = mng_process_display_basi (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BASI, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_basi (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BASI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_basi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_basi (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_basip pBASI = (mng_ani_basip)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BASI, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_basi (pData, pBASI->iRed, pBASI->iGreen, pBASI->iBlue, - pBASI->bHasalpha, pBASI->iAlpha, pBASI->iViewable); -#else - pData->iBASIred = pBASI->iRed; - pData->iBASIgreen = pBASI->iGreen; - pData->iBASIblue = pBASI->iBlue; - pData->bBASIhasalpha = pBASI->bHasalpha; - pData->iBASIalpha = pBASI->iAlpha; - pData->iBASIviewable = pBASI->iViewable; - - iRetcode = mng_process_display_basi (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BASI, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocatype, - mng_int32 iLocax, - mng_int32 iLocay) -#else -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_clonp pCLON; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLON, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_clon), - mng_free_obj_general, - mng_process_ani_clon, - &pTemp); - if (iRetcode) - return iRetcode; - pCLON = (mng_ani_clonp)pTemp; -#else - MNG_ALLOC (pData, pCLON, sizeof (mng_ani_clon)); - - pCLON->sHeader.fCleanup = mng_free_ani_clon; - pCLON->sHeader.fProcess = mng_process_ani_clon; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pCLON); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pCLON->iSourceid = iSourceid; - pCLON->iCloneid = iCloneid; - pCLON->iClonetype = iClonetype; - pCLON->bHasdonotshow = bHasdonotshow; - pCLON->iDonotshow = iDonotshow; - pCLON->iConcrete = iConcrete; - pCLON->bHasloca = bHasloca; - pCLON->iLocatype = iLocatype; - pCLON->iLocax = iLocax; - pCLON->iLocay = iLocay; -#else - pCLON->iSourceid = ((mng_clonp)pChunk)->iSourceid; - pCLON->iCloneid = ((mng_clonp)pChunk)->iCloneid; - pCLON->iClonetype = ((mng_clonp)pChunk)->iClonetype; - pCLON->bHasdonotshow = ((mng_clonp)pChunk)->bHasdonotshow; - pCLON->iDonotshow = ((mng_clonp)pChunk)->iDonotshow; - pCLON->iConcrete = ((mng_clonp)pChunk)->iConcrete; - pCLON->bHasloca = ((mng_clonp)pChunk)->bHasloca; - pCLON->iLocatype = ((mng_clonp)pChunk)->iLocationtype; - pCLON->iLocax = ((mng_clonp)pChunk)->iLocationx; - pCLON->iLocay = ((mng_clonp)pChunk)->iLocationy; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_clon (pData, iSourceid, iCloneid, iClonetype, - bHasdonotshow, iDonotshow, iConcrete, - bHasloca, iLocatype, iLocax, iLocay); -#else - iRetcode = mng_process_display_clon (pData, - ((mng_clonp)pChunk)->iSourceid, - ((mng_clonp)pChunk)->iCloneid, - ((mng_clonp)pChunk)->iClonetype, - ((mng_clonp)pChunk)->bHasdonotshow, - ((mng_clonp)pChunk)->iDonotshow, - ((mng_clonp)pChunk)->iConcrete, - ((mng_clonp)pChunk)->bHasloca, - ((mng_clonp)pChunk)->iLocationtype, - ((mng_clonp)pChunk)->iLocationx, - ((mng_clonp)pChunk)->iLocationy); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iCLONsourceid = iSourceid; - pData->iCLONcloneid = iCloneid; - pData->iCLONclonetype = iClonetype; - pData->bCLONhasdonotshow = bHasdonotshow; - pData->iCLONdonotshow = iDonotshow; - pData->iCLONconcrete = iConcrete; - pData->bCLONhasloca = bHasloca; - pData->iCLONlocationtype = iLocatype; - pData->iCLONlocationx = iLocax; - pData->iCLONlocationy = iLocay; -#else - pData->iCLONsourceid = ((mng_clonp)pChunk)->iSourceid; - pData->iCLONcloneid = ((mng_clonp)pChunk)->iCloneid; - pData->iCLONclonetype = ((mng_clonp)pChunk)->iClonetype; - pData->bCLONhasdonotshow = ((mng_clonp)pChunk)->bHasdonotshow; - pData->iCLONdonotshow = ((mng_clonp)pChunk)->iDonotshow; - pData->iCLONconcrete = ((mng_clonp)pChunk)->iConcrete; - pData->bCLONhasloca = ((mng_clonp)pChunk)->bHasloca; - pData->iCLONlocationtype = ((mng_clonp)pChunk)->iLocationtype; - pData->iCLONlocationx = ((mng_clonp)pChunk)->iLocationx; - pData->iCLONlocationy = ((mng_clonp)pChunk)->iLocationy; -#endif - - iRetcode = mng_process_display_clon (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLON, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_clon (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLON, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_clon)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_clon (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_clonp pCLON = (mng_ani_clonp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLON, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_clon (pData, pCLON->iSourceid, pCLON->iCloneid, - pCLON->iClonetype, pCLON->bHasdonotshow, - pCLON->iDonotshow, pCLON->iConcrete, - pCLON->bHasloca, pCLON->iLocatype, - pCLON->iLocax, pCLON->iLocay); -#else - pData->iCLONcloneid = pCLON->iCloneid; - pData->iCLONsourceid = pCLON->iSourceid; - pData->iCLONclonetype = pCLON->iClonetype; - pData->bCLONhasdonotshow = pCLON->bHasdonotshow; - pData->iCLONdonotshow = pCLON->iDonotshow; - pData->iCLONconcrete = pCLON->iConcrete; - pData->bCLONhasloca = pCLON->bHasloca; - pData->iCLONlocationtype = pCLON->iLocatype; - pData->iCLONlocationx = pCLON->iLocax; - pData->iCLONlocationy = pCLON->iLocay; - - iRetcode = mng_process_display_clon (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLON, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_back (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile) -#else -mng_retcode mng_create_ani_back (mng_datap pData) -#endif -{ - mng_ani_backp pBACK; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BACK, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_back), - mng_free_obj_general, - mng_process_ani_back, - &pTemp); - if (iRetcode) - return iRetcode; - pBACK = (mng_ani_backp)pTemp; -#else - MNG_ALLOC (pData, pBACK, sizeof (mng_ani_back)); - - pBACK->sHeader.fCleanup = mng_free_ani_back; - pBACK->sHeader.fProcess = mng_process_ani_back; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pBACK); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pBACK->iRed = iRed; - pBACK->iGreen = iGreen; - pBACK->iBlue = iBlue; - pBACK->iMandatory = iMandatory; - pBACK->iImageid = iImageid; - pBACK->iTile = iTile; -#else - pBACK->iRed = pData->iBACKred; - pBACK->iGreen = pData->iBACKgreen; - pBACK->iBlue = pData->iBACKblue; - pBACK->iMandatory = pData->iBACKmandatory; - pBACK->iImageid = pData->iBACKimageid; - pBACK->iTile = pData->iBACKtile; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_back (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BACK, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_back)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_back (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_backp pBACK = (mng_ani_backp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BACK, MNG_LC_START); -#endif - - pData->iBACKred = pBACK->iRed; - pData->iBACKgreen = pBACK->iGreen; - pData->iBACKblue = pBACK->iBlue; - pData->iBACKmandatory = pBACK->iMandatory; - pData->iBACKimageid = pBACK->iImageid; - pData->iBACKtile = pBACK->iTile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_framp pFRAM; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_FRAM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_fram), - mng_free_obj_general, - mng_process_ani_fram, - &pTemp); - if (iRetcode) - return iRetcode; - pFRAM = (mng_ani_framp)pTemp; -#else - MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram)); - - pFRAM->sHeader.fCleanup = mng_free_ani_fram; - pFRAM->sHeader.fProcess = mng_process_ani_fram; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pFRAM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pFRAM->iFramemode = iFramemode; - pFRAM->iChangedelay = iChangedelay; - pFRAM->iDelay = iDelay; - pFRAM->iChangetimeout = iChangetimeout; - pFRAM->iTimeout = iTimeout; - pFRAM->iChangeclipping = iChangeclipping; - pFRAM->iCliptype = iCliptype; - pFRAM->iClipl = iClipl; - pFRAM->iClipr = iClipr; - pFRAM->iClipt = iClipt; - pFRAM->iClipb = iClipb; -#else - pFRAM->iFramemode = ((mng_framp)pChunk)->iMode; - pFRAM->iChangedelay = ((mng_framp)pChunk)->iChangedelay; - pFRAM->iDelay = ((mng_framp)pChunk)->iDelay; - pFRAM->iChangetimeout = ((mng_framp)pChunk)->iChangetimeout; - pFRAM->iTimeout = ((mng_framp)pChunk)->iTimeout; - pFRAM->iChangeclipping = ((mng_framp)pChunk)->iChangeclipping; - pFRAM->iCliptype = ((mng_framp)pChunk)->iBoundarytype; - pFRAM->iClipl = ((mng_framp)pChunk)->iBoundaryl; - pFRAM->iClipr = ((mng_framp)pChunk)->iBoundaryr; - pFRAM->iClipt = ((mng_framp)pChunk)->iBoundaryt; - pFRAM->iClipb = ((mng_framp)pChunk)->iBoundaryb; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_fram (pData, iFramemode, - iChangedelay, iDelay, - iChangetimeout, iTimeout, - iChangeclipping, iCliptype, - iClipl, iClipr, - iClipt, iClipb); -#else - iRetcode = mng_process_display_fram (pData, - ((mng_framp)pChunk)->iMode, - ((mng_framp)pChunk)->iChangedelay, - ((mng_framp)pChunk)->iDelay, - ((mng_framp)pChunk)->iChangetimeout, - ((mng_framp)pChunk)->iTimeout, - ((mng_framp)pChunk)->iChangeclipping, - ((mng_framp)pChunk)->iBoundarytype, - ((mng_framp)pChunk)->iBoundaryl, - ((mng_framp)pChunk)->iBoundaryr, - ((mng_framp)pChunk)->iBoundaryt, - ((mng_framp)pChunk)->iBoundaryb); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iTempFramemode = iFramemode; - pData->iTempChangedelay = iChangedelay; - pData->iTempDelay = iDelay; - pData->iTempChangetimeout = iChangetimeout; - pData->iTempTimeout = iTimeout; - pData->iTempChangeclipping = iChangeclipping; - pData->iTempCliptype = iCliptype; - pData->iTempClipl = iClipl; - pData->iTempClipr = iClipr; - pData->iTempClipt = iClipt; - pData->iTempClipb = iClipb; -#else - pData->iTempFramemode = ((mng_framp)pChunk)->iMode; - pData->iTempChangedelay = ((mng_framp)pChunk)->iChangedelay; - pData->iTempDelay = ((mng_framp)pChunk)->iDelay; - pData->iTempChangetimeout = ((mng_framp)pChunk)->iChangetimeout; - pData->iTempTimeout = ((mng_framp)pChunk)->iTimeout; - pData->iTempChangeclipping = ((mng_framp)pChunk)->iChangeclipping; - pData->iTempCliptype = ((mng_framp)pChunk)->iBoundarytype; - pData->iTempClipl = ((mng_framp)pChunk)->iBoundaryl; - pData->iTempClipr = ((mng_framp)pChunk)->iBoundaryr; - pData->iTempClipt = ((mng_framp)pChunk)->iBoundaryt; - pData->iTempClipb = ((mng_framp)pChunk)->iBoundaryb; -#endif - - iRetcode = mng_process_display_fram (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_fram (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_FRAM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_fram)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_fram (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_framp pFRAM = (mng_ani_framp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_FRAM, MNG_LC_START); -#endif - - if (pData->iBreakpoint) /* previously broken ? */ - { - iRetcode = mng_process_display_fram2 (pData); - pData->iBreakpoint = 0; /* not again */ - } - else - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_fram (pData, pFRAM->iFramemode, - pFRAM->iChangedelay, pFRAM->iDelay, - pFRAM->iChangetimeout, pFRAM->iTimeout, - pFRAM->iChangeclipping, pFRAM->iCliptype, - pFRAM->iClipl, pFRAM->iClipr, - pFRAM->iClipt, pFRAM->iClipb); -#else - pData->iTempFramemode = pFRAM->iFramemode; - pData->iTempChangedelay = pFRAM->iChangedelay; - pData->iTempDelay = pFRAM->iDelay; - pData->iTempChangetimeout = pFRAM->iChangetimeout; - pData->iTempTimeout = pFRAM->iTimeout; - pData->iTempChangeclipping = pFRAM->iChangeclipping; - pData->iTempCliptype = pFRAM->iCliptype; - pData->iTempClipl = pFRAM->iClipl; - pData->iTempClipr = pFRAM->iClipr; - pData->iTempClipt = pFRAM->iClipt; - pData->iTempClipb = pFRAM->iClipb; - - iRetcode = mng_process_display_fram (pData); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_move (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iLocax, - mng_int32 iLocay) -#else -mng_retcode mng_create_ani_move (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_movep pMOVE; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MOVE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_move), - mng_free_obj_general, - mng_process_ani_move, - &pTemp); - if (iRetcode) - return iRetcode; - pMOVE = (mng_ani_movep)pTemp; -#else - MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move)); - - pMOVE->sHeader.fCleanup = mng_free_ani_move; - pMOVE->sHeader.fProcess = mng_process_ani_move; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pMOVE); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pMOVE->iFirstid = iFirstid; - pMOVE->iLastid = iLastid; - pMOVE->iType = iType; - pMOVE->iLocax = iLocax; - pMOVE->iLocay = iLocay; -#else - pMOVE->iFirstid = ((mng_movep)pChunk)->iFirstid; - pMOVE->iLastid = ((mng_movep)pChunk)->iLastid; - pMOVE->iType = ((mng_movep)pChunk)->iMovetype; - pMOVE->iLocax = ((mng_movep)pChunk)->iMovex; - pMOVE->iLocay = ((mng_movep)pChunk)->iMovey; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_move (pData, iFirstid, iLastid, - iType, iLocax, iLocay); -#else - iRetcode = mng_process_display_move (pData, - ((mng_movep)pChunk)->iFirstid, - ((mng_movep)pChunk)->iLastid, - ((mng_movep)pChunk)->iMovetype, - ((mng_movep)pChunk)->iMovex, - ((mng_movep)pChunk)->iMovey); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iMOVEfromid = iFirstid; - pData->iMOVEtoid = iLastid; - pData->iMOVEmovetype = iType; - pData->iMOVEmovex = iLocax; - pData->iMOVEmovey = iLocay; -#else - pData->iMOVEfromid = ((mng_movep)pChunk)->iFirstid; - pData->iMOVEtoid = ((mng_movep)pChunk)->iLastid; - pData->iMOVEmovetype = ((mng_movep)pChunk)->iMovetype; - pData->iMOVEmovex = ((mng_movep)pChunk)->iMovex; - pData->iMOVEmovey = ((mng_movep)pChunk)->iMovey; -#endif - - iRetcode = mng_process_display_move (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MOVE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_move (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MOVE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_move)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_move (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - mng_ani_movep pMOVE = (mng_ani_movep)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MOVE, MNG_LC_START); -#endif - /* re-process the MOVE chunk */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_move (pData, pMOVE->iFirstid, pMOVE->iLastid, - pMOVE->iType, pMOVE->iLocax, pMOVE->iLocay); -#else - pData->iMOVEfromid = pMOVE->iFirstid; - pData->iMOVEtoid = pMOVE->iLastid; - pData->iMOVEmovetype = pMOVE->iType; - pData->iMOVEmovex = pMOVE->iLocax; - pData->iMOVEmovey = pMOVE->iLocay; - - iRetcode = mng_process_display_move (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MOVE, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_clipp pCLIP; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLIP, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_clip), - mng_free_obj_general, - mng_process_ani_clip, - &pTemp); - if (iRetcode) - return iRetcode; - pCLIP = (mng_ani_clipp)pTemp; -#else - MNG_ALLOC (pData, pCLIP, sizeof (mng_ani_clip)); - - pCLIP->sHeader.fCleanup = mng_free_ani_clip; - pCLIP->sHeader.fProcess = mng_process_ani_clip; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pCLIP); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pCLIP->iFirstid = iFirstid; - pCLIP->iLastid = iLastid; - pCLIP->iType = iType; - pCLIP->iClipl = iClipl; - pCLIP->iClipr = iClipr; - pCLIP->iClipt = iClipt; - pCLIP->iClipb = iClipb; -#else - pCLIP->iFirstid = ((mng_clipp)pChunk)->iFirstid; - pCLIP->iLastid = ((mng_clipp)pChunk)->iLastid; - pCLIP->iType = ((mng_clipp)pChunk)->iCliptype; - pCLIP->iClipl = ((mng_clipp)pChunk)->iClipl; - pCLIP->iClipr = ((mng_clipp)pChunk)->iClipr; - pCLIP->iClipt = ((mng_clipp)pChunk)->iClipt; - pCLIP->iClipb = ((mng_clipp)pChunk)->iClipb; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_clip (pData, iFirstid, iLastid, - iType, iClipl, iClipr, - iClipt, iClipb); -#else - iRetcode = mng_process_display_clip (pData, - ((mng_clipp)pChunk)->iFirstid, - ((mng_clipp)pChunk)->iLastid, - ((mng_clipp)pChunk)->iCliptype, - ((mng_clipp)pChunk)->iClipl, - ((mng_clipp)pChunk)->iClipr, - ((mng_clipp)pChunk)->iClipt, - ((mng_clipp)pChunk)->iClipb); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iCLIPfromid = iFirstid; - pData->iCLIPtoid = iLastid; - pData->iCLIPcliptype = iType; - pData->iCLIPclipl = iClipl; - pData->iCLIPclipr = iClipr; - pData->iCLIPclipt = iClipt; - pData->iCLIPclipb = iClipb; -#else - pData->iCLIPfromid = ((mng_clipp)pChunk)->iFirstid; - pData->iCLIPtoid = ((mng_clipp)pChunk)->iLastid; - pData->iCLIPcliptype = ((mng_clipp)pChunk)->iCliptype; - pData->iCLIPclipl = ((mng_clipp)pChunk)->iClipl; - pData->iCLIPclipr = ((mng_clipp)pChunk)->iClipr; - pData->iCLIPclipt = ((mng_clipp)pChunk)->iClipt; - pData->iCLIPclipb = ((mng_clipp)pChunk)->iClipb; -#endif - - iRetcode = mng_process_display_clip (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLIP, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_clip (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLIP, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_clip)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_clip (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - mng_ani_clipp pCLIP = (mng_ani_clipp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLIP, MNG_LC_START); -#endif - /* re-process the CLIP chunk */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_clip (pData, pCLIP->iFirstid, pCLIP->iLastid, - pCLIP->iType, pCLIP->iClipl, pCLIP->iClipr, - pCLIP->iClipt, pCLIP->iClipb); -#else - pData->iCLIPfromid = pCLIP->iFirstid; - pData->iCLIPtoid = pCLIP->iLastid; - pData->iCLIPcliptype = pCLIP->iType; - pData->iCLIPclipl = pCLIP->iClipl; - pData->iCLIPclipr = pCLIP->iClipr; - pData->iCLIPclipt = pCLIP->iClipt; - pData->iCLIPclipb = pCLIP->iClipb; - - iRetcode = mng_process_display_clip (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLIP, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_show (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode) -#else -mng_retcode mng_create_ani_show (mng_datap pData) -#endif -{ - mng_ani_showp pSHOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SHOW, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_show), - mng_free_obj_general, - mng_process_ani_show, - &pTemp); - if (iRetcode) - return iRetcode; - pSHOW = (mng_ani_showp)pTemp; -#else - MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show)); - - pSHOW->sHeader.fCleanup = mng_free_ani_show; - pSHOW->sHeader.fProcess = mng_process_ani_show; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSHOW); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pSHOW->iFirstid = iFirstid; - pSHOW->iLastid = iLastid; - pSHOW->iMode = iMode; -#else - pSHOW->iFirstid = pData->iSHOWfromid; - pSHOW->iLastid = pData->iSHOWtoid; - pSHOW->iMode = pData->iSHOWmode; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_show (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SHOW, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_show)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_show (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - mng_ani_showp pSHOW = (mng_ani_showp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SHOW, MNG_LC_START); -#endif - - if (pData->iBreakpoint) /* returning from breakpoint ? */ - { - iRetcode = mng_process_display_show (pData); - } - else - { /* "re-run" SHOW chunk */ - pData->iSHOWmode = pSHOW->iMode; - pData->iSHOWfromid = pSHOW->iFirstid; - pData->iSHOWtoid = pSHOW->iLastid; - - iRetcode = mng_process_display_show (pData); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SHOW, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_term (mng_datap pData, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax) -#else -mng_retcode mng_create_ani_term (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_termp pTERM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TERM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_term), - mng_free_obj_general, - mng_process_ani_term, - &pTemp); - if (iRetcode) - return iRetcode; - pTERM = (mng_ani_termp)pTemp; -#else - MNG_ALLOC (pData, pTERM, sizeof (mng_ani_term)); - - pTERM->sHeader.fCleanup = mng_free_ani_term; - pTERM->sHeader.fProcess = mng_process_ani_term; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pTERM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pTERM->iTermaction = iTermaction; - pTERM->iIteraction = iIteraction; - pTERM->iDelay = iDelay; - pTERM->iItermax = iItermax; -#else - pTERM->iTermaction = ((mng_termp)pChunk)->iTermaction; - pTERM->iIteraction = ((mng_termp)pChunk)->iIteraction; - pTERM->iDelay = ((mng_termp)pChunk)->iDelay; - pTERM->iItermax = ((mng_termp)pChunk)->iItermax; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_term (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TERM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_term)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_term (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TERM, MNG_LC_START); -#endif - - /* dummy: no action required! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_create_ani_save (mng_datap pData) -{ - mng_ptr pTemp; - mng_ani_savep pSAVE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SAVE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_save), - mng_free_obj_general, - mng_process_ani_save, - &pTemp); - if (iRetcode) - return iRetcode; - pSAVE = (mng_ani_savep)pTemp; -#else - MNG_ALLOC (pData, pSAVE, sizeof (mng_ani_save)); - - pSAVE->sHeader.fCleanup = mng_free_ani_save; - pSAVE->sHeader.fProcess = mng_process_ani_save; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSAVE); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_save (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SAVE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_save)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_save (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SAVE, MNG_LC_START); -#endif - - iRetcode = mng_process_display_save (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname) -#else -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ptr pTemp; - mng_ani_seekp pSEEK; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SEEK, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_seek), - mng_free_ani_seek, - mng_process_ani_seek, - &pTemp); - if (iRetcode) - return iRetcode; - pSEEK = (mng_ani_seekp)pTemp; -#else - MNG_ALLOC (pData, pSEEK, sizeof (mng_ani_seek)); - - pSEEK->sHeader.fCleanup = mng_free_ani_seek; - pSEEK->sHeader.fProcess = mng_process_ani_seek; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSEEK); - - pData->pLastseek = (mng_objectp)pSEEK; - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pSEEK->iSegmentnamesize = iSegmentnamesize; - if (iSegmentnamesize) - { - MNG_ALLOC (pData, pSEEK->zSegmentname, iSegmentnamesize + 1); - MNG_COPY (pSEEK->zSegmentname, zSegmentname, iSegmentnamesize); - } -#else - pSEEK->iSegmentnamesize = ((mng_seekp)pChunk)->iNamesize; - if (pSEEK->iSegmentnamesize) - { - MNG_ALLOC (pData, pSEEK->zSegmentname, pSEEK->iSegmentnamesize + 1); - MNG_COPY (pSEEK->zSegmentname, ((mng_seekp)pChunk)->zName, pSEEK->iSegmentnamesize); - } -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_seek (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_seekp pSEEK = (mng_ani_seekp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SEEK, MNG_LC_START); -#endif - - if (pSEEK->iSegmentnamesize) - MNG_FREEX (pData, pSEEK->zSegmentname, pSEEK->iSegmentnamesize + 1); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_seek)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SEEK, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_seek (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_seekp pSEEK = (mng_ani_seekp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SEEK, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DYNAMICMNG - if (!pData->bStopafterseek) /* can we really process this one ? */ -#endif - { - pData->pLastseek = pObject; - - if (pData->fProcessseek) /* inform the app ? */ - { - mng_bool bOke; - mng_pchar zName; - - MNG_ALLOC (pData, zName, pSEEK->iSegmentnamesize + 1); - - if (pSEEK->iSegmentnamesize) - MNG_COPY (zName, pSEEK->zSegmentname, pSEEK->iSegmentnamesize); - - bOke = pData->fProcessseek ((mng_handle)pData, zName); - - MNG_FREEX (pData, zName, pSEEK->iSegmentnamesize + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - } - - iRetcode = mng_process_display_seek (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky) -#else -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_dhdrp pDHDR; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DHDR, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_dhdr), - mng_free_obj_general, - mng_process_ani_dhdr, - &pTemp); - if (iRetcode) - return iRetcode; - pDHDR = (mng_ani_dhdrp)pTemp; -#else - MNG_ALLOC (pData, pDHDR, sizeof (mng_ani_dhdr)); - - pDHDR->sHeader.fCleanup = mng_free_ani_dhdr; - pDHDR->sHeader.fProcess = mng_process_ani_dhdr; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pDHDR); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pDHDR->iObjectid = iObjectid; - pDHDR->iImagetype = iImagetype; - pDHDR->iDeltatype = iDeltatype; - pDHDR->iBlockwidth = iBlockwidth; - pDHDR->iBlockheight = iBlockheight; - pDHDR->iBlockx = iBlockx; - pDHDR->iBlocky = iBlocky; -#else - pDHDR->iObjectid = ((mng_dhdrp)pChunk)->iObjectid; - pDHDR->iImagetype = ((mng_dhdrp)pChunk)->iImagetype; - pDHDR->iDeltatype = ((mng_dhdrp)pChunk)->iDeltatype; - pDHDR->iBlockwidth = ((mng_dhdrp)pChunk)->iBlockwidth; - pDHDR->iBlockheight = ((mng_dhdrp)pChunk)->iBlockheight; - pDHDR->iBlockx = ((mng_dhdrp)pChunk)->iBlockx; - pDHDR->iBlocky = ((mng_dhdrp)pChunk)->iBlocky; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_dhdr (pData, iObjectid, - iImagetype, iDeltatype, - iBlockwidth, iBlockheight, - iBlockx, iBlocky); -#else - iRetcode = mng_process_display_dhdr (pData, - ((mng_dhdrp)pChunk)->iObjectid, - ((mng_dhdrp)pChunk)->iImagetype, - ((mng_dhdrp)pChunk)->iDeltatype, - ((mng_dhdrp)pChunk)->iBlockwidth, - ((mng_dhdrp)pChunk)->iBlockheight, - ((mng_dhdrp)pChunk)->iBlockx, - ((mng_dhdrp)pChunk)->iBlocky); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iDHDRobjectid = iObjectid; - pData->iDHDRimagetype = iImagetype; - pData->iDHDRdeltatype = iDeltatype; - pData->iDHDRblockwidth = iBlockwidth; - pData->iDHDRblockheight = iBlockheight; - pData->iDHDRblockx = iBlockx; - pData->iDHDRblocky = iBlocky; -#else - pData->iDHDRobjectid = ((mng_dhdrp)pChunk)->iObjectid; - pData->iDHDRimagetype = ((mng_dhdrp)pChunk)->iImagetype; - pData->iDHDRdeltatype = ((mng_dhdrp)pChunk)->iDeltatype; - pData->iDHDRblockwidth = ((mng_dhdrp)pChunk)->iBlockwidth; - pData->iDHDRblockheight = ((mng_dhdrp)pChunk)->iBlockheight; - pData->iDHDRblockx = ((mng_dhdrp)pChunk)->iBlockx; - pData->iDHDRblocky = ((mng_dhdrp)pChunk)->iBlocky; -#endif - - iRetcode = mng_process_display_dhdr (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DHDR, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_dhdr (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_dhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_dhdr (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_dhdrp pDHDR = (mng_ani_dhdrp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DHDR, MNG_LC_START); -#endif - - pData->bHasDHDR = MNG_TRUE; /* let everyone know we're inside a DHDR */ - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_dhdr (pData, pDHDR->iObjectid, - pDHDR->iImagetype, pDHDR->iDeltatype, - pDHDR->iBlockwidth, pDHDR->iBlockheight, - pDHDR->iBlockx, pDHDR->iBlocky); -#else - pData->iDHDRobjectid = pDHDR->iObjectid; - pData->iDHDRimagetype = pDHDR->iImagetype; - pData->iDHDRdeltatype = pDHDR->iDeltatype; - pData->iDHDRblockwidth = pDHDR->iBlockwidth; - pData->iDHDRblockheight = pDHDR->iBlockheight; - pData->iDHDRblockx = pDHDR->iBlockx; - pData->iDHDRblocky = pDHDR->iBlocky; - - iRetcode = mng_process_display_dhdr (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype) -#else -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_promp pPROM=NULL; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PROM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_prom), - mng_free_obj_general, - mng_process_ani_prom, - &pTemp); - if (iRetcode) - return iRetcode; - pPROM = (mng_ani_promp)pTemp; -#else - MNG_ALLOC (pData, pPROM, sizeof (mng_ani_prom)); - - pPROM->sHeader.fCleanup = mng_free_ani_prom; - pPROM->sHeader.fProcess = mng_process_ani_prom; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pPROM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pPROM->iBitdepth = iBitdepth; - pPROM->iColortype = iColortype; - pPROM->iFilltype = iFilltype; -#else - pPROM->iBitdepth = ((mng_promp)pChunk)->iSampledepth; - pPROM->iColortype = ((mng_promp)pChunk)->iColortype; - pPROM->iFilltype = ((mng_promp)pChunk)->iFilltype; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_prom (pData, iBitdepth, - iColortype, iFilltype); -#else - iRetcode = mng_process_display_prom (pData, - ((mng_promp)pChunk)->iSampledepth, - ((mng_promp)pChunk)->iColortype, - ((mng_promp)pChunk)->iFilltype); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iPROMbitdepth = iBitdepth; - pData->iPROMcolortype = iColortype; - pData->iPROMfilltype = iFilltype; -#else - pData->iPROMbitdepth = ((mng_promp)pChunk)->iSampledepth; - pData->iPROMcolortype = ((mng_promp)pChunk)->iColortype; - pData->iPROMfilltype = ((mng_promp)pChunk)->iFilltype; -#endif - - iRetcode = mng_process_display_prom (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PROM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_prom (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PROM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_prom)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_prom (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_promp pPROM = (mng_ani_promp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PROM, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_prom (pData, pPROM->iBitdepth, - pPROM->iColortype, pPROM->iFilltype); -#else - pData->iPROMbitdepth = pPROM->iBitdepth; - pData->iPROMcolortype = pPROM->iColortype; - pData->iPROMfilltype = pPROM->iFilltype; - - iRetcode = mng_process_display_prom (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PROM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_ipng (mng_datap pData) -{ - mng_ani_ipngp pIPNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IPNG, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_ipng), - mng_free_obj_general, - mng_process_ani_ipng, - &pTemp); - if (iRetcode) - return iRetcode; - pIPNG = (mng_ani_ipngp)pTemp; -#else - MNG_ALLOC (pData, pIPNG, sizeof (mng_ani_ipng)); - - pIPNG->sHeader.fCleanup = mng_free_ani_ipng; - pIPNG->sHeader.fProcess = mng_process_ani_ipng; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pIPNG); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_ipng (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IPNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_ipng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_ipng (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IPNG, MNG_LC_START); -#endif - - iRetcode = mng_process_display_ipng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_create_ani_ijng (mng_datap pData) -{ - mng_ani_ijngp pIJNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IJNG, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_ijng), - mng_free_obj_general, - mng_process_ani_ijng, - &pTemp); - if (iRetcode) - return iRetcode; - pIJNG = (mng_ani_ijngp)pTemp; -#else - MNG_ALLOC (pData, pIJNG, sizeof (mng_ani_ijng)); - - pIJNG->sHeader.fCleanup = mng_free_ani_ijng; - pIJNG->sHeader.fProcess = mng_process_ani_ijng; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pIJNG); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_ijng (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IJNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_ijng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_ijng (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IJNG, MNG_LC_START); -#endif - - iRetcode = mng_process_display_ijng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries) -{ - mng_ani_ppltp pPPLT; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_pplt), - mng_free_obj_general, - mng_process_ani_pplt, - &pTemp); - if (iRetcode) - return iRetcode; - pPPLT = (mng_ani_ppltp)pTemp; -#else - MNG_ALLOC (pData, pPPLT, sizeof (mng_ani_pplt)); - - pPPLT->sHeader.fCleanup = mng_free_ani_pplt; - pPPLT->sHeader.fProcess = mng_process_ani_pplt; -#endif - - pPPLT->iType = iType; - pPPLT->iCount = iCount; - - MNG_COPY (pPPLT->aIndexentries, paIndexentries, sizeof (pPPLT->aIndexentries)); - MNG_COPY (pPPLT->aAlphaentries, paAlphaentries, sizeof (pPPLT->aAlphaentries)); - MNG_COPY (pPPLT->aUsedentries, paUsedentries, sizeof (pPPLT->aUsedentries )); - - mng_add_ani_object (pData, (mng_object_headerp)pPPLT); - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_pplt (pData, iType, iCount, - paIndexentries, paAlphaentries, paUsedentries); -#else - pData->iPPLTtype = iType; - pData->iPPLTcount = iCount; - pData->paPPLTindexentries = paIndexentries; - pData->paPPLTalphaentries = paAlphaentries; - pData->paPPLTusedentries = paUsedentries; - - iRetcode = mng_process_display_pplt (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_pplt (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_pplt)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_pplt (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_ppltp pPPLT = (mng_ani_ppltp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_pplt (pData, pPPLT->iType, pPPLT->iCount, - pPPLT->aIndexentries, pPPLT->aAlphaentries, - pPPLT->aUsedentries); -#else - pData->iPPLTtype = pPPLT->iType; - pData->iPPLTcount = pPPLT->iCount; - pData->paPPLTindexentries = &pPPLT->aIndexentries; - pData->paPPLTalphaentries = &pPPLT->aAlphaentries; - pData->paPPLTusedentries = &pPPLT->aUsedentries; - - iRetcode = mng_process_display_pplt (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY) -#else -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_magnp pMAGN=NULL; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_magn), - mng_free_obj_general, - mng_process_ani_magn, - &pTemp); - if (iRetcode) - return iRetcode; - pMAGN = (mng_ani_magnp)pTemp; -#else - MNG_ALLOC (pData, pMAGN, sizeof (mng_ani_magn)); - - pMAGN->sHeader.fCleanup = mng_free_ani_magn; - pMAGN->sHeader.fProcess = mng_process_ani_magn; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pMAGN); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pMAGN->iFirstid = iFirstid; - pMAGN->iLastid = iLastid; - pMAGN->iMethodX = iMethodX; - pMAGN->iMX = iMX; - pMAGN->iMY = iMY; - pMAGN->iML = iML; - pMAGN->iMR = iMR; - pMAGN->iMT = iMT; - pMAGN->iMB = iMB; - pMAGN->iMethodY = iMethodY; -#else - pMAGN->iFirstid = ((mng_magnp)pChunk)->iFirstid; - pMAGN->iLastid = ((mng_magnp)pChunk)->iLastid; - pMAGN->iMethodX = ((mng_magnp)pChunk)->iMethodX; - pMAGN->iMX = ((mng_magnp)pChunk)->iMX; - pMAGN->iMY = ((mng_magnp)pChunk)->iMY; - pMAGN->iML = ((mng_magnp)pChunk)->iML; - pMAGN->iMR = ((mng_magnp)pChunk)->iMR; - pMAGN->iMT = ((mng_magnp)pChunk)->iMT; - pMAGN->iMB = ((mng_magnp)pChunk)->iMB; - pMAGN->iMethodY = ((mng_magnp)pChunk)->iMethodY; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_magn (pData, pMAGN->iFirstid, pMAGN->iLastid, - pMAGN->iMethodX, pMAGN->iMX, pMAGN->iMY, - pMAGN->iML, pMAGN->iMR, pMAGN->iMT, - pMAGN->iMB, pMAGN->iMethodY); -#else - iRetcode = mng_process_display_magn (pData, - ((mng_magnp)pChunk)->iFirstid, - ((mng_magnp)pChunk)->iLastid, - ((mng_magnp)pChunk)->iMethodX, - ((mng_magnp)pChunk)->iMX, - ((mng_magnp)pChunk)->iMY, - ((mng_magnp)pChunk)->iML, - ((mng_magnp)pChunk)->iMR, - ((mng_magnp)pChunk)->iMT, - ((mng_magnp)pChunk)->iMB, - ((mng_magnp)pChunk)->iMethodY); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iMAGNfirstid = iFirstid; - pData->iMAGNlastid = iLastid; - pData->iMAGNmethodX = iMethodX; - pData->iMAGNmX = iMX; - pData->iMAGNmY = iMY; - pData->iMAGNmL = iML; - pData->iMAGNmR = iMR; - pData->iMAGNmT = iMT; - pData->iMAGNmB = iMB; - pData->iMAGNmethodY = iMethodY; -#else - pData->iMAGNfirstid = ((mng_magnp)pChunk)->iFirstid; - pData->iMAGNlastid = ((mng_magnp)pChunk)->iLastid; - pData->iMAGNmethodX = ((mng_magnp)pChunk)->iMethodX; - pData->iMAGNmX = ((mng_magnp)pChunk)->iMX; - pData->iMAGNmY = ((mng_magnp)pChunk)->iMY; - pData->iMAGNmL = ((mng_magnp)pChunk)->iML; - pData->iMAGNmR = ((mng_magnp)pChunk)->iMR; - pData->iMAGNmT = ((mng_magnp)pChunk)->iMT; - pData->iMAGNmB = ((mng_magnp)pChunk)->iMB; - pData->iMAGNmethodY = ((mng_magnp)pChunk)->iMethodY; -#endif - - iRetcode = mng_process_display_magn (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_magn (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_magn)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_magn (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_magnp pMAGN = (mng_ani_magnp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_magn (pData, pMAGN->iFirstid, pMAGN->iLastid, - pMAGN->iMethodX, pMAGN->iMX, pMAGN->iMY, - pMAGN->iML, pMAGN->iMR, pMAGN->iMT, - pMAGN->iMB, pMAGN->iMethodY); -#else - pData->iMAGNfirstid = pMAGN->iFirstid; - pData->iMAGNlastid = pMAGN->iLastid; - pData->iMAGNmethodX = pMAGN->iMethodX; - pData->iMAGNmX = pMAGN->iMX; - pData->iMAGNmY = pMAGN->iMY; - pData->iMAGNmL = pMAGN->iML; - pData->iMAGNmR = pMAGN->iMR; - pData->iMAGNmT = pMAGN->iMT; - pData->iMAGNmB = pMAGN->iMB; - pData->iMAGNmethodY = pMAGN->iMethodY; - - iRetcode = mng_process_display_magn (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources) -#else -mng_retcode mng_create_ani_past (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_pastp pPAST; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PAST, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_past), - mng_free_ani_past, - mng_process_ani_past, - &pTemp); - if (iRetcode) - return iRetcode; - pPAST = (mng_ani_pastp)pTemp; -#else - MNG_ALLOC (pData, pPAST, sizeof (mng_ani_past)); - - pPAST->sHeader.fCleanup = mng_free_ani_past; - pPAST->sHeader.fProcess = mng_process_ani_past; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pPAST); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pPAST->iTargetid = iTargetid; - pPAST->iTargettype = iTargettype; - pPAST->iTargetx = iTargetx; - pPAST->iTargety = iTargety; - pPAST->iCount = iCount; - - if (iCount) - { - MNG_ALLOC (pData, pPAST->pSources, (iCount * sizeof (mng_past_source))); - MNG_COPY (pPAST->pSources, pSources, (iCount * sizeof (mng_past_source))); - } -#else - pPAST->iTargetid = ((mng_pastp)pChunk)->iDestid; - pPAST->iTargettype = ((mng_pastp)pChunk)->iTargettype; - pPAST->iTargetx = ((mng_pastp)pChunk)->iTargetx; - pPAST->iTargety = ((mng_pastp)pChunk)->iTargety; - pPAST->iCount = ((mng_pastp)pChunk)->iCount; - - if (pPAST->iCount) - { - mng_size_t iSize = (mng_size_t)(pPAST->iCount * sizeof (mng_past_source)); - MNG_ALLOC (pData, pPAST->pSources, iSize); - MNG_COPY (pPAST->pSources, ((mng_pastp)pChunk)->pSources, iSize); - } -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_past (pData, iTargetid, iTargettype, - iTargetx, iTargety, - iCount, pSources); -#else - iRetcode = mng_process_display_past (pData, - ((mng_pastp)pChunk)->iDestid, - ((mng_pastp)pChunk)->iTargettype, - ((mng_pastp)pChunk)->iTargetx, - ((mng_pastp)pChunk)->iTargety, - ((mng_pastp)pChunk)->iCount, - ((mng_pastp)pChunk)->pSources); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iPASTtargetid = iTargetid; - pData->iPASTtargettype = iTargettype; - pData->iPASTtargetx = iTargetx; - pData->iPASTtargety = iTargety; - pData->iPASTcount = iCount; - pData->pPASTsources = pSources; -#else - pData->iPASTtargetid = ((mng_pastp)pChunk)->iDestid; - pData->iPASTtargettype = ((mng_pastp)pChunk)->iTargettype; - pData->iPASTtargetx = ((mng_pastp)pChunk)->iTargetx; - pData->iPASTtargety = ((mng_pastp)pChunk)->iTargety; - pData->iPASTcount = ((mng_pastp)pChunk)->iCount; - pData->pPASTsources = ((mng_pastp)pChunk)->pSources; -#endif - - iRetcode = mng_process_display_past (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PAST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_free_ani_past (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_pastp pPAST = (mng_ani_pastp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PAST, MNG_LC_START); -#endif - - if (pPAST->iCount) - MNG_FREEX (pData, pPAST->pSources, (pPAST->iCount * sizeof (mng_past_source))); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_past)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PAST, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_ani_past (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_pastp pPAST = (mng_ani_pastp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PAST, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_past (pData, pPAST->iTargetid, pPAST->iTargettype, - pPAST->iTargetx, pPAST->iTargety, - pPAST->iCount, pPAST->pSources); -#else - pData->iPASTtargetid = pPAST->iTargetid; - pData->iPASTtargettype = pPAST->iTargettype; - pData->iPASTtargetx = pPAST->iTargetx; - pData->iPASTtargety = pPAST->iTargety; - pData->iPASTcount = pPAST->iCount; - pData->pPASTsources = pPAST->pSources; - - iRetcode = mng_process_display_past (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PAST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds) -#else -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_discp pDISC; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DISC, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_disc), - mng_free_ani_disc, - mng_process_ani_disc, - &pTemp); - if (iRetcode) - return iRetcode; - pDISC = (mng_ani_discp)pTemp; -#else - MNG_ALLOC (pData, pDISC, sizeof (mng_ani_disc)); - - pDISC->sHeader.fCleanup = mng_free_ani_disc; - pDISC->sHeader.fProcess = mng_process_ani_disc; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pDISC); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pDISC->iCount = iCount; - - if (iCount) - { - MNG_ALLOC (pData, pDISC->pIds, (iCount << 1)); - MNG_COPY (pDISC->pIds, pIds, (iCount << 1)); - } -#else - pDISC->iCount = ((mng_discp)pChunk)->iCount; - - if (pDISC->iCount) - { - mng_size_t iSize = (mng_size_t)(pDISC->iCount << 1); - MNG_ALLOC (pData, pDISC->pIds, iSize); - MNG_COPY (pDISC->pIds, ((mng_discp)pChunk)->pObjectids, iSize); - } -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_disc (pData, iCount, pIds); -#else - iRetcode = mng_process_display_disc (pData, - ((mng_discp)pChunk)->iCount, - ((mng_discp)pChunk)->pObjectids); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iDISCcount = iCount; - pData->pDISCids = pIds; -#else - pData->iDISCcount = ((mng_discp)pChunk)->iCount; - pData->pDISCids = ((mng_discp)pChunk)->pObjectids; -#endif - - iRetcode = mng_process_display_disc (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_disc (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_discp pDISC = (mng_ani_discp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DISC, MNG_LC_START); -#endif - - if (pDISC->iCount) - MNG_FREEX (pData, pDISC->pIds, (pDISC->iCount << 1)); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_disc)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DISC, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_disc (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_discp pDISC = (mng_ani_discp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DISC, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_disc (pData, pDISC->iCount, pDISC->pIds); -#else - pData->iDISCcount = pDISC->iCount; - pData->pDISCids = pDISC->pIds; - - iRetcode = mng_process_display_disc (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DISC, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_event (mng_datap pData, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname) -#else -mng_retcode mng_create_event (mng_datap pData, - mng_ptr pEntry) -#endif -{ - mng_eventp pEvent; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_EVENT, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { - mng_object_headerp pLast; - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_event), - mng_free_event, - mng_process_event, - &pTemp); - if (iRetcode) - return iRetcode; - pEvent = (mng_eventp)pTemp; -#else - MNG_ALLOC (pData, pEvent, sizeof (mng_event)); - - pEvent->sHeader.fCleanup = mng_free_event; - pEvent->sHeader.fProcess = mng_process_event; -#endif - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pEvent->iEventtype = iEventtype; - pEvent->iMasktype = iMasktype; - pEvent->iLeft = iLeft; - pEvent->iRight = iRight; - pEvent->iTop = iTop; - pEvent->iBottom = iBottom; - pEvent->iObjectid = iObjectid; - pEvent->iIndex = iIndex; - pEvent->iSegmentnamesize = iSegmentnamesize; - - if (iSegmentnamesize) - { - MNG_ALLOC (pData, pEvent->zSegmentname, iSegmentnamesize+1); - MNG_COPY (pEvent->zSegmentname, zSegmentname, iSegmentnamesize); - } -#else - pEvent->iEventtype = ((mng_evnt_entryp)pEntry)->iEventtype; - pEvent->iMasktype = ((mng_evnt_entryp)pEntry)->iMasktype; - pEvent->iLeft = ((mng_evnt_entryp)pEntry)->iLeft; - pEvent->iRight = ((mng_evnt_entryp)pEntry)->iRight; - pEvent->iTop = ((mng_evnt_entryp)pEntry)->iTop; - pEvent->iBottom = ((mng_evnt_entryp)pEntry)->iBottom; - pEvent->iObjectid = ((mng_evnt_entryp)pEntry)->iObjectid; - pEvent->iIndex = ((mng_evnt_entryp)pEntry)->iIndex; - pEvent->iSegmentnamesize = ((mng_evnt_entryp)pEntry)->iSegmentnamesize; - - if (pEvent->iSegmentnamesize) - { - MNG_ALLOC (pData, pEvent->zSegmentname, pEvent->iSegmentnamesize+1); - MNG_COPY (pEvent->zSegmentname, ((mng_evnt_entryp)pEntry)->zSegmentname, pEvent->iSegmentnamesize); - } -#endif - /* fixup the double-linked list */ - pLast = (mng_object_headerp)pData->pLastevent; - - if (pLast) /* link it as last in the chain */ - { - pEvent->sHeader.pPrev = pLast; - pLast->pNext = pEvent; - } - else - { - pData->pFirstevent = pEvent; - } - - pData->pLastevent = pEvent; - pData->bDynamic = MNG_TRUE; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_EVENT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_event (mng_datap pData, - mng_objectp pObject) -{ - mng_eventp pEvent = (mng_eventp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVENT, MNG_LC_START); -#endif - - if (pEvent->iSegmentnamesize) - MNG_FREEX (pData, pEvent->zSegmentname, pEvent->iSegmentnamesize + 1); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pEvent, sizeof (mng_event)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVENT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_event (mng_datap pData, - mng_objectp pObject) -{ -#ifndef MNG_SKIPCHUNK_SEEK - mng_eventp pEvent = (mng_eventp)pObject; - mng_object_headerp pAni; - mng_bool bFound = MNG_FALSE; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_EVENT, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_SEEK - if (!pEvent->pSEEK) /* need to find SEEK first ? */ - { - pAni = (mng_object_headerp)pData->pFirstaniobj; - - while ((pAni) && (!bFound)) - { - if ((pAni->fCleanup == mng_free_ani_seek) && - (strcmp(pEvent->zSegmentname, ((mng_ani_seekp)pAni)->zSegmentname) == 0)) - bFound = MNG_TRUE; - else - pAni = (mng_object_headerp)pAni->pNext; - } - - if (pAni) - pEvent->pSEEK = (mng_ani_seekp)pAni; - } - - if (pEvent->pSEEK) /* anything to do ? */ - { - pEvent->iLastx = pData->iEventx; - pEvent->iLasty = pData->iEventy; - /* let's start from this SEEK then */ - pData->pCurraniobj = (mng_objectp)pEvent->pSEEK; - pData->bRunningevent = MNG_TRUE; - /* wake-up the app ! */ - if (!pData->fSettimer ((mng_handle)pData, 5)) - MNG_ERROR (pData, MNG_APPTIMERERROR); - - } - else - MNG_ERROR (pData, MNG_SEEKNOTFOUND); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_EVENT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_SUPPORT_DYNAMICMNG */ - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint32 iFramessize, - mng_ptr pFrames) -#else -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_ptr pEntry) -#endif -{ - mng_mpng_objp pMPNG; - mng_ptr pTemp; - mng_retcode iRetcode; - mng_uint8p pFrame; - mng_int32 iCnt, iMax; - mng_uint32 iX, iY, iWidth, iHeight; - mng_int32 iXoffset, iYoffset; - mng_uint16 iTicks; - mng_uint16 iDelay; - mng_bool bNewframe; - mng_ani_loopp pLOOP; - mng_ani_endlp pENDL; - mng_ani_framp pFRAM; - mng_ani_movep pMOVE; - mng_ani_clipp pCLIP; - mng_ani_showp pSHOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_MPNG_OBJ, MNG_LC_START); -#endif - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_mpng_obj), mng_free_mpng_obj, - mng_process_mpng_obj, &pTemp); - if (iRetcode) - return iRetcode; - pMPNG = (mng_mpng_objp)pTemp; -#else - MNG_ALLOC (pData, pMPNG, sizeof (mng_mpng_obj)); - - pMPNG->sHeader.fCleanup = mng_free_mpng_obj; - pMPNG->sHeader.fProcess = mng_process_mpng_obj; -#endif - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pMPNG->iFramewidth = iFramewidth; - pMPNG->iFrameheight = iFrameheight; - pMPNG->iNumplays = iNumplays; - pMPNG->iTickspersec = iTickspersec; - pMPNG->iFramessize = iFramessize; - - if (iFramessize) - { - MNG_ALLOC (pData, pMPNG->pFrames, iFramessize); - MNG_COPY (pMPNG->pFrames, pFrames, iFramessize); - } -#else - pMPNG->iFramewidth = ((mng_mpngp)pEntry)->iFramewidth; - pMPNG->iFrameheight = ((mng_mpngp)pEntry)->iFrameheight; - pMPNG->iNumplays = ((mng_mpngp)pEntry)->iNumplays; - pMPNG->iTickspersec = ((mng_mpngp)pEntry)->iTickspersec; - pMPNG->iFramessize = ((mng_mpngp)pEntry)->iFramessize; - - if (pMPNG->iFramessize) - { - MNG_ALLOC (pData, pMPNG->pFrames, pMPNG->iFramessize); - MNG_COPY (pMPNG->pFrames, ((mng_mpngp)pEntry)->pFrames, pMPNG->iFramessize); - } -#endif - - pData->pMPNG = pMPNG; - pData->eImagetype = mng_it_mpng; - - iRetcode = mng_process_display_mpng (pData); - if (iRetcode) - return iRetcode; - - /* now let's create the MNG animation directives from this */ - - pFrame = (mng_uint8p)pMPNG->pFrames; - iMax = pMPNG->iFramessize / 26; - /* set up MNG impersonation */ - pData->iTicks = pMPNG->iTickspersec; - pData->iLayercount = iMax; - - if (pMPNG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_loop), - mng_free_ani_loop, mng_process_ani_loop, - &((mng_ptr)pLOOP)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop)); - - pLOOP->sHeader.fCleanup = mng_free_ani_loop; - pLOOP->sHeader.fProcess = mng_process_ani_loop; -#endif - - pLOOP->iLevel = 1; - if (pMPNG->iNumplays) - pLOOP->iRepeatcount = pMPNG->iNumplays; - else - pLOOP->iRepeatcount = 0xFFFFFFFFl; - - mng_add_ani_object (pData, (mng_object_headerp)pLOOP); - } - - bNewframe = MNG_TRUE; /* create the frame display objects */ - - for (iCnt = 0; iCnt < iMax; iCnt++) - { - iX = mng_get_uint32 (pFrame); - iY = mng_get_uint32 (pFrame+4); - iWidth = mng_get_uint32 (pFrame+8); - iHeight = mng_get_uint32 (pFrame+12); - iXoffset = mng_get_int32 (pFrame+16); - iYoffset = mng_get_int32 (pFrame+20); - iTicks = mng_get_uint16 (pFrame+24); - - iDelay = iTicks; - if (!iDelay) - { - mng_uint8p pTemp = pFrame+26; - mng_int32 iTemp = iCnt+1; - - while ((iTemp < iMax) && (!iDelay)) - { - iDelay = mng_get_uint16 (pTemp+24); - pTemp += 26; - iTemp++; - } - } - - if (bNewframe) - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_fram), - mng_free_obj_general, mng_process_ani_fram, - &((mng_ptr)pFRAM)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram)); - - pFRAM->sHeader.fCleanup = mng_free_ani_fram; - pFRAM->sHeader.fProcess = mng_process_ani_fram; -#endif - - pFRAM->iFramemode = 4; - pFRAM->iChangedelay = 1; - pFRAM->iDelay = iDelay; - - mng_add_ani_object (pData, (mng_object_headerp)pFRAM); - } - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_move), - mng_free_obj_general, - mng_process_ani_move, - &((mng_ptr)pMOVE)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move)); - - pMOVE->sHeader.fCleanup = mng_free_ani_move; - pMOVE->sHeader.fProcess = mng_process_ani_move; -#endif - - pMOVE->iLocax = iXoffset - (mng_int32)iX; - pMOVE->iLocay = iYoffset - (mng_int32)iY; - - mng_add_ani_object (pData, (mng_object_headerp)pMOVE); - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_clip), - mng_free_obj_general, - mng_process_ani_clip, - &((mng_ptr)pCLIP)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pCLIP, sizeof (mng_ani_clip)); - - pCLIP->sHeader.fCleanup = mng_free_ani_clip; - pCLIP->sHeader.fProcess = mng_process_ani_clip; -#endif - - pCLIP->iClipl = iXoffset; - pCLIP->iClipr = iXoffset + (mng_int32)iWidth; - pCLIP->iClipt = iYoffset; - pCLIP->iClipb = iYoffset + (mng_int32)iHeight; - - mng_add_ani_object (pData, (mng_object_headerp)pCLIP); - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_show), - mng_free_obj_general, mng_process_ani_show, - &((mng_ptr)pSHOW)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show)); - - pSHOW->sHeader.fCleanup = mng_free_ani_show; - pSHOW->sHeader.fProcess = mng_process_ani_show; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSHOW); - - bNewframe = (mng_bool)iTicks; - pFrame += 26; - } - - if (pMPNG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_endl), - mng_free_obj_general, mng_process_ani_endl, - &((mng_ptr)pENDL)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl)); - - pENDL->sHeader.fCleanup = mng_free_ani_endl; - pENDL->sHeader.fProcess = mng_process_ani_endl; -#endif - - pENDL->iLevel = 1; - - mng_add_ani_object (pData, (mng_object_headerp)pENDL); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_MPNG_OBJ, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_mpng_obj (mng_datap pData, - mng_objectp pObject) -{ - mng_mpng_objp pMPNG = (mng_mpng_objp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG_OBJ, MNG_LC_START); -#endif - - if (pMPNG->iFramessize) - MNG_FREEX (pData, pMPNG->pFrames, pMPNG->iFramessize); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pMPNG, sizeof (mng_mpng_obj)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG_OBJ, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_mpng_obj (mng_datap pData, - mng_objectp pObject) -{ - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_MPNG_PROPOSAL */ - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_uint32 iNumframes, - mng_uint32 iTickspersec, - mng_uint32 iNumplays, - mng_uint32 iTilewidth, - mng_uint32 iTileheight, - mng_uint8 iInterlace, - mng_uint8 iStillused) -#else -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_ptr pEntry) -#endif -{ - mng_ang_objp pANG; - mng_ptr pTemp; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANG_OBJ, MNG_LC_START); -#endif - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ang_obj), mng_free_ang_obj, - mng_process_ang_obj, &pTemp); - if (iRetcode) - return iRetcode; - pANG = (mng_ang_objp)pTemp; -#else - MNG_ALLOC (pData, pANG, sizeof (mng_ang_obj)); - - pANG->sHeader.fCleanup = mng_free_ang_obj; - pANG->sHeader.fProcess = mng_process_ang_obj; -#endif - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pANG->iNumframes = iNumframes; - pANG->iTickspersec = iTickspersec; - pANG->iNumplays = iNumplays; - pANG->iTilewidth = iTilewidth; - pANG->iTileheight = iTileheight; - pANG->iInterlace = iInterlace; - pANG->iStillused = iStillused; -#else - pANG->iNumframes = ((mng_ahdrp)pEntry)->iNumframes; - pANG->iTickspersec = ((mng_ahdrp)pEntry)->iTickspersec; - pANG->iNumplays = ((mng_ahdrp)pEntry)->iNumplays; - pANG->iTilewidth = ((mng_ahdrp)pEntry)->iTilewidth; - pANG->iTileheight = ((mng_ahdrp)pEntry)->iTileheight; - pANG->iInterlace = ((mng_ahdrp)pEntry)->iInterlace; - pANG->iStillused = ((mng_ahdrp)pEntry)->iStillused; -#endif - - pData->pANG = pANG; - pData->eImagetype = mng_it_ang; - - iRetcode = mng_process_display_ang (pData); - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANG_OBJ, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ang_obj (mng_datap pData, - mng_objectp pObject) -{ - mng_ang_objp pANG = (mng_ang_objp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANG_OBJ, MNG_LC_START); -#endif - - if (pANG->iTilessize) - MNG_FREEX (pData, pANG->pTiles, pANG->iTilessize); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pANG, sizeof (mng_ang_obj)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANG_OBJ, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ang_obj (mng_datap pData, - mng_objectp pObject) -{ - mng_ang_objp pANG = (mng_ang_objp)pObject; - mng_uint8p pTile = (mng_uint8p)pANG->pTiles; - mng_retcode iRetcode; - mng_int32 iCnt, iMax; - mng_uint32 iTicks; - mng_int32 iXoffset, iYoffset; - mng_uint8 iSource; - mng_ani_loopp pLOOP; - mng_ani_endlp pENDL; - mng_ani_framp pFRAM; - mng_ani_movep pMOVE; - mng_ani_showp pSHOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANG_OBJ, MNG_LC_START); -#endif - - /* let's create the MNG animation directives from this */ - - iMax = pANG->iNumframes; - /* set up MNG impersonation */ - pData->iTicks = pANG->iTickspersec; - pData->iLayercount = iMax; - - if (pANG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_loop), - mng_free_ani_loop, mng_process_ani_loop, - &((mng_ptr)pLOOP)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop)); - - pLOOP->sHeader.fCleanup = mng_free_ani_loop; - pLOOP->sHeader.fProcess = mng_process_ani_loop; -#endif - - pLOOP->iLevel = 1; - if (pANG->iNumplays) - pLOOP->iRepeatcount = pANG->iNumplays; - else - pLOOP->iRepeatcount = 0xFFFFFFFFl; - - mng_add_ani_object (pData, (mng_object_headerp)pLOOP); - } - - for (iCnt = 0; iCnt < iMax; iCnt++) - { - iTicks = mng_get_uint32 (pTile); - iXoffset = mng_get_int32 (pTile+4); - iYoffset = mng_get_int32 (pTile+8); - iSource = *(pTile+12); - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_fram), - mng_free_obj_general, mng_process_ani_fram, - &((mng_ptr)pFRAM)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram)); - - pFRAM->sHeader.fCleanup = mng_free_ani_fram; - pFRAM->sHeader.fProcess = mng_process_ani_fram; -#endif - - pFRAM->iFramemode = 4; - pFRAM->iChangedelay = 1; - pFRAM->iDelay = iTicks; - - mng_add_ani_object (pData, (mng_object_headerp)pFRAM); - - if (!iSource) - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_move), - mng_free_obj_general, - mng_process_ani_move, - &((mng_ptr)pMOVE)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move)); - - pMOVE->sHeader.fCleanup = mng_free_ani_move; - pMOVE->sHeader.fProcess = mng_process_ani_move; -#endif - - pMOVE->iFirstid = 1; - pMOVE->iLastid = 1; - pMOVE->iLocax = -iXoffset; - pMOVE->iLocay = -iYoffset; - - mng_add_ani_object (pData, (mng_object_headerp)pMOVE); - } - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_show), - mng_free_obj_general, mng_process_ani_show, - &((mng_ptr)pSHOW)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show)); - - pSHOW->sHeader.fCleanup = mng_free_ani_show; - pSHOW->sHeader.fProcess = mng_process_ani_show; -#endif - - if (iSource) - pSHOW->iFirstid = 0; - else - pSHOW->iFirstid = 1; - pSHOW->iLastid = pSHOW->iFirstid; - - mng_add_ani_object (pData, (mng_object_headerp)pSHOW); - - pTile += sizeof(mng_adat_tile); - } - - if (pANG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_endl), - mng_free_obj_general, mng_process_ani_endl, - &((mng_ptr)pENDL)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl)); - - pENDL->sHeader.fCleanup = mng_free_ani_endl; - pENDL->sHeader.fProcess = mng_process_ani_endl; -#endif - - pENDL->iLevel = 1; - - mng_add_ani_object (pData, (mng_object_headerp)pENDL); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANG_OBJ, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_ANG_PROPOSAL */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_object_prc.h b/Engine/lib/lmng/libmng_object_prc.h deleted file mode 100644 index ffd20c871..000000000 --- a/Engine/lib/lmng/libmng_object_prc.h +++ /dev/null @@ -1,690 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_object_prc.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Object processing routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the internal object processing routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for global color-chunks in animation * */ -/* * - added support for global PLTE,tRNS,bKGD in animation * */ -/* * - added SAVE & SEEK animation objects * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - changed ani_object create routines not to return the * */ -/* * created object (wasn't necessary) * */ -/* * - added compression/filter/interlace fields to * */ -/* * object-buffer for delta-image processing * */ -/* * * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for PPLT chunk * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added routine to discard "invalid" objects * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around Delta-PNG code * */ -/* * - added SKIPCHUNK feature * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_object_prc_h_ -#define _libmng_object_prc_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_drop_invalid_objects (mng_datap pData); - -/* ************************************************************************** */ - -mng_retcode mng_create_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_imagedatap *ppObject); - -mng_retcode mng_free_imagedataobject (mng_datap pData, - mng_imagedatap pImagedata); - -mng_retcode mng_clone_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_imagedatap pSource, - mng_imagedatap *ppClone); - -/* ************************************************************************** */ - -mng_retcode mng_create_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bConcrete, - mng_bool bVisible, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_int32 iPosx, - mng_int32 iPosy, - mng_bool bClipped, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb, - mng_imagep *ppObject); - -mng_retcode mng_free_imageobject (mng_datap pData, - mng_imagep pImage); - -mng_imagep mng_find_imageobject (mng_datap pData, - mng_uint16 iId); - -mng_retcode mng_clone_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bPartial, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy, - mng_imagep pSource, - mng_imagep *ppClone); - -mng_retcode mng_renum_imageobject (mng_datap pData, - mng_imagep pSource, - mng_uint16 iId, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy); - -mng_retcode mng_reset_object_details (mng_datap pData, - mng_imagep pImage, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_bool bResetall); - -mng_retcode mng_promote_imageobject (mng_datap pData, - mng_imagep pImage, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype); - -mng_retcode mng_magnify_imageobject (mng_datap pData, - mng_imagep pImage); - -mng_retcode mng_colorcorrect_object (mng_datap pData, - mng_imagep pImage); - -/* ************************************************************************** */ - -mng_retcode mng_create_ani_image (mng_datap pData); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - -mng_retcode mng_create_ani_plte (mng_datap pData, - mng_uint32 iEntrycount, - mng_palette8ep paEntries); - -mng_retcode mng_create_ani_trns (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iGamma); - -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey); - -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_bool bEmpty, - mng_uint8 iRenderinginent); - -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iProfilesize, - mng_ptr pProfile); - -mng_retcode mng_create_ani_bkgd (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue); - -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_uint8 iLevel, - mng_uint32 iRepeatcount, - mng_uint8 iTermcond, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals); - -mng_retcode mng_create_ani_endl (mng_datap pData, - mng_uint8 iLevel); - -mng_retcode mng_create_ani_defi (mng_datap pData); - -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable); - -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocatype, - mng_int32 iLocax, - mng_int32 iLocay); - -mng_retcode mng_create_ani_back (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile); - -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); - -mng_retcode mng_create_ani_move (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iLocax, - mng_int32 iLocay); - -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); - -mng_retcode mng_create_ani_show (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode); - -mng_retcode mng_create_ani_term (mng_datap pData, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax); - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_create_ani_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky); - -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype); - -mng_retcode mng_create_ani_ipng (mng_datap pData); -mng_retcode mng_create_ani_ijng (mng_datap pData); - -mng_retcode mng_create_ani_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY); -#endif - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_create_ani_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources); -#endif - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds); -#endif - -#else /* MNG_OPTIMIZE_CHUNKREADER */ - -mng_retcode mng_create_ani_plte (mng_datap pData); -mng_retcode mng_create_ani_trns (mng_datap pData); -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_bkgd (mng_datap pData); -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_endl (mng_datap pData, - mng_uint8 iLevel); -mng_retcode mng_create_ani_defi (mng_datap pData); -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_back (mng_datap pData); -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_move (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_show (mng_datap pData); -mng_retcode mng_create_ani_term (mng_datap pData, - mng_chunkp pChunk); -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_create_ani_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_chunkp pChunk); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_ipng (mng_datap pData); -mng_retcode mng_create_ani_ijng (mng_datap pData); - -mng_retcode mng_create_ani_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_chunkp pChunk); -#endif -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_create_ani_past (mng_datap pData, - mng_chunkp pChunk); -#endif -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_chunkp pChunk); -#endif - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_image (mng_datap pData, - mng_objectp pObject); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - -mng_retcode mng_free_ani_plte (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_trns (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_gama (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode mng_free_ani_chrm (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode mng_free_ani_srgb (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode mng_free_ani_bkgd (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode mng_free_ani_endl (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_free_ani_defi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_basi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_clon (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_back (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_fram (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_move (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_clip (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_show (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_term (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_free_ani_save (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_free_ani_dhdr (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_prom (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_ipng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_ijng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_pplt (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_free_ani_magn (mng_datap pData, - mng_objectp pObject); -#endif - -#endif /* MNG_OPTIMIZE_OBJCLEANUP */ - - -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode mng_free_ani_iccp (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode mng_free_ani_loop (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_free_ani_seek (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_free_ani_past (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_free_ani_disc (mng_datap pData, - mng_objectp pObject); - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_image (mng_datap pData, - mng_objectp pObject); - -mng_retcode mng_process_ani_plte (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_trns (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_gama (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode mng_process_ani_chrm (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode mng_process_ani_srgb (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode mng_process_ani_iccp (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode mng_process_ani_bkgd (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode mng_process_ani_loop (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_endl (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_process_ani_defi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_basi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_clon (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_back (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_fram (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_move (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_clip (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_show (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_term (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_ani_save (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_ani_seek (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_ani_dhdr (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_prom (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_ipng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_ijng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_pplt (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_process_ani_magn (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_ani_past (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_process_ani_disc (mng_datap pData, - mng_objectp pObject); - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_event (mng_datap pData, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname); -#else -mng_retcode mng_create_event (mng_datap pData, - mng_ptr pEntry); -#endif -mng_retcode mng_free_event (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_event (mng_datap pData, - mng_objectp pObject); -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint32 iFramessize, - mng_ptr pFrames); -#else -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_ptr pEntry); -#endif -mng_retcode mng_free_mpng_obj (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_mpng_obj (mng_datap pData, - mng_objectp pObject); -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_uint32 iNumframes, - mng_uint32 iTickspersec, - mng_uint32 iNumplays, - mng_uint32 iTilewidth, - mng_uint32 iTileheight, - mng_uint8 iInterlace, - mng_uint8 iStillused); -#else -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_ptr pEntry); -#endif -mng_retcode mng_free_ang_obj (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ang_obj (mng_datap pData, - mng_objectp pObject); -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_object_prc_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_objects.h b/Engine/lib/lmng/libmng_objects.h deleted file mode 100644 index 053e6b4b2..000000000 --- a/Engine/lib/lmng/libmng_objects.h +++ /dev/null @@ -1,635 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_objects.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Internal object structures (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the internal object structures * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - changed inclusion to DISPLAY_PROCS * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added global color-chunks for animations * */ -/* * - added global PLTE,tRNS,bKGD chunks for animation * */ -/* * - added SAVE & SEEK animation objects * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - added framenr/layernr/playtime to object header * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added ani-objects for delta-image processing * */ -/* * - added compression/filter/interlace fields to * */ -/* * object-buffer for delta-image processing * */ -/* * * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed definition of aTRNSentries * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added definition for PPLT animation-processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for delta-JNG * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added valid-flag to stored objects for read() / display()* */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - added storage for pixel-/alpha-sampledepth for delta's * */ -/* * * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * * */ -/* * 1.0.6 - 10/07/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_objects_h_ -#define _libmng_objects_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -typedef mng_retcode (*mng_cleanupobject) (mng_datap pData, - mng_objectp pHeader); - -typedef mng_retcode (*mng_processobject) (mng_datap pData, - mng_objectp pHeader); - -/* ************************************************************************** */ - -typedef struct { - mng_cleanupobject fCleanup; - mng_processobject fProcess; - mng_objectp pNext; /* for double-linked list */ - mng_objectp pPrev; - mng_uint32 iFramenr; - mng_uint32 iLayernr; - mng_uint32 iPlaytime; -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_size_t iObjsize; -#endif - } mng_object_header; -typedef mng_object_header * mng_object_headerp; - -/* ************************************************************************** */ - -typedef struct { /* MNG specification "object-buffer" */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iRefcount; /* reference counter */ - mng_bool bFrozen; /* frozen flag */ - mng_bool bConcrete; /* concrete flag */ - mng_bool bViewable; /* viewable flag */ - mng_uint32 iWidth; /* image specifics */ - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - - mng_bool bCorrected; /* indicates if an abstract image - has already been color-corrected */ - - mng_uint8 iAlphabitdepth; /* used only for JNG images */ - mng_uint8 iJHDRcompression; - mng_uint8 iJHDRinterlace; - - mng_uint8 iPixelsampledepth; /* used with delta-images */ - mng_uint8 iAlphasampledepth; - - mng_bool bHasPLTE; /* PLTE chunk present */ - mng_bool bHasTRNS; /* tRNS chunk present */ - mng_bool bHasGAMA; /* gAMA chunk present */ - mng_bool bHasCHRM; /* cHRM chunk present */ - mng_bool bHasSRGB; /* sRGB chunk present */ - mng_bool bHasICCP; /* iCCP chunk present */ - mng_bool bHasBKGD; /* bKGD chunk present */ - - mng_uint32 iPLTEcount; /* PLTE fields */ - mng_rgbpaltab aPLTEentries; - - mng_uint16 iTRNSgray; /* tRNS fields */ - mng_uint16 iTRNSred; - mng_uint16 iTRNSgreen; - mng_uint16 iTRNSblue; - mng_uint32 iTRNScount; - mng_uint8arr aTRNSentries; - - mng_uint32 iGamma; /* gAMA fields */ - - mng_uint32 iWhitepointx; /* cHRM fields */ - mng_uint32 iWhitepointy; - mng_uint32 iPrimaryredx; - mng_uint32 iPrimaryredy; - mng_uint32 iPrimarygreenx; - mng_uint32 iPrimarygreeny; - mng_uint32 iPrimarybluex; - mng_uint32 iPrimarybluey; - - mng_uint8 iRenderingintent; /* sRGB fields */ - - mng_uint32 iProfilesize; /* iCCP fields */ - mng_ptr pProfile; - - mng_uint8 iBKGDindex; /* bKGD fields */ - mng_uint16 iBKGDgray; - mng_uint16 iBKGDred; - mng_uint16 iBKGDgreen; - mng_uint16 iBKGDblue; - - mng_uint32 iSamplesize; /* size of a sample */ - mng_uint32 iRowsize; /* size of a row of samples */ - mng_uint32 iImgdatasize; /* size of the sample data buffer */ - mng_uint8p pImgdata; /* actual sample data buffer */ - - } mng_imagedata; -typedef mng_imagedata * mng_imagedatap; - -/* ************************************************************************** */ - -typedef struct { /* MNG specification "object" */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iId; /* object-id */ - mng_bool bFrozen; /* frozen flag */ - mng_bool bVisible; /* potential visibility flag */ - mng_bool bViewable; /* viewable flag */ - mng_bool bValid; /* marks invalid when only reading */ - mng_int32 iPosx; /* location fields */ - mng_int32 iPosy; - mng_bool bClipped; /* clipping fields */ - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; -#ifndef MNG_SKIPCHUNK_MAGN - mng_uint8 iMAGN_MethodX; /* magnification (MAGN) */ - mng_uint8 iMAGN_MethodY; - mng_uint16 iMAGN_MX; - mng_uint16 iMAGN_MY; - mng_uint16 iMAGN_ML; - mng_uint16 iMAGN_MR; - mng_uint16 iMAGN_MT; - mng_uint16 iMAGN_MB; -#endif -#ifndef MNG_SKIPCHUNK_PAST - mng_int32 iPastx; /* target x/y from previous PAST */ - mng_int32 iPasty; -#endif - mng_imagedatap pImgbuf; /* the image-data buffer */ - } mng_image; -typedef mng_image * mng_imagep; - -/* ************************************************************************** */ - - /* "on-the-fly" image (= object 0) */ -typedef mng_image mng_ani_image; /* let's (ab)use the general "object" */ -typedef mng_ani_image * mng_ani_imagep; /* that's actualy crucial, so don't change it! */ - -/* ************************************************************************** */ - -typedef struct { /* global PLTE object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iEntrycount; - mng_rgbpaltab aEntries; - } mng_ani_plte; -typedef mng_ani_plte * mng_ani_pltep; - -/* ************************************************************************** */ - -typedef struct { /* global tRNS object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iRawlen; - mng_uint8arr aRawdata; - } mng_ani_trns; -typedef mng_ani_trns * mng_ani_trnsp; - -/* ************************************************************************** */ - -typedef struct { /* global gAMA object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint32 iGamma; - } mng_ani_gama; -typedef mng_ani_gama * mng_ani_gamap; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -typedef struct { /* global cHRM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint32 iWhitepointx; - mng_uint32 iWhitepointy; - mng_uint32 iRedx; - mng_uint32 iRedy; - mng_uint32 iGreenx; - mng_uint32 iGreeny; - mng_uint32 iBluex; - mng_uint32 iBluey; - } mng_ani_chrm; -typedef mng_ani_chrm * mng_ani_chrmp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* global sRGB object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint8 iRenderingintent; - } mng_ani_srgb; -typedef mng_ani_srgb * mng_ani_srgbp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -typedef struct { /* global iCCP object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint32 iProfilesize; - mng_ptr pProfile; - } mng_ani_iccp; -typedef mng_ani_iccp * mng_ani_iccpp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* global bKGD object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - } mng_ani_bkgd; -typedef mng_ani_bkgd * mng_ani_bkgdp; - -/* ************************************************************************** */ - -typedef struct { /* LOOP object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iLevel; - mng_uint32 iRepeatcount; - mng_uint8 iTermcond; - mng_uint32 iItermin; - mng_uint32 iItermax; - mng_uint32 iCount; - mng_uint32p pSignals; - - mng_uint32 iRunningcount; /* running counter */ - } mng_ani_loop; -typedef mng_ani_loop * mng_ani_loopp; - -/* ************************************************************************** */ - -typedef struct { /* ENDL object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iLevel; - - mng_ani_loopp pLOOP; /* matching LOOP */ - } mng_ani_endl; -typedef mng_ani_endl * mng_ani_endlp; - -/* ************************************************************************** */ - -typedef struct { /* DEFI object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iId; - mng_bool bHasdonotshow; - mng_uint8 iDonotshow; - mng_bool bHasconcrete; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_int32 iLocax; - mng_int32 iLocay; - mng_bool bHasclip; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_ani_defi; -typedef mng_ani_defi * mng_ani_defip; - -/* ************************************************************************** */ - -typedef struct { /* BASI object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_bool bHasalpha; - mng_uint16 iAlpha; - mng_uint8 iViewable; - } mng_ani_basi; -typedef mng_ani_basi * mng_ani_basip; - -/* ************************************************************************** */ - -typedef struct { /* CLON object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iCloneid; - mng_uint16 iSourceid; - mng_uint8 iClonetype; - mng_bool bHasdonotshow; - mng_uint8 iDonotshow; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_uint8 iLocatype; - mng_int32 iLocax; - mng_int32 iLocay; - } mng_ani_clon; -typedef mng_ani_clon * mng_ani_clonp; - -/* ************************************************************************** */ - -typedef struct { /* BACK object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_uint8 iMandatory; - mng_uint16 iImageid; - mng_uint8 iTile; - } mng_ani_back; -typedef mng_ani_back * mng_ani_backp; - -/* ************************************************************************** */ - -typedef struct { /* FRAM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iFramemode; - mng_uint8 iChangedelay; - mng_uint32 iDelay; - mng_uint8 iChangetimeout; - mng_uint32 iTimeout; - mng_uint8 iChangeclipping; - mng_uint8 iCliptype; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_ani_fram; -typedef mng_ani_fram * mng_ani_framp; - -/* ************************************************************************** */ - -typedef struct { /* MOVE object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iType; - mng_int32 iLocax; - mng_int32 iLocay; - } mng_ani_move; -typedef mng_ani_move * mng_ani_movep; - -/* ************************************************************************** */ - -typedef struct { /* CLIP object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iType; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_ani_clip; -typedef mng_ani_clip * mng_ani_clipp; - -/* ************************************************************************** */ - -typedef struct { /* SHOW object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMode; - } mng_ani_show; -typedef mng_ani_show * mng_ani_showp; - -/* ************************************************************************** */ - -typedef struct { /* TERM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iTermaction; - mng_uint8 iIteraction; - mng_uint32 iDelay; - mng_uint32 iItermax; - } mng_ani_term; -typedef mng_ani_term * mng_ani_termp; - -/* ************************************************************************** */ - -typedef struct { /* SAVE object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - } mng_ani_save; -typedef mng_ani_save * mng_ani_savep; - -/* ************************************************************************** */ - -typedef struct { /* SEEK object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iSegmentnamesize; - mng_pchar zSegmentname; - } mng_ani_seek; -typedef mng_ani_seek * mng_ani_seekp; - -/* ************************************************************************** */ -#ifndef MNG_NO_DELTA_PNG -typedef struct { /* DHDR object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iObjectid; - mng_uint8 iImagetype; - mng_uint8 iDeltatype; - mng_uint32 iBlockwidth; - mng_uint32 iBlockheight; - mng_uint32 iBlockx; - mng_uint32 iBlocky; - } mng_ani_dhdr; -typedef mng_ani_dhdr * mng_ani_dhdrp; - -/* ************************************************************************** */ - -typedef struct { /* PROM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iFilltype; - } mng_ani_prom; -typedef mng_ani_prom * mng_ani_promp; - -/* ************************************************************************** */ - -typedef struct { /* IPNG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - } mng_ani_ipng; -typedef mng_ani_ipng * mng_ani_ipngp; - -/* ************************************************************************** */ - -typedef struct { /* IJNG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - } mng_ani_ijng; -typedef mng_ani_ijng * mng_ani_ijngp; - -/* ************************************************************************** */ - -typedef struct { /* PPLT object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iType; - mng_uint32 iCount; - mng_rgbpaltab aIndexentries; - mng_uint8arr aAlphaentries; - mng_uint8arr aUsedentries; - } mng_ani_pplt; -typedef mng_ani_pplt * mng_ani_ppltp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -typedef struct { /* MAGN object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMethodX; - mng_uint16 iMX; - mng_uint16 iMY; - mng_uint16 iML; - mng_uint16 iMR; - mng_uint16 iMT; - mng_uint16 iMB; - mng_uint8 iMethodY; - } mng_ani_magn; -typedef mng_ani_magn * mng_ani_magnp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -typedef struct { /* PAST object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iTargetid; - mng_uint8 iTargettype; - mng_int32 iTargetx; - mng_int32 iTargety; - mng_uint32 iCount; - mng_ptr pSources; - } mng_ani_past; -typedef mng_ani_past * mng_ani_pastp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -typedef struct { /* DISC object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iCount; - mng_uint16p pIds; - } mng_ani_disc; -typedef mng_ani_disc * mng_ani_discp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -typedef struct { /* event object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iSegmentnamesize; - mng_pchar zSegmentname; - - mng_ani_seekp pSEEK; /* SEEK ani object */ - mng_int32 iLastx; /* last X/Y coordinates */ - mng_int32 iLasty; - } mng_event; -typedef mng_event * mng_eventp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -typedef struct { /* mPNG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iFramewidth; - mng_uint32 iFrameheight; - mng_uint32 iNumplays; - mng_uint16 iTickspersec; - mng_uint32 iFramessize; - mng_ptr pFrames; - } mng_mpng_obj; -typedef mng_mpng_obj * mng_mpng_objp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -typedef struct { /* ANG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iNumframes; - mng_uint32 iTickspersec; - mng_uint32 iNumplays; - mng_uint32 iTilewidth; - mng_uint32 iTileheight; - mng_uint8 iInterlace; - mng_uint8 iStillused; - mng_uint32 iTilessize; - mng_ptr pTiles; - } mng_ang_obj; -typedef mng_ang_obj * mng_ang_objp; -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_objects_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_pixels.c b/Engine/lib/lmng/libmng_pixels.c deleted file mode 100644 index ce5637be9..000000000 --- a/Engine/lib/lmng/libmng_pixels.c +++ /dev/null @@ -1,24610 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_pixels.c copyright (c) 2000-2005 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Pixel-row management routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the pixel-row management routines * */ -/* * * */ -/* * the dual alpha-composing for RGBA/BGRA/etc output-canvas' * */ -/* * is based on the Note on Compositing chapter of the * */ -/* * DOH-3 draft, noted to me by Adam M. Costello * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/22/2000 - G.Juyn * */ -/* * - added JNG support * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - fixed minor bugs 16-bit pixel-handling * */ -/* * - added delta-image row-processing routines * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - fixed endian support (hopefully) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - implemented app bkgd restore routines * */ -/* * - implemented RGBA8, ARGB8, BGRA8 & ABGR8 display routines * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/09/2000 - G.Juyn * */ -/* * - fixed alpha-handling for alpha canvasstyles * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed to support delta-images * */ -/* * - optimized some store_xxx routines * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed nasty bug with embedded PNG after delta-image * */ -/* * 0.5.3 - 06/24/2000 - G.Juyn * */ -/* * - fixed problem with 16-bit GA format * */ -/* * 0.5.3 - 06/25/2000 - G.Juyn * */ -/* * - fixed problem with cheap transparency for 4-bit gray * */ -/* * - fixed display_xxxx routines for interlaced images * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - fixed compiler-warning for non-initialized iB variable * */ -/* * * */ -/* * 0.9.1 - 07/05/2000 - G.Juyn * */ -/* * - fixed mandatory BACK color to be opaque * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - B110547 - fixed bug in interlace code * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/20/2000 - G.Juyn * */ -/* * - fixed app-supplied background restore * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/30/2000 - G.Juyn * */ -/* * - fixed MAGN rounding errors (thanks Matthias!) * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - fixed alpha-blending for RGBA canvasstyle * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - fixed alpha-blending for other alpha-canvasstyles * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.3 - 10/28/2000 - G.Juyn * */ -/* * - fixed tRNS processing for gray-image < 8-bits * */ -/* * * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - removed "old" MAGN methods 3 & 4 * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.4 - 11/04/2001 - G.Juyn * */ -/* * - fixed possible compile-problem in cleanup_rowproc * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B558212 - off by one error * */ -/* * - MNG subimage alpha composite wrong for rgba8 images * */ -/* * * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/16/2002 - G.Juyn * */ -/* * - completed MAGN support (16-bit functions) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - optimized restore-background for bKGD cases * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - finished support for BACK image & tiling * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * * */ -/* * 1.0.6 - 03/09/2003 - G.Juyn * */ -/* * - hiding 12-bit JPEG stuff * */ -/* * 1.0.6 - 05/11/2003 - Glenn RP * */ -/* * - added size-optimization COMPOSE routine usage * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 05/25/2003 - Glenn RP * */ -/* * - added size-optimization DIV255B8 routine usage * */ -/* * 1.0.6 - 06/09/2003 - G. R-P * */ -/* * - added conditionals around 8-bit magn routines * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - removed conditionals around 8-bit magn routines * */ -/* * - added MNG_NO_16BIT_SUPPORT and MNG_NO_DELTA_PNG * */ -/* * conditionals * */ -/* * - reversed many loops to use decrementing counter * */ -/* * - combined init functions * */ -/* * - converted some switches to array references * */ -/* * 1.0.6 - 07/29/2003 - G.Juyn * */ -/* * - fixed duplicate for-loop * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals around PAST chunk support * */ -/* * - fixed "FOOTPRINT_COMPOSEIV" typo (now "FOOTPRINT_DIV") * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added more conditionals around "promote" functions * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/08/2004 - G.R-P * */ -/* * - added more conditionals around 16-bit-supporting code * */ -/* * 1.0.7 - 03/09/2004 - G.Juyn * */ -/* * - fixed bug in promote_g8_g8 with 16bit support off * */ -/* * 1.0.7 - 03/09/2004 - G.R-P * */ -/* * - more optimizations with 16bit support off * */ -/* * 1.0.7 - 03/10/2004 - G.Juyn * */ -/* * - fixed some warnings for 16bit optimizations * */ -/* * 1.0.7 - 03/21/2004 - G.Juyn * */ -/* * - fixed some 64-bit platform compiler warnings * */ -/* * * */ -/* * 1.0.8 - 06/20/2004 - G.Juyn * */ -/* * - some speed optimizations (thanks to John Stiles) * */ -/* * 1.0.8 - 08/01/2004 - G.Juyn * */ -/* * - added support for 3+byte pixelsize for JPEG's * */ -/* * * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added LITTLEENDIAN/BIGENDIAN fixtures (thanks J.Stiles) * */ -/* * - fixed MNG_NO_1_2_4BIT_SUPPORT for TBBN1G04.PNG * */ -/* * 1.0.9 - 12/31/2004 - G.R-P. * */ -/* * - fixed warnings about C++ style (//) comments * */ -/* * * */ -/* * 1.0.10 - 07/06/2005 - G.R-P. * */ -/* * - added MORE MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.10 - 10/06/2005 - G.R-P. * */ -/* * - alloc more memory for MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.10 - 12/07/2005 - G.R-P. * */ -/* * - optimized footprint of 16bit support * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_memory.h" -#include "libmng_cms.h" -#include "libmng_filter.h" -#include "libmng_pixels.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* TODO: magnification & canvas-positioning/-clipping */ - -/* TODO: major optimization of pixel-loops by using assembler (?) */ - -/* ************************************************************************** */ -/* * * */ -/* * Interlace tables * */ -/* * * */ -/* ************************************************************************** */ - -MNG_LOCAL mng_uint32 const interlace_row [7] = { 0, 0, 4, 0, 2, 0, 1 }; -MNG_LOCAL mng_uint32 const interlace_rowskip [7] = { 8, 8, 8, 4, 4, 2, 2 }; -MNG_LOCAL mng_uint32 const interlace_col [7] = { 0, 4, 0, 2, 0, 1, 0 }; -MNG_LOCAL mng_uint32 const interlace_colskip [7] = { 8, 8, 4, 4, 2, 2, 1 }; -MNG_LOCAL mng_uint32 const interlace_roundoff [7] = { 7, 7, 3, 3, 1, 1, 0 }; -MNG_LOCAL mng_uint32 const interlace_divider [7] = { 3, 3, 2, 2, 1, 1, 0 }; - -/* ************************************************************************** */ -/* * * */ -/* * Alpha composing macros * */ -/* * the code below is slightly modified from the libpng package * */ -/* * the original was last optimized by Greg Roelofs & Mark Adler * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_COMPOSE8(RET,FG,ALPHA,BG) { \ - mng_uint16 iH = (mng_uint16)((mng_uint16)(FG) * (mng_uint16)(ALPHA) \ - + (mng_uint16)(BG)*(mng_uint16)(255 - \ - (mng_uint16)(ALPHA)) + (mng_uint16)128); \ - (RET) = (mng_uint8)((iH + (iH >> 8)) >> 8); } - -#define MNG_COMPOSE16(RET,FG,ALPHA,BG) { \ - mng_uint32 iH = (mng_uint32)((mng_uint32)(FG) * (mng_uint32)(ALPHA) \ - + (mng_uint32)(BG)*(mng_uint32)(65535L - \ - (mng_uint32)(ALPHA)) + (mng_uint32)32768L); \ - (RET) = (mng_uint16)((iH + (iH >> 16)) >> 16); } - -/* ************************************************************************** */ -/* * * */ -/* * Alpha blending macros * */ -/* * this code is based on Adam Costello's "Note on Compositing" from the * */ -/* * mng-list which gives the following formula: * */ -/* * * */ -/* * top pixel = (Rt, Gt, Bt, At) * */ -/* * bottom pixel = (Rb, Gb, Bb, Ab) * */ -/* * composite pixel = (Rc, Gc, Bc, Ac) * */ -/* * * */ -/* * all values in the range 0..1 * */ -/* * * */ -/* * Ac = 1 - (1 - At)(1 - Ab) * */ -/* * s = At / Ac * */ -/* * t = (1 - At) Ab / Ac * */ -/* * Rc = s Rt + t Rb * */ -/* * Gc = s Gt + t Gb * */ -/* * Bc = s Bt + t Bb * */ -/* * * */ -/* * (I just hope I coded it correctly in integer arithmetic...) * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_BLEND8(RT, GT, BT, AT, RB, GB, BB, AB, RC, GC, BC, AC) { \ - mng_uint32 S, T; \ - (AC) = (mng_uint8)((mng_uint32)255 - \ - ((((mng_uint32)255 - (mng_uint32)(AT)) * \ - ((mng_uint32)255 - (mng_uint32)(AB)) ) >> 8)); \ - S = (mng_uint32)(((mng_uint32)(AT) << 8) / \ - (mng_uint32)(AC)); \ - T = (mng_uint32)(((mng_uint32)255 - (mng_uint32)(AT)) * \ - (mng_uint32)(AB) / (mng_uint32)(AC)); \ - (RC) = (mng_uint8)((S * (mng_uint32)(RT) + \ - T * (mng_uint32)(RB) + (mng_uint32)127) >> 8); \ - (GC) = (mng_uint8)((S * (mng_uint32)(GT) + \ - T * (mng_uint32)(GB) + (mng_uint32)127) >> 8); \ - (BC) = (mng_uint8)((S * (mng_uint32)(BT) + \ - T * (mng_uint32)(BB) + (mng_uint32)127) >> 8); } - -#define MNG_BLEND16(RT, GT, BT, AT, RB, GB, BB, AB, RC, GC, BC, AC) { \ - mng_uint32 S, T; \ - (AC) = (mng_uint16)((mng_uint32)65535 - \ - ((((mng_uint32)65535 - (mng_uint32)(AT)) * \ - ((mng_uint32)65535 - (mng_uint32)(AB)) ) >> 16)); \ - S = (mng_uint32)(((mng_uint32)(AT) << 16) / \ - (mng_uint32)(AC)); \ - T = (mng_uint32)(((mng_uint32)65535 - (mng_uint32)(AT)) * \ - (mng_uint32)(AB) / (mng_uint32)(AC)); \ - (RC) = (mng_uint16)((S * (mng_uint32)(RT) + \ - T * (mng_uint32)(RB) + (mng_uint32)32767) >> 16); \ - (GC) = (mng_uint16)((S * (mng_uint32)(GT) + \ - T * (mng_uint32)(GB) + (mng_uint32)32767) >> 16); \ - (BC) = (mng_uint16)((S * (mng_uint32)(BT) + \ - T * (mng_uint32)(BB) + (mng_uint32)32767) >> 16); } - -/* ************************************************************************** */ - -/* note a good optimizing compiler will optimize this */ -#define DIV255B8(x) (mng_uint8)(((x) + 127) / 255) -#define DIV255B16(x) (mng_uint16)(((x) + 32767) / 65535) - -/* ************************************************************************** */ -/* * * */ -/* * Progressive display check - checks to see if progressive display is * */ -/* * in order & indicates so * */ -/* * * */ -/* * The routine is called after a call to one of the display_xxx routines * */ -/* * if appropriate * */ -/* * * */ -/* * The refresh is warrented in the read_chunk routine (mng_read.c) * */ -/* * and only during read&display processing, since there's not much point * */ -/* * doing it from memory! * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_check (mng_datap pData) -{ - if ((pData->bDoProgressive) && /* need progressive display? */ - ((pData->eImagetype != mng_it_mng) || (pData->iDataheight > 300)) && - (pData->iDestb - pData->iDestt > 50) && (!pData->pCurraniobj)) - { - mng_int32 iC = pData->iRow + pData->iDestt - pData->iSourcet; - - if (iC % 20 == 0) /* every 20th line */ - pData->bNeedrefresh = MNG_TRUE; - - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Display routines - convert rowdata (which is already color-corrected) * */ -/* * to the output canvas, respecting the opacity information * */ -/* * * */ -/* ************************************************************************** */ - -MNG_LOCAL void check_update_region (mng_datap pData) -{ /* determine actual canvas row */ - mng_int32 iRow = pData->iRow + pData->iDestt - pData->iSourcet; - /* check for change in update-region */ - if ((pData->iDestl < (mng_int32)pData->iUpdateleft) || (pData->iUpdateright == 0)) - pData->iUpdateleft = pData->iDestl; - - if (pData->iDestr > (mng_int32)pData->iUpdateright) - pData->iUpdateright = pData->iDestr; - - if ((iRow < (mng_int32)pData->iUpdatetop) || (pData->iUpdatebottom == 0)) - pData->iUpdatetop = iRow; - - if (iRow+1 > (mng_int32)pData->iUpdatebottom) - pData->iUpdatebottom = iRow+1; - - return; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGr16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGb16 >> 8); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - } - else - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *pDataline, iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iA8, *(pScanline+2)); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGg16; - mng_uint16 iBGg16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *(pDataline+2*iBps); - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - } - else - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - /* and return the composed values */ - *(pScanline+i) = (mng_uint8)(iFGg16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - } - else - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iA8, *(pScanline+i)); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - } - else - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iA8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *pDataline, iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iA8, *(pScanline+2)); -#endif - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGBA8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgba8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *(pScanline+3) = *(pDataline+6); - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGr16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGb16 >> 8); - /* alpha remains fully opaque !!! */ - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgba8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *(pDataline+2*iBps); - *(pScanline+3) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - *(pScanline+i) = (mng_uint8)(iFGg16 >> 8); - /* alpha remains fully opaque !!! */ - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgba8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGBA8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGBA8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgba8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[4]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[2]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[4] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgba8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[4]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[2]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[4] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgba8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[2]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGBA8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ARGB8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_argb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_START); -#endif - - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+4); - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+4); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+1)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+3)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8)(iFGr16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+3) = (mng_uint8)(iFGb16 >> 8); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+1)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+3)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCr16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCb16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCr8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCb8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_argb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+3*iBps); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+iBps); - *(pScanline+3) = *(pDataline+2*iBps); - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+4); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i+1)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - /* alpha remains fully opaque !!! */ - *(pScanline+i+1) = (mng_uint8)(iFGg16 >> 8); - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+1)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+3)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCr16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCb16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+i), iFGa8, *(pScanline+i+1)); - } - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCr8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCb8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_argb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_START); -#endif - - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+i), iFGa8, *(pScanline+i+1)); - } -#else - MNG_COMPOSE8 (*(pScanline+1), *pDataline, iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2)); - MNG_COMPOSE8 (*(pScanline+3), *(pDataline+2), iFGa8, *(pScanline+3)); -#endif - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCr8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCb8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ARGB8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ARGB8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_argb8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[4]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[2]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[4] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_argb8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[4]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[2]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[4] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_argb8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[2]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ARGB8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8_A8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb8_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination rows */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination rows starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *pAlphaline = *(pDataline+6); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGr16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGb16 >> 8); - /* alpha remains fully opaque !!! */ - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pAlphaline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb8_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination rows */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination rows starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *(pDataline+2*iBps); - *pAlphaline = *(pDataline+3*iBps); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - *(pScanline+i) = (mng_uint8)(iFGg16 >> 8); - /* alpha remains fully opaque !!! */ - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pAlphaline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb8_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination rows */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination rows starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pAlphaline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB8_A8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 8; - else - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGb16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGr16 >> 8); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - } - else - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGg16; - mng_uint16 iBGg16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+2*iBps); - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - } - else - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+2-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - /* and return the composed values */ - *(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - } - else - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - } - else - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); -#endif - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRX8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgrx8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 8; - else - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGb16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGr16 >> 8); - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgrx8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGg16; - mng_uint16 iBGg16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+2*iBps); - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+2-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - /* and return the composed values */ - *(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8); - } - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgrx8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); -#endif - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRX8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRA8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgra8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+6); - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGb16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGr16 >> 8); - /* alpha remains fully opaque !!! */ - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCb16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCr16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iFGa8, *(pScanline+2)); - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+2), *(pScanline+1), *pScanline, iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCb8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCr8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgra8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+2*iBps); - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+2-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - *(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8); - /* alpha remains fully opaque !!! */ - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCb16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCr16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iFGa8, *(pScanline+i)); - } - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+2), *(pScanline+1), *pScanline, iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCb8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCr8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgra8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iFGa8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iFGa8, *(pScanline+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+2), *(pScanline+1), *pScanline, iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCb8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCr8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRA8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRA8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgra8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { - pScanline[0] = DIV255B8(s * pDataline[4]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[0]); - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { - pScanline[0] = DIV255B8(s * pDataline[2]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[0]); - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[4] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[2] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgra8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[4-i-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[4]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[0]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[2]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[0]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[4] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[2] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgra8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[2]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[0]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[2] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRA8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ABGR8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_abgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *(pDataline+4); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *(pDataline+4); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+3)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+1)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - /* alpha itself remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8)(iFGb16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+3) = (mng_uint8)(iFGr16 >> 8); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+3)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+1)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCb16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCr16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+2), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2)); - MNG_COMPOSE8 (*(pScanline+3), *pDataline, iFGa8, *(pScanline+3)); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCb8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCr8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_abgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+3*iBps); - *(pScanline+1) = *(pDataline+2*iBps); - *(pScanline+2) = *(pDataline+iBps); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *(pDataline+4); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+3-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - /* alpha itself remains fully opaque !!! */ - *(pScanline+3-i) = (mng_uint8)(iFGg16 >> 8); - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+3)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+1)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCb16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCr16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+2-i), iFGa8, *(pScanline+i+1)); - } - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCb8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCr8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_abgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+2-i), iFGa8, *(pScanline+i+1)); - } -#else - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+2), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2)); - MNG_COMPOSE8 (*(pScanline+3), *pDataline, iFGa8, *(pScanline+3)); -#endif - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCb8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCr8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ABGR8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ABGR8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_abgr8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_abgr8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_abgr8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ABGR8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ( (*(pDataline+2)&0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | - ( (*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) | - ( (*(pDataline+iBps)&0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( ( *(pDataline+4)) & 0xF8) | (*(pDataline+2) >> 5 ) ); - *pScanline = (mng_uint8)( ( ( *(pDataline )) >> 3 ) | ((*(pDataline+2) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | (*(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+4)) & 0xF8) | (*(pDataline+2)>>5) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ((*(pDataline+2)&0xFC) << 3) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( *(pScanline+1) & 0xF8 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0) >> 3 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)((iFGb16 >> 8) &0xF8) | ( (mng_uint8)(iFGg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8)( (mng_uint8) (iFGr16 >>11) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( *(pScanline+1) & 0xF8); - iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( ( *(pDataline+2*iBps)) & 0xF8) | - (*(pDataline+iBps) >> 5 ) ); - *pScanline = (mng_uint8)( ( ( *(pDataline )) >> 3 ) | - ((*(pDataline+iBps) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+4)) & 0xF8) | (*(pDataline+2)>>5) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ((*(pDataline+2)&0xFC) << 3) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( *(pScanline+1) & 0xF8 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0) >> 3 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)((iFGb16 >> 8) &0xF8) | ( (mng_uint8)(iFGg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8)( (mng_uint8) (iFGr16 >>11) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( *(pScanline+1) & 0xF8); - iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | (*(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( *(pScanline+1) & 0xF8); - iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRA565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgra565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ( (*(pDataline+2)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+6); - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCb16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgra565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | - ( (*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) | - ( (*(pDataline+iBps)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCb16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgra565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRA565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGBA565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgba565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+4))&0xF8 ) | ( (*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline)) >>3) | ( (*(pDataline+2)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+6); - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline+4))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGb16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGr16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCb16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCr16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iRed = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgba565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2*iBps))&0xF8 ) | - ( (*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline)) >>3) | - ( (*(pDataline+iBps)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline+4))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGb16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGr16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCb16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCr16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iRed = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgba565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iRed = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGBA565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR565_A8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr565_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16, iBGa16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - mng_uint8 iA8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row -starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ((*(pDataline+2)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+6)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ((*(pDataline+1)&0xFC ) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+3)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else /* Not fully opaque */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iA16) /* any opacity at all ? */ - { - if ((iA16 == 0xFFFF) || (iBGa16 == 0)) /* fully opaque or background fully transparent ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { - /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iA16>>8); - } - else /* background is not fully opaque */ - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iA16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8)&0xF8 ) | ( (mng_uint8)(iCg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iCb16>>11) ) | (((mng_uint8)(iCg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; -iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - iBGa8 = *pAlphaline; - - if (iA8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iA8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { - /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) ); - *pAlphaline = iA8; - } - else /* background not fully opaque */ - { - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) ); - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr565_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16, iBGa16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - mng_uint8 iA8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row -starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | - ((*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) | - ((*(pDataline+iBps)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+6)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else /* Not fully opaque */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iA16) /* any opacity at all ? */ - { - if ((iA16 == 0xFFFF) || (iBGa16 == 0)) /* fully opaque or background fully transparent ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { - /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iA16>>8); - } - else /* background is not fully opaque */ - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iA16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8)&0xF8 ) | ( (mng_uint8)(iCg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iCb16>>11) ) | (((mng_uint8)(iCg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; -iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - iBGa8 = *pAlphaline; - - if (iA8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iA8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { - /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) ); - *pAlphaline = iA8; - } - else /* background not fully opaque */ - { - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) ); - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr565_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row -starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ((*(pDataline+1)&0xFC ) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+3)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else /* Not fully opaque */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; -iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - iBGa8 = *pAlphaline; - - if (iA8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iA8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { - /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) ); - *pAlphaline = iA8; - } - else /* background not fully opaque */ - { - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) ); - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR565_A8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB555 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGb16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGr16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2*iBps) & 0xF8) >> 1 ) | (*(pDataline+iBps) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+iBps) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGb16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGr16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB555 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR555 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGb16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGr16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGr16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGb16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+iBps) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2*iBps) >> 3 ) | ((*(pDataline+iBps) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGb16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGr16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGr16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGb16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR555 */ - - -#ifndef MNG_SKIPCHUNK_BACK -/* ************************************************************************** */ -/* * * */ -/* * Background restore routines - restore the background with info from * */ -/* * the BACK and/or bKGD chunk or the app's background canvas * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_backimage (mng_datap pData) -{ - /* save some stuff */ - mng_uint8p pRGBArow = pData->pRGBArow; - mng_int32 iRow = pData->iRow; - mng_int32 iRowsamples = pData->iRowsamples; - - mng_retcode iRetcode; /* work variables */ - mng_uint8p pTemp; - mng_uint8p pWork = pRGBArow; - mng_uint32 iX; - mng_int32 iZ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKIMAGE, MNG_LC_START); -#endif - /* determine row to retrieve */ - pData->iRow = pData->iDestt + iRow + pData->iBackimgoffsy; - - while (pData->iRow >= (mng_int32)pData->iBackimgheight) - pData->iRow -= (mng_int32)pData->iBackimgheight; - /* set width to that of background image */ - pData->iRowsamples = pData->iBackimgwidth; - /* retrieve into alternate buffer ! */ - pData->pRGBArow = pData->pPrevrow; - /* get it then */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - - if (iRetcode) /* on error; bail out */ - return iRetcode; - /* we got the full row; but now need to - paste it into the proper location */ - iX = pData->iDestl - pData->iBackimgoffsx; - - while (iX >= pData->iBackimgwidth) - iX -= pData->iBackimgwidth; - -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->bIsRGBA16) /* 16-bit buffer ? */ - { - pTemp = pData->pPrevrow + (iX << 3); - - for (iZ = (pData->iDestr - pData->iDestl); iZ > 0; iZ--) - { - MNG_COPY (pWork, pTemp, 8); - - pWork += 8; - pTemp += 8; - iX++; - /* reached end of bkgd-image line ? */ - if (iX >= pData->iBackimgwidth) - { - iX = 0; - pTemp = pData->pPrevrow; - } - } - } - else -#endif - { - pTemp = pData->pPrevrow + (iX << 2); - - for (iZ = (pData->iDestr - pData->iDestl); iZ > 0; iZ--) - { - MNG_COPY (pWork, pTemp, 4); - - pWork += 4; - pTemp += 4; - iX++; - /* reached end of bkgd-image line ? */ - if (iX >= pData->iBackimgwidth) - { - iX = 0; - pTemp = pData->pPrevrow; - } - } - } - - pData->pRGBArow = pRGBArow; /* restore original values */ - pData->iRow = iRow; - pData->iRowsamples = iRowsamples; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKIMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_backcolor (mng_datap pData) -{ - mng_int32 iX; - mng_uint32p pWork32 = (mng_uint32p)pData->pRGBArow; - mng_uint32 iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKCOLOR, MNG_LC_START); -#endif - -#ifdef MNG_BIGENDIAN_SUPPORTED - /* fast way for big endian */ - iWrite = (((mng_uint8)(pData->iBACKred >> 8)) << 24) | - (((mng_uint8)(pData->iBACKgreen >> 8)) << 16) | - (((mng_uint8)(pData->iBACKblue >> 8)) << 8) | - ( 0xFF ); -#elif defined(MNG_LITTLEENDIAN_SUPPORTED) - /* fast way for little endian */ - iWrite = ( 0xFF << 24) | - (((mng_uint8)(pData->iBACKblue >> 8)) << 16) | - (((mng_uint8)(pData->iBACKgreen >> 8)) << 8) | - (((mng_uint8)(pData->iBACKred >> 8)) ); -#else - /* generic way, works on all platforms */ - /* put the data in memory in the correct order */ - { - mng_uint8 aBytes[4]; - aBytes[0] = (mng_uint8)(pData->iBACKred >> 8); - aBytes[1] = (mng_uint8)(pData->iBACKgreen >> 8); - aBytes[2] = (mng_uint8)(pData->iBACKblue >> 8); - aBytes[3] = 0xFF; - /* load that data into a register */ - iWrite = *(mng_uint32*) aBytes; - } -#endif - /* ok; drop the background-color in there */ - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - *pWork32++ = iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode mng_restore_bkgd_bkgd (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pWork = pData->pRGBArow; - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint8 iRed = 0; - mng_uint8 iGreen = 0; - mng_uint8 iBlue = 0; - mng_uint32p pWork32 = (mng_uint32p)pWork; - mng_uint32 iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BKGD, MNG_LC_START); -#endif - - switch (pBuf->iColortype) - { - case 0 : ; /* gray types */ - case 4 : { - mng_uint8 iGray; - -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - iGray = (mng_uint8)(pBuf->iBKGDgray >> 8); - else -#endif - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - /* LBR scaling */ - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - iGray = (mng_uint8)(multiplier[pBuf->iBitdepth] * pBuf->iBKGDgray); -#else - iGray = (mng_uint8)pBuf->iBKGDgray; -#endif - } - - iRed = iGray; - iGreen = iGray; - iBlue = iGray; - - break; - } - - case 3 : { /* indexed type */ - iRed = pBuf->aPLTEentries [pBuf->iBKGDindex].iRed; - iGreen = pBuf->aPLTEentries [pBuf->iBKGDindex].iGreen; - iBlue = pBuf->aPLTEentries [pBuf->iBKGDindex].iBlue; - - break; - } - - case 2 : ; /* rgb types */ - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - { - iRed = (mng_uint8)(pBuf->iBKGDred >> 8); - iGreen = (mng_uint8)(pBuf->iBKGDgreen >> 8); - iBlue = (mng_uint8)(pBuf->iBKGDblue >> 8); - } - else -#endif - { - iRed = (mng_uint8)(pBuf->iBKGDred ); - iGreen = (mng_uint8)(pBuf->iBKGDgreen); - iBlue = (mng_uint8)(pBuf->iBKGDblue ); - } - - break; - } - } - -#ifdef MNG_BIGENDIAN_SUPPORTED - /* fast way for big endian */ - iWrite = (iRed << 24) | - (iGreen << 16) | - (iBlue << 8); -#elif defined(MNG_LITTLEENDIAN_SUPPORTED) - /* fast way for little endian */ - iWrite = (iBlue << 16) | - (iGreen << 8) | - (iRed ); -#else - /* generic way, works on all platforms */ - /* put the data in memory in the correct order */ - { - mng_uint8 aBytes[4]; - aBytes[0] = (mng_uint8)(iRed); - aBytes[1] = (mng_uint8)(iGreen); - aBytes[2] = (mng_uint8)(iBlue); - aBytes[3] = 0x00; - /* load that data into a register */ - iWrite = *(mng_uint32*) aBytes; - } -#endif - /* ok; drop it in there */ - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - *pWork32++ = iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_bgcolor (mng_datap pData) -{ - mng_int32 iX; - mng_uint32p pWork32 = (mng_uint32p)pData->pRGBArow; - mng_uint32 iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGCOLOR, MNG_LC_START); -#endif - -#ifdef MNG_BIGENDIAN_SUPPORTED - /* fast way for big endian */ - iWrite = (((mng_uint8)(pData->iBGred >> 8)) << 24) | - (((mng_uint8)(pData->iBGgreen >> 8)) << 16) | - (((mng_uint8)(pData->iBGblue >> 8)) << 8); -#elif defined(MNG_LITTLEENDIAN_SUPPORTED) - /* fast way for little endian */ - iWrite = (((mng_uint8)(pData->iBGblue >> 8)) << 16) | - (((mng_uint8)(pData->iBGgreen >> 8)) << 8) | - (((mng_uint8)(pData->iBGred >> 8)) ); -#else - /* generic way, works on all platforms */ - /* put the data in memory in the correct order */ - { - mng_uint8 aBytes[4]; - aBytes[0] = (mng_uint8)(pData->iBGred >> 8); - aBytes[1] = (mng_uint8)(pData->iBGgreen >> 8); - aBytes[2] = (mng_uint8)(pData->iBGblue >> 8); - aBytes[3] = 0x00; - /* load that data into a register */ - iWrite = *(mng_uint32*) aBytes; - } -#endif - /* ok; drop the background-color in there */ - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - *pWork32++ = iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8 -mng_retcode mng_restore_bkgd_rgb8 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB8, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = *pBkgd; /* ok; copy the pixel */ - *(pWork+1) = *(pBkgd+1); - *(pWork+2) = *(pBkgd+2); - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_RGB8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR8 -mng_retcode mng_restore_bkgd_bgr8 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR8, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = *(pBkgd+2); /* ok; copy the pixel */ - *(pWork+1) = *(pBkgd+1); - *(pWork+2) = *pBkgd; - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_BGR8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRX8 -mng_retcode mng_restore_bkgd_bgrx8 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGRX8, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = *(pBkgd+2); /* ok; copy the pixel */ - *(pWork+1) = *(pBkgd+1); - *(pWork+2) = *pBkgd; - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_BGRX8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR565 -mng_retcode mng_restore_bkgd_bgr565 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR565, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = (mng_uint8)( *(pBkgd+1) & 0xF8); /* ok; copy the pixel */ - *(pWork+1) = (mng_uint8)( (*(pBkgd+1) << 5 ) | ( ((*pBkgd)&0xE0)>>3 ) ); - *(pWork+2) = (mng_uint8)( *(pBkgd) << 3 ); - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_BGR565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB565 -mng_retcode mng_restore_bkgd_rgb565 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB565, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = (mng_uint8)( *(pBkgd)&0xF8); /* ok; copy the pixel */ - *(pWork+1) = (mng_uint8)( (*(pBkgd+1) << 5) | ( ((*pBkgd)&0xE0)>>3 ) ); - *(pWork+2) = (mng_uint8)( *(pBkgd+1) << 3); - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_RBB565 */ - - -/* ************************************************************************** */ -/* * * */ -/* * Row retrieval routines - retrieve processed & uncompressed row-data * */ -/* * from the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -/* TODO: a serious optimization is to retrieve only those pixels that will - actually be displayed; this would require changes in - the "display_image" routine (in mng_display.c) & - all the "retrieve_xxx" routines below & - the "display_xxx" routines above !!!!! - NOTE that "correct_xxx" routines would not require modification */ - -mng_retcode mng_retrieve_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = *pWorkrow; /* get the gray-value */ - /* is it transparent ? */ - if ((mng_uint16)iG == pBuf->iTRNSgray) - { - *pRGBArow = 0x00; /* nuttin to display */ - *(pRGBArow+1) = 0x00; - *(pRGBArow+2) = 0x00; - *(pRGBArow+3) = 0x00; - } - else - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - iG = (mng_uint8)(iG * multiplier[pBuf->iBitdepth]); -#endif - - *pRGBArow = iG; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iG; - *(pRGBArow+3) = 0xFF; - } - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; /* LBR scaling */ - iG = (mng_uint8)(multiplier[pBuf->iBitdepth] * *pWorkrow); -#else - iG = *pWorkrow; /* get the gray-value */ -#endif - - *pRGBArow = iG; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iG; - *(pRGBArow+3) = 0xFF; - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = mng_get_uint16 (pWorkrow); /* get the gray-value */ - /* is it transparent ? */ - if (iG == pBuf->iTRNSgray) - { /* nuttin to display */ - mng_put_uint16 (pRGBArow, 0x0000); - mng_put_uint16 (pRGBArow+2, 0x0000); - mng_put_uint16 (pRGBArow+4, 0x0000); - mng_put_uint16 (pRGBArow+6, 0x0000); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iG); - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iG); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pWorkrow += 2; /* next pixel */ - pRGBArow += 8; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = mng_get_uint16 (pWorkrow); /* get the gray-value */ - - mng_put_uint16 (pRGBArow, iG); /* and put in intermediate row */ - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iG); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pWorkrow += 2; /* next pixel */ - pRGBArow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iR, iG, iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = *pWorkrow; /* get the rgb-values */ - iG = *(pWorkrow+1); - iB = *(pWorkrow+2); - /* is it transparent ? */ - if (((mng_uint16)iR == pBuf->iTRNSred ) && - ((mng_uint16)iG == pBuf->iTRNSgreen) && - ((mng_uint16)iB == pBuf->iTRNSblue ) ) - { - *pRGBArow = 0x00; /* nothing to display */ - *(pRGBArow+1) = 0x00; - *(pRGBArow+2) = 0x00; - *(pRGBArow+3) = 0x00; - } - else - { - *pRGBArow = iR; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; - } - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRGBArow = *pWorkrow; /* just copy the pixel */ - *(pRGBArow+1) = *(pWorkrow+1); - *(pRGBArow+2) = *(pWorkrow+2); - *(pRGBArow+3) = 0xFF; - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iR, iG, iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = mng_get_uint16 (pWorkrow); /* get the rgb-values */ - iG = mng_get_uint16 (pWorkrow+2); - iB = mng_get_uint16 (pWorkrow+4); - /* is it transparent ? */ - if ((iR == pBuf->iTRNSred ) && - (iG == pBuf->iTRNSgreen) && - (iB == pBuf->iTRNSblue ) ) - { /* nothing to display */ - mng_put_uint16 (pRGBArow, 0x0000); - mng_put_uint16 (pRGBArow+2, 0x0000); - mng_put_uint16 (pRGBArow+4, 0x0000); - mng_put_uint16 (pRGBArow+6, 0x0000); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iR); - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iB); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* just copy the pixel */ - mng_put_uint16 (pRGBArow, mng_get_uint16 (pWorkrow )); - mng_put_uint16 (pRGBArow+2, mng_get_uint16 (pWorkrow+2)); - mng_put_uint16 (pRGBArow+4, mng_get_uint16 (pWorkrow+4)); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_idx8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_IDX8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get the index */ - /* is it valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - *(pRGBArow+3) = pBuf->aTRNSentries [iQ]; - else - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get the index */ - /* is it valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = *pWorkrow; /* get the gray-value */ - *pRGBArow = iG; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iG; - *(pRGBArow+3) = *(pWorkrow+1); - - pWorkrow += 2; /* next pixel */ - pRGBArow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = mng_get_uint16 (pWorkrow); /* get the gray-value */ - - mng_put_uint16 (pRGBArow, iG); /* and put in intermediate row */ - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iG); - mng_put_uint16 (pRGBArow+6, mng_get_uint16 (pWorkrow+2)); - - pWorkrow += 4; /* next pixel */ - pRGBArow += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - /* can't be easier than this ! */ - MNG_COPY (pRGBArow, pWorkrow, pBuf->iRowsize); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - /* can't be easier than this ! */ - MNG_COPY (pRGBArow, pWorkrow, pBuf->iRowsize); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_g1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - *pOutrow = 0x01; /* white */ - else - *pOutrow = 0x00; /* black */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_g2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - - iQ = (mng_uint8)((iB & iM) >> iS); /* get the gray level */ - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_g4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - - iQ = (mng_uint8)((iB & iM) >> iS); /* get the gray level */ - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* copy into object buffer */ - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow)); - - pOutrow += (pData->iColinc << 1); /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy the RGB bytes */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pWorkrow += 3; /* next pixel */ - pOutrow += (pData->iColinc * 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 6); /* copy the RGB bytes */ - - pWorkrow += 6; /* next pixel */ - pOutrow += (pData->iColinc * 6); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_idx1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* store the index */ - *pOutrow = 0x01; - else - *pOutrow = 0x00; - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_idx2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* store the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_idx4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* store the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_idx8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy the GA bytes */ - *(pOutrow+1) = *(pWorkrow+1); - - pWorkrow += 2; /* next pixel */ - pOutrow += (pData->iColinc << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 4); /* copy the GA bytes */ - - pWorkrow += 4; /* next pixel */ - pOutrow += (pData->iColinc << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy the RGBA bytes */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - - pWorkrow += 4; /* next pixel */ - pOutrow += (pData->iColinc << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 8); /* copy the RGBA bytes */ - - pWorkrow += 8; /* next pixel */ - pOutrow += (pData->iColinc << 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines (JPEG) - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - /* easy as pie ... */ - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of gray-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; -#if RGB_PIXELSIZE != 3 - mng_int32 iX; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - -#if RGB_PIXELSIZE == 3 - /* easy as pie ... */ - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples * 3); -#else -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy pixel into object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pOutrow += 3; /* next pixel */ - pWorkrow += RGB_PIXELSIZE; - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of rgb-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_GA8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy into object buffer */ - - pOutrow += 2; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_GA8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of gray-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy pixel into object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pOutrow += 4; /* next pixel */ - pWorkrow += RGB_PIXELSIZE; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGBA8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of rgb-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_alpha (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_ALPHA, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pJPEGrow2; - pOutrow = pBuf->pImgdata + (pData->iJPEGalpharow * pBuf->iRowsize) + 1; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += 2; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_ALPHA, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_alpha (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_ALPHA, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pJPEGrow2; - pOutrow = pBuf->pImgdata + (pData->iJPEGalpharow * pBuf->iRowsize) + 3; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += 4; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_ALPHA, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it opaque ? */ - *pOutrow = 0xFF; /* opaque */ - else - *pOutrow = 0x00; /* transparent */ - - pOutrow += 2; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A1, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_a2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - { - const mng_uint8 alpha_level[4] = { 0x00, 0x55, 0xAA, 0xFF}; - *pOutrow = alpha_level[((iB & iM) >> iS)] ; - } -#else - switch ((iB & iM) >> iS) /* determine the alpha level */ - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += 2; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A2, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_a4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the alpha level */ - iQ = (mng_uint8)((iB & iM) >> iS); - iQ = (mng_uint8)(iQ + (iQ << 4)); /* expand to 8-bit by replication */ - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += 2; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A4, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += 2; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A8, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* only high-order byte! */ - - pOutrow += 2; /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A16, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it opaque ? */ - *pOutrow = 0xFF; /* opaque */ - else - *pOutrow = 0x00; /* transparent */ - - pOutrow += 4; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A1, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_a2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - { - const mng_uint8 alpha_level[4] = { 0x00, 0x55, 0xAA, 0xFF}; - *pOutrow = alpha_level[((iB & iM) >> iS)] ; - } -#else - switch ((iB & iM) >> iS) /* determine the alpha level */ - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A2, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_a4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the alpha level */ - iQ = (mng_uint8)((iB & iM) >> iS); - iQ = (mng_uint8)(iQ + (iQ << 4)); /* expand to 8-bit by replication */ - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A4, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in buffer */ - - pOutrow += 4; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A8, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* only high-order byte */ - - pOutrow += 4; /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A16, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* opaque ? */ - mng_put_uint16 (pOutrow, 0xFFFF);/* opaque */ - else - mng_put_uint16 (pOutrow, 0x0000);/* transparent */ - - pOutrow += 4; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A1, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - { - const mng_uint16 gray_level[4] = { 0x0000, 0x5555, 0xAAAA, 0xFFFF}; - mng_put_uint16 (pOutrow, gray_level[((iB & iM) >> iS)]) ; - } -#else - switch ((iB & iM) >> iS) /* determine the gray level */ - { - case 0x03 : { mng_put_uint16 (pOutrow, 0xFFFF); break; } - case 0x02 : { mng_put_uint16 (pOutrow, 0xAAAA); break; } - case 0x01 : { mng_put_uint16 (pOutrow, 0x5555); break; } - default : { mng_put_uint16 (pOutrow, 0x0000); } - } -#endif - - pOutrow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A2, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint16 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint16)((iB & iM) >> iS); - iQ = (mng_uint16)(iQ + (iQ << 4)); /* expand to 16-bit by replication */ - iQ = (mng_uint16)(iQ + (iQ << 8)); - /* put in object buffer */ - mng_put_uint16 (pOutrow, iQ); - - pOutrow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A4, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = (mng_uint16)(*pWorkrow); /* get input byte */ - iW = (mng_uint16)(iW + (iW << 8)); /* expand to 16-bit by replication */ - - mng_put_uint16 (pOutrow, iW); /* put in object buffer */ - - pOutrow += 4; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A8, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g12_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* copy it */ - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow)); - - pOutrow += 4; /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A16, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG */ - -#ifndef MNG_NO_DELTA_PNG -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the processed & uncompressed row-data * */ -/* * onto the target "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - *pOutrow = 0xFF; /* white */ - else - *pOutrow = 0x00; /* black */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* invert if it is white ? */ - *pOutrow = (mng_uint8)(*pOutrow ^ 0xFF); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1, MNG_LC_END); -#endif - - return mng_store_g1 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g2 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - const mng_uint8 level[4] = { 0x00, 0x55, 0xAA, 0xFF}; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - *pOutrow = level[((iB & iM) >> iS)] ; -#else - switch ((iB & iM) >> iS) /* determine the alpha level */ - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - *pOutrow = level[((*pOutrow >> 6) + ((iB & iM) >> iS)) & 0x03] ; -#else - switch (((*pOutrow >> 6) + ((iB & iM) >> iS)) & 0x03) - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2, MNG_LC_END); -#endif - - return mng_store_g2 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g4 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* expand to 8-bit by replication */ - iQ = (mng_uint8)(iQ + (iQ << 4)); - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)(((*pOutrow >> 4) + ((iB & iM) >> iS)) & 0x0F); - /* expand to 8-bit by replication */ - iQ = (mng_uint8)(iQ + (iQ << 4)); - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_END); -#endif - - return mng_store_g4 (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_delta_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow); - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8, MNG_LC_END); -#endif - - return mng_store_g8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow) )); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16, MNG_LC_END); -#endif - - return mng_store_g16 (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - /* next pixel */ - pOutrow += (pData->iColinc * 3); - pWorkrow += 3; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow ); - *(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1)); - *(pOutrow+2) = (mng_uint8)(*(pOutrow+2) + *(pWorkrow+2)); - /* next pixel */ - pOutrow += (pData->iColinc * 3); - pWorkrow += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8, MNG_LC_END); -#endif - - return mng_store_rgb8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - *(pOutrow+4) = *(pWorkrow+4); - *(pOutrow+5) = *(pWorkrow+5); - /* next pixel */ - pOutrow += (pData->iColinc * 6); - pWorkrow += 6; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow ) )); - mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) + - mng_get_uint16 (pWorkrow+2) )); - mng_put_uint16 (pOutrow+4, (mng_uint16)(mng_get_uint16 (pOutrow+4 ) + - mng_get_uint16 (pWorkrow+4) )); - /* next pixel */ - pOutrow += (pData->iColinc * 6); - pWorkrow += 6; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16, MNG_LC_END); -#endif - - return mng_store_rgb16 (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_idx1 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* put the right index value */ - *pOutrow = 1; - else - *pOutrow = 0; - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* invert if it is non-zero index */ - *pOutrow = (mng_uint8)(*pOutrow ^ 0x01); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX1, MNG_LC_END); -#endif - - return mng_store_idx1 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_idx2 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* put the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* calculate the index */ - *pOutrow = (mng_uint8)((*pOutrow + ((iB & iM) >> iS)) & 0x03); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX2, MNG_LC_END); -#endif - - return mng_store_idx2 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_idx4 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* put the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* calculate the index */ - *pOutrow = (mng_uint8)((*pOutrow + ((iB & iM) >> iS)) & 0x0F); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX4, MNG_LC_END); -#endif - - return mng_store_idx4 (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_idx8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow); - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX8, MNG_LC_END); -#endif - - return mng_store_idx8 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow ); - *(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1)); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8, MNG_LC_END); -#endif - - return mng_store_ga8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow ) )); - mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) + - mng_get_uint16 (pWorkrow+2) )); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16, MNG_LC_END); -#endif - - return mng_store_ga16 (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow ); - *(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1)); - *(pOutrow+2) = (mng_uint8)(*(pOutrow+2) + *(pWorkrow+2)); - *(pOutrow+3) = (mng_uint8)(*(pOutrow+3) + *(pWorkrow+3)); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8, MNG_LC_END); -#endif - - return mng_store_rgba8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 8); /* put in object buffer */ - /* next pixel */ - pOutrow += (pData->iColinc << 3); - pWorkrow += 8; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow ) )); - mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) + - mng_get_uint16 (pWorkrow+2) )); - mng_put_uint16 (pOutrow+4, (mng_uint16)(mng_get_uint16 (pOutrow+4 ) + - mng_get_uint16 (pWorkrow+4) )); - mng_put_uint16 (pOutrow+6, (mng_uint16)(mng_get_uint16 (pOutrow+6 ) + - mng_get_uint16 (pWorkrow+6) )); - /* next pixel */ - pOutrow += (pData->iColinc << 3); - pWorkrow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16, MNG_LC_END); -#endif - - return mng_store_rgba16 (pData); -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the source row onto the target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1_g1 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1_G1, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0x01); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g2_g2 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2_G2, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0x03); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g4_g4 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4_G4, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0x0F); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_g8_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8_G8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_g16_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16_G16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 1)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 2; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgb8_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8_RGB8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples * 3); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples*3; iX > 0; iX--) -#else - for (iX = 0; iX < (pData->iRowsamples * 3); iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16_RGB16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples * 6)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) + - mng_get_uint16 (pWorkrow+4)) & 0xFFFF)); - - pOutrow += 6; - pWorkrow += 6; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_delta_ga8_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_GA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples << 1); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = (pData->iRowsamples<<1); iX > 0; iX--) -#else - for (iX = 0; iX < (pData->iRowsamples << 1); iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_ga8_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_G8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - - pOutrow += 2; - pWorkrow++; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow += 2; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_ga8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_A8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - - pOutrow += 2; - pWorkrow++; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow += 2; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_GA16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 2)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - - pOutrow += 4; - pWorkrow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_G16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow)); - - pOutrow += 4; - pWorkrow += 2; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 4; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_A16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+2, mng_get_uint16 (pWorkrow)); - - pOutrow += 4; - pWorkrow += 2; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 4; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_A16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgba8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples << 2); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = (pData->iRowsamples << 2); iX > 0; iX--) -#else - for (iX = 0; iX < (pData->iRowsamples << 2); iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_delta_rgba8_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGB8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pOutrow += 4; - pWorkrow += 3; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow ) & 0xFF); - *(pOutrow+1) = (mng_uint8)(((mng_uint16)*(pOutrow+1) + - (mng_uint16)*(pWorkrow+1)) & 0xFF); - *(pOutrow+2) = (mng_uint8)(((mng_uint16)*(pOutrow+2) + - (mng_uint16)*(pWorkrow+2)) & 0xFF); - - pOutrow += 4; - pWorkrow += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgba8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_A8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - - pOutrow += 4; - pWorkrow++; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow += 4; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGBA16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 3)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) + - mng_get_uint16 (pWorkrow+4)) & 0xFFFF)); - mng_put_uint16 (pOutrow+6, (mng_uint16)((mng_get_uint16 (pOutrow+6) + - mng_get_uint16 (pWorkrow+6)) & 0xFFFF)); - - pOutrow += 8; - pWorkrow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGB16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow )); - mng_put_uint16 (pOutrow+2, mng_get_uint16 (pWorkrow+2)); - mng_put_uint16 (pOutrow+4, mng_get_uint16 (pWorkrow+4)); - - pOutrow += 8; - pWorkrow += 6; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) + - mng_get_uint16 (pWorkrow+4)) & 0xFFFF)); - - pOutrow += 8; - pWorkrow += 6; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_A16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+6, mng_get_uint16 (pWorkrow)); - - pOutrow += 8; - pWorkrow += 2; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+6, (mng_uint16)((mng_get_uint16 (pOutrow+6) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 8; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_A16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - scale the delta to bitdepth of target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g1_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 1); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g1_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 3); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g1_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 7); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g1_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = (mng_uint8)(*pWorkrow << 7); - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g2_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 2); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g2_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 6); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g2_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = (mng_uint8)(*pWorkrow << 6); - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g4_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 4); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g4_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = (mng_uint8)(*pWorkrow << 4); - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g8_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_ga8_ga16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA8_GA16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + ((pData->iRowsamples - 1) << 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 2); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + ((pData->iRowsamples - 1) << 1)); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 2)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+3) = 0; - *(pOutrow+2) = *(pWorkrow+1); - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow -= 2; - pOutrow -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA8_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_rgb8_rgb16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB8_RGB16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (3 * (pData->iRowsamples - 1)); - pOutrow = pOutrow + (6 * (pData->iRowsamples - 1)); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + 3 * (pData->iRowsamples - 1)); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + 6 * (pData->iRowsamples - 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+5) = 0; - *(pOutrow+4) = *(pWorkrow+2); - *(pOutrow+3) = 0; - *(pOutrow+2) = *(pWorkrow+1); - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow -= 3; - pOutrow -= 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_rgba8_rgba16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA8_RGBA16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + ((pData->iRowsamples - 1) << 2); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 3); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + ((pData->iRowsamples - 1) << 2)); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 3)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+7) = 0; - *(pOutrow+6) = *(pWorkrow+3); - *(pOutrow+5) = 0; - *(pOutrow+4) = *(pWorkrow+2); - *(pOutrow+3) = 0; - *(pOutrow+2) = *(pWorkrow+1); - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow -= 4; - pOutrow -= 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g2_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 1); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g4_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 3); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g8_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 7); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g16_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 15); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g4_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 2); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g8_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 6); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g16_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 14); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g8_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 4); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g16_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 12); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_scale_g16_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_ga16_ga8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA16_GA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA16_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_rgb16_rgb8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB16_RGB8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB16_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_rgba16_rgba8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA16_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA16_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image bit routines - promote bit_depth * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_uint8 mng_promote_replicate_1_2 (mng_uint8 iB) -{ - return (mng_uint8)((iB << 1) | iB); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_1_4 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 1) + iB); - return (mng_uint8)((iB << 2) + iB); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_1_8 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 1) + iB); - iB = (mng_uint8)((iB << 2) + iB); - return (mng_uint8)((iB << 4) + iB); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_1_16 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 1) + iB); - iB = (mng_uint8)((iB << 2) + iB); - iB = (mng_uint8)((iB << 4) + iB); - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_2_4 (mng_uint8 iB) -{ - return (mng_uint8)((iB << 2) + iB); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_2_8 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 2) + iB); - return (mng_uint8)((iB << 4) + iB); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_2_16 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 2) + iB); - iB = (mng_uint8)((iB << 4) + iB); - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_4_8 (mng_uint8 iB) -{ - return (mng_uint8)((iB << 4) + iB); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_4_16 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 4) + iB); - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif -#endif /* NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_8_16 (mng_uint8 iB) -{ - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif - -/* ************************************************************************** */ - -#if !defined(MNG_NO_DELTA_PNG) -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_uint8 mng_promote_zerofill_1_2 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 1); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_1_4 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 3); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_1_8 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 7); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_1_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 15); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_2_4 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 2); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_2_8 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 6); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_2_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 14); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_4_8 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 4); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_4_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 12); -} -#endif -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_8_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 8); -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - promote color_type * */ -/* * * */ -/* ************************************************************************** */ - -#if !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN) -mng_retcode mng_promote_g8_g8 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - *pDstline = iB; - - pSrcline++; - pDstline++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_g16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - - *pDstline = (mng_uint8)(iW >> 8); - *(pDstline+1) = (mng_uint8)(iW && 0xFF); - - pSrcline++; - pDstline += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_promote_g16_g16 (mng_datap pData) -{ - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_G16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - *pDstline = *pSrcline; - pSrcline++; - pDstline++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - *(pDstline+1) = 0xFF; - - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - - *pDstline = iB; - - pSrcline++; - pDstline += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - { - *(pDstline+2) = 0xFF; - *(pDstline+3) = 0xFF; - } - - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - *pDstline = (mng_uint8)(iW >> 8); - *(pDstline+1) = (mng_uint8)(iW && 0xFF); - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g16_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_GA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iW != pBuf->iTRNSgray)) - *(pDstline+1) = 0xFFFF; - - *pDstline = iW; - - pSrcline++; - pDstline += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_rgb8 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - - *pDstline = iB; - *(pDstline+1) = iB; - *(pDstline+2) = iB; - - pSrcline++; - pDstline += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgb16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - iB = (mng_uint8)(iW >> 8); - *pDstline = iB; - *(pDstline+2) = iB; - *(pDstline+4) = iB; - iB = (mng_uint8)(iW && 0xFF); - *(pDstline+1) = iB; - *(pDstline+3) = iB; - *(pDstline+5) = iB; - - pSrcline++; - pDstline += 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g16_rgb16 (mng_datap pData) -{ - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - - *pDstline = iW; - *(pDstline+1) = iW; - *(pDstline+2) = iW; - - pSrcline++; - pDstline += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - *(pDstline+3) = 0xFF; - - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - - *pDstline = iB; - *(pDstline+1) = iB; - *(pDstline+2) = iB; - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - { - *(pDstline+6) = 0xFF; - *(pDstline+7) = 0xFF; - } - - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - iB = (mng_uint8)(iW >> 8); - *pDstline = iB; - *(pDstline+2) = iB; - *(pDstline+4) = iB; - iB = (mng_uint8)(iW && 0xFF); - *(pDstline+1) = iB; - *(pDstline+3) = iB; - *(pDstline+5) = iB;; - - pSrcline++; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g16_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || (iW != pBuf->iTRNSgray)) - *(pDstline+3) = 0xFFFF; - - *pDstline = iW; - *(pDstline+1) = iW; - *(pDstline+2) = iW; - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga8_ga16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_GA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - - *pDstline = (mng_uint8)(iW >> 8); - *(pDstline+1) = (mng_uint8)(iW && 0xFF); - *(pDstline+2) = (mng_uint8)(iA >> 8); - *(pDstline+3) = (mng_uint8)(iA && 0xFF); - - pSrcline += 2; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_ga8_rgba8 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint8 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - iA = *(pSrcline+1); - - *pDstline = iB; - *(pDstline+1) = iB; - *(pDstline+2) = iB; - *(pDstline+3) = iA; - - pSrcline += 2; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga8_rgba16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - - iB = (mng_uint8)(iW >> 8); - *pDstline = iB; - *(pDstline+2) = iB; - *(pDstline+4) = iB; - iB = (mng_uint8)(iW && 0xFF); - *(pDstline+1) = iB; - *(pDstline+3) = iB; - *(pDstline+5) = iB; - *(pDstline+6) = (mng_uint8)(iA >> 8); - *(pDstline+7) = (mng_uint8)(iA && 0xFF); - - pSrcline += 2; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga16_rgba16 (mng_datap pData) -{ - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA16_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - iA = *(pSrcline+1); - - *pDstline = iW; - *(pDstline+1) = iW; - *(pDstline+2) = iW; - *(pDstline+3) = iA; - - pSrcline += 2; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgb16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+2)); - - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - - pSrcline += 3; - pDstline += 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_rgb8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iR; - mng_uint8 iG; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = *pSrcline; - iG = *(pSrcline+1); - iB = *(pSrcline+2); - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iR != pBuf->iTRNSred) || - ((mng_uint16)iG != pBuf->iTRNSgreen) || ((mng_uint16)iB != pBuf->iTRNSblue)) - *(pDstline+3) = 0xFF; - - *pDstline = iR; - *(pDstline+1) = iG; - *(pDstline+2) = iB; - - pSrcline += 3; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iR; - mng_uint8 iG; - mng_uint8 iB; - mng_uint16 iRw; - mng_uint16 iGw; - mng_uint16 iBw; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = *pSrcline; - iG = *(pSrcline+1); - iB = *(pSrcline+2); - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iR != pBuf->iTRNSred) || - ((mng_uint16)iG != pBuf->iTRNSgreen) || ((mng_uint16)iB != pBuf->iTRNSblue)) - { - *(pDstline+6) = 0xFF; - *(pDstline+7) = 0xFF; - } - - iRw = ((mng_bitdepth_16)pData->fPromBitdepth) (iR); - iGw = ((mng_bitdepth_16)pData->fPromBitdepth) (iG); - iBw = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - *pDstline = (mng_uint8)(iRw >> 8); - *(pDstline+1) = (mng_uint8)(iRw && 0xFF); - *(pDstline+2) = (mng_uint8)(iGw >> 8); - *(pDstline+3) = (mng_uint8)(iGw && 0xFF); - *(pDstline+4) = (mng_uint8)(iBw >> 8); - *(pDstline+5) = (mng_uint8)(iBw && 0xFF); - - pSrcline += 3; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb16_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB16_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = *pSrcline; - iG = *(pSrcline+1); - iB = *(pSrcline+2); - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || (iR != pBuf->iTRNSred) || - (iG != pBuf->iTRNSgreen) || (iB != pBuf->iTRNSblue)) - *(pDstline+3) = 0xFFFF; - - *pDstline = iR; - *(pDstline+1) = iG; - *(pDstline+2) = iB; - - pSrcline += 3; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_idx8_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - - if ((mng_uint32)iB < pBuf->iPLTEcount) - { - *pDstline = pBuf->aPLTEentries [iB].iRed; - *(pDstline+1) = pBuf->aPLTEentries [iB].iGreen; - *(pDstline+2) = pBuf->aPLTEentries [iB].iBlue; - } - - pSrcline++; - pDstline += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iN; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iN = *pSrcline; - - if ((mng_uint32)iN < pBuf->iPLTEcount) - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iRed); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iGreen); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iBlue); - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - } - - pSrcline++; - pDstline += 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_idx8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - - if ((mng_uint32)iB < pBuf->iPLTEcount) - { - *pDstline = pBuf->aPLTEentries [iB].iRed; - *(pDstline+1) = pBuf->aPLTEentries [iB].iGreen; - *(pDstline+2) = pBuf->aPLTEentries [iB].iBlue; - - if ((pBuf->bHasTRNS) && ((mng_uint32)iB < pBuf->iTRNScount)) - *(pDstline+3) = pBuf->aTRNSentries [iB]; - else - *(pDstline+3) = 0xFF; - } - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iN; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iN = *pSrcline; - - if ((mng_uint32)iN < pBuf->iPLTEcount) - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iRed); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iGreen); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iBlue); - - if ((pBuf->bHasTRNS) && ((mng_uint32)iN < pBuf->iTRNScount)) - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aTRNSentries [iN]); - else - iA = 0xFFFF; - - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - *(pDstline+6) = (mng_uint8)(iA >> 8); - *(pDstline+7) = (mng_uint8)(iA && 0xFF); - } - - pSrcline++; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_promote_rgba8_rgba16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGBA8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+2)); - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+3)); - - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - *(pDstline+6) = (mng_uint8)(iA >> 8); - *(pDstline+7) = (mng_uint8)(iA && 0xFF); - - pSrcline += 4; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGBA8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN) */ - -/* ************************************************************************** */ -/* * * */ -/* * Row processing routines - convert uncompressed data from zlib to * */ -/* * managable row-data which serves as input to the color-management * */ -/* * routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G1, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { - if (pBuf->iTRNSgray) /* white transparent ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - /* transparent ! */ - mng_put_uint32 (pRGBArow, 0x00000000); - else /* opaque black */ - mng_put_uint32 (pRGBArow, 0x000000FF); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - } - } - else /* black transparent */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - /* opaque white */ - mng_put_uint32 (pRGBArow, 0xFFFFFFFF); - else /* transparent */ - mng_put_uint32 (pRGBArow, 0x00000000); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - } - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else /* no transparency */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - /* opaque white */ - mng_put_uint32 (pRGBArow, 0xFFFFFFFF); - else /* opaque black */ - mng_put_uint32 (pRGBArow, 0x000000FF); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - const mng_uint32 level[4] = { 0x000000FF, 0x555555FF, - 0xAAAAAAFF, 0xFFFFFFFF}; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G2, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* determine gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - - if (iQ == pBuf->iTRNSgray) /* transparent ? */ - mng_put_uint32 (pRGBArow, 0x00000000); - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - mng_put_uint32 (pRGBArow, level[iQ]); -#else - switch (iQ) /* determine the gray level */ - { - case 0x03 : { mng_put_uint32 (pRGBArow, 0xFFFFFFFF); break; } - case 0x02 : { mng_put_uint32 (pRGBArow, 0xAAAAAAFF); break; } - case 0x01 : { mng_put_uint32 (pRGBArow, 0x555555FF); break; } - default : { mng_put_uint32 (pRGBArow, 0x000000FF); } - } -#endif - } - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - mng_put_uint32 (pRGBArow, level[((iB & iM) >> iS)] ); -#else - switch ((iB & iM) >> iS) /* determine the gray level */ - { - case 0x03 : { mng_put_uint32 (pRGBArow, 0xFFFFFFFF); break; } - case 0x02 : { mng_put_uint32 (pRGBArow, 0xAAAAAAFF); break; } - case 0x01 : { mng_put_uint32 (pRGBArow, 0x555555FF); break; } - default : { mng_put_uint32 (pRGBArow, 0x000000FF); } - } -#endif - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G4, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - - if (iQ == pBuf->iTRNSgray) /* transparent ? */ - { - *pRGBArow = 0; /* put in intermediate row */ - *(pRGBArow+1) = 0; - *(pRGBArow+2) = 0; - *(pRGBArow+3) = 0; - } - else - { /* expand to 8-bit by replication */ - iQ = (mng_uint8)(iQ + (iQ << 4)); - - *pRGBArow = iQ; /* put in intermediate row */ - *(pRGBArow+1) = iQ; - *(pRGBArow+2) = iQ; - *(pRGBArow+3) = 0xFF; - } - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - iQ = (mng_uint8)(iQ + (iQ << 4));/* expand to 8-bit by replication */ - - *pRGBArow = iQ; /* put in intermediate row */ - *(pRGBArow+1) = iQ; - *(pRGBArow+2) = iQ; - *(pRGBArow+3) = 0xFF; - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_process_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G8, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iB = *pWorkrow; /* get next input-byte */ - - if (iB == pBuf->iTRNSgray) /* transparent ? */ - { - *pRGBArow = 0; /* put in intermediate row */ - *(pRGBArow+1) = 0; - *(pRGBArow+2) = 0; - *(pRGBArow+3) = 0; - } - else - { - *pRGBArow = iB; /* put in intermediate row */ - *(pRGBArow+1) = iB; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; - } - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iB = *pWorkrow; /* get next input-byte */ - - *pRGBArow = iB; /* put in intermediate row */ - *(pRGBArow+1) = iB; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iW; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G16, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = mng_get_uint16 (pWorkrow); /* get input */ - - if (iW == pBuf->iTRNSgray) /* transparent ? */ - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, 0); - mng_put_uint16 (pRGBArow+2, 0); - mng_put_uint16 (pRGBArow+4, 0); - mng_put_uint16 (pRGBArow+6, 0); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iW); - mng_put_uint16 (pRGBArow+2, iW); - mng_put_uint16 (pRGBArow+4, iW); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pRGBArow += 8; /* next pixel */ - pWorkrow += 2; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = mng_get_uint16 (pWorkrow); /* get input */ - - mng_put_uint16 (pRGBArow, iW); /* and put in intermediate row */ - mng_put_uint16 (pRGBArow+2, iW); - mng_put_uint16 (pRGBArow+4, iW); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pRGBArow += 8; /* next pixel */ - pWorkrow += 2; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_rgb8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iR, iG, iB; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB8, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = *pWorkrow; /* get the RGB values */ - iG = *(pWorkrow+1); - iB = *(pWorkrow+2); - /* transparent ? */ - if ((iR == pBuf->iTRNSred) && (iG == pBuf->iTRNSgreen) && - (iB == pBuf->iTRNSblue)) - { - *pRGBArow = 0; /* this pixel is transparent ! */ - *(pRGBArow+1) = 0; - *(pRGBArow+2) = 0; - *(pRGBArow+3) = 0; - } - else - { - *pRGBArow = iR; /* copy the RGB values */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; /* this one isn't transparent */ - } - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRGBArow = *pWorkrow; /* copy the RGB bytes */ - *(pRGBArow+1) = *(pWorkrow+1); - *(pRGBArow+2) = *(pWorkrow+2); - *(pRGBArow+3) = 0xFF; /* no alpha; so always fully opaque */ - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_rgb16 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iR, iG, iB; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB16, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = mng_get_uint16 (pWorkrow); /* get the RGB values */ - iG = mng_get_uint16 (pWorkrow+2); - iB = mng_get_uint16 (pWorkrow+4); - /* transparent ? */ - if ((iR == pBuf->iTRNSred) && (iG == pBuf->iTRNSgreen) && - (iB == pBuf->iTRNSblue)) - { /* transparent then */ - mng_put_uint16 (pRGBArow, 0); - mng_put_uint16 (pRGBArow+2, 0); - mng_put_uint16 (pRGBArow+4, 0); - mng_put_uint16 (pRGBArow+6, 0); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iR); - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iB); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* copy the RGB values */ - mng_put_uint16 (pRGBArow, mng_get_uint16 (pWorkrow )); - mng_put_uint16 (pRGBArow+2, mng_get_uint16 (pWorkrow+2)); - mng_put_uint16 (pRGBArow+4, mng_get_uint16 (pWorkrow+4)); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_idx1 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - iS = 7; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - *(pRGBArow+3) = pBuf->aTRNSentries [iQ]; - else - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - iS -= 1; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - iS = 7; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - iS -= 1; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_idx2 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX2, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - *(pRGBArow+3) = pBuf->aTRNSentries [iQ]; - else - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_idx4 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX4, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = pWorkrow [0]; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - pRGBArow [3] = pBuf->aTRNSentries [iQ]; - else - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = pWorkrow [0]; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_process_idx8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX8, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get input byte */ - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - pRGBArow [3] = pBuf->aTRNSentries [iQ]; - else - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get input byte */ - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ga8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRGBArow = *pWorkrow; /* copy the gray value */ - *(pRGBArow+1) = *pWorkrow; - *(pRGBArow+2) = *pWorkrow; - *(pRGBArow+3) = *(pWorkrow+1); /* copy the alpha value */ - - pWorkrow += 2; /* next pixel */ - pRGBArow += 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_ga16 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = mng_get_uint16 (pWorkrow); /* copy the gray value */ - mng_put_uint16 (pRGBArow, iW); - mng_put_uint16 (pRGBArow+2, iW); - mng_put_uint16 (pRGBArow+4, iW); - /* copy the alpha value */ - mng_put_uint16 (pRGBArow+6, mng_get_uint16 (pWorkrow+2)); - - pWorkrow += 4; /* next pixel */ - pRGBArow += 8; - } - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_rgba8 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA8, MNG_LC_START); -#endif - /* this is the easiest transform */ - MNG_COPY (pData->pRGBArow, pData->pWorkrow + pData->iPixelofs, pData->iRowsize); - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_rgba16 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA16, MNG_LC_START); -#endif - /* this is the easiest transform */ - MNG_COPY (pData->pRGBArow, pData->pWorkrow + pData->iPixelofs, pData->iRowsize); - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines - set up the variables needed * */ -/* * to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_g1_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g1; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g1_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g1; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = ((pData->iRowsamples + 7) >> 3); - pData->iRowmax = ((pData->iDatawidth + 7) >> 3) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g2_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g2; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g2_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g2; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = ((pData->iRowsamples + 3) >> 2); - pData->iRowmax = ((pData->iDatawidth + 3) >> 2) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g4_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g4; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g4_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g4; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = ((pData->iRowsamples + 1) >> 1); - pData->iRowmax = ((pData->iDatawidth + 1) >> 1) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_init_g8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iDatawidth + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_g16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_g16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g16; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = (pData->iDatawidth << 1) + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_init_rgb8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 3; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 3; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_rgb8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 3; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 3; - pData->iRowmax = (pData->iDatawidth * 3) + pData->iPixelofs; - pData->iFilterbpp = 3; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgb16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 6; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 6; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 6; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgb16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb16; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 6; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 6; - pData->iRowmax = (pData->iDatawidth * 6) + pData->iPixelofs; - pData->iFilterbpp = 6; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_idx1_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx1; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx1_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx1; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = ((pData->iDatawidth + 7) >> 3) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx2_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx2; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx2_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx2; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = ((pData->iDatawidth + 3) >> 2) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx4_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx4; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx4_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx4; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = ((pData->iDatawidth + 1) >> 1) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_init_idx8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iDatawidth + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_ga8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_ga8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = (pData->iDatawidth << 1) + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_ga16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_ga16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga16; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = (pData->iDatawidth << 2) + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_init_rgba8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -/* ************************************************************************** */ - -mng_retcode mng_init_rgba8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = (pData->iDatawidth << 2) + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgba16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 8; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 8; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgba16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba16; -#endif - - pData->iPass = 0; /* from 0..6; (1..7 in specification) */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 8; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 3; - pData->iRowmax = (pData->iDatawidth << 3) + pData->iPixelofs; - pData->iFilterbpp = 8; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines (JPEG) - set up the variables * */ -/* * needed to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_jpeg_a1_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A1_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a1; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a1; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g1; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A1_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_jpeg_a2_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A2_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a2; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a2; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g2; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A2_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_jpeg_a4_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A4_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a4; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a4; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g4; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A4_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_init_jpeg_a8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A8_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a8; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a8; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_jpeg_a16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A16_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a16; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a16; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 2; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - -/* ************************************************************************** */ -/* * * */ -/* * Generic row processing initialization & cleanup routines * */ -/* * - initialize the buffers used by the row processing routines * */ -/* * - cleanup the buffers used by the row processing routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_init_rowproc (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWPROC, MNG_LC_START); -#endif - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - if (pData->ePng_imgtype != png_none) - { - if (pData->fDisplayrow) - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - pData->fProcessrow = (mng_fptr)mng_process_g1; - break; - case png_g2: - pData->fProcessrow = (mng_fptr)mng_process_g2; - break; - case png_g4: - pData->fProcessrow = (mng_fptr)mng_process_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - pData->fProcessrow = (mng_fptr)mng_process_g8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fProcessrow = (mng_fptr)mng_process_idx1; - break; - case png_idx2: - pData->fProcessrow = (mng_fptr)mng_process_idx2; - break; - case png_idx4: - pData->fProcessrow = (mng_fptr)mng_process_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fProcessrow = (mng_fptr)mng_process_idx8; - break; - case png_ga8: - pData->fProcessrow = (mng_fptr)mng_process_ga8; - break; - case png_rgb8: - pData->fProcessrow = (mng_fptr)mng_process_rgb8; - break; - case png_rgba8: - pData->fProcessrow = (mng_fptr)mng_process_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: - pData->fProcessrow = (mng_fptr)mng_process_g16; - break; - case png_ga16: - pData->fProcessrow = (mng_fptr)mng_process_ga16; - break; - case png_rgb16: - pData->fProcessrow = (mng_fptr)mng_process_rgb16; - break; - case png_rgba16: - pData->fProcessrow = (mng_fptr)mng_process_rgba16; - break; -#endif - default: - break; - } - - if (pData->pStoreobj) /* store in object too ? */ - { -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - pData->fStorerow = (mng_fptr)mng_delta_g1; - break; - case png_g2: - pData->fStorerow = (mng_fptr)mng_delta_g2; - break; - case png_g4: - pData->fStorerow = (mng_fptr)mng_delta_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - pData->fStorerow = (mng_fptr)mng_delta_g8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fStorerow = (mng_fptr)mng_delta_idx1; - break; - case png_idx2: - pData->fStorerow = (mng_fptr)mng_delta_idx2; - break; - case png_idx4: - pData->fStorerow = (mng_fptr)mng_delta_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fStorerow = (mng_fptr)mng_delta_idx8; - break; - case png_ga8: - pData->fStorerow = (mng_fptr)mng_delta_ga8; - break; - case png_rgb8: - pData->fStorerow = (mng_fptr)mng_delta_rgb8; - break; - case png_rgba8: - pData->fStorerow = (mng_fptr)mng_delta_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: - pData->fStorerow = (mng_fptr)mng_delta_g16; - break; - case png_ga16: - pData->fStorerow = (mng_fptr)mng_delta_ga16; - break; - case png_rgb16: - pData->fStorerow = (mng_fptr)mng_delta_rgb16; - break; - case png_rgba16: - pData->fStorerow = (mng_fptr)mng_delta_rgba16; - break; -#endif - default: - break; - } - else -#endif /* MNG_NO_DELTA_PNG */ - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - pData->fStorerow = (mng_fptr)mng_store_g1; - break; - case png_g2: - pData->fStorerow = (mng_fptr)mng_store_g2; - break; - case png_g4: - pData->fStorerow = (mng_fptr)mng_store_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - pData->fStorerow = (mng_fptr)mng_store_g8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fStorerow = (mng_fptr)mng_store_idx1; - break; - case png_idx2: - pData->fStorerow = (mng_fptr)mng_store_idx2; - break; - case png_idx4: - pData->fStorerow = (mng_fptr)mng_store_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fStorerow = (mng_fptr)mng_store_idx8; - break; - case png_ga8: - pData->fStorerow = (mng_fptr)mng_store_ga8; - break; - case png_rgb8: - pData->fStorerow = (mng_fptr)mng_store_rgb8; - break; - case png_rgba8: - pData->fStorerow = (mng_fptr)mng_store_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: - pData->fStorerow = (mng_fptr)mng_store_g16; - break; - case png_ga16: - pData->fStorerow = (mng_fptr)mng_store_ga16; - break; - case png_rgb16: - pData->fStorerow = (mng_fptr)mng_store_rgb16; - break; - case png_rgba16: - pData->fStorerow = (mng_fptr)mng_store_rgba16; - break; -#endif - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_jpeg_a1: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a1; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a1; break; } - } - } - /* TODO: bitdepth 12 & 20 */ - break; - case png_jpeg_a2: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a2; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a2; break; } - } - } - break; - /* TODO: bitdepth 12 & 20 */ - case png_jpeg_a4: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a4; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a4; break; } - } - } - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - /* TODO: bitdepth 12 & 20 */ - case png_jpeg_a8: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a8; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a8; break; } - } - } - break; - /* TODO: bitdepth 12 & 20 */ -#ifndef MNG_NO_16BIT_SUPPORT - case png_jpeg_a16: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a16; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a16; break; } - } - } - break; - /* TODO: bitdepth 12 & 20 */ -#endif -#endif /* MNG_INCLUDE_JNG */ - default: - break; - } - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a1: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g1; - break; - case png_g2: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a2: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g2; - break; - case png_g4: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a4: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a8: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g8; - break; - case png_rgb8: - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fDifferrow = (mng_fptr)mng_differ_idx1; - break; - case png_idx2: - pData->fDifferrow = (mng_fptr)mng_differ_idx2; - break; - case png_idx4: - pData->fDifferrow = (mng_fptr)mng_differ_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fDifferrow = (mng_fptr)mng_differ_idx8; - break; - case png_ga8: - pData->fDifferrow = (mng_fptr)mng_differ_ga8; - break; - case png_rgb8: - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; - break; - case png_rgba8: - pData->fDifferrow = (mng_fptr)mng_differ_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a16: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g16; - break; - case png_ga16: - pData->fDifferrow = (mng_fptr)mng_differ_ga16; - break; - case png_rgb16: - pData->fDifferrow = (mng_fptr)mng_differ_rgb16; - break; - case png_rgba16: - pData->fDifferrow = (mng_fptr)mng_differ_rgba16; - break; -#endif - default: - break; - } -#endif - - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - case png_idx1: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a1: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iFilterbpp = 1; - break; - case png_g2: - case png_idx2: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a2: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iFilterbpp = 1; - break; - case png_g4: - case png_idx4: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a4: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iFilterbpp = 1; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - case png_idx8: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a8: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 1; - break; - case png_ga8: -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a16: -#endif -#endif - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 2; - break; - case png_rgb8: - pData->iSamplemul = 3; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 3; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_ga16: -#endif - case png_rgba8: - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 4; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_rgb16: - pData->iSamplemul = 6; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 6; - break; - case png_rgba16: - pData->iSamplemul = 8; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 8; - break; -#endif - default: - break; - } - - if (pData->iInterlace) /* noninterlaced */ - { - pData->iPass = 0; /* from 0..6; (1..7 in specification) */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> - interlace_divider [0]; - pData->iRowmax = ((pData->iDatawidth * pData->iSamplemul + - pData->iSampleofs) >> pData->iSamplediv) + pData->iPixelofs; - } - else /* interlaced */ - { - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - } - if (pData->iSamplediv > 0) - pData->iRowsize = (pData->iRowsamples + pData->iSampleofs) >> - pData->iSamplediv; - else - pData->iRowsize = (pData->iRowsamples * pData->iSamplemul); - - if (!pData->iInterlace) /* noninterlaced */ - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - -#ifdef MNG_NO_16BIT_SUPPORT - pData->bIsRGBA16 = MNG_FALSE; -#else - switch (pData->ePng_imgtype) - { - case png_g16: - case png_ga16: - case png_rgb16: - case png_rgba16: - pData->bIsRGBA16 = MNG_TRUE; - break; - default: - pData->bIsRGBA16 = MNG_FALSE; - break; - } -#endif - - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - if (pData->pStoreobj) /* storage object selected ? */ - { - pData->pStorebuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - /* and so it becomes viewable ! */ - ((mng_imagep)pData->pStoreobj)->bViewable = MNG_TRUE; - ((mng_imagedatap)pData->pStorebuf)->bViewable = MNG_TRUE; - } - - /* allocate the buffers; the individual init routines have already - calculated the required maximum size; except in the case of a JNG - without alpha!!! */ - if (pData->iRowmax) - { -#if defined(MNG_NO_16BIT_SUPPORT) || defined (MNG_NO_1_2_4BIT_SUPPORT) - mng_uint8 iRowadd = 0; -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth < 8) - iRowadd=(pData->iPNGdepth*pData->iRowmax+7)/8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - iRowadd=pData->iRowmax; -#endif - MNG_ALLOC (pData, pData->pWorkrow, pData->iRowmax+iRowadd); - MNG_ALLOC (pData, pData->pPrevrow, pData->iRowmax+iRowadd); -#else - MNG_ALLOC (pData, pData->pWorkrow, pData->iRowmax); - MNG_ALLOC (pData, pData->pPrevrow, pData->iRowmax); -#endif - } - - /* allocate an RGBA16 row for intermediate processing */ - MNG_ALLOC (pData, pData->pRGBArow, (pData->iDatawidth << 3)); - -#ifndef MNG_NO_CMS - if (pData->fDisplayrow) /* display "on-the-fly" ? */ - { -#if defined(MNG_FULL_CMS) /* determine color-management initialization */ - mng_retcode iRetcode = mng_init_full_cms (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE); -#elif defined(MNG_GAMMA_ONLY) - mng_retcode iRetcode = mng_init_gamma_only (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE); -#elif defined(MNG_APP_CMS) - mng_retcode iRetcode = mng_init_app_cms (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* !MNG_NO_CMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_next_row (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_ROW, MNG_LC_START); -#endif - - pData->iRow += pData->iRowinc; /* increase the row counter */ - - if (pData->iPass >= 0) /* interlaced ? */ - { - while ((pData->iPass < 7) && /* went 'outside' the image ? */ - ((pData->iRow >= (mng_int32)pData->iDataheight) || - (pData->iCol >= (mng_int32)pData->iDatawidth ) )) - { - pData->iPass++; /* next pass ! */ - - if (pData->iPass < 7) /* there's only 7 passes ! */ - { - pData->iRow = interlace_row [pData->iPass]; - pData->iRowinc = interlace_rowskip [pData->iPass]; - pData->iCol = interlace_col [pData->iPass]; - pData->iColinc = interlace_colskip [pData->iPass]; - pData->iRowsamples = (pData->iDatawidth - pData->iCol + interlace_roundoff [pData->iPass]) - >> interlace_divider [pData->iPass]; - - if (pData->iSamplemul > 1) /* recalculate row dimension */ - pData->iRowsize = pData->iRowsamples * pData->iSamplemul; - else - if (pData->iSamplediv > 0) - pData->iRowsize = (pData->iRowsamples + pData->iSampleofs) >> pData->iSamplediv; - else - pData->iRowsize = pData->iRowsamples; - - } - - if ((pData->iPass < 7) && /* reset previous row to zeroes ? */ - (pData->iRow < (mng_int32)pData->iDataheight) && - (pData->iCol < (mng_int32)pData->iDatawidth ) ) - { /* making sure the filters will work properly! */ - mng_int32 iX; - mng_uint8p pTemp = pData->pPrevrow; - -#ifdef MNG_NO_16BIT_SUPPORT -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPNGmult*pData->iRowsize; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPNGmult*pData->iRowsize; iX++) -#endif -#else -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif -#endif - { - *pTemp = 0; - pTemp++; - } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_ROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_cleanup_rowproc (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEANUP_ROWPROC, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS /* cleanup cms profile/transform */ - { - mng_retcode iRetcode = mng_clear_cms (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_INCLUDE_LCMS */ - - if (pData->pRGBArow) /* cleanup buffer for intermediate row */ - MNG_FREEX (pData, pData->pRGBArow, (pData->iDatawidth << 3)); - if (pData->pPrevrow) /* cleanup buffer for previous row */ - MNG_FREEX (pData, pData->pPrevrow, pData->iRowmax); - if (pData->pWorkrow) /* cleanup buffer for working row */ - MNG_FREEX (pData, pData->pWorkrow, pData->iRowmax); - - pData->pWorkrow = MNG_NULL; /* propogate uninitialized buffers */ - pData->pPrevrow = MNG_NULL; - pData->pRGBArow = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEANUP_ROWPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; /* woohiii */ -} - -/* ************************************************************************** */ -/* * * */ -/* * Generic row processing routines for JNG * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -/* ************************************************************************** */ - -mng_retcode mng_display_jpeg_rows (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_JPEG_ROWS, MNG_LC_START); -#endif - /* any completed rows ? */ - if ((pData->iJPEGrow > pData->iJPEGdisprow) && - (pData->iJPEGalpharow > pData->iJPEGdisprow) ) - { - mng_uint32 iX, iMax; - mng_uint32 iSaverow = pData->iRow; /* save alpha decompression row-count */ - /* determine the highest complete(!) row */ - if (pData->iJPEGrow > pData->iJPEGalpharow) - iMax = pData->iJPEGalpharow; - else - iMax = pData->iJPEGrow; - /* display the rows */ - for (iX = pData->iJPEGdisprow; iX < iMax; iX++) - { - pData->iRow = iX; /* make sure we all know which row to handle */ - /* makeup an intermediate row from the buffer */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* color-correct it if necessary */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* and display it */ - { - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) /* check progressive display refresh */ - iRetcode = mng_display_progressive_check (pData); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - pData->iJPEGdisprow = iMax; /* keep track of the last displayed row */ - pData->iRow = iSaverow; /* restore alpha decompression row-count */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_JPEG_ROWS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_next_jpeg_alpharow (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ALPHAROW, MNG_LC_START); -#endif - - pData->iJPEGalpharow++; /* count the row */ - - if (pData->fDisplayrow) /* display "on-the-fly" ? */ - { /* try to display what you can */ - iRetcode = mng_display_jpeg_rows (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ALPHAROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_next_jpeg_row (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ROW, MNG_LC_START); -#endif - - pData->iJPEGrow++; /* increase the row-counter */ - - if (pData->fDisplayrow) /* display "on-the-fly" ? */ - { /* has alpha channel ? */ - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { /* try to display what you can */ - iRetcode = mng_display_jpeg_rows (pData); - } - else - { /* make sure we all know which row to handle */ - pData->iRow = pData->iJPEGrow - 1; - /* makeup an intermediate row from the buffer */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* color-correct it if necessary */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* and display it */ - { - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) /* check progressive display refresh */ - iRetcode = mng_display_progressive_check (pData); - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - /* surpassed last filled row ? */ - if (pData->iJPEGrow > pData->iJPEGrgbrow) - pData->iJPEGrgbrow = pData->iJPEGrow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) /* calculate the distances */ - { - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - pTempdst += 3; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - pTempdst += 3; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - - pTempdst += 2; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - - pTempdst += 2; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - *pTempdst = *(pTempsrc1+1); /* replicate alpha from left */ - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - *pTempdst = *(pTempsrc2+1); /* replicate alpha from right */ - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate gray from left */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate gray from right */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *pTempdst = *(pTempsrc1+3); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - - (mng_int32)(*(pTempsrc1+3)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - *(pTempdst+3) = *(pTempsrc1+3); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - *(pTempdst+3) = *(pTempsrc2+3); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - /* replicate alpha from left */ - *pTempdst = *(pTempsrc1+3); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - /* replicate alpha from right */ - *pTempdst = *(pTempsrc2+3); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate color from left */ - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - *(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - - (mng_int32)(*(pTempsrc1+3)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate color from right */ - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - *(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - - (mng_int32)(*(pTempsrc1+3)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -mng_retcode mng_magnify_g8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth) - else - MNG_COPY (pDstline, pSrcline2, iWidth); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth * 3); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth * 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth * 3) - else - MNG_COPY (pDstline, pSrcline2, iWidth * 3); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth * 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth << 1); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth << 1) - else - MNG_COPY (pDstline, pSrcline2, iWidth << 1); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* replicate gray from top */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc2; /* replicate gray from bottom */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth << 2); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth << 2) - else - MNG_COPY (pDstline, pSrcline2, iWidth << 2); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc1++; /* replicate color from top */ - *pTempdst++ = *pTempsrc1++; - *pTempdst++ = *pTempsrc1++; - - pTempsrc2 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc2++; /* replicate color from bottom */ - *pTempdst++ = *pTempsrc2++; - *pTempdst++ = *pTempsrc2++; - - pTempsrc1 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) /* calculate the distances */ - { - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) )); - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - pTempdst += 3; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - pTempdst += 3; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p) pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - - pTempdst += 2; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - - pTempdst += 2; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - *pTempdst = *(pTempsrc1+1); /* replicate alpha from left */ - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - *pTempdst = *(pTempsrc2+1); /* replicate alpha from right */ - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate gray from left */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate gray from right */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *pTempdst = *(pTempsrc1+3); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - *(pTempdst+3) = *(pTempsrc1+3); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - *(pTempdst+3) = *(pTempsrc2+3); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - /* replicate alpha from left */ - *pTempdst = *(pTempsrc1+3); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - /* replicate alpha from right */ - *pTempdst = *(pTempsrc2+3); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate color from left */ - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - mng_put_uint16 ((mng_uint8p)(pTempdst+3), - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) ); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate color from right */ - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - mng_put_uint16 ((mng_uint8p)(pTempdst+3), - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) ); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, (iWidth << 1)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 1)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 1)) - else - MNG_COPY (pDstline, pSrcline2, (iWidth << 1)); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 1)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth * 6); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth * 6); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth * 6) - else - MNG_COPY (pDstline, pSrcline2, iWidth * 6); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth * 6); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, (iWidth << 2)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 2)) - else - MNG_COPY (pDstline, pSrcline2, (iWidth << 2)); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* replicate gray from top */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc2; /* replicate gray from bottom */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, (iWidth << 3)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 3)) - else - MNG_COPY (pDstline, pSrcline2, (iWidth << 3)); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc1++; /* replicate color from top */ - *pTempdst++ = *pTempsrc1++; - *pTempdst++ = *pTempsrc1++; - - pTempsrc2 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc2++; /* replicate color from bottom */ - *pTempdst++ = *pTempsrc2++; - *pTempdst++ = *pTempsrc2++; - - pTempsrc1 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */ -#endif /* MNG_SKIPCHUNK_MAGN */ - -/* ************************************************************************** */ -/* * * */ -/* * PAST composition routines - compose over/under with a target object * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_composeover_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8; - mng_uint8 iCr8, iCg8, iCb8, iCa8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iFGa8 = *(pWorkrow+3); /* get alpha values */ - iBGa8 = *(pOutrow+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pOutrow = *pWorkrow; - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = iFGa8; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pOutrow+i), *(pWorkrow+i), iFGa8, *(pOutrow+i)); - } -#else - MNG_COMPOSE8 (*pOutrow, *pWorkrow, iFGa8, *pOutrow ); - MNG_COMPOSE8 (*(pOutrow+1), *(pWorkrow+1), iFGa8, *(pOutrow+1)); - MNG_COMPOSE8 (*(pOutrow+2), *(pWorkrow+2), iFGa8, *(pOutrow+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND8 (*pWorkrow, *(pWorkrow+1), *(pWorkrow+2), iFGa8, - *pOutrow, *(pOutrow+1), *(pOutrow+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pOutrow = iCr8; - *(pOutrow+1) = iCg8; - *(pOutrow+2) = iCb8; - *(pOutrow+3) = iCa8; - } - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_composeover_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint16p pWorkrow; - mng_uint16p pOutrow; - mng_int32 iX; - mng_uint16 iFGa16, iFGr16, iFGg16, iFGb16; - mng_uint16 iBGa16, iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA16, MNG_LC_START); -#endif - - pWorkrow = (mng_uint16p)pData->pRGBArow; - pOutrow = (mng_uint16p)(pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize)); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* get alpha values */ - iFGa16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+3)); - iBGa16 = mng_get_uint16 ((mng_uint8p)(pOutrow+3)); - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* then simply copy the values */ - *pOutrow = *pWorkrow; - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - } - else - { /* get color values */ - iFGr16 = mng_get_uint16 ((mng_uint8p)pWorkrow); - iFGg16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+1)); - iFGb16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+2)); - iBGr16 = mng_get_uint16 ((mng_uint8p)pOutrow); - iBGg16 = mng_get_uint16 ((mng_uint8p)(pOutrow+1)); - iBGb16 = mng_get_uint16 ((mng_uint8p)(pOutrow+2)); - - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE16 (iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16 (iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16 (iFGb16, iFGb16, iFGa16, iBGb16); - - mng_put_uint16 ((mng_uint8p)pOutrow, iFGr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iFGg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iFGb16); - /* alpha remains fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND16 (iFGr16, iFGg16, iFGb16, iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - mng_put_uint16 ((mng_uint8p)pOutrow, iCr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iCg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iCb16); - mng_put_uint16 ((mng_uint8p)(pOutrow+3), iCa16); - } - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_composeunder_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8; - mng_uint8 iCr8, iCg8, iCb8, iCa8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iFGa8 = *(pOutrow+3); /* get alpha values */ - iBGa8 = *(pWorkrow+3); - /* anything to do at all ? */ - if ((iBGa8) && (iFGa8 != 0xFF)) - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pOutrow+i), *(pOutrow+i), iFGa8, *(pWorkrow+i)); - } -#else - MNG_COMPOSE8 (*pOutrow, *pOutrow, iFGa8, *pWorkrow ); - MNG_COMPOSE8 (*(pOutrow+1), *(pOutrow+1), iFGa8, *(pWorkrow+1)); - MNG_COMPOSE8 (*(pOutrow+2), *(pOutrow+2), iFGa8, *(pWorkrow+2)); -#endif - *(pOutrow+3) = 0xFF; /* alpha becomes fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND8 (*pOutrow, *(pOutrow+1), *(pOutrow+2), iFGa8, - *pWorkrow, *(pWorkrow+1), *(pWorkrow+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pOutrow = iCr8; - *(pOutrow+1) = iCg8; - *(pOutrow+2) = iCb8; - *(pOutrow+3) = iCa8; - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_composeunder_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint16p pWorkrow; - mng_uint16p pOutrow; - mng_int32 iX; - mng_uint16 iFGa16, iFGr16, iFGg16, iFGb16; - mng_uint16 iBGa16, iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA16, MNG_LC_START); -#endif - - pWorkrow = (mng_uint16p)pData->pRGBArow; - pOutrow = (mng_uint16p)(pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize)); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* get alpha values */ - iFGa16 = mng_get_uint16 ((mng_uint8p)(pOutrow+3)); - iBGa16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+3)); - /* anything to do at all ? */ - if ((iBGa16) && (iFGa16 != 0xFFFF)) - { - iFGr16 = mng_get_uint16 ((mng_uint8p)pOutrow); - iFGg16 = mng_get_uint16 ((mng_uint8p)(pOutrow+1)); - iFGb16 = mng_get_uint16 ((mng_uint8p)(pOutrow+2)); - iBGr16 = mng_get_uint16 ((mng_uint8p)pWorkrow); - iBGg16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+1)); - iBGb16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+2)); - - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE16 (iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16 (iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16 (iFGb16, iFGb16, iFGa16, iBGb16); - - mng_put_uint16 ((mng_uint8p)pOutrow, iFGr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iFGg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iFGb16); - *(pOutrow+3) = 0xFFFF; /* alpha becomes fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND16 (iFGr16, iFGg16, iFGb16, iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - mng_put_uint16 ((mng_uint8p)pOutrow, iCr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iCg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iCb16); - mng_put_uint16 ((mng_uint8p)(pOutrow+3), iCa16); - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * PAST flip & tile routines - flip or tile a row of pixels * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_flip_rgba8 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA8, MNG_LC_START); -#endif - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + pData->iRowsamples - 1; - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* let's flip */ - *pOutrow = *pWorkrow; - pOutrow++; - pWorkrow--; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_flip_rgba16 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA16, MNG_LC_START); -#endif - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + ((pData->iRowsamples - 1) << 1); - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* let's flip */ - *pOutrow = *pWorkrow; - *(pOutrow + 1) = *(pWorkrow + 1); - - pOutrow += 2; - pWorkrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_tile_rgba8 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - mng_uint32 iZ, iMax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA8, MNG_LC_START); -#endif - - iZ = pData->iSourcel; /* indent ? */ - /* what's our source-length */ - iMax = ((mng_imagep)pData->pRetrieveobj)->pImgbuf->iWidth; - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + iZ; - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - - for (iX = pData->iDestl; iX < pData->iDestr; iX++) - { /* tiiiile */ - *pOutrow = *pWorkrow; - - pWorkrow++; - pOutrow++; - iZ++; - - if (iZ >= iMax) /* end of source ? */ - { - iZ = 0; - pWorkrow = (mng_uint32p)pData->pWorkrow; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_tile_rgba16 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - mng_uint32 iZ, iMax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA16, MNG_LC_START); -#endif - - iZ = pData->iSourcel; /* indent ? */ - /* what's our source-length */ - iMax = ((mng_imagep)pData->pRetrieveobj)->pImgbuf->iWidth; - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + (iZ << 1); - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - - for (iX = pData->iDestl; iX < pData->iDestr; iX++) - { /* tiiiile */ - *pOutrow = *pWorkrow; - *(pOutrow + 1) = *(pWorkrow + 1); - - pWorkrow += 2; - pOutrow += 2; - iZ++; - - if (iZ >= iMax) /* end of source ? */ - { - iZ = 0; - pWorkrow = (mng_uint32p)pData->pWorkrow; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SKIPCHUNK_PAST */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_pixels.h b/Engine/lib/lmng/libmng_pixels.h deleted file mode 100644 index 5a0281e89..000000000 --- a/Engine/lib/lmng/libmng_pixels.h +++ /dev/null @@ -1,1147 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_pixels.h copyright (c) 2000-2006 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Pixel-row management routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the pixel-row management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/22/2000 - G.Juyn * */ -/* * - added some JNG definitions * */ -/* * - added delta-image row-processing routines * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN support * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/16/2002 - G.Juyn * */ -/* * - completed MAGN support (16-bit functions) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * * */ -/* * 1.0.6 - 03/09/2003 - G.Juyn * */ -/* * - hiding 12-bit JPEG stuff * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 06/09/2003 - G. R-P * */ -/* * - added conditionals around 8-bit magn routines * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - removed conditionals around 8-bit magn routines * */ -/* * - added conditionals around 16-bit and delta-PNG * */ -/* * supporting code * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/18/2003 - G.R-P * */ -/* * - added conditionals around 1, 2, and 4-bit prototypes * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_pixels_h_ -#define _libmng_pixels_h_ - -/* ************************************************************************** */ -/* * * */ -/* * Progressive display check - checks to see if progressive display is * */ -/* * in order & indicates so * */ -/* * * */ -/* * The routine is called after a call to one of the display_xxx routines * */ -/* * if appropriate * */ -/* * * */ -/* * The refresh is warrented in the read_chunk routine (mng_read.c) * */ -/* * and only during read&display processing, since there's not much point * */ -/* * doing it from memory! * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_check (mng_datap pData); - -/* ************************************************************************** */ -/* * * */ -/* * Display routines - convert rowdata (which is already color-corrected) * */ -/* * to the output canvas, respecting any transparency information * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8 -mng_retcode mng_display_rgb8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGBA8 -mng_retcode mng_display_rgba8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGBA8_PM -mng_retcode mng_display_rgba8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ARGB8 -mng_retcode mng_display_argb8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ARGB8_PM -mng_retcode mng_display_argb8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB8_A8 -mng_retcode mng_display_rgb8_a8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR8 -mng_retcode mng_display_bgr8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 -mng_retcode mng_display_bgrx8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRA8 -mng_retcode mng_display_bgra8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRA8_PM -mng_retcode mng_display_bgra8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ABGR8 -mng_retcode mng_display_abgr8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ABGR8_PM -mng_retcode mng_display_abgr8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB565 -mng_retcode mng_display_rgb565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGBA565 -mng_retcode mng_display_rgba565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR565 -mng_retcode mng_display_bgr565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRA565 -mng_retcode mng_display_bgra565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR565_A8 -mng_retcode mng_display_bgr565_a8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB555 -mng_retcode mng_display_rgb555 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR555 -mng_retcode mng_display_bgr555 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Background restore routines - restore the background with info from * */ -/* * the BACK and/or bKGD chunk and/or the app's background canvas * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_backimage (mng_datap pData); -mng_retcode mng_restore_bkgd_backcolor (mng_datap pData); -mng_retcode mng_restore_bkgd_bkgd (mng_datap pData); -mng_retcode mng_restore_bkgd_bgcolor (mng_datap pData); -#ifndef MNG_SKIPCANVAS_RGB8 -mng_retcode mng_restore_bkgd_rgb8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR8 -mng_retcode mng_restore_bkgd_bgr8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 -mng_retcode mng_restore_bkgd_bgrx8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB565 -mng_retcode mng_restore_bkgd_rgb565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR565 -mng_retcode mng_restore_bkgd_bgr565 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row retrieval routines - retrieve processed & uncompressed row-data * */ -/* * from the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_retrieve_g8 (mng_datap pData); -mng_retcode mng_retrieve_rgb8 (mng_datap pData); -mng_retcode mng_retrieve_idx8 (mng_datap pData); -mng_retcode mng_retrieve_ga8 (mng_datap pData); -mng_retcode mng_retrieve_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_g16 (mng_datap pData); -mng_retcode mng_retrieve_ga16 (mng_datap pData); -mng_retcode mng_retrieve_rgb16 (mng_datap pData); -mng_retcode mng_retrieve_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_g1 (mng_datap pData); -mng_retcode mng_store_g2 (mng_datap pData); -mng_retcode mng_store_g4 (mng_datap pData); -mng_retcode mng_store_idx1 (mng_datap pData); -mng_retcode mng_store_idx2 (mng_datap pData); -mng_retcode mng_store_idx4 (mng_datap pData); -#endif -mng_retcode mng_store_idx8 (mng_datap pData); -mng_retcode mng_store_rgb8 (mng_datap pData); -mng_retcode mng_store_g8 (mng_datap pData); -mng_retcode mng_store_ga8 (mng_datap pData); -mng_retcode mng_store_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_g16 (mng_datap pData); -mng_retcode mng_store_ga16 (mng_datap pData); -mng_retcode mng_store_rgb16 (mng_datap pData); -mng_retcode mng_store_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines (JPEG) - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_store_jpeg_g8 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8 (mng_datap pData); -mng_retcode mng_store_jpeg_ga8 (mng_datap pData); -mng_retcode mng_store_jpeg_rgba8 (mng_datap pData); - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb12 (mng_datap pData); -mng_retcode mng_store_jpeg_ga12 (mng_datap pData); -mng_retcode mng_store_jpeg_rgba12 (mng_datap pData); -#endif - -mng_retcode mng_store_jpeg_g8_alpha (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8_alpha (mng_datap pData); - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_g8_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_g8_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_g8_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a16 (mng_datap pData); -#endif - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_rgb8_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a16 (mng_datap pData); -#endif - -#ifdef MNG_SUPPORT_JPEG12 -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_g12_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_g12_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_g12_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_g12_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g12_a16 (mng_datap pData); -#endif - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb12_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb12_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb12_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_rgb12_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb12_a16 (mng_datap pData); -#endif -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the processed & uncompressed row-data * */ -/* * onto the target "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1 (mng_datap pData); -mng_retcode mng_delta_g2 (mng_datap pData); -mng_retcode mng_delta_g4 (mng_datap pData); -#endif -mng_retcode mng_delta_g8 (mng_datap pData); -mng_retcode mng_delta_g16 (mng_datap pData); -mng_retcode mng_delta_rgb8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16 (mng_datap pData); -#endif -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_idx1 (mng_datap pData); -mng_retcode mng_delta_idx2 (mng_datap pData); -mng_retcode mng_delta_idx4 (mng_datap pData); -#endif -mng_retcode mng_delta_idx8 (mng_datap pData); -mng_retcode mng_delta_ga8 (mng_datap pData); -mng_retcode mng_delta_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16 (mng_datap pData); -mng_retcode mng_delta_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the source row onto the target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1_g1 (mng_datap pData); -mng_retcode mng_delta_g2_g2 (mng_datap pData); -mng_retcode mng_delta_g4_g4 (mng_datap pData); -#endif -mng_retcode mng_delta_g8_g8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_g16_g16 (mng_datap pData); -#endif -mng_retcode mng_delta_ga8_ga8 (mng_datap pData); -mng_retcode mng_delta_ga8_g8 (mng_datap pData); -mng_retcode mng_delta_ga8_a8 (mng_datap pData); -mng_retcode mng_delta_rgba8_rgb8 (mng_datap pData); -mng_retcode mng_delta_rgba8_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_ga16 (mng_datap pData); -mng_retcode mng_delta_ga16_g16 (mng_datap pData); -mng_retcode mng_delta_ga16_a16 (mng_datap pData); -mng_retcode mng_delta_rgba16_a16 (mng_datap pData); -mng_retcode mng_delta_rgba16_rgb16 (mng_datap pData); -#endif -#endif /* MNG_NO_DELTA_PNG */ -mng_retcode mng_delta_rgb8_rgb8 (mng_datap pData); /* Used for PAST */ -mng_retcode mng_delta_rgba8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16_rgb16 (mng_datap pData); -mng_retcode mng_delta_rgba16_rgba16 (mng_datap pData); -#endif - -#ifndef MNG_NO_DELTA_PNG -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - scale the delta to bitdepth of target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g1_g2 (mng_datap pData); -mng_retcode mng_scale_g1_g4 (mng_datap pData); -mng_retcode mng_scale_g1_g8 (mng_datap pData); -mng_retcode mng_scale_g2_g4 (mng_datap pData); -mng_retcode mng_scale_g2_g8 (mng_datap pData); -mng_retcode mng_scale_g4_g8 (mng_datap pData); -#endif -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g1_g16 (mng_datap pData); -mng_retcode mng_scale_g2_g16 (mng_datap pData); -mng_retcode mng_scale_g4_g16 (mng_datap pData); -#endif -mng_retcode mng_scale_g8_g16 (mng_datap pData); -mng_retcode mng_scale_ga8_ga16 (mng_datap pData); -mng_retcode mng_scale_rgb8_rgb16 (mng_datap pData); -mng_retcode mng_scale_rgba8_rgba16 (mng_datap pData); -#endif - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g2_g1 (mng_datap pData); -mng_retcode mng_scale_g4_g1 (mng_datap pData); -mng_retcode mng_scale_g8_g1 (mng_datap pData); -mng_retcode mng_scale_g4_g2 (mng_datap pData); -mng_retcode mng_scale_g8_g2 (mng_datap pData); -mng_retcode mng_scale_g8_g4 (mng_datap pData); -#endif -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g16_g1 (mng_datap pData); -mng_retcode mng_scale_g16_g2 (mng_datap pData); -mng_retcode mng_scale_g16_g4 (mng_datap pData); -#endif -mng_retcode mng_scale_g16_g8 (mng_datap pData); -mng_retcode mng_scale_ga16_ga8 (mng_datap pData); -mng_retcode mng_scale_rgb16_rgb8 (mng_datap pData); -mng_retcode mng_scale_rgba16_rgba8 (mng_datap pData); -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image bit routines - promote bit_depth * */ -/* * * */ -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_1_2 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_1_4 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_1_8 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_2_4 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_2_8 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_4_8 (mng_uint8 iB); -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_1_16 (mng_uint8 iB); -mng_uint16 mng_promote_replicate_2_16 (mng_uint8 iB); -mng_uint16 mng_promote_replicate_4_16 (mng_uint8 iB); -mng_uint16 mng_promote_replicate_8_16 (mng_uint8 iB); -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_uint8 mng_promote_zerofill_1_2 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_1_4 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_1_8 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_2_4 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_2_8 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_4_8 (mng_uint8 iB); -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_1_16 (mng_uint8 iB); -mng_uint16 mng_promote_zerofill_2_16 (mng_uint8 iB); -mng_uint16 mng_promote_zerofill_4_16 (mng_uint8 iB); -mng_uint16 mng_promote_zerofill_8_16 (mng_uint8 iB); -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - promote color_type * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_g8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_g16 (mng_datap pData); -mng_retcode mng_promote_g16_g16 (mng_datap pData); -#endif - -mng_retcode mng_promote_g8_ga8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_ga16 (mng_datap pData); -mng_retcode mng_promote_g16_ga16 (mng_datap pData); -#endif - -mng_retcode mng_promote_g8_rgb8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgb16 (mng_datap pData); -mng_retcode mng_promote_g16_rgb16 (mng_datap pData); -#endif - -mng_retcode mng_promote_g8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgba16 (mng_datap pData); -mng_retcode mng_promote_g16_rgba16 (mng_datap pData); - -mng_retcode mng_promote_ga8_ga16 (mng_datap pData); -#endif - -mng_retcode mng_promote_ga8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga8_rgba16 (mng_datap pData); -mng_retcode mng_promote_ga16_rgba16 (mng_datap pData); -#endif - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgb16 (mng_datap pData); -#endif - -mng_retcode mng_promote_rgb8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgba16 (mng_datap pData); -mng_retcode mng_promote_rgb16_rgba16 (mng_datap pData); -#endif - -mng_retcode mng_promote_idx8_rgb8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgb16 (mng_datap pData); -#endif - -mng_retcode mng_promote_idx8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgba16 (mng_datap pData); - -mng_retcode mng_promote_rgba8_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing routines - convert uncompressed data from zlib to * */ -/* * managable row-data which serves as input to the color-management * */ -/* * routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_g1 (mng_datap pData); -mng_retcode mng_process_g2 (mng_datap pData); -mng_retcode mng_process_g4 (mng_datap pData); -#endif -mng_retcode mng_process_g8 (mng_datap pData); -mng_retcode mng_process_rgb8 (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_idx1 (mng_datap pData); -mng_retcode mng_process_idx2 (mng_datap pData); -mng_retcode mng_process_idx4 (mng_datap pData); -#endif -mng_retcode mng_process_idx8 (mng_datap pData); -mng_retcode mng_process_ga8 (mng_datap pData); -mng_retcode mng_process_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_g16 (mng_datap pData); -mng_retcode mng_process_ga16 (mng_datap pData); -mng_retcode mng_process_rgb16 (mng_datap pData); -mng_retcode mng_process_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines - set up the variables needed * */ -/* * to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_g1_i (mng_datap pData); -mng_retcode mng_init_g2_i (mng_datap pData); -mng_retcode mng_init_g4_i (mng_datap pData); -#endif -mng_retcode mng_init_g8_i (mng_datap pData); -mng_retcode mng_init_rgb8_i (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_idx1_i (mng_datap pData); -mng_retcode mng_init_idx2_i (mng_datap pData); -mng_retcode mng_init_idx4_i (mng_datap pData); -#endif -mng_retcode mng_init_idx8_i (mng_datap pData); -mng_retcode mng_init_ga8_i (mng_datap pData); -mng_retcode mng_init_rgba8_i (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_g1_ni (mng_datap pData); -mng_retcode mng_init_g2_ni (mng_datap pData); -mng_retcode mng_init_g4_ni (mng_datap pData); -#endif -mng_retcode mng_init_g8_ni (mng_datap pData); -mng_retcode mng_init_rgb8_ni (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_idx1_ni (mng_datap pData); -mng_retcode mng_init_idx2_ni (mng_datap pData); -mng_retcode mng_init_idx4_ni (mng_datap pData); -#endif -mng_retcode mng_init_idx8_ni (mng_datap pData); -mng_retcode mng_init_ga8_ni (mng_datap pData); -mng_retcode mng_init_rgba8_ni (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_g16_i (mng_datap pData); -mng_retcode mng_init_rgb16_i (mng_datap pData); -mng_retcode mng_init_ga16_i (mng_datap pData); -mng_retcode mng_init_rgba16_i (mng_datap pData); -mng_retcode mng_init_g16_ni (mng_datap pData); -mng_retcode mng_init_rgb16_ni (mng_datap pData); -mng_retcode mng_init_ga16_ni (mng_datap pData); -mng_retcode mng_init_rgba16_ni (mng_datap pData); -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines (JPEG) - set up the variables * */ -/* * needed to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_jpeg_a1_ni (mng_datap pData); -mng_retcode mng_init_jpeg_a2_ni (mng_datap pData); -mng_retcode mng_init_jpeg_a4_ni (mng_datap pData); -#endif -mng_retcode mng_init_jpeg_a8_ni (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_jpeg_a16_ni (mng_datap pData); -#endif -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * General row processing routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_init_rowproc (mng_datap pData); -mng_retcode mng_next_row (mng_datap pData); -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_next_jpeg_alpharow (mng_datap pData); -mng_retcode mng_next_jpeg_row (mng_datap pData); -#endif -mng_retcode mng_cleanup_rowproc (mng_datap pData); - -/* ************************************************************************** */ -/* * * */ -/* * Magnification row routines - apply magnification transforms * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -mng_retcode mng_magnify_g8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -#endif -mng_retcode mng_magnify_rgba8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -mng_retcode mng_magnify_g8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -#endif -mng_retcode mng_magnify_rgba8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); - -/* ************************************************************************** */ -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -mng_retcode mng_magnify_g16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); - -mng_retcode mng_magnify_g16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * PAST composition routines - compose over/under with a target object * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_composeover_rgba8 (mng_datap pData); -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_composeunder_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_composeover_rgba16 (mng_datap pData); -mng_retcode mng_composeunder_rgba16 (mng_datap pData); -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * PAST flip & tile routines - flip or tile a row of pixels * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_flip_rgba8 (mng_datap pData); -mng_retcode mng_tile_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_flip_rgba16 (mng_datap pData); -mng_retcode mng_tile_rgba16 (mng_datap pData); -#endif -#endif - -/* ************************************************************************** */ - -#endif /* _libmng_pixels_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_prop_xs.c b/Engine/lib/lmng/libmng_prop_xs.c deleted file mode 100644 index 88e416d5c..000000000 --- a/Engine/lib/lmng/libmng_prop_xs.c +++ /dev/null @@ -1,2799 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_prop_xs.c copyright (c) 2000-2006 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : property get/set interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the property get/set functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - fixed calling convention * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added set_outputprofile2 & set_srgbprofile2 * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - changed inclusion of cms-routines * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for get/set default zlib/IJG parms * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contribution by Tim Rowley) * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added get/set for speedtype to facilitate testing * */ -/* * - added get for imagelevel during processtext callback * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed incompatible return-types * */ -/* * * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added get routines for internal display variables * */ -/* * - added get/set routines for suspensionmode variable * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added get/set routines for sectionbreak variable * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - added status_xxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B495442 - invalid returnvalue in mng_get_suspensionmode * */ -/* * * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around some JNG-supporting code * */ -/* * 1.0.6 - 07/11/2003 - G.R-P * */ -/* * - added conditionals zlib and jpeg property accessors * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added conditionals around various unused functions * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/07/2004 - G.R-P. * */ -/* * - put gamma, cms-related functions inside #ifdef * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * * */ -/* * 1.0.9 - 09/18/2004 - G.R-P. * */ -/* * - added some MNG_SUPPORT_WRITE conditionals * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_memory.h" -#include "libmng_cms.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Property set functions * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle, - mng_ptr pUserdata) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->pUserdata = pUserdata; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_canvasstyle (mng_handle hHandle, - mng_uint32 iStyle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CANVASSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - switch (iStyle) - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGBA8 - case MNG_CANVAS_RGBA8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGBA8_PM - case MNG_CANVAS_RGBA8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_ARGB8 - case MNG_CANVAS_ARGB8 : break; -#endif -#ifndef MNG_SKIPCANVAS_ARGB8_PM - case MNG_CANVAS_ARGB8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_RGB8_A8 - case MNG_CANVAS_RGB8_A8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRA8 - case MNG_CANVAS_BGRA8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRA8_PM - case MNG_CANVAS_BGRA8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_ABGR8 - case MNG_CANVAS_ABGR8 : break; -#endif -#ifndef MNG_SKIPCANVAS_ABGR8_PM - case MNG_CANVAS_ABGR8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGBA565 - case MNG_CANVAS_RGBA565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRA565 - case MNG_CANVAS_BGRA565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR565_A8 - case MNG_CANVAS_BGR565_A8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGB555 - case MNG_CANVAS_RGB555 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR555 - case MNG_CANVAS_BGR555 : break; -#endif -/* case MNG_CANVAS_RGB16 : break; */ -/* case MNG_CANVAS_RGBA16 : break; */ -/* case MNG_CANVAS_ARGB16 : break; */ -/* case MNG_CANVAS_BGR16 : break; */ -/* case MNG_CANVAS_BGRA16 : break; */ -/* case MNG_CANVAS_ABGR16 : break; */ -/* case MNG_CANVAS_INDEX8 : break; */ -/* case MNG_CANVAS_INDEXA8 : break; */ -/* case MNG_CANVAS_AINDEX8 : break; */ -/* case MNG_CANVAS_GRAY8 : break; */ -/* case MNG_CANVAS_GRAY16 : break; */ -/* case MNG_CANVAS_GRAYA8 : break; */ -/* case MNG_CANVAS_GRAYA16 : break; */ -/* case MNG_CANVAS_AGRAY8 : break; */ -/* case MNG_CANVAS_AGRAY16 : break; */ -/* case MNG_CANVAS_DX15 : break; */ -/* case MNG_CANVAS_DX16 : break; */ - default : { MNG_ERROR (((mng_datap)hHandle), MNG_INVALIDCNVSTYLE) }; - } - - ((mng_datap)hHandle)->iCanvasstyle = iStyle; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CANVASSTYLE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_bkgdstyle (mng_handle hHandle, - mng_uint32 iStyle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BKGDSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - switch (iStyle) /* alpha-modes not supported */ - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : break; -#endif -/* case MNG_CANVAS_RGB16 : break; */ -/* case MNG_CANVAS_BGR16 : break; */ -/* case MNG_CANVAS_INDEX8 : break; */ -/* case MNG_CANVAS_GRAY8 : break; */ -/* case MNG_CANVAS_GRAY16 : break; */ -/* case MNG_CANVAS_DX15 : break; */ -/* case MNG_CANVAS_DX16 : break; */ - default : MNG_ERROR (((mng_datap)hHandle), MNG_INVALIDCNVSTYLE); - } - - ((mng_datap)hHandle)->iBkgdstyle = iStyle; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BKGDSTYLE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BGCOLOR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iBGred = iRed; - ((mng_datap)hHandle)->iBGgreen = iGreen; - ((mng_datap)hHandle)->iBGblue = iBlue; - ((mng_datap)hHandle)->bUseBKGD = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BGCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_usebkgd (mng_handle hHandle, - mng_bool bUseBKGD) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bUseBKGD = bUseBKGD; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle, - mng_bool bStorechunks) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_STORECHUNKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bStorechunks = bStorechunks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_STORECHUNKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_sectionbreaks (mng_handle hHandle, - mng_bool bSectionbreaks) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SECTIONBREAKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bSectionbreaks = bSectionbreaks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SECTIONBREAKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_cacheplayback (mng_handle hHandle, - mng_bool bCacheplayback) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CACHEPLAYBACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - if (((mng_datap)hHandle)->bHasheader) - MNG_ERROR (((mng_datap)hHandle), MNG_FUNCTIONINVALID); - - ((mng_datap)hHandle)->bCacheplayback = bCacheplayback; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CACHEPLAYBACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_doprogressive (mng_handle hHandle, - mng_bool bDoProgressive) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DOPROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - ((mng_datap)hHandle)->bDoProgressive = bDoProgressive; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DOPROGRESSIVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_crcmode (mng_handle hHandle, - mng_uint32 iCrcmode) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CRCMODE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - ((mng_datap)hHandle)->iCrcmode = iCrcmode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CRCMODE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_srgb (mng_handle hHandle, - mng_bool bIssRGB) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bIssRGB = bIssRGB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_set_outputprofile (mng_handle hHandle, - mng_pchar zFilename) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf2) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf2); - /* allocate new CMS profile handle */ - pData->hProf2 = mnglcms_createfileprofile (zFilename); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE2, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf2) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf2); - /* allocate new CMS profile handle */ - pData->hProf2 = mnglcms_creatememprofile (iProfilesize, pProfile); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_outputsrgb (mng_handle hHandle) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTSRGB, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf2) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf2); - /* allocate new CMS profile handle */ - pData->hProf2 = mnglcms_createsrgbprofile (); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTSRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle, - mng_pchar zFilename) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE2, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf3) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf3); - /* allocate new CMS profile handle */ - pData->hProf3 = mnglcms_createfileprofile (zFilename); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_srgbprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf3) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf3); - /* allocate new CMS profile handle */ - pData->hProf3 = mnglcms_creatememprofile (iProfilesize, pProfile); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_srgbimplicit (mng_handle hHandle) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBIMPLICIT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf3) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf3); - /* allocate new CMS profile handle */ - pData->hProf3 = mnglcms_createsrgbprofile (); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBIMPLICIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_set_viewgamma (mng_handle hHandle, - mng_float dGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dViewgamma = dGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_displaygamma (mng_handle hHandle, - mng_float dGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDisplaygamma = dGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_dfltimggamma (mng_handle hHandle, - mng_float dGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDfltimggamma = dGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_set_viewgammaint (mng_handle hHandle, - mng_uint32 iGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dViewgamma = (mng_float)iGamma / 100000; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_displaygammaint (mng_handle hHandle, - mng_uint32 iGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDisplaygamma = (mng_float)iGamma / 100000; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_DFLT_INFO -mng_retcode MNG_DECL mng_set_dfltimggammaint (mng_handle hHandle, - mng_uint32 iGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDfltimggamma = (mng_float)iGamma / 100000; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIP_MAXCANVAS -mng_retcode MNG_DECL mng_set_maxcanvaswidth (mng_handle hHandle, - mng_uint32 iMaxwidth) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxwidth = iMaxwidth; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASWIDTH, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_maxcanvasheight (mng_handle hHandle, - mng_uint32 iMaxheight) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASHEIGHT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxheight = iMaxheight; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASHEIGHT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_maxcanvassize (mng_handle hHandle, - mng_uint32 iMaxwidth, - mng_uint32 iMaxheight) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASSIZE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxwidth = iMaxwidth; - ((mng_datap)hHandle)->iMaxheight = iMaxheight; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASSIZE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_level (mng_handle hHandle, - mng_int32 iZlevel) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_LEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZlevel = iZlevel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_LEVEL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_method (mng_handle hHandle, - mng_int32 iZmethod) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_METHOD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZmethod = iZmethod; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_METHOD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_windowbits (mng_handle hHandle, - mng_int32 iZwindowbits) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_WINDOWBITS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZwindowbits = iZwindowbits; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_WINDOWBITS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_memlevel (mng_handle hHandle, - mng_int32 iZmemlevel) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MEMLEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZmemlevel = iZmemlevel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MEMLEVEL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_strategy (mng_handle hHandle, - mng_int32 iZstrategy) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_STRATEGY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZstrategy = iZstrategy; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_STRATEGY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_maxidat (mng_handle hHandle, - mng_uint32 iMaxIDAT) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MAXIDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxIDAT = iMaxIDAT; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MAXIDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_dctmethod (mng_handle hHandle, - mngjpeg_dctmethod eJPEGdctmethod) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_DCTMETHOD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->eJPEGdctmethod = eJPEGdctmethod; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_DCTMETHOD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif MNG_SUPPORT_WRITE -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_quality (mng_handle hHandle, - mng_int32 iJPEGquality) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_QUALITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iJPEGquality = iJPEGquality; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_QUALITY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_smoothing (mng_handle hHandle, - mng_int32 iJPEGsmoothing) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_SMOOTHING, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iJPEGsmoothing = iJPEGsmoothing; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_SMOOTHING, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_progressive (mng_handle hHandle, - mng_bool bJPEGprogressive) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_PROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bJPEGcompressprogr = bJPEGprogressive; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_PROGRESSIVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_optimized (mng_handle hHandle, - mng_bool bJPEGoptimized) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_OPTIMIZED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bJPEGcompressopt = bJPEGoptimized; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_OPTIMIZED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_maxjdat (mng_handle hHandle, - mng_uint32 iMaxJDAT) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_MAXJDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxJDAT = iMaxJDAT; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_MAXJDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_set_suspensionmode (mng_handle hHandle, - mng_bool bSuspensionmode) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SUSPENSIONMODE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - if (((mng_datap)hHandle)->bReading) /* we must NOT be reading !!! */ - MNG_ERROR ((mng_datap)hHandle, MNG_FUNCTIONINVALID); - - ((mng_datap)hHandle)->bSuspensionmode = bSuspensionmode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SUSPENSIONMODE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle, - mng_speedtype iSpeed) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SPEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iSpeed = iSpeed; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SPEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ -/* * * */ -/* * Property get functions * */ -/* * * */ -/* ************************************************************************** */ - -mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle) -{ /* no tracing in here to prevent recursive calls */ - MNG_VALIDHANDLEX (hHandle) - return ((mng_datap)hHandle)->pUserdata; -} - -/* ************************************************************************** */ - -mng_imgtype MNG_DECL mng_get_sigtype (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIGTYPE, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_it_unknown; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIGTYPE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->eSigtype; -} - -/* ************************************************************************** */ - -mng_imgtype MNG_DECL mng_get_imagetype (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGETYPE, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_it_unknown; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGETYPE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->eImagetype; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_imagewidth (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEWIDTH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iWidth; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_imageheight (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEHEIGHT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iHeight; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_ticks (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TICKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TICKS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTicks; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_framecount (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FRAMECOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FRAMECOUNT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iFramecount; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_layercount (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LAYERCOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LAYERCOUNT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iLayercount; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_playtime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_PLAYTIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_PLAYTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iPlaytime; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_simplicity (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIMPLICITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIMPLICITY, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iSimplicity; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_bitdepth (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BITDEPTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iBitdepth; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRimgbitdepth; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BITDEPTH, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_colortype (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COLORTYPE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iColortype; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRcolortype; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COLORTYPE, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_compression (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COMPRESSION, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iCompression; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRimgcompression; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COMPRESSION, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_filter (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FILTER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iFilter; - else - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FILTER, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_interlace (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_INTERLACE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iInterlace; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRimginterlace; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_INTERLACE, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphabitdepth (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHABITDEPTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphabitdepth; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHABITDEPTH, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint8 MNG_DECL mng_get_refreshpass (mng_handle hHandle) -{ - mng_uint8 iRslt; - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_REFRESHPASS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - pData = (mng_datap)hHandle; - /* for PNG we know the exact pass */ - if ((pData->eImagetype == mng_it_png) && (pData->iPass >= 0)) - iRslt = pData->iPass; -#ifdef MNG_INCLUDE_JNG - else /* for JNG we'll fake it... */ - if ((pData->eImagetype == mng_it_jng) && - (pData->bJPEGhasheader) && (pData->bJPEGdecostarted) && - (pData->bJPEGprogressive)) - { - if (pData->pJPEGdinfo->input_scan_number <= 1) - iRslt = 0; /* first pass (I think...) */ - else - if (jpeg_input_complete (pData->pJPEGdinfo)) - iRslt = 7; /* input complete; aka final pass */ - else - iRslt = 3; /* anything between 0 and 7 will do */ - - } -#endif - else - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_REFRESHPASS, MNG_LC_END); -#endif - - return iRslt; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ -mng_uint8 MNG_DECL mng_get_alphacompression (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHACOMPRESSION, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphacompression; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHACOMPRESSION, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphafilter (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAFILTER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphafilter; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAFILTER, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphainterlace (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAINTERLACE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphainterlace; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAINTERLACE, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphadepth (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHADEPTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHADEPTH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iAlphadepth; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_canvasstyle (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CANVASSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CANVASSTYLE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iCanvasstyle; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_bkgdstyle (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BKGDSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BKGDSTYLE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iBkgdstyle; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_get_bgcolor (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GET_BGCOLOR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - *iRed = ((mng_datap)hHandle)->iBGred; - *iGreen = ((mng_datap)hHandle)->iBGgreen; - *iBlue = ((mng_datap)hHandle)->iBGblue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GET_BGCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_usebkgd (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_USEBKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_USEBKGD, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bUseBKGD; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_storechunks (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_STORECHUNKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_STORECHUNKS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bStorechunks; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_sectionbreaks (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SECTIONBREAKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SECTIONBREAKS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bSectionbreaks; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_cacheplayback (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CACHEPLAYBACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CACHEPLAYBACK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bCacheplayback; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_doprogressive (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_DOPROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_DOPROGRESSIVE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bDoProgressive; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_crcmode (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CRCMODE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CRCMODE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iCrcmode; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_get_srgb (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SRGB, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bIssRGB; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_float MNG_DECL mng_get_viewgamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->dViewgamma; -} -#endif - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_float MNG_DECL mng_get_displaygamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->dDisplaygamma; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DFLT_INFO -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_float MNG_DECL mng_get_dfltimggamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->dDfltimggamma; -} -#endif -#endif - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_uint32 MNG_DECL mng_get_viewgammaint (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_END); -#endif - - return (mng_uint32)(((mng_datap)hHandle)->dViewgamma * 100000); -} -#endif - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_uint32 MNG_DECL mng_get_displaygammaint (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return (mng_uint32)(((mng_datap)hHandle)->dDisplaygamma * 100000); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DFLT_INFO -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_uint32 MNG_DECL mng_get_dfltimggammaint (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return (mng_uint32)(((mng_datap)hHandle)->dDfltimggamma * 100000); -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIP_MAXCANVAS -mng_uint32 MNG_DECL mng_get_maxcanvaswidth (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASWIDTH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxwidth; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_maxcanvasheight (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASHEIGHT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASHEIGHT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxheight; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_level (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_LEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_LEVEL, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZlevel; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_method (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_METHOD, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_METHOD, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZmethod; -} - -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_windowbits (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_WINDOWBITS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_WINDOWBITS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZwindowbits; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_memlevel (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MEMLEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MEMLEVEL, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZmemlevel; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_strategy (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_STRATEGY, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_STRATEGY, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZstrategy; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_uint32 MNG_DECL mng_get_zlib_maxidat (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MAXIDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MAXIDAT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxIDAT; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mngjpeg_dctmethod MNG_DECL mng_get_jpeg_dctmethod (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_DCTMETHOD, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return JDCT_ISLOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_DCTMETHOD, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->eJPEGdctmethod; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_int32 MNG_DECL mng_get_jpeg_quality (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_QUALITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_QUALITY, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iJPEGquality; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_int32 MNG_DECL mng_get_jpeg_smoothing (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_SMOOTHING, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_SMOOTHING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iJPEGsmoothing; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_bool MNG_DECL mng_get_jpeg_progressive (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_PROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_PROGRESSIVE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bJPEGcompressprogr; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_bool MNG_DECL mng_get_jpeg_optimized (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_OPTIMIZED, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_OPTIMIZED, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bJPEGcompressopt; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_uint32 MNG_DECL mng_get_jpeg_maxjdat (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_MAXJDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_MAXJDAT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxJDAT; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_bool MNG_DECL mng_get_suspensionmode (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SUSPENSIONMODE, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SUSPENSIONMODE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bSuspensionmode; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_speedtype MNG_DECL mng_get_speed (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iSpeed; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_imagelevel (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGELEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGELEVEL, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iImagelevel; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_get_lastbackchunk (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue, - mng_uint8* iMandatory) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTBACKCHUNK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - if (((mng_datap)hHandle)->eImagetype != mng_it_mng) - MNG_ERROR (((mng_datap)hHandle), MNG_FUNCTIONINVALID); - - *iRed = ((mng_datap)hHandle)->iBACKred; - *iGreen = ((mng_datap)hHandle)->iBACKgreen; - *iBlue = ((mng_datap)hHandle)->iBACKblue; - *iMandatory = ((mng_datap)hHandle)->iBACKmandatory; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTBACKCHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_get_lastseekname (mng_handle hHandle, - mng_pchar zSegmentname) -{ - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTSEEKNAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; - /* only allowed for MNG ! */ - if (pData->eImagetype != mng_it_mng) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (pData->pLastseek) /* is there a last SEEK ? */ - { - mng_ani_seekp pSEEK = (mng_ani_seekp)pData->pLastseek; - - if (pSEEK->iSegmentnamesize) /* copy the name if there is one */ - MNG_COPY (zSegmentname, pSEEK->zSegmentname, pSEEK->iSegmentnamesize); - - *(((mng_uint8p)zSegmentname) + pSEEK->iSegmentnamesize) = 0; - } - else - { /* return an empty string */ - *((mng_uint8p)zSegmentname) = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTSEEKNAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint32 MNG_DECL mng_get_currframdelay (mng_handle hHandle) -{ - mng_datap pData; - mng_uint32 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRFRAMDELAY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; - /* only allowed for MNG ! */ - if (pData->eImagetype != mng_it_mng) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - iRslt = pData->iFramedelay; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRFRAMDELAY, MNG_LC_END); -#endif - - return iRslt; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint32 MNG_DECL mng_get_starttime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_STARTTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_STARTTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iStarttime; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint32 MNG_DECL mng_get_runtime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_RUNTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_RUNTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iRuntime; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_currentframe (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTFRAME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTFRAME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iFrameseq; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_currentlayer (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTLAYER, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTLAYER, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iLayerseq; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_currentplaytime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTPLAYTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTPLAYTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iFrametime; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_totalframes (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALFRAMES, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALFRAMES, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTotalframes; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_totallayers (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALLAYERS, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALLAYERS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTotallayers; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_totalplaytime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALPLAYTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALPLAYTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTotalplaytime; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_status_error (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_ERROR, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_ERROR, MNG_LC_END); -#endif - - return (mng_bool)((mng_datap)hHandle)->iErrorcode; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_bool MNG_DECL mng_status_reading (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_READING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_READING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bReading; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_bool MNG_DECL mng_status_suspendbreak (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_SUSPENDBREAK, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_SUSPENDBREAK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bSuspended; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_bool MNG_DECL mng_status_creating (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_CREATING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_CREATING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bCreating; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_bool MNG_DECL mng_status_writing (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_WRITING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_WRITING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bWriting; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_status_displaying (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DISPLAYING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DISPLAYING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bDisplaying; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_status_running (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bRunning; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_status_timerbreak (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_TIMERBREAK, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_TIMERBREAK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bTimerset; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -mng_bool MNG_DECL mng_status_dynamic (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DYNAMIC, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DYNAMIC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bDynamic; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -mng_bool MNG_DECL mng_status_runningevent (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNINGEVENT, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNINGEVENT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bRunningevent; -} -#endif - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_read.c b/Engine/lib/lmng/libmng_read.c deleted file mode 100644 index c922e19a5..000000000 --- a/Engine/lib/lmng/libmng_read.c +++ /dev/null @@ -1,1369 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_read.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Read logic (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the high-level read logic * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - cleaned up some code regarding mixed support * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added support for JNG * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contribution by Tim Rowley) * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - changed read-processing for improved I/O-suspension * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed EOF processing behavior * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed default readbuffer size from 1024 to 4200 * */ -/* * * */ -/* * 0.9.2 - 07/27/2000 - G.Juyn * */ -/* * - B110320 - fixed GCC warning about mix-sized pointer math * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - B110546 - fixed for improperly returning UNEXPECTEDEOF * */ -/* * 0.9.2 - 08/04/2000 - G.Juyn * */ -/* * - B111096 - fixed large-buffer read-suspension * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - removed test-MaGN * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 0.9.5 - 01/23/2001 - G.Juyn * */ -/* * - fixed timing-problem with switching framing_modes * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B495443 - incorrect suspend check in read_databuffer * */ -/* * * */ -/* * 1.0.5 - 07/04/2002 - G.Juyn * */ -/* * - added errorcode for extreme chunk-sizes * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 07/16/2002 - G.Juyn * */ -/* * - B581625 - large chunks fail with suspension reads * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/16/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_NO_DELTA_PNG reduction * */ -/* * - skip additional code when MNG_INCLUDE_JNG is not enabled * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/08/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 07/06/2004 - G.R-P * */ -/* * - defend against using undefined closestream function * */ -/* * 1.0.8 - 07/28/2004 - G.R-P * */ -/* * - added check for extreme chunk-lengths * */ -/* * * */ -/* * 1.0.9 - 09/16/2004 - G.Juyn * */ -/* * - fixed chunk pushing mechanism * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * 1.0.9 - 12/31/2004 - G.R-P * */ -/* * - removed stray characters from #ifdef directive * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_chunks.h" -#ifdef MNG_OPTIMIZE_CHUNKREADER -#include "libmng_chunk_descr.h" -#endif -#include "libmng_chunk_prc.h" -#include "libmng_chunk_io.h" -#include "libmng_display.h" -#include "libmng_read.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_process_eof (mng_datap pData) -{ - if (!pData->bEOF) /* haven't closed the stream yet ? */ - { - pData->bEOF = MNG_TRUE; /* now we do! */ - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fClosestream && !pData->fClosestream ((mng_handle)pData)) - { - MNG_ERROR (pData, MNG_APPIOERROR); - } -#endif - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_release_pushdata (mng_datap pData) -{ - mng_pushdatap pFirst = pData->pFirstpushdata; - mng_pushdatap pNext = pFirst->pNext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHDATA, MNG_LC_START); -#endif - - pData->pFirstpushdata = pNext; /* next becomes the first */ - - if (!pNext) /* no next? => no last! */ - pData->pLastpushdata = MNG_NULL; - /* buffer owned and release callback defined? */ - if ((pFirst->bOwned) && (pData->fReleasedata)) - pData->fReleasedata ((mng_handle)pData, pFirst->pData, pFirst->iLength); - else /* otherwise use internal free mechanism */ - MNG_FREEX (pData, pFirst->pData, pFirst->iLength); - /* and free it */ - MNG_FREEX (pData, pFirst, sizeof(mng_pushdata)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_release_pushchunk (mng_datap pData) -{ - mng_pushdatap pFirst = pData->pFirstpushchunk; - mng_pushdatap pNext = pFirst->pNext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHCHUNK, MNG_LC_START); -#endif - - pData->pFirstpushchunk = pNext; /* next becomes the first */ - - if (!pNext) /* no next? => no last! */ - pData->pLastpushchunk = MNG_NULL; - /* buffer owned and release callback defined? */ - if ((pFirst->bOwned) && (pData->fReleasedata)) - pData->fReleasedata ((mng_handle)pData, pFirst->pData, pFirst->iLength); - else /* otherwise use internal free mechanism */ - MNG_FREEX (pData, pFirst->pData, pFirst->iLength); - /* and free it */ - MNG_FREEX (pData, pFirst, sizeof(mng_pushdata)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHCHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode read_data (mng_datap pData, - mng_uint8p pBuf, - mng_uint32 iSize, - mng_uint32 * iRead) -{ - mng_retcode iRetcode; - mng_uint32 iTempsize = iSize; - mng_uint8p pTempbuf = pBuf; - mng_pushdatap pPush = pData->pFirstpushdata; - mng_uint32 iPushsize = 0; - *iRead = 0; /* nothing yet */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATA, MNG_LC_START); -#endif - - while (pPush) /* calculate size of pushed data */ - { - iPushsize += pPush->iRemaining; - pPush = pPush->pNext; - } - - if (iTempsize <= iPushsize) /* got enough push data? */ - { - while (iTempsize) - { - pPush = pData->pFirstpushdata; - /* enough data remaining in this buffer? */ - if (pPush->iRemaining <= iTempsize) - { /* no: then copy what we've got */ - MNG_COPY (pTempbuf, pPush->pDatanext, pPush->iRemaining); - /* move pointers & lengths */ - pTempbuf += pPush->iRemaining; - *iRead += pPush->iRemaining; - iTempsize -= pPush->iRemaining; - /* release the depleted buffer */ - iRetcode = mng_release_pushdata (pData); - if (iRetcode) - return iRetcode; - } - else - { /* copy the needed bytes */ - MNG_COPY (pTempbuf, pPush->pDatanext, iTempsize); - /* move pointers & lengths */ - pPush->iRemaining -= iTempsize; - pPush->pDatanext += iTempsize; - pTempbuf += iTempsize; - *iRead += iTempsize; - iTempsize = 0; /* all done!!! */ - } - } - } - else - { - mng_uint32 iTempread = 0; - /* get it from the app then */ - if (!pData->fReaddata (((mng_handle)pData), pTempbuf, iTempsize, &iTempread)) - MNG_ERROR (pData, MNG_APPIOERROR); - - *iRead += iTempread; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode read_databuffer (mng_datap pData, - mng_uint8p pBuf, - mng_uint8p * pBufnext, - mng_uint32 iSize, - mng_uint32 * iRead) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATABUFFER, MNG_LC_START); -#endif - - if (pData->bSuspensionmode) - { - mng_uint8p pTemp; - mng_uint32 iTemp; - - *iRead = 0; /* let's be negative about the outcome */ - - if (!pData->pSuspendbuf) /* need to create a suspension buffer ? */ - { - pData->iSuspendbufsize = MNG_SUSPENDBUFFERSIZE; - /* so, create it */ - MNG_ALLOC (pData, pData->pSuspendbuf, pData->iSuspendbufsize); - - pData->iSuspendbufleft = 0; /* make sure to fill it first time */ - pData->pSuspendbufnext = pData->pSuspendbuf; - } - /* more than our buffer can hold ? */ - if (iSize > pData->iSuspendbufsize) - { - mng_uint32 iRemain; - - if (!*pBufnext) /* first time ? */ - { - if (pData->iSuspendbufleft) /* do we have some data left ? */ - { /* then copy it */ - MNG_COPY (pBuf, pData->pSuspendbufnext, pData->iSuspendbufleft); - /* fixup variables */ - *pBufnext = pBuf + pData->iSuspendbufleft; - pData->pSuspendbufnext = pData->pSuspendbuf; - pData->iSuspendbufleft = 0; - } - else - { - *pBufnext = pBuf; - } - } - /* calculate how much to get */ - iRemain = iSize - (mng_uint32)(*pBufnext - pBuf); - /* let's go get it */ - iRetcode = read_data (pData, *pBufnext, iRemain, &iTemp); - if (iRetcode) - return iRetcode; - /* first read after suspension return 0 means EOF */ - if ((pData->iSuspendpoint) && (iTemp == 0)) - { /* that makes it final */ - mng_retcode iRetcode = mng_process_eof (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* indicate the source is depleted */ - *iRead = iSize - iRemain + iTemp; - } - else - { - if (iTemp < iRemain) /* suspension required ? */ - { - *pBufnext = *pBufnext + iTemp; - pData->bSuspended = MNG_TRUE; - } - else - { - *iRead = iSize; /* got it all now ! */ - } - } - } - else - { /* need to read some more ? */ - while ((!pData->bSuspended) && (!pData->bEOF) && (iSize > pData->iSuspendbufleft)) - { /* not enough space left in buffer ? */ - if (pData->iSuspendbufsize - pData->iSuspendbufleft - - (mng_uint32)(pData->pSuspendbufnext - pData->pSuspendbuf) < - MNG_SUSPENDREQUESTSIZE) - { - if (pData->iSuspendbufleft) /* then lets shift (if there's anything left) */ - MNG_COPY (pData->pSuspendbuf, pData->pSuspendbufnext, pData->iSuspendbufleft); - /* adjust running pointer */ - pData->pSuspendbufnext = pData->pSuspendbuf; - } - /* still not enough room ? */ - if (pData->iSuspendbufsize - pData->iSuspendbufleft < MNG_SUSPENDREQUESTSIZE) - MNG_ERROR (pData, MNG_INTERNALERROR); - /* now read some more data */ - pTemp = pData->pSuspendbufnext + pData->iSuspendbufleft; - - iRetcode = read_data (pData, pTemp, MNG_SUSPENDREQUESTSIZE, &iTemp); - if (iRetcode) - return iRetcode; - /* adjust fill-counter */ - pData->iSuspendbufleft += iTemp; - /* first read after suspension returning 0 means EOF */ - if ((pData->iSuspendpoint) && (iTemp == 0)) - { /* that makes it final */ - mng_retcode iRetcode = mng_process_eof (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->iSuspendbufleft) /* return the leftover scraps */ - MNG_COPY (pBuf, pData->pSuspendbufnext, pData->iSuspendbufleft); - /* and indicate so */ - *iRead = pData->iSuspendbufleft; - pData->pSuspendbufnext = pData->pSuspendbuf; - pData->iSuspendbufleft = 0; - } - else - { /* suspension required ? */ - if ((iSize > pData->iSuspendbufleft) && (iTemp < MNG_SUSPENDREQUESTSIZE)) - pData->bSuspended = MNG_TRUE; - - } - - pData->iSuspendpoint = 0; /* reset it here in case we loop back */ - } - - if ((!pData->bSuspended) && (!pData->bEOF)) - { /* return the data ! */ - MNG_COPY (pBuf, pData->pSuspendbufnext, iSize); - - *iRead = iSize; /* returned it all */ - /* adjust suspension-buffer variables */ - pData->pSuspendbufnext += iSize; - pData->iSuspendbufleft -= iSize; - } - } - } - else - { - iRetcode = read_data (pData, (mng_ptr)pBuf, iSize, iRead); - if (iRetcode) - return iRetcode; - if (*iRead == 0) /* suspension required ? */ - pData->bSuspended = MNG_TRUE; - } - - pData->iSuspendpoint = 0; /* safely reset it here ! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATABUFFER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode process_raw_chunk (mng_datap pData, - mng_uint8p pBuf, - mng_uint32 iBuflen) -{ - -#ifndef MNG_OPTIMIZE_CHUNKREADER - /* the table-idea & binary search code was adapted from - libpng 1.1.0 (pngread.c) */ - /* NOTE1: the table must remain sorted by chunkname, otherwise the binary - search will break !!! (ps. watch upper-/lower-case chunknames !!) */ - /* NOTE2: the layout must remain equal to the header part of all the - chunk-structures (yes, that means even the pNext and pPrev fields; - it's wasting a bit of space, but hey, the code is a lot easier) */ - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - mng_chunk_header mng_chunk_unknown = {MNG_UINT_HUH, mng_init_general, mng_free_unknown, - mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0, sizeof(mng_unknown_chunk)}; -#else - mng_chunk_header mng_chunk_unknown = {MNG_UINT_HUH, mng_init_unknown, mng_free_unknown, - mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0}; -#endif - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - - mng_chunk_header mng_chunk_table [] = - { -#ifndef MNG_SKIPCHUNK_BACK - {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_back, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back)}, -#endif -#ifndef MNG_SKIPCHUNK_BASI - {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_basi, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi)}, -#endif -#ifndef MNG_SKIPCHUNK_CLIP - {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_clip, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip)}, -#endif -#ifndef MNG_SKIPCHUNK_CLON - {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_clon, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon)}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk)}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_DEFI - {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_defi, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi)}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_dhdr, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr)}, -#endif -#ifndef MNG_SKIPCHUNK_DISC - {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc)}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DROP - {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop)}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_endl, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl)}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram)}, -#endif - {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat)}, /* 12-th element! */ - {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_iend, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend)}, - {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_ihdr, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr)}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_ijng, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng)}, -#endif - {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_ipng, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng)}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)}, - {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat)}, - {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_jhdr, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr)}, - {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_jsep, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep)}, - {MNG_UINT_JdAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)}, -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop)}, -#endif -#ifndef MNG_SKIPCHUNK_MAGN - {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_magn, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn)}, -#endif - {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_mend, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend)}, - {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_mhdr, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr)}, -#ifndef MNG_SKIPCHUNK_MOVE - {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_move, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move)}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr)}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past)}, -#endif - {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_plte, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte)}, -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_pplt, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt)}, - {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_prom, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom)}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save)}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek)}, -#endif -#ifndef MNG_SKIPCHUNK_SHOW - {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_show, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show)}, -#endif -#ifndef MNG_SKIPCHUNK_TERM - {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_term, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term)}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_bkgd, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd)}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_chrm, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm)}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0, sizeof(mng_expi)}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt)}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_fpri, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri)}, -#endif -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_gama, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama)}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_hist, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist)}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp)}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt)}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng)}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need)}, -#endif -/* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */ -/* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_phyg, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg)}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_phys, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys)}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_sbit, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit)}, -#endif -/* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt)}, -#endif - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)}, -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text)}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_time, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time)}, -#endif - {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_trns, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns)}, -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt)}, -#endif - }; - -#else /* MNG_OPTIMIZE_CHUNKINITFREE */ - - mng_chunk_header mng_chunk_table [] = - { -#ifndef MNG_SKIPCHUNK_BACK - {MNG_UINT_BACK, mng_init_back, mng_free_back, mng_read_back, mng_write_back, mng_assign_back, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_BASI - {MNG_UINT_BASI, mng_init_basi, mng_free_basi, mng_read_basi, mng_write_basi, mng_assign_basi, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_CLIP - {MNG_UINT_CLIP, mng_init_clip, mng_free_clip, mng_read_clip, mng_write_clip, mng_assign_clip, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_CLON - {MNG_UINT_CLON, mng_init_clon, mng_free_clon, mng_read_clon, mng_write_clon, mng_assign_clon, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_UINT_DBYK, mng_init_dbyk, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_DEFI - {MNG_UINT_DEFI, mng_init_defi, mng_free_defi, mng_read_defi, mng_write_defi, mng_assign_defi, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_DHDR, mng_init_dhdr, mng_free_dhdr, mng_read_dhdr, mng_write_dhdr, mng_assign_dhdr, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_DISC - {MNG_UINT_DISC, mng_init_disc, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DROP - {MNG_UINT_DROP, mng_init_drop, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_ENDL, mng_init_endl, mng_free_endl, mng_read_endl, mng_write_endl, mng_assign_endl, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {MNG_UINT_FRAM, mng_init_fram, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0}, -#endif - {MNG_UINT_IDAT, mng_init_idat, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0}, /* 12-th element! */ - {MNG_UINT_IEND, mng_init_iend, mng_free_iend, mng_read_iend, mng_write_iend, mng_assign_iend, 0, 0}, - {MNG_UINT_IHDR, mng_init_ihdr, mng_free_ihdr, mng_read_ihdr, mng_write_ihdr, mng_assign_ihdr, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_IJNG, mng_init_ijng, mng_free_ijng, mng_read_ijng, mng_write_ijng, mng_assign_ijng, 0, 0}, -#endif - {MNG_UINT_IPNG, mng_init_ipng, mng_free_ipng, mng_read_ipng, mng_write_ipng, mng_assign_ipng, 0, 0}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_JDAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0}, - {MNG_UINT_JDAT, mng_init_jdat, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0}, - {MNG_UINT_JHDR, mng_init_jhdr, mng_free_jhdr, mng_read_jhdr, mng_write_jhdr, mng_assign_jhdr, 0, 0}, - {MNG_UINT_JSEP, mng_init_jsep, mng_free_jsep, mng_read_jsep, mng_write_jsep, mng_assign_jsep, 0, 0}, - {MNG_UINT_JdAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_LOOP, mng_init_loop, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_MAGN - {MNG_UINT_MAGN, mng_init_magn, mng_free_magn, mng_read_magn, mng_write_magn, mng_assign_magn, 0, 0}, -#endif - {MNG_UINT_MEND, mng_init_mend, mng_free_mend, mng_read_mend, mng_write_mend, mng_assign_mend, 0, 0}, - {MNG_UINT_MHDR, mng_init_mhdr, mng_free_mhdr, mng_read_mhdr, mng_write_mhdr, mng_assign_mhdr, 0, 0}, -#ifndef MNG_SKIPCHUNK_MOVE - {MNG_UINT_MOVE, mng_init_move, mng_free_move, mng_read_move, mng_write_move, mng_assign_move, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_UINT_ORDR, mng_init_ordr, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_UINT_PAST, mng_init_past, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0}, -#endif - {MNG_UINT_PLTE, mng_init_plte, mng_free_plte, mng_read_plte, mng_write_plte, mng_assign_plte, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_PPLT, mng_init_pplt, mng_free_pplt, mng_read_pplt, mng_write_pplt, mng_assign_pplt, 0, 0}, - {MNG_UINT_PROM, mng_init_prom, mng_free_prom, mng_read_prom, mng_write_prom, mng_assign_prom, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_UINT_SAVE, mng_init_save, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_UINT_SEEK, mng_init_seek, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SHOW - {MNG_UINT_SHOW, mng_init_show, mng_free_show, mng_read_show, mng_write_show, mng_assign_show, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_TERM - {MNG_UINT_TERM, mng_init_term, mng_free_term, mng_read_term, mng_write_term, mng_assign_term, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_UINT_bKGD, mng_init_bkgd, mng_free_bkgd, mng_read_bkgd, mng_write_bkgd, mng_assign_bkgd, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_UINT_cHRM, mng_init_chrm, mng_free_chrm, mng_read_chrm, mng_write_chrm, mng_assign_chrm, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_UINT_eXPI, mng_init_expi, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_UINT_evNT, mng_init_evnt, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_UINT_fPRI, mng_init_fpri, mng_free_fpri, mng_read_fpri, mng_write_fpri, mng_assign_fpri, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_UINT_gAMA, mng_init_gama, mng_free_gama, mng_read_gama, mng_write_gama, mng_assign_gama, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_UINT_hIST, mng_init_hist, mng_free_hist, mng_read_hist, mng_write_hist, mng_assign_hist, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_UINT_iCCP, mng_init_iccp, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_UINT_iTXt, mng_init_itxt, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UINT_nEED, mng_init_need, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0}, -#endif -/* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */ -/* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_UINT_pHYg, mng_init_phyg, mng_free_phyg, mng_read_phyg, mng_write_phyg, mng_assign_phyg, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_UINT_pHYs, mng_init_phys, mng_free_phys, mng_read_phys, mng_write_phys, mng_assign_phys, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_UINT_sBIT, mng_init_sbit, mng_free_sbit, mng_read_sbit, mng_write_sbit, mng_assign_sbit, 0, 0}, -#endif -/* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_UINT_sPLT, mng_init_splt, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0}, -#endif - {MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0}, -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_UINT_tEXt, mng_init_text, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_UINT_tIME, mng_init_time, mng_free_time, mng_read_time, mng_write_time, mng_assign_time, 0, 0}, -#endif - {MNG_UINT_tRNS, mng_init_trns, mng_free_trns, mng_read_trns, mng_write_trns, mng_assign_trns, 0, 0}, -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_UINT_zTXt, mng_init_ztxt, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0}, -#endif - }; - -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_chunk_headerp pEntry; /* pointer to found entry */ -#else - mng_chunk_header sEntry; /* temp chunk-header */ -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - - mng_chunkid iChunkname; /* the chunk's tag */ - mng_chunkp pChunk; /* chunk structure (if #define MNG_STORE_CHUNKS) */ - mng_retcode iRetcode; /* temporary error-code */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RAW_CHUNK, MNG_LC_START); -#endif - /* reset timer indicator on read-cycle */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - /* get the chunkname */ - iChunkname = (mng_chunkid)(mng_get_uint32 (pBuf)); - - pBuf += sizeof (mng_chunkid); /* adjust the buffer */ - iBuflen -= sizeof (mng_chunkid); - pChunk = 0; - -#ifndef MNG_OPTIMIZE_CHUNKREADER - /* determine max index of table */ - iTop = (sizeof (mng_chunk_table) / sizeof (mng_chunk_table [0])) - 1; - - /* binary search; with 54 chunks, worst-case is 7 comparisons */ - iLower = 0; -#ifndef MNG_NO_DELTA_PNG - iMiddle = 11; /* start with the IDAT entry */ -#else - iMiddle = 8; -#endif - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (mng_chunk_table [iMiddle].iChunkname < iChunkname) - iLower = iMiddle + 1; - else if (mng_chunk_table [iMiddle].iChunkname > iChunkname) - iUpper = iMiddle - 1; - else - { - pEntry = &mng_chunk_table [iMiddle]; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (!pEntry) /* unknown chunk ? */ - pEntry = &mng_chunk_unknown; /* make it so! */ - -#else /* MNG_OPTIMIZE_CHUNKREADER */ - - mng_get_chunkheader (iChunkname, &sEntry); - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - - pData->iChunkname = iChunkname; /* keep track of where we are */ - pData->iChunkseq++; - -#ifndef MNG_OPTIMIZE_CHUNKREADER - if (pEntry->fRead) /* read-callback available ? */ - { - iRetcode = pEntry->fRead (pData, pEntry, iBuflen, (mng_ptr)pBuf, &pChunk); - - if (!iRetcode) /* everything oke ? */ - { /* remember unknown chunk's id */ - if ((pChunk) && (pEntry->iChunkname == MNG_UINT_HUH)) - ((mng_chunk_headerp)pChunk)->iChunkname = iChunkname; - } - } -#else /* MNG_OPTIMIZE_CHUNKREADER */ - if (sEntry.fRead) /* read-callback available ? */ - { - iRetcode = sEntry.fRead (pData, &sEntry, iBuflen, (mng_ptr)pBuf, &pChunk); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - if (!iRetcode) /* everything oke ? */ - { /* remember unknown chunk's id */ - if ((pChunk) && (sEntry.iChunkname == MNG_UINT_HUH)) - ((mng_chunk_headerp)pChunk)->iChunkname = iChunkname; - } -#endif - } -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - else - iRetcode = MNG_NOERROR; - - if (pChunk) /* store this chunk ? */ - mng_add_chunk (pData, pChunk); /* do it */ - -#ifdef MNG_INCLUDE_JNG /* implicit EOF ? */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR)) -#endif - iRetcode = mng_process_eof (pData);/* then do some EOF processing */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RAW_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode check_chunk_crc (mng_datap pData, - mng_uint8p pBuf, - mng_uint32 iBuflen) -{ - mng_uint32 iCrc; /* calculated CRC */ - mng_bool bDiscard = MNG_FALSE; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK_CRC, MNG_LC_START); -#endif - - if (pData->iCrcmode & MNG_CRC_INPUT) /* crc included ? */ - { - mng_bool bCritical = (mng_bool)((*pBuf & 0x20) == 0); - mng_uint32 iL = iBuflen - (mng_uint32)(sizeof (iCrc)); - - if (((bCritical ) && (pData->iCrcmode & MNG_CRC_CRITICAL )) || - ((!bCritical) && (pData->iCrcmode & MNG_CRC_ANCILLARY))) - { /* calculate the crc */ - iCrc = mng_crc (pData, pBuf, iL); - /* and check it */ - if (!(iCrc == mng_get_uint32 (pBuf + iL))) - { - mng_bool bWarning = MNG_FALSE; - mng_bool bError = MNG_FALSE; - - if (bCritical) - { - switch (pData->iCrcmode & MNG_CRC_CRITICAL) - { - case MNG_CRC_CRITICAL_WARNING : { bWarning = MNG_TRUE; break; } - case MNG_CRC_CRITICAL_ERROR : { bError = MNG_TRUE; break; } - } - } - else - { - switch (pData->iCrcmode & MNG_CRC_ANCILLARY) - { - case MNG_CRC_ANCILLARY_DISCARD : { bDiscard = MNG_TRUE; break; } - case MNG_CRC_ANCILLARY_WARNING : { bWarning = MNG_TRUE; break; } - case MNG_CRC_ANCILLARY_ERROR : { bError = MNG_TRUE; break; } - } - } - - if (bWarning) - MNG_WARNING (pData, MNG_INVALIDCRC); - if (bError) - MNG_ERROR (pData, MNG_INVALIDCRC); - } - } - - if (!bDiscard) /* still processing ? */ - iRetcode = process_raw_chunk (pData, pBuf, iL); - } - else - { /* no crc => straight onto processing */ - iRetcode = process_raw_chunk (pData, pBuf, iBuflen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK_CRC, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode read_chunk (mng_datap pData) -{ - mng_uint32 iBufmax = pData->iReadbufsize; - mng_uint8p pBuf = pData->pReadbuf; - mng_uint32 iBuflen = 0; /* number of bytes requested */ - mng_uint32 iRead = 0; /* number of bytes read */ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DISPLAY - if (pData->pCurraniobj) /* processing an animation object ? */ - { - do /* process it then */ - { - iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj); - /* refresh needed ? */ -/* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh)) - iRetcode = display_progressive_refresh (pData, 1); */ - /* can we advance to next object ? */ - if ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait)) - { /* reset timer indicator on read-cycle */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - - pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext; - /* TERM processing to be done ? */ - if ((!pData->pCurraniobj) && (pData->bHasTERM) && (!pData->bHasMHDR)) - iRetcode = mng_process_display_mend (pData); - } - } /* until error or a break or no more objects */ - while ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bFreezing)); - } - else - { - if (pData->iBreakpoint) /* do we need to finish something first ? */ - { - switch (pData->iBreakpoint) /* return to broken display routine */ - { -#ifndef MNG_SKIPCHUNK_FRAM - case 1 : { iRetcode = mng_process_display_fram2 (pData); break; } -#endif - case 2 : { iRetcode = mng_process_display_ihdr (pData); break; } -#ifndef MNG_SKIPCHUNK_SHOW - case 3 : ; /* same as 4 !!! */ - case 4 : { iRetcode = mng_process_display_show (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_CLON - case 5 : { iRetcode = mng_process_display_clon2 (pData); break; } -#endif -#ifdef MNG_INCLUDE_JNG - case 7 : { iRetcode = mng_process_display_jhdr (pData); break; } -#endif - case 6 : ; /* same as 8 !!! */ - case 8 : { iRetcode = mng_process_display_iend (pData); break; } -#ifndef MNG_SKIPCHUNK_MAGN - case 9 : { iRetcode = mng_process_display_magn2 (pData); break; } -#endif - case 10 : { iRetcode = mng_process_display_mend2 (pData); break; } -#ifndef MNG_SKIPCHUNK_PAST - case 11 : { iRetcode = mng_process_display_past2 (pData); break; } -#endif - } - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - /* can we continue processing now, or do we */ - /* need to wait for the timer to finish (again) ? */ -#ifdef MNG_SUPPORT_DISPLAY - if ((!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bEOF)) -#else - if (!pData->bEOF) -#endif - { -#ifdef MNG_SUPPORT_DISPLAY - /* freezing in progress ? */ - if ((pData->bFreezing) && (pData->iSuspendpoint == 0)) - pData->bRunning = MNG_FALSE; /* then this is the right moment to do it */ -#endif - - if (pData->iSuspendpoint <= 2) - { - iBuflen = sizeof (mng_uint32); /* read length */ - iRetcode = read_databuffer (pData, pBuf, &pData->pReadbufnext, iBuflen, &iRead); - - if (iRetcode) /* bail on errors */ - return iRetcode; - - if (pData->bSuspended) /* suspended ? */ - pData->iSuspendpoint = 2; - else /* save the length */ - { - pData->iChunklen = mng_get_uint32 (pBuf); - if (pData->iChunklen > 0x7ffffff) - return MNG_INVALIDLENGTH; - } - - } - - if (!pData->bSuspended) /* still going ? */ - { /* previously suspended or not eof ? */ - if ((pData->iSuspendpoint > 2) || (iRead == iBuflen)) - { /* determine length chunkname + data (+ crc) */ - if (pData->iCrcmode & MNG_CRC_INPUT) - iBuflen = pData->iChunklen + (mng_uint32)(sizeof (mng_chunkid) + sizeof (mng_uint32)); - else - iBuflen = pData->iChunklen + (mng_uint32)(sizeof (mng_chunkid)); - - /* do we have enough data in the current push buffer ? */ - if ((pData->pFirstpushdata) && (iBuflen <= pData->pFirstpushdata->iRemaining)) - { - mng_pushdatap pPush = pData->pFirstpushdata; - pBuf = pPush->pDatanext; - pPush->pDatanext += iBuflen; - pPush->iRemaining -= iBuflen; - pData->iSuspendpoint = 0; /* safely reset this here ! */ - - iRetcode = check_chunk_crc (pData, pBuf, iBuflen); - if (iRetcode) - return iRetcode; - - if (!pPush->iRemaining) /* buffer depleted? then release it */ - iRetcode = mng_release_pushdata (pData); - } - else - { - if (iBuflen < iBufmax) /* does it fit in default buffer ? */ - { /* note that we don't use the full size - so there's always a zero-byte at the - very end !!! */ - iRetcode = read_databuffer (pData, pBuf, &pData->pReadbufnext, iBuflen, &iRead); - if (iRetcode) /* bail on errors */ - return iRetcode; - - if (pData->bSuspended) /* suspended ? */ - pData->iSuspendpoint = 3; - else - { - if (iRead != iBuflen) /* did we get all the data ? */ - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - iRetcode = check_chunk_crc (pData, pBuf, iBuflen); - } - } - else - { - if (iBuflen > 16777216) /* is the length incredible? */ - MNG_ERROR (pData, MNG_IMPROBABLELENGTH); - - if (!pData->iSuspendpoint) /* create additional large buffer ? */ - { /* again reserve space for the last zero-byte */ - pData->iLargebufsize = iBuflen + 1; - pData->pLargebufnext = MNG_NULL; - MNG_ALLOC (pData, pData->pLargebuf, pData->iLargebufsize); - } - - iRetcode = read_databuffer (pData, pData->pLargebuf, &pData->pLargebufnext, iBuflen, &iRead); - if (iRetcode) - return iRetcode; - - if (pData->bSuspended) /* suspended ? */ - pData->iSuspendpoint = 4; - else - { - if (iRead != iBuflen) /* did we get all the data ? */ - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - iRetcode = check_chunk_crc (pData, pData->pLargebuf, iBuflen); - /* cleanup additional large buffer */ - MNG_FREE (pData, pData->pLargebuf, pData->iLargebufsize); - } - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - else - { /* that's final */ - iRetcode = mng_process_eof (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if ((iRead != 0) || /* did we get an unexpected eof ? */ -#ifdef MNG_INCLUDE_JNG - (pData->bHasIHDR || pData->bHasMHDR || pData->bHasJHDR)) -#else - (pData->bHasIHDR || pData->bHasMHDR)) -#endif - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - } - } - } - -#ifdef MNG_SUPPORT_DISPLAY /* refresh needed ? */ - if ((!pData->bTimerset) && (!pData->bSuspended) && (pData->bNeedrefresh)) - { - iRetcode = mng_display_progressive_refresh (pData, 1); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode process_pushedchunk (mng_datap pData) -{ - mng_pushdatap pPush; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_DISPLAY - if (pData->pCurraniobj) /* processing an animation object ? */ - { - do /* process it then */ - { - iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj); - /* refresh needed ? */ -/* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh)) - iRetcode = display_progressive_refresh (pData, 1); */ - /* can we advance to next object ? */ - if ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait)) - { /* reset timer indicator on read-cycle */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - - pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext; - /* TERM processing to be done ? */ - if ((!pData->pCurraniobj) && (pData->bHasTERM) && (!pData->bHasMHDR)) - iRetcode = mng_process_display_mend (pData); - } - } /* until error or a break or no more objects */ - while ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bFreezing)); - } - else - { - if (pData->iBreakpoint) /* do we need to finish something first ? */ - { - switch (pData->iBreakpoint) /* return to broken display routine */ - { -#ifndef MNG_SKIPCHUNK_FRAM - case 1 : { iRetcode = mng_process_display_fram2 (pData); break; } -#endif - case 2 : { iRetcode = mng_process_display_ihdr (pData); break; } -#ifndef MNG_SKIPCHUNK_SHOW - case 3 : ; /* same as 4 !!! */ - case 4 : { iRetcode = mng_process_display_show (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_CLON - case 5 : { iRetcode = mng_process_display_clon2 (pData); break; } -#endif -#ifdef MNG_INCLUDE_JNG - case 7 : { iRetcode = mng_process_display_jhdr (pData); break; } -#endif - case 6 : ; /* same as 8 !!! */ - case 8 : { iRetcode = mng_process_display_iend (pData); break; } -#ifndef MNG_SKIPCHUNK_MAGN - case 9 : { iRetcode = mng_process_display_magn2 (pData); break; } -#endif - case 10 : { iRetcode = mng_process_display_mend2 (pData); break; } -#ifndef MNG_SKIPCHUNK_PAST - case 11 : { iRetcode = mng_process_display_past2 (pData); break; } -#endif - } - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - /* can we continue processing now, or do we */ - /* need to wait for the timer to finish (again) ? */ -#ifdef MNG_SUPPORT_DISPLAY - if ((!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bEOF)) -#else - if (!pData->bEOF) -#endif - { - pData->iSuspendpoint = 0; /* safely reset it here ! */ - pPush = pData->pFirstpushchunk; - - iRetcode = process_raw_chunk (pData, pPush->pData, pPush->iLength); - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_DISPLAY /* refresh needed ? */ - if ((!pData->bTimerset) && (!pData->bSuspended) && (pData->bNeedrefresh)) - { - iRetcode = mng_display_progressive_refresh (pData, 1); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - } - - return mng_release_pushchunk (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_read_graphic (mng_datap pData) -{ - mng_uint32 iBuflen; /* number of bytes requested */ - mng_uint32 iRead; /* number of bytes read */ - mng_retcode iRetcode; /* temporary error-code */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GRAPHIC, MNG_LC_START); -#endif - - if (!pData->pReadbuf) /* buffer allocated ? */ - { - pData->iReadbufsize = 4200; /* allocate a default read buffer */ - MNG_ALLOC (pData, pData->pReadbuf, pData->iReadbufsize); - } - /* haven't processed the signature ? */ - if ((!pData->bHavesig) || (pData->iSuspendpoint == 1)) - { - iBuflen = 2 * sizeof (mng_uint32); /* read signature */ - - iRetcode = read_databuffer (pData, pData->pReadbuf, &pData->pReadbufnext, iBuflen, &iRead); - - if (iRetcode) - return iRetcode; - - if (pData->bSuspended) /* input suspension ? */ - pData->iSuspendpoint = 1; - else - { - if (iRead != iBuflen) /* full signature received ? */ - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - /* is it a valid signature ? */ - if (mng_get_uint32 (pData->pReadbuf) == PNG_SIG) - pData->eSigtype = mng_it_png; - else -#ifdef MNG_INCLUDE_JNG - if (mng_get_uint32 (pData->pReadbuf) == JNG_SIG) - pData->eSigtype = mng_it_jng; - else -#endif - if (mng_get_uint32 (pData->pReadbuf) == MNG_SIG) - pData->eSigtype = mng_it_mng; - else - MNG_ERROR (pData, MNG_INVALIDSIG); - /* all of it ? */ - if (mng_get_uint32 (pData->pReadbuf+4) != POST_SIG) - MNG_ERROR (pData, MNG_INVALIDSIG); - - pData->bHavesig = MNG_TRUE; - } - } - - if (!pData->bSuspended) /* still going ? */ - { - do - { /* reset timer during mng_read() ? */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - - if (pData->pFirstpushchunk) /* chunks pushed ? */ - iRetcode = process_pushedchunk (pData); /* process the pushed chunk */ - else - iRetcode = read_chunk (pData); /* read & process a chunk */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#ifdef MNG_SUPPORT_DISPLAY /* until EOF or a break-request */ - while (((!pData->bEOF) || (pData->pCurraniobj)) && - (!pData->bSuspended) && (!pData->bSectionwait) && - ((!pData->bTimerset) || ((pData->bReading) && (!pData->bDisplaying)))); -#else - while ((!pData->bEOF) && (!pData->bSuspended)); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GRAPHIC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_read.h b/Engine/lib/lmng/libmng_read.h deleted file mode 100644 index 119cc3e60..000000000 --- a/Engine/lib/lmng/libmng_read.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_read.h copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.8 * */ -/* * * */ -/* * purpose : Read management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the read management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - added closestream() processing for mng_cleanup() * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.8 - 04/12/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_read_h_ -#define _libmng_read_h_ - -/* ************************************************************************** */ - -mng_retcode mng_process_eof (mng_datap pData); - -mng_retcode mng_release_pushdata (mng_datap pData); - -mng_retcode mng_release_pushchunk (mng_datap pData); - -mng_retcode mng_read_graphic (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_read_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_trace.c b/Engine/lib/lmng/libmng_trace.c deleted file mode 100644 index a6a2cab2b..000000000 --- a/Engine/lib/lmng/libmng_trace.c +++ /dev/null @@ -1,1683 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_trace.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Trace functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the trace functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added trace telltale reporting * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added tracestrings for global animation color-chunks * */ -/* * - added tracestrings for get/set of default ZLIB/IJG parms * */ -/* * - added tracestrings for global PLTE,tRNS,bKGD * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added tracestrings for image-object promotion * */ -/* * - added tracestrings for delta-image processing * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added tracestrings for getalphaline callback * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added tracestring for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added tracestring for mng_read_resume HLAPI function * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added tracestrings for get/set speedtype * */ -/* * - added tracestring for get imagelevel * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added tracestring for delta-image processing * */ -/* * - added tracestrings for PPLT chunk processing * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added tracecodes for special display processing * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added tracestring for get/set suspensionmode * */ -/* * - added tracestrings for get/set display variables * */ -/* * - added tracecode for read_databuffer (I/O-suspension) * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added tracestrings for SAVE/SEEK callbacks * */ -/* * - added tracestrings for get/set sectionbreaks * */ -/* * - added tracestring for special error routine * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added tracestring for updatemngheader * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - added tracestrings for status_xxxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added tracestring for updatemngsimplicity * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * - added optional support for bKGD for PNG images * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - added routine to discard "invalid" objects * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * 1.0.5 - 10/09/2002 - G.Juyn * */ -/* * - fixed trace-constants for PAST chunk * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around JNG and Delta-PNG code * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added conditionals around various unused functions * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */ -/* * - put gamma, cms-related declarations inside #ifdef * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_TRACE_PROCS - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_TRACE_STRINGS -MNG_LOCAL mng_trace_entry const trace_table [] = - { - {MNG_FN_INITIALIZE, "initialize"}, - {MNG_FN_RESET, "reset"}, - {MNG_FN_CLEANUP, "cleanup"}, - {MNG_FN_READ, "read"}, - {MNG_FN_WRITE, "write"}, - {MNG_FN_CREATE, "create"}, - {MNG_FN_READDISPLAY, "readdisplay"}, - {MNG_FN_DISPLAY, "display"}, - {MNG_FN_DISPLAY_RESUME, "display_resume"}, - {MNG_FN_DISPLAY_FREEZE, "display_freeze"}, - {MNG_FN_DISPLAY_RESET, "display_reset"}, -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED - {MNG_FN_DISPLAY_GOFRAME, "display_goframe"}, - {MNG_FN_DISPLAY_GOLAYER, "display_golayer"}, - {MNG_FN_DISPLAY_GOTIME, "display_gotime"}, -#endif - {MNG_FN_GETLASTERROR, "getlasterror"}, - {MNG_FN_READ_RESUME, "read_resume"}, - {MNG_FN_TRAPEVENT, "trapevent"}, - {MNG_FN_READ_PUSHDATA, "read_pushdata"}, - {MNG_FN_READ_PUSHSIG, "read_pushsig"}, - {MNG_FN_READ_PUSHCHUNK, "read_pushchunk"}, - - {MNG_FN_SETCB_MEMALLOC, "setcb_memalloc"}, - {MNG_FN_SETCB_MEMFREE, "setcb_memfree"}, - {MNG_FN_SETCB_READDATA, "setcb_readdata"}, - {MNG_FN_SETCB_WRITEDATA, "setcb_writedata"}, - {MNG_FN_SETCB_ERRORPROC, "setcb_errorproc"}, - {MNG_FN_SETCB_TRACEPROC, "setcb_traceproc"}, - {MNG_FN_SETCB_PROCESSHEADER, "setcb_processheader"}, - {MNG_FN_SETCB_PROCESSTEXT, "setcb_processtext"}, - {MNG_FN_SETCB_GETCANVASLINE, "setcb_getcanvasline"}, - {MNG_FN_SETCB_GETBKGDLINE, "setcb_getbkgdline"}, - {MNG_FN_SETCB_REFRESH, "setcb_refresh"}, - {MNG_FN_SETCB_GETTICKCOUNT, "setcb_gettickcount"}, - {MNG_FN_SETCB_SETTIMER, "setcb_settimer"}, - {MNG_FN_SETCB_PROCESSGAMMA, "setcb_processgamma"}, - {MNG_FN_SETCB_PROCESSCHROMA, "setcb_processchroma"}, - {MNG_FN_SETCB_PROCESSSRGB, "setcb_processsrgb"}, - {MNG_FN_SETCB_PROCESSICCP, "setcb_processiccp"}, - {MNG_FN_SETCB_PROCESSAROW, "setcb_processarow"}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {MNG_FN_SETCB_OPENSTREAM, "setcb_openstream"}, - {MNG_FN_SETCB_CLOSESTREAM, "setcb_closestream"}, -#endif - {MNG_FN_SETCB_GETALPHALINE, "setcb_getalphaline"}, - {MNG_FN_SETCB_PROCESSSAVE, "setcb_processsave"}, - {MNG_FN_SETCB_PROCESSSEEK, "setcb_processseek"}, - {MNG_FN_SETCB_PROCESSNEED, "setcb_processneed"}, - {MNG_FN_SETCB_PROCESSUNKNOWN, "setcb_processunknown"}, - {MNG_FN_SETCB_PROCESSMEND, "setcb_processmend"}, - {MNG_FN_SETCB_PROCESSTERM, "setcb_processterm"}, - {MNG_FN_SETCB_RELEASEDATA, "setcb_releasedata"}, - - {MNG_FN_GETCB_MEMALLOC, "getcb_memalloc"}, - {MNG_FN_GETCB_MEMFREE, "getcb_memfree"}, - {MNG_FN_GETCB_READDATA, "getcb_readdata,"}, - {MNG_FN_GETCB_WRITEDATA, "getcb_writedata"}, - {MNG_FN_GETCB_ERRORPROC, "getcb_errorproc"}, - {MNG_FN_GETCB_TRACEPROC, "getcb_traceproc"}, - {MNG_FN_GETCB_PROCESSHEADER, "getcb_processheader"}, - {MNG_FN_GETCB_PROCESSTEXT, "getcb_processtext"}, - {MNG_FN_GETCB_GETCANVASLINE, "getcb_getcanvasline"}, - {MNG_FN_GETCB_GETBKGDLINE, "getcb_getbkgdline"}, - {MNG_FN_GETCB_REFRESH, "getcb_refresh"}, - {MNG_FN_GETCB_GETTICKCOUNT, "getcb_gettickcount"}, - {MNG_FN_GETCB_SETTIMER, "getcb_settimer"}, - {MNG_FN_GETCB_PROCESSGAMMA, "getcb_processgamma"}, - {MNG_FN_GETCB_PROCESSCHROMA, "getcb_processchroma"}, - {MNG_FN_GETCB_PROCESSSRGB, "getcb_processsrgb"}, - {MNG_FN_GETCB_PROCESSICCP, "getcb_processiccp"}, - {MNG_FN_GETCB_PROCESSAROW, "getcb_processarow"}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {MNG_FN_GETCB_OPENSTREAM, "getcb_openstream"}, - {MNG_FN_GETCB_CLOSESTREAM, "getcb_closestream"}, -#endif - {MNG_FN_GETCB_GETALPHALINE, "getcb_getalphaline"}, - {MNG_FN_GETCB_PROCESSSAVE, "getcb_processsave"}, - {MNG_FN_GETCB_PROCESSSEEK, "getcb_processseek"}, - {MNG_FN_GETCB_PROCESSNEED, "getcb_processneed"}, - {MNG_FN_GETCB_PROCESSUNKNOWN, "getcb_processunknown"}, - {MNG_FN_GETCB_PROCESSMEND, "getcb_processmend"}, - {MNG_FN_GETCB_PROCESSTERM, "getcb_processterm"}, - {MNG_FN_GETCB_RELEASEDATA, "getcb_releasedata"}, - - {MNG_FN_SET_USERDATA, "set_userdata"}, - {MNG_FN_SET_CANVASSTYLE, "set_canvasstyle"}, - {MNG_FN_SET_BKGDSTYLE, "set_bkgdstyle"}, - {MNG_FN_SET_BGCOLOR, "set_bgcolor"}, - {MNG_FN_SET_STORECHUNKS, "set_storechunks"}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {MNG_FN_SET_VIEWGAMMA, "set_viewgamma"}, -#ifndef MNG_NO_DFLT_INFO - {MNG_FN_SET_DISPLAYGAMMA, "set_displaygamma"}, -#endif - {MNG_FN_SET_DFLTIMGGAMMA, "set_dfltimggamma"}, -#endif - {MNG_FN_SET_SRGB, "set_srgb"}, - {MNG_FN_SET_OUTPUTPROFILE, "set_outputprofile"}, - {MNG_FN_SET_SRGBPROFILE, "set_srgbprofile"}, -#ifndef MNG_SKIP_MAXCANVAS - {MNG_FN_SET_MAXCANVASWIDTH, "set_maxcanvaswidth"}, - {MNG_FN_SET_MAXCANVASHEIGHT, "set_maxcanvasheight"}, - {MNG_FN_SET_MAXCANVASSIZE, "set_maxcanvassize"}, -#endif -#ifndef MNG_NO_ACCESS_ZLIB - {MNG_FN_SET_ZLIB_LEVEL, "set_zlib_level"}, - {MNG_FN_SET_ZLIB_METHOD, "set_zlib_method"}, - {MNG_FN_SET_ZLIB_WINDOWBITS, "set_zlib_windowbits"}, - {MNG_FN_SET_ZLIB_MEMLEVEL, "set_zlib_memlevel"}, - {MNG_FN_SET_ZLIB_STRATEGY, "set_zlib_strategy"}, - {MNG_FN_SET_ZLIB_MAXIDAT, "set_zlib_maxidat"}, -#endif -#ifndef MNG_NO_ACCESS_JPEG - {MNG_FN_SET_JPEG_DCTMETHOD, "set_jpeg_dctmethod"}, - {MNG_FN_SET_JPEG_QUALITY, "set_jpeg_quality"}, - {MNG_FN_SET_JPEG_SMOOTHING, "set_jpeg_smoothing"}, - {MNG_FN_SET_JPEG_PROGRESSIVE, "set_jpeg_progressive"}, - {MNG_FN_SET_JPEG_OPTIMIZED, "set_jpeg_optimized"}, - {MNG_FN_SET_JPEG_MAXJDAT, "set_jpeg_maxjdat"}, -#endif - {MNG_FN_SET_SPEED, "set_speed"}, - {MNG_FN_SET_SUSPENSIONMODE, "set_suspensionmode"}, - {MNG_FN_SET_SECTIONBREAKS, "set_sectionbreaks"}, - {MNG_FN_SET_USEBKGD, "set_usebkgd"}, - {MNG_FN_SET_OUTPUTPROFILE2, "set_outputprofile2"}, - {MNG_FN_SET_SRGBPROFILE2, "set_srgbprofile2"}, - {MNG_FN_SET_OUTPUTSRGB, "set_outputsrgb"}, - {MNG_FN_SET_SRGBIMPLICIT, "set_srgbimplicit"}, - {MNG_FN_SET_CACHEPLAYBACK, "set_cacheplayback"}, - {MNG_FN_SET_DOPROGRESSIVE, "set_doprogressive"}, - {MNG_FN_SET_CRCMODE, "set_crcmode"}, - - {MNG_FN_GET_USERDATA, "get_userdata"}, - {MNG_FN_GET_SIGTYPE, "get_sigtype"}, - {MNG_FN_GET_IMAGETYPE, "get_imagetype"}, - {MNG_FN_GET_IMAGEWIDTH, "get_imagewidth"}, - {MNG_FN_GET_IMAGEHEIGHT, "get_imageheight"}, - {MNG_FN_GET_TICKS, "get_ticks"}, - {MNG_FN_GET_FRAMECOUNT, "get_framecount"}, - {MNG_FN_GET_LAYERCOUNT, "get_layercount"}, - {MNG_FN_GET_PLAYTIME, "get_playtime"}, - {MNG_FN_GET_SIMPLICITY, "get_simplicity"}, - {MNG_FN_GET_CANVASSTYLE, "get_canvasstyle"}, - {MNG_FN_GET_BKGDSTYLE, "get_bkgdstyle"}, - {MNG_FN_GET_BGCOLOR, "get_bgcolor"}, - {MNG_FN_GET_STORECHUNKS, "get_storechunks"}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {MNG_FN_GET_VIEWGAMMA, "get_viewgamma"}, - {MNG_FN_GET_DISPLAYGAMMA, "get_displaygamma"}, -#ifndef MNG_NO_DFLT_INFO - {MNG_FN_GET_DFLTIMGGAMMA, "get_dfltimggamma"}, -#endif -#endif - {MNG_FN_GET_SRGB, "get_srgb"}, -#ifndef MNG_SKIP_MAXCANVAS - {MNG_FN_GET_MAXCANVASWIDTH, "get_maxcanvaswidth"}, - {MNG_FN_GET_MAXCANVASHEIGHT, "get_maxcanvasheight"}, -#endif -#ifndef MNG_NO_ACCESS_ZLIB - {MNG_FN_GET_ZLIB_LEVEL, "get_zlib_level"}, - {MNG_FN_GET_ZLIB_METHOD, "get_zlib_method"}, - {MNG_FN_GET_ZLIB_WINDOWBITS, "get_zlib_windowbits"}, - {MNG_FN_GET_ZLIB_MEMLEVEL, "get_zlib_memlevel"}, - {MNG_FN_GET_ZLIB_STRATEGY, "get_zlib_strategy"}, - {MNG_FN_GET_ZLIB_MAXIDAT, "get_zlib_maxidat"}, -#endif -#ifndef MNG_NO_ACCESS_JPEG - {MNG_FN_GET_JPEG_DCTMETHOD, "get_jpeg_dctmethod"}, - {MNG_FN_GET_JPEG_QUALITY, "get_jpeg_quality"}, - {MNG_FN_GET_JPEG_SMOOTHING, "get_jpeg_smoothing"}, - {MNG_FN_GET_JPEG_PROGRESSIVE, "get_jpeg_progressive"}, - {MNG_FN_GET_JPEG_OPTIMIZED, "get_jpeg_optimized"}, - {MNG_FN_GET_JPEG_MAXJDAT, "get_jpeg_maxjdat"}, -#endif - {MNG_FN_GET_SPEED, "get_speed"}, - {MNG_FN_GET_IMAGELEVEL, "get_imagelevel"}, - {MNG_FN_GET_SUSPENSIONMODE, "get_speed"}, - {MNG_FN_GET_STARTTIME, "get_starttime"}, - {MNG_FN_GET_RUNTIME, "get_runtime"}, -#ifndef MNG_NO_CURRENT_INFO - {MNG_FN_GET_CURRENTFRAME, "get_currentframe"}, - {MNG_FN_GET_CURRENTLAYER, "get_currentlayer"}, - {MNG_FN_GET_CURRENTPLAYTIME, "get_currentplaytime"}, -#endif - {MNG_FN_GET_SECTIONBREAKS, "get_sectionbreaks"}, - {MNG_FN_GET_ALPHADEPTH, "get_alphadepth"}, - {MNG_FN_GET_BITDEPTH, "get_bitdepth"}, - {MNG_FN_GET_COLORTYPE, "get_colortype"}, - {MNG_FN_GET_COMPRESSION, "get_compression"}, - {MNG_FN_GET_FILTER, "get_filter"}, - {MNG_FN_GET_INTERLACE, "get_interlace"}, - {MNG_FN_GET_ALPHABITDEPTH, "get_alphabitdepth"}, - {MNG_FN_GET_ALPHACOMPRESSION, "get_alphacompression"}, - {MNG_FN_GET_ALPHAFILTER, "get_alphafilter"}, - {MNG_FN_GET_ALPHAINTERLACE, "get_alphainterlace"}, - {MNG_FN_GET_USEBKGD, "get_usebkgd"}, - {MNG_FN_GET_REFRESHPASS, "get_refreshpass"}, - {MNG_FN_GET_CACHEPLAYBACK, "get_cacheplayback"}, - {MNG_FN_GET_DOPROGRESSIVE, "get_doprogressive"}, - {MNG_FN_GET_LASTBACKCHUNK, "get_lastbackchunk"}, - {MNG_FN_GET_LASTSEEKNAME, "get_lastseekname"}, -#ifndef MNG_NO_CURRENT_INFO - {MNG_FN_GET_TOTALFRAMES, "get_totalframes"}, - {MNG_FN_GET_TOTALLAYERS, "get_totallayers"}, - {MNG_FN_GET_TOTALPLAYTIME, "get_totalplaytime"}, -#endif - {MNG_FN_GET_CRCMODE, "get_crcmode"}, - {MNG_FN_GET_CURRFRAMDELAY, "get_currframdelay"}, - - {MNG_FN_STATUS_ERROR, "status_error"}, - {MNG_FN_STATUS_READING, "status_reading"}, - {MNG_FN_STATUS_SUSPENDBREAK, "status_suspendbreak"}, - {MNG_FN_STATUS_CREATING, "status_creating"}, - {MNG_FN_STATUS_WRITING, "status_writing"}, - {MNG_FN_STATUS_DISPLAYING, "status_displaying"}, - {MNG_FN_STATUS_RUNNING, "status_running"}, - {MNG_FN_STATUS_TIMERBREAK, "status_timerbreak"}, - {MNG_FN_STATUS_DYNAMIC, "status_dynamic"}, - {MNG_FN_STATUS_RUNNINGEVENT, "status_runningevent"}, - - {MNG_FN_ITERATE_CHUNKS, "iterate_chunks"}, - {MNG_FN_COPY_CHUNK, "copy_chunk"}, - - {MNG_FN_GETCHUNK_IHDR, "getchunk_ihdr"}, - {MNG_FN_GETCHUNK_PLTE, "getchunk_plte"}, - {MNG_FN_GETCHUNK_IDAT, "getchunk_idat"}, - {MNG_FN_GETCHUNK_IEND, "getchunk_iend"}, - {MNG_FN_GETCHUNK_TRNS, "getchunk_trns"}, -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_FN_GETCHUNK_GAMA, "getchunk_gama"}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_FN_GETCHUNK_CHRM, "getchunk_chrm"}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {MNG_FN_GETCHUNK_SRGB, "getchunk_srgb"}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_FN_GETCHUNK_ICCP, "getchunk_iccp"}, -#endif -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_FN_GETCHUNK_TEXT, "getchunk_text"}, -#endif -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_FN_GETCHUNK_ZTXT, "getchunk_ztxt"}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_FN_GETCHUNK_ITXT, "getchunk_itxt"}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_FN_GETCHUNK_BKGD, "getchunk_bkgd"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_FN_GETCHUNK_PHYS, "getchunk_phys"}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_FN_GETCHUNK_SBIT, "getchunk_sbit"}, -#endif -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_FN_GETCHUNK_SPLT, "getchunk_splt"}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_FN_GETCHUNK_HIST, "getchunk_hist"}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_FN_GETCHUNK_TIME, "getchunk_time"}, -#endif - {MNG_FN_GETCHUNK_MHDR, "getchunk_mhdr"}, - {MNG_FN_GETCHUNK_MEND, "getchunk_mend"}, -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_FN_GETCHUNK_LOOP, "getchunk_loop"}, - {MNG_FN_GETCHUNK_ENDL, "getchunk_endl"}, -#endif - {MNG_FN_GETCHUNK_DEFI, "getchunk_defi"}, -#ifndef MNG_SKIPCHUNK_BASI - {MNG_FN_GETCHUNK_BASI, "getchunk_basi"}, -#endif - {MNG_FN_GETCHUNK_CLON, "getchunk_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_GETCHUNK_PAST, "getchunk_past"}, -#endif - {MNG_FN_GETCHUNK_DISC, "getchunk_disc"}, - {MNG_FN_GETCHUNK_BACK, "getchunk_back"}, - {MNG_FN_GETCHUNK_FRAM, "getchunk_fram"}, - {MNG_FN_GETCHUNK_MOVE, "getchunk_move"}, - {MNG_FN_GETCHUNK_CLIP, "getchunk_clip"}, - {MNG_FN_GETCHUNK_SHOW, "getchunk_show"}, - {MNG_FN_GETCHUNK_TERM, "getchunk_term"}, -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_GETCHUNK_SAVE, "getchunk_save"}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_FN_GETCHUNK_SEEK, "getchunk_seek"}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_FN_GETCHUNK_EXPI, "getchunk_expi"}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_FN_GETCHUNK_FPRI, "getchunk_fpri"}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_FN_GETCHUNK_NEED, "getchunk_need"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_FN_GETCHUNK_PHYG, "getchunk_phyg"}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_FN_GETCHUNK_JHDR, "getchunk_jhdr"}, - {MNG_FN_GETCHUNK_JDAT, "getchunk_jdat"}, - {MNG_FN_GETCHUNK_JSEP, "getchunk_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_GETCHUNK_DHDR, "getchunk_dhdr"}, - {MNG_FN_GETCHUNK_PROM, "getchunk_prom"}, - {MNG_FN_GETCHUNK_IPNG, "getchunk_ipng"}, - {MNG_FN_GETCHUNK_PPLT, "getchunk_pplt"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_GETCHUNK_IJNG, "getchunk_ijng"}, -#endif -#ifndef MNG_SKIPCHUNK_DROP - {MNG_FN_GETCHUNK_DROP, "getchunk_drop"}, -#endif -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_FN_GETCHUNK_DBYK, "getchunk_dbyk"}, -#endif -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_FN_GETCHUNK_ORDR, "getchunk_ordr"}, -#endif -#endif - {MNG_FN_GETCHUNK_UNKNOWN, "getchunk_unknown"}, - {MNG_FN_GETCHUNK_MAGN, "getchunk_magn"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_GETCHUNK_JDAA, "getchunk_jdaa"}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_GETCHUNK_EVNT, "getchunk_evnt"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_GETCHUNK_MPNG, "getchunk_mpng"}, -#endif - -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_GETCHUNK_PAST_SRC, "getchunk_past_src"}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_GETCHUNK_SAVE_ENTRY, "getchunk_save_entry"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_GETCHUNK_PPLT_ENTRY, "getchunk_pplt_entry"}, - {MNG_FN_GETCHUNK_ORDR_ENTRY, "getchunk_ordr_entry"}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_GETCHUNK_EVNT_ENTRY, "getchunk_evnt_entry"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_GETCHUNK_MPNG_FRAME, "getchunk_mpng_frame"}, -#endif - - {MNG_FN_PUTCHUNK_IHDR, "putchunk_ihdr"}, - {MNG_FN_PUTCHUNK_PLTE, "putchunk_plte"}, - {MNG_FN_PUTCHUNK_IDAT, "putchunk_idat"}, - {MNG_FN_PUTCHUNK_IEND, "putchunk_iend"}, - {MNG_FN_PUTCHUNK_TRNS, "putchunk_trns"}, -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_FN_PUTCHUNK_GAMA, "putchunk_gama"}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_FN_PUTCHUNK_CHRM, "putchunk_chrm"}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {MNG_FN_PUTCHUNK_SRGB, "putchunk_srgb"}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_FN_PUTCHUNK_ICCP, "putchunk_iccp"}, -#endif -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_FN_PUTCHUNK_TEXT, "putchunk_text"}, -#endif -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_FN_PUTCHUNK_ZTXT, "putchunk_ztxt"}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_FN_PUTCHUNK_ITXT, "putchunk_itxt"}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_FN_PUTCHUNK_BKGD, "putchunk_bkgd"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_FN_PUTCHUNK_PHYS, "putchunk_phys"}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_FN_PUTCHUNK_SBIT, "putchunk_sbit"}, -#endif -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_FN_PUTCHUNK_SPLT, "putchunk_splt"}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_FN_PUTCHUNK_HIST, "putchunk_hist"}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_FN_PUTCHUNK_TIME, "putchunk_time"}, -#endif - {MNG_FN_PUTCHUNK_MHDR, "putchunk_mhdr"}, - {MNG_FN_PUTCHUNK_MEND, "putchunk_mend"}, - {MNG_FN_PUTCHUNK_LOOP, "putchunk_loop"}, - {MNG_FN_PUTCHUNK_ENDL, "putchunk_endl"}, - {MNG_FN_PUTCHUNK_DEFI, "putchunk_defi"}, - {MNG_FN_PUTCHUNK_BASI, "putchunk_basi"}, - {MNG_FN_PUTCHUNK_CLON, "putchunk_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PUTCHUNK_PAST, "putchunk_past"}, -#endif - {MNG_FN_PUTCHUNK_DISC, "putchunk_disc"}, - {MNG_FN_PUTCHUNK_BACK, "putchunk_back"}, - {MNG_FN_PUTCHUNK_FRAM, "putchunk_fram"}, - {MNG_FN_PUTCHUNK_MOVE, "putchunk_move"}, - {MNG_FN_PUTCHUNK_CLIP, "putchunk_clip"}, - {MNG_FN_PUTCHUNK_SHOW, "putchunk_show"}, - {MNG_FN_PUTCHUNK_TERM, "putchunk_term"}, -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_PUTCHUNK_SAVE, "putchunk_save"}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_FN_PUTCHUNK_SEEK, "putchunk_seek"}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_FN_PUTCHUNK_EXPI, "putchunk_expi"}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_FN_PUTCHUNK_FPRI, "putchunk_fpri"}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_FN_PUTCHUNK_NEED, "putchunk_need"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_FN_PUTCHUNK_PHYG, "putchunk_phyg"}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PUTCHUNK_JHDR, "putchunk_jhdr"}, - {MNG_FN_PUTCHUNK_JDAT, "putchunk_jdat"}, - {MNG_FN_PUTCHUNK_JSEP, "putchunk_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PUTCHUNK_DHDR, "putchunk_dhdr"}, - {MNG_FN_PUTCHUNK_PROM, "putchunk_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PUTCHUNK_IPNG, "putchunk_ipng"}, -#endif - {MNG_FN_PUTCHUNK_PPLT, "putchunk_pplt"}, - {MNG_FN_PUTCHUNK_IJNG, "putchunk_ijng"}, -#ifndef MNG_SKIPCHUNK_DROP - {MNG_FN_PUTCHUNK_DROP, "putchunk_drop"}, -#endif -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_FN_PUTCHUNK_DBYK, "putchunk_dbyk"}, -#endif -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_FN_PUTCHUNK_ORDR, "putchunk_ordr"}, -#endif -#endif - {MNG_FN_PUTCHUNK_UNKNOWN, "putchunk_unknown"}, - {MNG_FN_PUTCHUNK_MAGN, "putchunk_magn"}, - {MNG_FN_PUTCHUNK_JDAA, "putchunk_jdaa"}, -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_PUTCHUNK_EVNT, "putchunk_evnt"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_PUTCHUNK_MPNG, "putchunk_mpng"}, -#endif - -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PUTCHUNK_PAST_SRC, "putchunk_past_src"}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_PUTCHUNK_SAVE_ENTRY, "putchunk_save_entry"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PUTCHUNK_PPLT_ENTRY, "putchunk_pplt_entry"}, -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_FN_PUTCHUNK_ORDR_ENTRY, "putchunk_ordr_entry"}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_PUTCHUNK_EVNT_ENTRY, "putchunk_evnt_entry"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_PUTCHUNK_MPNG_FRAME, "putchunk_mpng_frame"}, -#endif - - {MNG_FN_GETIMGDATA_SEQ, "getimgdata_seq"}, - {MNG_FN_GETIMGDATA_CHUNKSEQ, "getimgdata_chunkseq"}, - {MNG_FN_GETIMGDATA_CHUNK, "getimgdata_chunk"}, - - {MNG_FN_PUTIMGDATA_IHDR, "putimgdata_ihdr"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PUTIMGDATA_JHDR, "putimgdata_jhdr"}, - {MNG_FN_PUTIMGDATA_BASI, "putimgdata_basi"}, - {MNG_FN_PUTIMGDATA_DHDR, "putimgdata_dhdr"}, -#endif - - {MNG_FN_UPDATEMNGHEADER, "updatemngheader"}, - {MNG_FN_UPDATEMNGSIMPLICITY, "updatemngsimplicity"}, - - {MNG_FN_PROCESS_RAW_CHUNK, "process_raw_chunk"}, - {MNG_FN_READ_GRAPHIC, "read_graphic"}, - {MNG_FN_DROP_CHUNKS, "drop_chunks"}, - {MNG_FN_PROCESS_ERROR, "process_error"}, - {MNG_FN_CLEAR_CMS, "clear_cms"}, - {MNG_FN_DROP_OBJECTS, "drop_objects"}, - {MNG_FN_READ_CHUNK, "read_chunk"}, - {MNG_FN_LOAD_BKGDLAYER, "load_bkgdlayer"}, - {MNG_FN_NEXT_FRAME, "next_frame"}, - {MNG_FN_NEXT_LAYER, "next_layer"}, - {MNG_FN_INTERFRAME_DELAY, "interframe_delay"}, - {MNG_FN_DISPLAY_IMAGE, "display_image"}, - {MNG_FN_DROP_IMGOBJECTS, "drop_imgobjects"}, - {MNG_FN_DROP_ANIOBJECTS, "drop_aniobjects"}, - {MNG_FN_INFLATE_BUFFER, "inflate_buffer"}, - {MNG_FN_DEFLATE_BUFFER, "deflate_buffer"}, - {MNG_FN_WRITE_RAW_CHUNK, "write_raw_chunk"}, - {MNG_FN_WRITE_GRAPHIC, "write_graphic"}, - {MNG_FN_SAVE_STATE, "save_state"}, - {MNG_FN_RESTORE_STATE, "restore_state"}, - {MNG_FN_DROP_SAVEDATA, "drop_savedata"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_EXECUTE_DELTA_IMAGE, "execute_delta_image"}, -#endif - {MNG_FN_PROCESS_DISPLAY, "process_display"}, - {MNG_FN_CLEAR_CANVAS, "clear_canvas"}, - {MNG_FN_READ_DATABUFFER, "read_databuffer"}, - {MNG_FN_STORE_ERROR, "store_error"}, - {MNG_FN_DROP_INVALID_OBJECTS, "drop_invalid_objects"}, - {MNG_FN_RELEASE_PUSHDATA, "release_pushdata"}, - {MNG_FN_READ_DATA, "read_data"}, - {MNG_FN_READ_CHUNK_CRC, "read_chunk_crc"}, - {MNG_FN_RELEASE_PUSHCHUNK, "release_pushchunk"}, - - {MNG_FN_DISPLAY_RGB8, "display_rgb8"}, - {MNG_FN_DISPLAY_RGBA8, "display_rgba8"}, - {MNG_FN_DISPLAY_ARGB8, "display_argb8"}, - {MNG_FN_DISPLAY_BGR8, "display_bgr8"}, - {MNG_FN_DISPLAY_BGRA8, "display_bgra8"}, - {MNG_FN_DISPLAY_ABGR8, "display_abgr8"}, - {MNG_FN_DISPLAY_RGB16, "display_rgb16"}, - {MNG_FN_DISPLAY_RGBA16, "display_rgba16"}, - {MNG_FN_DISPLAY_ARGB16, "display_argb16"}, - {MNG_FN_DISPLAY_BGR16, "display_bgr16"}, - {MNG_FN_DISPLAY_BGRA16, "display_bgra16"}, - {MNG_FN_DISPLAY_ABGR16, "display_abgr16"}, - {MNG_FN_DISPLAY_INDEX8, "display_index8"}, - {MNG_FN_DISPLAY_INDEXA8, "display_indexa8"}, - {MNG_FN_DISPLAY_AINDEX8, "display_aindex8"}, - {MNG_FN_DISPLAY_GRAY8, "display_gray8"}, - {MNG_FN_DISPLAY_GRAY16, "display_gray16"}, - {MNG_FN_DISPLAY_GRAYA8, "display_graya8"}, - {MNG_FN_DISPLAY_GRAYA16, "display_graya16"}, - {MNG_FN_DISPLAY_AGRAY8, "display_agray8"}, - {MNG_FN_DISPLAY_AGRAY16, "display_agray16"}, - {MNG_FN_DISPLAY_DX15, "display_dx15"}, - {MNG_FN_DISPLAY_DX16, "display_dx16"}, - {MNG_FN_DISPLAY_RGB8_A8, "display_rgb8_a8"}, - {MNG_FN_DISPLAY_BGRA8PM, "display_bgra8_pm"}, - {MNG_FN_DISPLAY_BGRX8, "display_bgrx8"}, - {MNG_FN_DISPLAY_RGB565, "display_rgb565"}, - {MNG_FN_DISPLAY_RGBA565, "display_rgba565"}, - {MNG_FN_DISPLAY_BGR565, "display_bgr565"}, - {MNG_FN_DISPLAY_BGRA565, "display_bgra565"}, - {MNG_FN_DISPLAY_RGBA8_PM, "display_rgba8_pm"}, - {MNG_FN_DISPLAY_ARGB8_PM, "display_argb8_pm"}, - {MNG_FN_DISPLAY_ABGR8_PM, "display_abgr8_pm"}, - {MNG_FN_DISPLAY_BGR565_A8, "display_bgr565_a8"}, - - {MNG_FN_INIT_FULL_CMS, "init_full_cms"}, - {MNG_FN_CORRECT_FULL_CMS, "correct_full_cms"}, - {MNG_FN_INIT_GAMMA_ONLY, "init_gamma_only"}, - {MNG_FN_CORRECT_GAMMA_ONLY, "correct_gamma_only"}, - {MNG_FN_CORRECT_APP_CMS, "correct_app_cms"}, - {MNG_FN_INIT_FULL_CMS_OBJ, "init_full_cms_obj"}, - {MNG_FN_INIT_GAMMA_ONLY_OBJ, "init_gamma_only_obj"}, - {MNG_FN_INIT_APP_CMS, "init_app_cms"}, - {MNG_FN_INIT_APP_CMS_OBJ, "init_app_cms_obj"}, - - {MNG_FN_PROCESS_G1, "process_g1"}, - {MNG_FN_PROCESS_G2, "process_g2"}, - {MNG_FN_PROCESS_G4, "process_g4"}, - {MNG_FN_PROCESS_G8, "process_g8"}, - {MNG_FN_PROCESS_G16, "process_g16"}, - {MNG_FN_PROCESS_RGB8, "process_rgb8"}, - {MNG_FN_PROCESS_RGB16, "process_rgb16"}, - {MNG_FN_PROCESS_IDX1, "process_idx1"}, - {MNG_FN_PROCESS_IDX2, "process_idx2"}, - {MNG_FN_PROCESS_IDX4, "process_idx4"}, - {MNG_FN_PROCESS_IDX8, "process_idx8"}, - {MNG_FN_PROCESS_GA8, "process_ga8"}, - {MNG_FN_PROCESS_GA16, "process_ga16"}, - {MNG_FN_PROCESS_RGBA8, "process_rgba8"}, - {MNG_FN_PROCESS_RGBA16, "process_rgba16"}, - - {MNG_FN_INIT_G1_I, "init_g1_i"}, - {MNG_FN_INIT_G2_I, "init_g2_i"}, - {MNG_FN_INIT_G4_I, "init_g4_i"}, - {MNG_FN_INIT_G8_I, "init_g8_i"}, - {MNG_FN_INIT_G16_I, "init_g16_i"}, - {MNG_FN_INIT_RGB8_I, "init_rgb8_i"}, - {MNG_FN_INIT_RGB16_I, "init_rgb16_i"}, - {MNG_FN_INIT_IDX1_I, "init_idx1_i"}, - {MNG_FN_INIT_IDX2_I, "init_idx2_i"}, - {MNG_FN_INIT_IDX4_I, "init_idx4_i"}, - {MNG_FN_INIT_IDX8_I, "init_idx8_i"}, - {MNG_FN_INIT_GA8_I, "init_ga8_i"}, - {MNG_FN_INIT_GA16_I, "init_ga16_i"}, - {MNG_FN_INIT_RGBA8_I, "init_rgba8_i"}, - {MNG_FN_INIT_RGBA16_I, "init_rgba16_i"}, -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT - {MNG_FN_INIT_G1_NI, "init_g1_ni"}, - {MNG_FN_INIT_G2_NI, "init_g2_ni"}, - {MNG_FN_INIT_G4_NI, "init_g4_ni"}, - {MNG_FN_INIT_G8_NI, "init_g8_ni"}, - {MNG_FN_INIT_G16_NI, "init_g16_ni"}, - {MNG_FN_INIT_RGB8_NI, "init_rgb8_ni"}, - {MNG_FN_INIT_RGB16_NI, "init_rgb16_ni"}, - {MNG_FN_INIT_IDX1_NI, "init_idx1_ni"}, - {MNG_FN_INIT_IDX2_NI, "init_idx2_ni"}, - {MNG_FN_INIT_IDX4_NI, "init_idx4_ni"}, - {MNG_FN_INIT_IDX8_NI, "init_idx8_ni"}, - {MNG_FN_INIT_GA8_NI, "init_ga8_ni"}, - {MNG_FN_INIT_GA16_NI, "init_ga16_ni"}, - {MNG_FN_INIT_RGBA8_NI, "init_rgba8_ni"}, - {MNG_FN_INIT_RGBA16_NI, "init_rgba16_ni"}, -#endif - - {MNG_FN_INIT_ROWPROC, "init_rowproc"}, - {MNG_FN_NEXT_ROW, "next_row"}, - {MNG_FN_CLEANUP_ROWPROC, "cleanup_rowproc"}, - - {MNG_FN_FILTER_A_ROW, "filter_a_row"}, - {MNG_FN_FILTER_SUB, "filter_sub"}, - {MNG_FN_FILTER_UP, "filter_up"}, - {MNG_FN_FILTER_AVERAGE, "filter_average"}, - {MNG_FN_FILTER_PAETH, "filter_paeth"}, - - {MNG_FN_INIT_ROWDIFFERING, "init_rowdiffering"}, - {MNG_FN_DIFFER_G1, "differ_g1"}, - {MNG_FN_DIFFER_G2, "differ_g2"}, - {MNG_FN_DIFFER_G4, "differ_g4"}, - {MNG_FN_DIFFER_G8, "differ_g8"}, - {MNG_FN_DIFFER_G16, "differ_g16"}, - {MNG_FN_DIFFER_RGB8, "differ_rgb8"}, - {MNG_FN_DIFFER_RGB16, "differ_rgb16"}, - {MNG_FN_DIFFER_IDX1, "differ_idx1"}, - {MNG_FN_DIFFER_IDX2, "differ_idx2"}, - {MNG_FN_DIFFER_IDX4, "differ_idx4"}, - {MNG_FN_DIFFER_IDX8, "differ_idx8"}, - {MNG_FN_DIFFER_GA8, "differ_ga8"}, - {MNG_FN_DIFFER_GA16, "differ_ga16"}, - {MNG_FN_DIFFER_RGBA8, "differ_rgba8"}, - {MNG_FN_DIFFER_RGBA16, "differ_rgba16"}, - - {MNG_FN_CREATE_IMGDATAOBJECT, "create_imgdataobject"}, - {MNG_FN_FREE_IMGDATAOBJECT, "free_imgdataobject"}, - {MNG_FN_CLONE_IMGDATAOBJECT, "clone_imgdataobject"}, - {MNG_FN_CREATE_IMGOBJECT, "create_imgobject"}, - {MNG_FN_FREE_IMGOBJECT, "free_imgobject"}, - {MNG_FN_FIND_IMGOBJECT, "find_imgobject"}, - {MNG_FN_CLONE_IMGOBJECT, "clone_imgobject"}, - {MNG_FN_RESET_OBJECTDETAILS, "reset_objectdetails"}, - {MNG_FN_RENUM_IMGOBJECT, "renum_imgobject"}, - {MNG_FN_PROMOTE_IMGOBJECT, "promote_imgobject"}, - {MNG_FN_MAGNIFY_IMGOBJECT, "magnify_imgobject"}, - {MNG_FN_COLORCORRECT_OBJECT, "colorcorrect_object"}, - - {MNG_FN_STORE_G1, "store_g1"}, - {MNG_FN_STORE_G2, "store_g2"}, - {MNG_FN_STORE_G4, "store_g4"}, - {MNG_FN_STORE_G8, "store_g8"}, - {MNG_FN_STORE_G16, "store_g16"}, - {MNG_FN_STORE_RGB8, "store_rgb8"}, - {MNG_FN_STORE_RGB16, "store_rgb16"}, - {MNG_FN_STORE_IDX1, "store_idx1"}, - {MNG_FN_STORE_IDX2, "store_idx2"}, - {MNG_FN_STORE_IDX4, "store_idx4"}, - {MNG_FN_STORE_IDX8, "store_idx8"}, - {MNG_FN_STORE_GA8, "store_ga8"}, - {MNG_FN_STORE_GA16, "store_ga16"}, - {MNG_FN_STORE_RGBA8, "store_rgba8"}, - {MNG_FN_STORE_RGBA16, "store_rgba16"}, - - {MNG_FN_RETRIEVE_G8, "retrieve_g8"}, - {MNG_FN_RETRIEVE_G16, "retrieve_g16"}, - {MNG_FN_RETRIEVE_RGB8, "retrieve_rgb8"}, - {MNG_FN_RETRIEVE_RGB16, "retrieve_rgb16"}, - {MNG_FN_RETRIEVE_IDX8, "retrieve_idx8"}, - {MNG_FN_RETRIEVE_GA8, "retrieve_ga8"}, - {MNG_FN_RETRIEVE_GA16, "retrieve_ga16"}, - {MNG_FN_RETRIEVE_RGBA8, "retrieve_rgba8"}, - {MNG_FN_RETRIEVE_RGBA16, "retrieve_rgba16"}, - -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_DELTA_G1, "delta_g1"}, - {MNG_FN_DELTA_G2, "delta_g2"}, - {MNG_FN_DELTA_G4, "delta_g4"}, - {MNG_FN_DELTA_G8, "delta_g8"}, - {MNG_FN_DELTA_G16, "delta_g16"}, - {MNG_FN_DELTA_RGB8, "delta_rgb8"}, - {MNG_FN_DELTA_RGB16, "delta_rgb16"}, - {MNG_FN_DELTA_IDX1, "delta_idx1"}, - {MNG_FN_DELTA_IDX2, "delta_idx2"}, - {MNG_FN_DELTA_IDX4, "delta_idx4"}, - {MNG_FN_DELTA_IDX8, "delta_idx8"}, - {MNG_FN_DELTA_GA8, "delta_ga8"}, - {MNG_FN_DELTA_GA16, "delta_ga16"}, - {MNG_FN_DELTA_RGBA8, "delta_rgba8"}, - {MNG_FN_DELTA_RGBA16, "delta_rgba16"}, -#endif - - {MNG_FN_CREATE_ANI_LOOP, "create_ani_loop"}, - {MNG_FN_CREATE_ANI_ENDL, "create_ani_endl"}, - {MNG_FN_CREATE_ANI_DEFI, "create_ani_defi"}, - {MNG_FN_CREATE_ANI_BASI, "create_ani_basi"}, - {MNG_FN_CREATE_ANI_CLON, "create_ani_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_CREATE_ANI_PAST, "create_ani_past"}, -#endif - {MNG_FN_CREATE_ANI_DISC, "create_ani_disc"}, - {MNG_FN_CREATE_ANI_BACK, "create_ani_back"}, - {MNG_FN_CREATE_ANI_FRAM, "create_ani_fram"}, - {MNG_FN_CREATE_ANI_MOVE, "create_ani_move"}, - {MNG_FN_CREATE_ANI_CLIP, "create_ani_clip"}, - {MNG_FN_CREATE_ANI_SHOW, "create_ani_show"}, - {MNG_FN_CREATE_ANI_TERM, "create_ani_term"}, - {MNG_FN_CREATE_ANI_SAVE, "create_ani_save"}, - {MNG_FN_CREATE_ANI_SEEK, "create_ani_seek"}, - {MNG_FN_CREATE_ANI_GAMA, "create_ani_gama"}, - {MNG_FN_CREATE_ANI_CHRM, "create_ani_chrm"}, - {MNG_FN_CREATE_ANI_SRGB, "create_ani_srgb"}, - {MNG_FN_CREATE_ANI_ICCP, "create_ani_iccp"}, - {MNG_FN_CREATE_ANI_PLTE, "create_ani_plte"}, - {MNG_FN_CREATE_ANI_TRNS, "create_ani_trns"}, - {MNG_FN_CREATE_ANI_BKGD, "create_ani_bkgd"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_CREATE_ANI_DHDR, "create_ani_dhdr"}, - {MNG_FN_CREATE_ANI_PROM, "create_ani_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_CREATE_ANI_IPNG, "create_ani_ipng"}, -#endif - {MNG_FN_CREATE_ANI_IJNG, "create_ani_ijng"}, - {MNG_FN_CREATE_ANI_PPLT, "create_ani_pplt"}, -#endif - {MNG_FN_CREATE_ANI_MAGN, "create_ani_magn"}, - - {MNG_FN_CREATE_ANI_IMAGE, "create_ani_image"}, - {MNG_FN_CREATE_EVENT, "create_event"}, - - {MNG_FN_FREE_ANI_LOOP, "free_ani_loop"}, - {MNG_FN_FREE_ANI_ENDL, "free_ani_endl"}, - {MNG_FN_FREE_ANI_DEFI, "free_ani_defi"}, - {MNG_FN_FREE_ANI_BASI, "free_ani_basi"}, - {MNG_FN_FREE_ANI_CLON, "free_ani_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_FREE_ANI_PAST, "free_ani_past"}, -#endif - {MNG_FN_FREE_ANI_DISC, "free_ani_disc"}, - {MNG_FN_FREE_ANI_BACK, "free_ani_back"}, - {MNG_FN_FREE_ANI_FRAM, "free_ani_fram"}, - {MNG_FN_FREE_ANI_MOVE, "free_ani_move"}, - {MNG_FN_FREE_ANI_CLIP, "free_ani_clip"}, - {MNG_FN_FREE_ANI_SHOW, "free_ani_show"}, - {MNG_FN_FREE_ANI_TERM, "free_ani_term"}, - {MNG_FN_FREE_ANI_SAVE, "free_ani_save"}, - {MNG_FN_FREE_ANI_SEEK, "free_ani_seek"}, - {MNG_FN_FREE_ANI_GAMA, "free_ani_gama"}, - {MNG_FN_FREE_ANI_CHRM, "free_ani_chrm"}, - {MNG_FN_FREE_ANI_SRGB, "free_ani_srgb"}, - {MNG_FN_FREE_ANI_ICCP, "free_ani_iccp"}, - {MNG_FN_FREE_ANI_PLTE, "free_ani_plte"}, - {MNG_FN_FREE_ANI_TRNS, "free_ani_trns"}, - {MNG_FN_FREE_ANI_BKGD, "free_ani_bkgd"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_FREE_ANI_DHDR, "free_ani_dhdr"}, - {MNG_FN_FREE_ANI_PROM, "free_ani_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_FREE_ANI_IPNG, "free_ani_ipng"}, -#endif - {MNG_FN_FREE_ANI_IJNG, "free_ani_ijng"}, - {MNG_FN_FREE_ANI_PPLT, "free_ani_pplt"}, -#endif - {MNG_FN_FREE_ANI_MAGN, "free_ani_magn"}, - - {MNG_FN_FREE_ANI_IMAGE, "free_ani_image"}, - {MNG_FN_FREE_EVENT, "free_event"}, - - {MNG_FN_PROCESS_ANI_LOOP, "process_ani_loop"}, - {MNG_FN_PROCESS_ANI_ENDL, "process_ani_endl"}, - {MNG_FN_PROCESS_ANI_DEFI, "process_ani_defi"}, - {MNG_FN_PROCESS_ANI_BASI, "process_ani_basi"}, - {MNG_FN_PROCESS_ANI_CLON, "process_ani_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PROCESS_ANI_PAST, "process_ani_past"}, -#endif - {MNG_FN_PROCESS_ANI_DISC, "process_ani_disc"}, - {MNG_FN_PROCESS_ANI_BACK, "process_ani_back"}, - {MNG_FN_PROCESS_ANI_FRAM, "process_ani_fram"}, - {MNG_FN_PROCESS_ANI_MOVE, "process_ani_move"}, - {MNG_FN_PROCESS_ANI_CLIP, "process_ani_clip"}, - {MNG_FN_PROCESS_ANI_SHOW, "process_ani_show"}, - {MNG_FN_PROCESS_ANI_TERM, "process_ani_term"}, - {MNG_FN_PROCESS_ANI_SAVE, "process_ani_save"}, - {MNG_FN_PROCESS_ANI_SEEK, "process_ani_seek"}, - {MNG_FN_PROCESS_ANI_GAMA, "process_ani_gama"}, - {MNG_FN_PROCESS_ANI_CHRM, "process_ani_chrm"}, - {MNG_FN_PROCESS_ANI_SRGB, "process_ani_srgb"}, - {MNG_FN_PROCESS_ANI_ICCP, "process_ani_iccp"}, - {MNG_FN_PROCESS_ANI_PLTE, "process_ani_plte"}, - {MNG_FN_PROCESS_ANI_TRNS, "process_ani_trns"}, - {MNG_FN_PROCESS_ANI_BKGD, "process_ani_bkgd"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PROCESS_ANI_DHDR, "process_ani_dhdr"}, - {MNG_FN_PROCESS_ANI_PROM, "process_ani_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PROCESS_ANI_IPNG, "process_ani_ipng"}, -#endif - {MNG_FN_PROCESS_ANI_IJNG, "process_ani_ijng"}, - {MNG_FN_PROCESS_ANI_PPLT, "process_ani_pplt"}, -#endif - {MNG_FN_PROCESS_ANI_MAGN, "process_ani_magn"}, - - {MNG_FN_PROCESS_ANI_IMAGE, "process_ani_image"}, - {MNG_FN_PROCESS_EVENT, "process_event"}, - - {MNG_FN_RESTORE_BACKIMAGE, "restore_backimage"}, - {MNG_FN_RESTORE_BACKCOLOR, "restore_backcolor"}, - {MNG_FN_RESTORE_BGCOLOR, "restore_bgcolor"}, - {MNG_FN_RESTORE_RGB8, "restore_rgb8"}, - {MNG_FN_RESTORE_BGR8, "restore_bgr8"}, - {MNG_FN_RESTORE_BKGD, "restore_bkgd"}, - {MNG_FN_RESTORE_BGRX8, "restore_bgrx8"}, - {MNG_FN_RESTORE_RGB565, "restore_rgb565"}, - - {MNG_FN_INIT_IHDR, "init_ihdr"}, - {MNG_FN_INIT_PLTE, "init_plte"}, - {MNG_FN_INIT_IDAT, "init_idat"}, - {MNG_FN_INIT_IEND, "init_iend"}, - {MNG_FN_INIT_TRNS, "init_trns"}, - {MNG_FN_INIT_GAMA, "init_gama"}, - {MNG_FN_INIT_CHRM, "init_chrm"}, - {MNG_FN_INIT_SRGB, "init_srgb"}, - {MNG_FN_INIT_ICCP, "init_iccp"}, - {MNG_FN_INIT_TEXT, "init_text"}, - {MNG_FN_INIT_ZTXT, "init_ztxt"}, - {MNG_FN_INIT_ITXT, "init_itxt"}, - {MNG_FN_INIT_BKGD, "init_bkgd"}, - {MNG_FN_INIT_PHYS, "init_phys"}, - {MNG_FN_INIT_SBIT, "init_sbit"}, - {MNG_FN_INIT_SPLT, "init_splt"}, - {MNG_FN_INIT_HIST, "init_hist"}, - {MNG_FN_INIT_TIME, "init_time"}, - {MNG_FN_INIT_MHDR, "init_mhdr"}, - {MNG_FN_INIT_MEND, "init_mend"}, - {MNG_FN_INIT_LOOP, "init_loop"}, - {MNG_FN_INIT_ENDL, "init_endl"}, - {MNG_FN_INIT_DEFI, "init_defi"}, - {MNG_FN_INIT_BASI, "init_basi"}, - {MNG_FN_INIT_CLON, "init_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_INIT_PAST, "init_past"}, -#endif - {MNG_FN_INIT_DISC, "init_disc"}, - {MNG_FN_INIT_BACK, "init_back"}, - {MNG_FN_INIT_FRAM, "init_fram"}, - {MNG_FN_INIT_MOVE, "init_move"}, - {MNG_FN_INIT_CLIP, "init_clip"}, - {MNG_FN_INIT_SHOW, "init_show"}, - {MNG_FN_INIT_TERM, "init_term"}, - {MNG_FN_INIT_SAVE, "init_save"}, - {MNG_FN_INIT_SEEK, "init_seek"}, - {MNG_FN_INIT_EXPI, "init_expi"}, - {MNG_FN_INIT_FPRI, "init_fpri"}, - {MNG_FN_INIT_NEED, "init_need"}, - {MNG_FN_INIT_PHYG, "init_phyg"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_INIT_JHDR, "init_jhdr"}, - {MNG_FN_INIT_JDAT, "init_jdat"}, - {MNG_FN_INIT_JSEP, "init_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_INIT_DHDR, "init_dhdr"}, - {MNG_FN_INIT_PROM, "init_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_INIT_IPNG, "init_ipng"}, -#endif - {MNG_FN_INIT_PPLT, "init_pplt"}, - {MNG_FN_INIT_IJNG, "init_ijng"}, - {MNG_FN_INIT_DROP, "init_drop"}, - {MNG_FN_INIT_DBYK, "init_dbyk"}, - {MNG_FN_INIT_ORDR, "init_ordr"}, -#endif - {MNG_FN_INIT_UNKNOWN, "init_unknown"}, - {MNG_FN_INIT_MAGN, "init_magn"}, - {MNG_FN_INIT_JDAA, "init_jdaa"}, - {MNG_FN_INIT_EVNT, "init_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_INIT_MPNG, "init_mpng"}, -#endif - - {MNG_FN_ASSIGN_IHDR, "assign_ihdr"}, - {MNG_FN_ASSIGN_PLTE, "assign_plte"}, - {MNG_FN_ASSIGN_IDAT, "assign_idat"}, - {MNG_FN_ASSIGN_IEND, "assign_iend"}, - {MNG_FN_ASSIGN_TRNS, "assign_trns"}, - {MNG_FN_ASSIGN_GAMA, "assign_gama"}, - {MNG_FN_ASSIGN_CHRM, "assign_chrm"}, - {MNG_FN_ASSIGN_SRGB, "assign_srgb"}, - {MNG_FN_ASSIGN_ICCP, "assign_iccp"}, - {MNG_FN_ASSIGN_TEXT, "assign_text"}, - {MNG_FN_ASSIGN_ZTXT, "assign_ztxt"}, - {MNG_FN_ASSIGN_ITXT, "assign_itxt"}, - {MNG_FN_ASSIGN_BKGD, "assign_bkgd"}, - {MNG_FN_ASSIGN_PHYS, "assign_phys"}, - {MNG_FN_ASSIGN_SBIT, "assign_sbit"}, - {MNG_FN_ASSIGN_SPLT, "assign_splt"}, - {MNG_FN_ASSIGN_HIST, "assign_hist"}, - {MNG_FN_ASSIGN_TIME, "assign_time"}, - {MNG_FN_ASSIGN_MHDR, "assign_mhdr"}, - {MNG_FN_ASSIGN_MEND, "assign_mend"}, - {MNG_FN_ASSIGN_LOOP, "assign_loop"}, - {MNG_FN_ASSIGN_ENDL, "assign_endl"}, - {MNG_FN_ASSIGN_DEFI, "assign_defi"}, - {MNG_FN_ASSIGN_BASI, "assign_basi"}, - {MNG_FN_ASSIGN_CLON, "assign_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_ASSIGN_PAST, "assign_past"}, -#endif - {MNG_FN_ASSIGN_DISC, "assign_disc"}, - {MNG_FN_ASSIGN_BACK, "assign_back"}, - {MNG_FN_ASSIGN_FRAM, "assign_fram"}, - {MNG_FN_ASSIGN_MOVE, "assign_move"}, - {MNG_FN_ASSIGN_CLIP, "assign_clip"}, - {MNG_FN_ASSIGN_SHOW, "assign_show"}, - {MNG_FN_ASSIGN_TERM, "assign_term"}, - {MNG_FN_ASSIGN_SAVE, "assign_save"}, - {MNG_FN_ASSIGN_SEEK, "assign_seek"}, - {MNG_FN_ASSIGN_EXPI, "assign_expi"}, - {MNG_FN_ASSIGN_FPRI, "assign_fpri"}, - {MNG_FN_ASSIGN_NEED, "assign_need"}, - {MNG_FN_ASSIGN_PHYG, "assign_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_ASSIGN_JHDR, "assign_jhdr"}, - {MNG_FN_ASSIGN_JDAT, "assign_jdat"}, - {MNG_FN_ASSIGN_JSEP, "assign_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_ASSIGN_DHDR, "assign_dhdr"}, - {MNG_FN_ASSIGN_PROM, "assign_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_ASSIGN_IPNG, "assign_ipng"}, -#endif - {MNG_FN_ASSIGN_PPLT, "assign_pplt"}, - {MNG_FN_ASSIGN_IJNG, "assign_ijng"}, - {MNG_FN_ASSIGN_DROP, "assign_drop"}, - {MNG_FN_ASSIGN_DBYK, "assign_dbyk"}, - {MNG_FN_ASSIGN_ORDR, "assign_ordr"}, -#endif - {MNG_FN_ASSIGN_UNKNOWN, "assign_unknown"}, - {MNG_FN_ASSIGN_MAGN, "assign_magn"}, - {MNG_FN_ASSIGN_JDAA, "assign_jdaa"}, - {MNG_FN_ASSIGN_EVNT, "assign_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_ASSIGN_MPNG, "assign_mpng"}, -#endif - - {MNG_FN_FREE_IHDR, "free_ihdr"}, - {MNG_FN_FREE_PLTE, "free_plte"}, - {MNG_FN_FREE_IDAT, "free_idat"}, - {MNG_FN_FREE_IEND, "free_iend"}, - {MNG_FN_FREE_TRNS, "free_trns"}, - {MNG_FN_FREE_GAMA, "free_gama"}, - {MNG_FN_FREE_CHRM, "free_chrm"}, - {MNG_FN_FREE_SRGB, "free_srgb"}, - {MNG_FN_FREE_ICCP, "free_iccp"}, - {MNG_FN_FREE_TEXT, "free_text"}, - {MNG_FN_FREE_ZTXT, "free_ztxt"}, - {MNG_FN_FREE_ITXT, "free_itxt"}, - {MNG_FN_FREE_BKGD, "free_bkgd"}, - {MNG_FN_FREE_PHYS, "free_phys"}, - {MNG_FN_FREE_SBIT, "free_sbit"}, - {MNG_FN_FREE_SPLT, "free_splt"}, - {MNG_FN_FREE_HIST, "free_hist"}, - {MNG_FN_FREE_TIME, "free_time"}, - {MNG_FN_FREE_MHDR, "free_mhdr"}, - {MNG_FN_FREE_MEND, "free_mend"}, - {MNG_FN_FREE_LOOP, "free_loop"}, - {MNG_FN_FREE_ENDL, "free_endl"}, - {MNG_FN_FREE_DEFI, "free_defi"}, - {MNG_FN_FREE_BASI, "free_basi"}, - {MNG_FN_FREE_CLON, "free_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_FREE_PAST, "free_past"}, -#endif - {MNG_FN_FREE_DISC, "free_disc"}, - {MNG_FN_FREE_BACK, "free_back"}, - {MNG_FN_FREE_FRAM, "free_fram"}, - {MNG_FN_FREE_MOVE, "free_move"}, - {MNG_FN_FREE_CLIP, "free_clip"}, - {MNG_FN_FREE_SHOW, "free_show"}, - {MNG_FN_FREE_TERM, "free_term"}, - {MNG_FN_FREE_SAVE, "free_save"}, - {MNG_FN_FREE_SEEK, "free_seek"}, - {MNG_FN_FREE_EXPI, "free_expi"}, - {MNG_FN_FREE_FPRI, "free_fpri"}, - {MNG_FN_FREE_NEED, "free_need"}, - {MNG_FN_FREE_PHYG, "free_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_FREE_JHDR, "free_jhdr"}, - {MNG_FN_FREE_JDAT, "free_jdat"}, - {MNG_FN_FREE_JSEP, "free_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_FREE_DHDR, "free_dhdr"}, - {MNG_FN_FREE_PROM, "free_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_FREE_IPNG, "free_ipng"}, -#endif - {MNG_FN_FREE_PPLT, "free_pplt"}, - {MNG_FN_FREE_IJNG, "free_ijng"}, - {MNG_FN_FREE_DROP, "free_drop"}, - {MNG_FN_FREE_DBYK, "free_dbyk"}, - {MNG_FN_FREE_ORDR, "free_ordr"}, -#endif - {MNG_FN_FREE_UNKNOWN, "free_unknown"}, - {MNG_FN_FREE_MAGN, "free_magn"}, - {MNG_FN_FREE_JDAA, "free_jdaa"}, - {MNG_FN_FREE_EVNT, "free_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_FREE_MPNG, "free_mpng"}, -#endif - - {MNG_FN_READ_IHDR, "read_ihdr"}, - {MNG_FN_READ_PLTE, "read_plte"}, - {MNG_FN_READ_IDAT, "read_idat"}, - {MNG_FN_READ_IEND, "read_iend"}, - {MNG_FN_READ_TRNS, "read_trns"}, - {MNG_FN_READ_GAMA, "read_gama"}, - {MNG_FN_READ_CHRM, "read_chrm"}, - {MNG_FN_READ_SRGB, "read_srgb"}, - {MNG_FN_READ_ICCP, "read_iccp"}, - {MNG_FN_READ_TEXT, "read_text"}, - {MNG_FN_READ_ZTXT, "read_ztxt"}, - {MNG_FN_READ_ITXT, "read_itxt"}, - {MNG_FN_READ_BKGD, "read_bkgd"}, - {MNG_FN_READ_PHYS, "read_phys"}, - {MNG_FN_READ_SBIT, "read_sbit"}, - {MNG_FN_READ_SPLT, "read_splt"}, - {MNG_FN_READ_HIST, "read_hist"}, - {MNG_FN_READ_TIME, "read_time"}, - {MNG_FN_READ_MHDR, "read_mhdr"}, - {MNG_FN_READ_MEND, "read_mend"}, - {MNG_FN_READ_LOOP, "read_loop"}, - {MNG_FN_READ_ENDL, "read_endl"}, - {MNG_FN_READ_DEFI, "read_defi"}, - {MNG_FN_READ_BASI, "read_basi"}, - {MNG_FN_READ_CLON, "read_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_READ_PAST, "read_past"}, -#endif - {MNG_FN_READ_DISC, "read_disc"}, - {MNG_FN_READ_BACK, "read_back"}, - {MNG_FN_READ_FRAM, "read_fram"}, - {MNG_FN_READ_MOVE, "read_move"}, - {MNG_FN_READ_CLIP, "read_clip"}, - {MNG_FN_READ_SHOW, "read_show"}, - {MNG_FN_READ_TERM, "read_term"}, - {MNG_FN_READ_SAVE, "read_save"}, - {MNG_FN_READ_SEEK, "read_seek"}, - {MNG_FN_READ_EXPI, "read_expi"}, - {MNG_FN_READ_FPRI, "read_fpri"}, - {MNG_FN_READ_NEED, "read_need"}, - {MNG_FN_READ_PHYG, "read_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_READ_JHDR, "read_jhdr"}, - {MNG_FN_READ_JDAT, "read_jdat"}, - {MNG_FN_READ_JSEP, "read_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_READ_DHDR, "read_dhdr"}, - {MNG_FN_READ_PROM, "read_prom"}, - {MNG_FN_READ_IPNG, "read_ipng"}, - {MNG_FN_READ_PPLT, "read_pplt"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_READ_IJNG, "read_ijng"}, -#endif - {MNG_FN_READ_DROP, "read_drop"}, - {MNG_FN_READ_DBYK, "read_dbyk"}, - {MNG_FN_READ_ORDR, "read_ordr"}, -#endif - {MNG_FN_READ_UNKNOWN, "read_unknown"}, - {MNG_FN_READ_MAGN, "read_magn"}, - {MNG_FN_READ_JDAA, "read_jdaa"}, - {MNG_FN_READ_EVNT, "read_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_READ_MPNG, "read_mpng"}, -#endif - - {MNG_FN_WRITE_IHDR, "write_ihdr"}, - {MNG_FN_WRITE_PLTE, "write_plte"}, - {MNG_FN_WRITE_IDAT, "write_idat"}, - {MNG_FN_WRITE_IEND, "write_iend"}, - {MNG_FN_WRITE_TRNS, "write_trns"}, - {MNG_FN_WRITE_GAMA, "write_gama"}, - {MNG_FN_WRITE_CHRM, "write_chrm"}, - {MNG_FN_WRITE_SRGB, "write_srgb"}, - {MNG_FN_WRITE_ICCP, "write_iccp"}, - {MNG_FN_WRITE_TEXT, "write_text"}, - {MNG_FN_WRITE_ZTXT, "write_ztxt"}, - {MNG_FN_WRITE_ITXT, "write_itxt"}, - {MNG_FN_WRITE_BKGD, "write_bkgd"}, - {MNG_FN_WRITE_PHYS, "write_phys"}, - {MNG_FN_WRITE_SBIT, "write_sbit"}, - {MNG_FN_WRITE_SPLT, "write_splt"}, - {MNG_FN_WRITE_HIST, "write_hist"}, - {MNG_FN_WRITE_TIME, "write_time"}, - {MNG_FN_WRITE_MHDR, "write_mhdr"}, - {MNG_FN_WRITE_MEND, "write_mend"}, - {MNG_FN_WRITE_LOOP, "write_loop"}, - {MNG_FN_WRITE_ENDL, "write_endl"}, - {MNG_FN_WRITE_DEFI, "write_defi"}, - {MNG_FN_WRITE_BASI, "write_basi"}, - {MNG_FN_WRITE_CLON, "write_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_WRITE_PAST, "write_past"}, -#endif - {MNG_FN_WRITE_DISC, "write_disc"}, - {MNG_FN_WRITE_BACK, "write_back"}, - {MNG_FN_WRITE_FRAM, "write_fram"}, - {MNG_FN_WRITE_MOVE, "write_move"}, - {MNG_FN_WRITE_CLIP, "write_clip"}, - {MNG_FN_WRITE_SHOW, "write_show"}, - {MNG_FN_WRITE_TERM, "write_term"}, - {MNG_FN_WRITE_SAVE, "write_save"}, - {MNG_FN_WRITE_SEEK, "write_seek"}, - {MNG_FN_WRITE_EXPI, "write_expi"}, - {MNG_FN_WRITE_FPRI, "write_fpri"}, - {MNG_FN_WRITE_NEED, "write_need"}, - {MNG_FN_WRITE_PHYG, "write_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_WRITE_JHDR, "write_jhdr"}, - {MNG_FN_WRITE_JDAT, "write_jdat"}, - {MNG_FN_WRITE_JSEP, "write_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_WRITE_DHDR, "write_dhdr"}, - {MNG_FN_WRITE_PROM, "write_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_WRITE_IPNG, "write_ipng"}, -#endif - {MNG_FN_WRITE_PPLT, "write_pplt"}, - {MNG_FN_WRITE_IJNG, "write_ijng"}, - {MNG_FN_WRITE_DROP, "write_drop"}, - {MNG_FN_WRITE_DBYK, "write_dbyk"}, - {MNG_FN_WRITE_ORDR, "write_ordr"}, -#endif - {MNG_FN_WRITE_UNKNOWN, "write_unknown"}, - {MNG_FN_WRITE_MAGN, "write_magn"}, - {MNG_FN_WRITE_JDAA, "write_jdaa"}, - {MNG_FN_WRITE_EVNT, "write_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_WRITE_MPNG, "write_mpng"}, -#endif - - {MNG_FN_ZLIB_INITIALIZE, "zlib_initialize"}, - {MNG_FN_ZLIB_CLEANUP, "zlib_cleanup"}, - {MNG_FN_ZLIB_INFLATEINIT, "zlib_inflateinit"}, - {MNG_FN_ZLIB_INFLATEROWS, "zlib_inflaterows"}, - {MNG_FN_ZLIB_INFLATEDATA, "zlib_inflatedata"}, - {MNG_FN_ZLIB_INFLATEFREE, "zlib_inflatefree"}, - {MNG_FN_ZLIB_DEFLATEINIT, "zlib_deflateinit"}, - {MNG_FN_ZLIB_DEFLATEROWS, "zlib_deflaterows"}, - {MNG_FN_ZLIB_DEFLATEDATA, "zlib_deflatedata"}, - {MNG_FN_ZLIB_DEFLATEFREE, "zlib_deflatefree"}, - - {MNG_FN_PROCESS_DISPLAY_IHDR, "process_display_ihdr"}, - {MNG_FN_PROCESS_DISPLAY_PLTE, "process_display_plte"}, - {MNG_FN_PROCESS_DISPLAY_IDAT, "process_display_idat"}, - {MNG_FN_PROCESS_DISPLAY_IEND, "process_display_iend"}, - {MNG_FN_PROCESS_DISPLAY_TRNS, "process_display_trns"}, - {MNG_FN_PROCESS_DISPLAY_GAMA, "process_display_gama"}, - {MNG_FN_PROCESS_DISPLAY_CHRM, "process_display_chrm"}, - {MNG_FN_PROCESS_DISPLAY_SRGB, "process_display_srgb"}, - {MNG_FN_PROCESS_DISPLAY_ICCP, "process_display_iccp"}, - {MNG_FN_PROCESS_DISPLAY_BKGD, "process_display_bkgd"}, - {MNG_FN_PROCESS_DISPLAY_PHYS, "process_display_phys"}, - {MNG_FN_PROCESS_DISPLAY_SBIT, "process_display_sbit"}, - {MNG_FN_PROCESS_DISPLAY_SPLT, "process_display_splt"}, - {MNG_FN_PROCESS_DISPLAY_HIST, "process_display_hist"}, - {MNG_FN_PROCESS_DISPLAY_MHDR, "process_display_mhdr"}, - {MNG_FN_PROCESS_DISPLAY_MEND, "process_display_mend"}, - {MNG_FN_PROCESS_DISPLAY_LOOP, "process_display_loop"}, - {MNG_FN_PROCESS_DISPLAY_ENDL, "process_display_endl"}, - {MNG_FN_PROCESS_DISPLAY_DEFI, "process_display_defi"}, - {MNG_FN_PROCESS_DISPLAY_BASI, "process_display_basi"}, - {MNG_FN_PROCESS_DISPLAY_CLON, "process_display_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PROCESS_DISPLAY_PAST, "process_display_past"}, -#endif - {MNG_FN_PROCESS_DISPLAY_DISC, "process_display_disc"}, - {MNG_FN_PROCESS_DISPLAY_BACK, "process_display_back"}, - {MNG_FN_PROCESS_DISPLAY_FRAM, "process_display_fram"}, - {MNG_FN_PROCESS_DISPLAY_MOVE, "process_display_move"}, - {MNG_FN_PROCESS_DISPLAY_CLIP, "process_display_clip"}, - {MNG_FN_PROCESS_DISPLAY_SHOW, "process_display_show"}, - {MNG_FN_PROCESS_DISPLAY_TERM, "process_display_term"}, - {MNG_FN_PROCESS_DISPLAY_SAVE, "process_display_save"}, - {MNG_FN_PROCESS_DISPLAY_SEEK, "process_display_seek"}, - {MNG_FN_PROCESS_DISPLAY_EXPI, "process_display_expi"}, - {MNG_FN_PROCESS_DISPLAY_FPRI, "process_display_fpri"}, - {MNG_FN_PROCESS_DISPLAY_NEED, "process_display_need"}, - {MNG_FN_PROCESS_DISPLAY_PHYG, "process_display_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PROCESS_DISPLAY_JHDR, "process_display_jhdr"}, - {MNG_FN_PROCESS_DISPLAY_JDAT, "process_display_jdat"}, - {MNG_FN_PROCESS_DISPLAY_JSEP, "process_display_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PROCESS_DISPLAY_DHDR, "process_display_dhdr"}, - {MNG_FN_PROCESS_DISPLAY_PROM, "process_display_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PROCESS_DISPLAY_IPNG, "process_display_ipng"}, -#endif - {MNG_FN_PROCESS_DISPLAY_PPLT, "process_display_pplt"}, - {MNG_FN_PROCESS_DISPLAY_IJNG, "process_display_ijng"}, - {MNG_FN_PROCESS_DISPLAY_DROP, "process_display_drop"}, - {MNG_FN_PROCESS_DISPLAY_DBYK, "process_display_dbyk"}, - {MNG_FN_PROCESS_DISPLAY_ORDR, "process_display_ordr"}, -#endif - {MNG_FN_PROCESS_DISPLAY_MAGN, "process_display_magn"}, - {MNG_FN_PROCESS_DISPLAY_JDAA, "process_display_jdaa"}, - - {MNG_FN_JPEG_INITIALIZE, "jpeg_initialize"}, - {MNG_FN_JPEG_CLEANUP, "jpeg_cleanup"}, - {MNG_FN_JPEG_DECOMPRESSINIT, "jpeg_decompressinit"}, - {MNG_FN_JPEG_DECOMPRESSDATA, "jpeg_decompressdata"}, - {MNG_FN_JPEG_DECOMPRESSFREE, "jpeg_decompressfree"}, - - {MNG_FN_STORE_JPEG_G8, "store_jpeg_g8"}, - {MNG_FN_STORE_JPEG_RGB8, "store_jpeg_rgb8"}, - {MNG_FN_STORE_JPEG_G12, "store_jpeg_g12"}, - {MNG_FN_STORE_JPEG_RGB12, "store_jpeg_rgb12"}, - {MNG_FN_STORE_JPEG_GA8, "store_jpeg_ga8"}, - {MNG_FN_STORE_JPEG_RGBA8, "store_jpeg_rgba8"}, - {MNG_FN_STORE_JPEG_GA12, "store_jpeg_ga12"}, - {MNG_FN_STORE_JPEG_RGBA12, "store_jpeg_rgba12"}, - {MNG_FN_STORE_JPEG_G8_ALPHA, "store_jpeg_g8_alpha"}, - {MNG_FN_STORE_JPEG_RGB8_ALPHA, "store_jpeg_rgb8_alpha"}, - - {MNG_FN_INIT_JPEG_A1_NI, "init_jpeg_a1_ni"}, - {MNG_FN_INIT_JPEG_A2_NI, "init_jpeg_a2_ni"}, - {MNG_FN_INIT_JPEG_A4_NI, "init_jpeg_a4_ni"}, - {MNG_FN_INIT_JPEG_A8_NI, "init_jpeg_a8_ni"}, - {MNG_FN_INIT_JPEG_A16_NI, "init_jpeg_a16_ni"}, - - {MNG_FN_STORE_JPEG_G8_A1, "store_jpeg_g8_a1"}, - {MNG_FN_STORE_JPEG_G8_A2, "store_jpeg_g8_a2"}, - {MNG_FN_STORE_JPEG_G8_A4, "store_jpeg_g8_a4"}, - {MNG_FN_STORE_JPEG_G8_A8, "store_jpeg_g8_a8"}, - {MNG_FN_STORE_JPEG_G8_A16, "store_jpeg_g8_a16"}, - - {MNG_FN_STORE_JPEG_RGB8_A1, "store_jpeg_rgb8_a1"}, - {MNG_FN_STORE_JPEG_RGB8_A2, "store_jpeg_rgb8_a2"}, - {MNG_FN_STORE_JPEG_RGB8_A4, "store_jpeg_rgb8_a4"}, - {MNG_FN_STORE_JPEG_RGB8_A8, "store_jpeg_rgb8_a8"}, - {MNG_FN_STORE_JPEG_RGB8_A16, "store_jpeg_rgb8_a16"}, - - {MNG_FN_STORE_JPEG_G12_A1, "store_jpeg_g12_a1"}, - {MNG_FN_STORE_JPEG_G12_A2, "store_jpeg_g12_a2"}, - {MNG_FN_STORE_JPEG_G12_A4, "store_jpeg_g12_a4"}, - {MNG_FN_STORE_JPEG_G12_A8, "store_jpeg_g12_a8"}, - {MNG_FN_STORE_JPEG_G12_A16, "store_jpeg_g12_a16"}, - - {MNG_FN_STORE_JPEG_RGB12_A1, "store_jpeg_rgb12_a1"}, - {MNG_FN_STORE_JPEG_RGB12_A2, "store_jpeg_rgb12_a2"}, - {MNG_FN_STORE_JPEG_RGB12_A4, "store_jpeg_rgb12_a4"}, - {MNG_FN_STORE_JPEG_RGB12_A8, "store_jpeg_rgb12_a8"}, - {MNG_FN_STORE_JPEG_RGB12_A16, "store_jpeg_rgb12_a16"}, - - {MNG_FN_NEXT_JPEG_ALPHAROW, "next_jpeg_alpharow"}, - {MNG_FN_NEXT_JPEG_ROW, "next_jpeg_row"}, - {MNG_FN_DISPLAY_JPEG_ROWS, "display_jpeg_rows"}, - - {MNG_FN_MAGNIFY_G8_X1, "magnify_g8_x1"}, - {MNG_FN_MAGNIFY_G8_X2, "magnify_g8_x2"}, - {MNG_FN_MAGNIFY_RGB8_X1, "magnify_rgb8_x1"}, - {MNG_FN_MAGNIFY_RGB8_X2, "magnify_rgb8_x2"}, - {MNG_FN_MAGNIFY_GA8_X1, "magnify_ga8_x1"}, - {MNG_FN_MAGNIFY_GA8_X2, "magnify_ga8_x2"}, - {MNG_FN_MAGNIFY_GA8_X3, "magnify_ga8_x3"}, - {MNG_FN_MAGNIFY_GA8_X4, "magnify_ga8_x4"}, - {MNG_FN_MAGNIFY_RGBA8_X1, "magnify_rgba8_x1"}, - {MNG_FN_MAGNIFY_RGBA8_X2, "magnify_rgba8_x2"}, - {MNG_FN_MAGNIFY_RGBA8_X3, "magnify_rgba8_x3"}, - {MNG_FN_MAGNIFY_RGBA8_X4, "magnify_rgba8_x4"}, - {MNG_FN_MAGNIFY_G8_X3, "magnify_g8_x3"}, - {MNG_FN_MAGNIFY_RGB8_X3, "magnify_rgb8_x3"}, - {MNG_FN_MAGNIFY_GA8_X5, "magnify_ga8_x5"}, - {MNG_FN_MAGNIFY_RGBA8_X5, "magnify_rgba8_x5"}, - - {MNG_FN_MAGNIFY_G8_Y1, "magnify_g8_y1"}, - {MNG_FN_MAGNIFY_G8_Y2, "magnify_g8_y2"}, - {MNG_FN_MAGNIFY_RGB8_Y1, "magnify_rgb8_y1"}, - {MNG_FN_MAGNIFY_RGB8_Y2, "magnify_rgb8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y1, "magnify_ga8_y1"}, - {MNG_FN_MAGNIFY_GA8_Y2, "magnify_ga8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y3, "magnify_ga8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y4, "magnify_ga8_y4"}, - {MNG_FN_MAGNIFY_RGBA8_Y1, "magnify_rgba8_y1"}, - {MNG_FN_MAGNIFY_RGBA8_Y2, "magnify_rgba8_y2"}, - {MNG_FN_MAGNIFY_RGBA8_Y3, "magnify_rgba8_y3"}, - {MNG_FN_MAGNIFY_RGBA8_Y4, "magnify_rgba8_y4"}, - {MNG_FN_MAGNIFY_G8_Y3, "magnify_g8_y3"}, - {MNG_FN_MAGNIFY_RGB8_Y3, "magnify_rgb8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y5, "magnify_ga8_y5"}, - {MNG_FN_MAGNIFY_RGBA8_Y5, "magnify_rgba8_y5"}, - - {MNG_FN_MAGNIFY_G8_X1, "magnify_g8_x1"}, - {MNG_FN_MAGNIFY_G8_X2, "magnify_g8_x2"}, - {MNG_FN_MAGNIFY_RGB8_X1, "magnify_rgb8_x1"}, - {MNG_FN_MAGNIFY_RGB8_X2, "magnify_rgb8_x2"}, - {MNG_FN_MAGNIFY_GA8_X1, "magnify_ga8_x1"}, - {MNG_FN_MAGNIFY_GA8_X2, "magnify_ga8_x2"}, - {MNG_FN_MAGNIFY_GA8_X3, "magnify_ga8_x3"}, - {MNG_FN_MAGNIFY_GA8_X4, "magnify_ga8_x4"}, - {MNG_FN_MAGNIFY_RGBA8_X1, "magnify_rgba8_x1"}, - {MNG_FN_MAGNIFY_RGBA8_X2, "magnify_rgba8_x2"}, - {MNG_FN_MAGNIFY_RGBA8_X3, "magnify_rgba8_x3"}, - {MNG_FN_MAGNIFY_RGBA8_X4, "magnify_rgba8_x4"}, - {MNG_FN_MAGNIFY_G8_X3, "magnify_g8_x3"}, - {MNG_FN_MAGNIFY_RGB8_X3, "magnify_rgb8_x3"}, - {MNG_FN_MAGNIFY_GA8_X5, "magnify_ga8_x5"}, - {MNG_FN_MAGNIFY_RGBA8_X5, "magnify_rgba8_x5"}, - - {MNG_FN_MAGNIFY_G8_Y1, "magnify_g8_y1"}, - {MNG_FN_MAGNIFY_G8_Y2, "magnify_g8_y2"}, - {MNG_FN_MAGNIFY_RGB8_Y1, "magnify_rgb8_y1"}, - {MNG_FN_MAGNIFY_RGB8_Y2, "magnify_rgb8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y1, "magnify_ga8_y1"}, - {MNG_FN_MAGNIFY_GA8_Y2, "magnify_ga8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y3, "magnify_ga8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y4, "magnify_ga8_y4"}, - {MNG_FN_MAGNIFY_RGBA8_Y1, "magnify_rgba8_y1"}, - {MNG_FN_MAGNIFY_RGBA8_Y2, "magnify_rgba8_y2"}, - {MNG_FN_MAGNIFY_RGBA8_Y3, "magnify_rgba8_y3"}, - {MNG_FN_MAGNIFY_RGBA8_Y4, "magnify_rgba8_y4"}, - {MNG_FN_MAGNIFY_G8_Y3, "magnify_g8_y3"}, - {MNG_FN_MAGNIFY_RGB8_Y3, "magnify_rgb8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y5, "magnify_ga8_y5"}, - {MNG_FN_MAGNIFY_RGBA8_Y5, "magnify_rgba8_y5"}, - - {MNG_FN_DELTA_G1_G1, "delta_g1_g1"}, - {MNG_FN_DELTA_G2_G2, "delta_g2_g2"}, - {MNG_FN_DELTA_G4_G4, "delta_g4_g4"}, - {MNG_FN_DELTA_G8_G8, "delta_g8_g8"}, - {MNG_FN_DELTA_G16_G16, "delta_g16_g16"}, - {MNG_FN_DELTA_RGB8_RGB8, "delta_rgb8_rgb8"}, - {MNG_FN_DELTA_RGB16_RGB16, "delta_rgb16_rgb16"}, - {MNG_FN_DELTA_GA8_GA8, "delta_ga8_ga8"}, - {MNG_FN_DELTA_GA8_G8, "delta_ga8_g8"}, - {MNG_FN_DELTA_GA8_A8, "delta_ga8_a8"}, - {MNG_FN_DELTA_GA16_GA16, "delta_ga16_ga16"}, - {MNG_FN_DELTA_GA16_G16, "delta_ga16_g16"}, - {MNG_FN_DELTA_GA16_A16, "delta_ga16_a16"}, - {MNG_FN_DELTA_RGBA8_RGBA8, "delta_rgba8_rgba8"}, - {MNG_FN_DELTA_RGBA8_RGB8, "delta_rgba8_rgb8"}, - {MNG_FN_DELTA_RGBA8_A8, "delta_rgba8_a8"}, - {MNG_FN_DELTA_RGBA16_RGBA16, "delta_rgba16_rgba16"}, - {MNG_FN_DELTA_RGBA16_RGB16, "delta_rgba16_rgb16"}, - {MNG_FN_DELTA_RGBA16_A16, "delta_rgba16_a16"}, - - {MNG_FN_PROMOTE_G8_G8, "promote_g8_g8"}, - {MNG_FN_PROMOTE_G8_G16, "promote_g8_g16"}, - {MNG_FN_PROMOTE_G16_G16, "promote_g8_g16"}, - {MNG_FN_PROMOTE_G8_GA8, "promote_g8_ga8"}, - {MNG_FN_PROMOTE_G8_GA16, "promote_g8_ga16"}, - {MNG_FN_PROMOTE_G16_GA16, "promote_g16_ga16"}, - {MNG_FN_PROMOTE_G8_RGB8, "promote_g8_rgb8"}, - {MNG_FN_PROMOTE_G8_RGB16, "promote_g8_rgb16"}, - {MNG_FN_PROMOTE_G16_RGB16, "promote_g16_rgb16"}, - {MNG_FN_PROMOTE_G8_RGBA8, "promote_g8_rgba8"}, - {MNG_FN_PROMOTE_G8_RGBA16, "promote_g8_rgba16"}, - {MNG_FN_PROMOTE_G16_RGBA16, "promote_g16_rgba16"}, - {MNG_FN_PROMOTE_GA8_GA16, "promote_ga8_ga16"}, - {MNG_FN_PROMOTE_GA8_RGBA8, "promote_ga8_rgba8"}, - {MNG_FN_PROMOTE_GA8_RGBA16, "promote_ga8_rgba16"}, - {MNG_FN_PROMOTE_GA16_RGBA16, "promote_ga16_rgba16"}, - {MNG_FN_PROMOTE_RGB8_RGB16, "promote_rgb8_rgb16"}, - {MNG_FN_PROMOTE_RGB8_RGBA8, "promote_rgb8_rgba8"}, - {MNG_FN_PROMOTE_RGB8_RGBA16, "promote_rgb8_rgba16"}, - {MNG_FN_PROMOTE_RGB16_RGBA16, "promote_rgb16_rgba16"}, - {MNG_FN_PROMOTE_RGBA8_RGBA16, "promote_rgba8_rgba16"}, - {MNG_FN_PROMOTE_IDX8_RGB8, "promote_idx8_rgb8"}, - {MNG_FN_PROMOTE_IDX8_RGB16, "promote_idx8_rgb16"}, - {MNG_FN_PROMOTE_IDX8_RGBA8, "promote_idx8_rgba8"}, - {MNG_FN_PROMOTE_IDX8_RGBA16, "promote_idx8_rgba16"}, - - {MNG_FN_SCALE_G1_G2, "scale_g1_g2"}, - {MNG_FN_SCALE_G1_G4, "scale_g1_g4"}, - {MNG_FN_SCALE_G1_G8, "scale_g1_g8"}, - {MNG_FN_SCALE_G1_G16, "scale_g1_g16"}, - {MNG_FN_SCALE_G2_G4, "scale_g2_g4"}, - {MNG_FN_SCALE_G2_G8, "scale_g2_g8"}, - {MNG_FN_SCALE_G2_G16, "scale_g2_g16"}, - {MNG_FN_SCALE_G4_G8, "scale_g4_g8"}, - {MNG_FN_SCALE_G4_G16, "scale_g4_g16"}, - {MNG_FN_SCALE_G8_G16, "scale_g8_g16"}, - {MNG_FN_SCALE_GA8_GA16, "scale_ga8_ga16"}, - {MNG_FN_SCALE_RGB8_RGB16, "scale_rgb8_rgb16"}, - {MNG_FN_SCALE_RGBA8_RGBA16, "scale_rgba8_rgba16"}, - - {MNG_FN_SCALE_G2_G1, "scale_g2_g1"}, - {MNG_FN_SCALE_G4_G1, "scale_g4_g1"}, - {MNG_FN_SCALE_G8_G1, "scale_g8_g1"}, - {MNG_FN_SCALE_G16_G1, "scale_g16_g1"}, - {MNG_FN_SCALE_G4_G2, "scale_g4_g2"}, - {MNG_FN_SCALE_G8_G2, "scale_g8_g2"}, - {MNG_FN_SCALE_G16_G2, "scale_g16_g2"}, - {MNG_FN_SCALE_G8_G4, "scale_g8_g4"}, - {MNG_FN_SCALE_G16_G4, "scale_g16_g4"}, - {MNG_FN_SCALE_G16_G8, "scale_g16_g8"}, - {MNG_FN_SCALE_GA16_GA8, "scale_ga16_ga8"}, - {MNG_FN_SCALE_RGB16_RGB8, "scale_rgb16_rgb8"}, - {MNG_FN_SCALE_RGBA16_RGBA8, "scale_rgba16_rgba8"}, - - {MNG_FN_COMPOSEOVER_RGBA8, "composeover_rgba8"}, - {MNG_FN_COMPOSEOVER_RGBA16, "composeover_rgba16"}, - {MNG_FN_COMPOSEUNDER_RGBA8, "composeunder_rgba8"}, - {MNG_FN_COMPOSEUNDER_RGBA16, "composeunder_rgba16"}, - - {MNG_FN_FLIP_RGBA8, "flip_rgba8"}, - {MNG_FN_FLIP_RGBA16, "flip_rgba16"}, - {MNG_FN_TILE_RGBA8, "tile_rgba8"}, - {MNG_FN_TILE_RGBA16, "tile_rgba16"} - - }; -#endif /* MNG_INCLUDE_TRACE_STINGS */ - -/* ************************************************************************** */ - -mng_retcode mng_trace (mng_datap pData, - mng_uint32 iFunction, - mng_uint32 iLocation) -{ - mng_pchar zName = 0; /* bufferptr for tracestring */ - - if ((pData == 0) || (pData->iMagic != MNG_MAGIC)) - return MNG_INVALIDHANDLE; /* no good if the handle is corrupt */ - - if (pData->fTraceproc) /* report back to user ? */ - { -#ifdef MNG_INCLUDE_TRACE_STRINGS - { /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_trace_entryp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (trace_table) / sizeof (trace_table [0])) - 1; - - iLower = 0; /* initialize binary search */ - iMiddle = iTop >> 1; /* start in the middle */ - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (trace_table [iMiddle].iFunction < iFunction) - iLower = iMiddle + 1; - else if (trace_table [iMiddle].iFunction > iFunction) - iUpper = iMiddle - 1; - else - { - pEntry = &trace_table [iMiddle]; - break; - }; - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (pEntry) /* found it ? */ - zName = pEntry->zTracetext; - - } -#endif - /* oke, now tell */ - if (!pData->fTraceproc (((mng_handle)pData), iFunction, iLocation, zName)) - return MNG_APPTRACEABORT; - - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_TRACE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_trace.h b/Engine/lib/lmng/libmng_trace.h deleted file mode 100644 index 0c749d978..000000000 --- a/Engine/lib/lmng/libmng_trace.h +++ /dev/null @@ -1,1474 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_trace.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Trace functions (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the trace functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added chunk-access function trace-codes * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added save_state & restore_state trace-codes * */ -/* * 0.5.1 - 05/15/2000 - G.Juyn * */ -/* * - added getimgdata & putimgdata trace-codes * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG tracecodes * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added trace-table entry definition * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added tracecodes for global animation color-chunks * */ -/* * - added tracecodes for get/set of default ZLIB/IJG parms * */ -/* * - added tracecodes for global PLTE,tRNS,bKGD * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added tracecodes for image-object promotion * */ -/* * - added tracecodes for delta-image processing * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added tracecodes for getalphaline callback * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added tracecode for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added tracecode for mng_read_resume HLAPI function * */ -/* * * */ -/* * 0.5.3 - 06/06/2000 - G.Juyn * */ -/* * - added tracecodes for tracing JPEG progression * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added tracecodes for get/set speedtype * */ -/* * - added tracecodes for get imagelevel * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added tracecode for delta-image processing * */ -/* * - added tracecodes for PPLT chunk processing * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added tracecodes for special display processing * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added tracecode for get/set suspensionmode * */ -/* * - added tracecodes for get/set display variables * */ -/* * - added tracecode for read_databuffer (I/O-suspension) * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added tracecodes for SAVE/SEEK callbacks * */ -/* * - added tracecodes for get/set sectionbreaks * */ -/* * - added tracecode for special error routine * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added tracecode for updatemngheader * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - added tracecodes for status_xxxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added tracecode for updatemngsimplicity * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * - added optional support for bKGD for PNG images * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - added routine to discard "invalid" objects * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * 1.0.5 - 10/09/2002 - G.Juyn * */ -/* * - fixed trace-constants for PAST chunk * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 07/14/2003 - G.Randers-Pehrson * */ -/* * - added conditionals around rarely used features * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_trace_h_ -#define _libmng_trace_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_TRACE_PROCS - -/* ************************************************************************** */ - -/* TODO: add a trace-mask so certain functions can be excluded */ - -mng_retcode mng_trace (mng_datap pData, - mng_uint32 iFunction, - mng_uint32 iLocation); - -/* ************************************************************************** */ - -#define MNG_TRACE(D,F,L) { mng_retcode iR = mng_trace (D,F,L); \ - if (iR) return iR; } - -#define MNG_TRACEB(D,F,L) { if (mng_trace (D,F,L)) return MNG_FALSE; } - -#define MNG_TRACEX(D,F,L) { if (mng_trace (D,F,L)) return 0; } - -/* ************************************************************************** */ - -#define MNG_LC_START 1 -#define MNG_LC_END 2 -#define MNG_LC_INITIALIZE 3 -#define MNG_LC_CLEANUP 4 - -/* ************************************************************************** */ - -#define MNG_LC_JPEG_CREATE_DECOMPRESS 101 -#define MNG_LC_JPEG_READ_HEADER 102 -#define MNG_LC_JPEG_START_DECOMPRESS 103 -#define MNG_LC_JPEG_START_OUTPUT 104 -#define MNG_LC_JPEG_READ_SCANLINES 105 -#define MNG_LC_JPEG_FINISH_OUTPUT 106 -#define MNG_LC_JPEG_FINISH_DECOMPRESS 107 -#define MNG_LC_JPEG_DESTROY_DECOMPRESS 108 - -/* ************************************************************************** */ - -#define MNG_FN_INITIALIZE 1 -#define MNG_FN_RESET 2 -#define MNG_FN_CLEANUP 3 -#define MNG_FN_READ 4 -#define MNG_FN_WRITE 5 -#define MNG_FN_CREATE 6 -#define MNG_FN_READDISPLAY 7 -#define MNG_FN_DISPLAY 8 -#define MNG_FN_DISPLAY_RESUME 9 -#define MNG_FN_DISPLAY_FREEZE 10 -#define MNG_FN_DISPLAY_RESET 11 -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -#define MNG_FN_DISPLAY_GOFRAME 12 -#define MNG_FN_DISPLAY_GOLAYER 13 -#define MNG_FN_DISPLAY_GOTIME 14 -#endif -#define MNG_FN_GETLASTERROR 15 -#define MNG_FN_READ_RESUME 16 -#define MNG_FN_TRAPEVENT 17 -#define MNG_FN_READ_PUSHDATA 18 -#define MNG_FN_READ_PUSHSIG 19 -#define MNG_FN_READ_PUSHCHUNK 20 - -#define MNG_FN_SETCB_MEMALLOC 101 -#define MNG_FN_SETCB_MEMFREE 102 -#define MNG_FN_SETCB_READDATA 103 -#define MNG_FN_SETCB_WRITEDATA 104 -#define MNG_FN_SETCB_ERRORPROC 105 -#define MNG_FN_SETCB_TRACEPROC 106 -#define MNG_FN_SETCB_PROCESSHEADER 107 -#define MNG_FN_SETCB_PROCESSTEXT 108 -#define MNG_FN_SETCB_GETCANVASLINE 109 -#define MNG_FN_SETCB_GETBKGDLINE 110 -#define MNG_FN_SETCB_REFRESH 111 -#define MNG_FN_SETCB_GETTICKCOUNT 112 -#define MNG_FN_SETCB_SETTIMER 113 -#define MNG_FN_SETCB_PROCESSGAMMA 114 -#define MNG_FN_SETCB_PROCESSCHROMA 115 -#define MNG_FN_SETCB_PROCESSSRGB 116 -#define MNG_FN_SETCB_PROCESSICCP 117 -#define MNG_FN_SETCB_PROCESSAROW 118 -#ifndef MNG_NO_OPEN_CLOSE_STREAM -#define MNG_FN_SETCB_OPENSTREAM 119 -#define MNG_FN_SETCB_CLOSESTREAM 120 -#endif -#define MNG_FN_SETCB_GETALPHALINE 121 -#define MNG_FN_SETCB_PROCESSSAVE 122 -#define MNG_FN_SETCB_PROCESSSEEK 123 -#define MNG_FN_SETCB_PROCESSNEED 124 -#define MNG_FN_SETCB_PROCESSUNKNOWN 125 -#define MNG_FN_SETCB_PROCESSMEND 126 -#define MNG_FN_SETCB_PROCESSTERM 127 -#define MNG_FN_SETCB_RELEASEDATA 128 - -#define MNG_FN_GETCB_MEMALLOC 201 -#define MNG_FN_GETCB_MEMFREE 202 -#define MNG_FN_GETCB_READDATA 203 -#define MNG_FN_GETCB_WRITEDATA 204 -#define MNG_FN_GETCB_ERRORPROC 205 -#define MNG_FN_GETCB_TRACEPROC 206 -#define MNG_FN_GETCB_PROCESSHEADER 207 -#define MNG_FN_GETCB_PROCESSTEXT 208 -#define MNG_FN_GETCB_GETCANVASLINE 209 -#define MNG_FN_GETCB_GETBKGDLINE 210 -#define MNG_FN_GETCB_REFRESH 211 -#define MNG_FN_GETCB_GETTICKCOUNT 212 -#define MNG_FN_GETCB_SETTIMER 213 -#define MNG_FN_GETCB_PROCESSGAMMA 214 -#define MNG_FN_GETCB_PROCESSCHROMA 215 -#define MNG_FN_GETCB_PROCESSSRGB 216 -#define MNG_FN_GETCB_PROCESSICCP 217 -#define MNG_FN_GETCB_PROCESSAROW 218 -#ifndef MNG_NO_OPEN_CLOSE_STREAM -#define MNG_FN_GETCB_OPENSTREAM 219 -#define MNG_FN_GETCB_CLOSESTREAM 220 -#endif -#define MNG_FN_GETCB_GETALPHALINE 221 -#define MNG_FN_GETCB_PROCESSSAVE 222 -#define MNG_FN_GETCB_PROCESSSEEK 223 -#define MNG_FN_GETCB_PROCESSNEED 224 -#define MNG_FN_GETCB_PROCESSUNKNOWN 225 -#define MNG_FN_GETCB_PROCESSMEND 226 -#define MNG_FN_GETCB_PROCESSTERM 227 -#define MNG_FN_GETCB_RELEASEDATA 228 - -#define MNG_FN_SET_USERDATA 301 -#define MNG_FN_SET_CANVASSTYLE 302 -#define MNG_FN_SET_BKGDSTYLE 303 -#define MNG_FN_SET_BGCOLOR 304 -#define MNG_FN_SET_STORECHUNKS 305 -#define MNG_FN_SET_VIEWGAMMA 306 -#define MNG_FN_SET_DISPLAYGAMMA 307 -#define MNG_FN_SET_DFLTIMGGAMMA 308 -#define MNG_FN_SET_SRGB 309 -#define MNG_FN_SET_OUTPUTPROFILE 310 -#define MNG_FN_SET_SRGBPROFILE 311 -#define MNG_FN_SET_MAXCANVASWIDTH 312 -#define MNG_FN_SET_MAXCANVASHEIGHT 313 -#define MNG_FN_SET_MAXCANVASSIZE 314 -#define MNG_FN_SET_ZLIB_LEVEL 315 -#define MNG_FN_SET_ZLIB_METHOD 316 -#define MNG_FN_SET_ZLIB_WINDOWBITS 317 -#define MNG_FN_SET_ZLIB_MEMLEVEL 318 -#define MNG_FN_SET_ZLIB_STRATEGY 319 -#define MNG_FN_SET_ZLIB_MAXIDAT 320 -#define MNG_FN_SET_JPEG_DCTMETHOD 321 -#define MNG_FN_SET_JPEG_QUALITY 322 -#define MNG_FN_SET_JPEG_SMOOTHING 323 -#define MNG_FN_SET_JPEG_PROGRESSIVE 324 -#define MNG_FN_SET_JPEG_OPTIMIZED 325 -#define MNG_FN_SET_JPEG_MAXJDAT 326 -#define MNG_FN_SET_SPEED 327 -#define MNG_FN_SET_SUSPENSIONMODE 328 -#define MNG_FN_SET_SECTIONBREAKS 329 -#define MNG_FN_SET_USEBKGD 330 -#define MNG_FN_SET_OUTPUTPROFILE2 331 -#define MNG_FN_SET_SRGBPROFILE2 332 -#define MNG_FN_SET_OUTPUTSRGB 333 -#define MNG_FN_SET_SRGBIMPLICIT 334 -#define MNG_FN_SET_CACHEPLAYBACK 335 -#define MNG_FN_SET_DOPROGRESSIVE 336 -#define MNG_FN_SET_CRCMODE 337 - -#define MNG_FN_GET_USERDATA 401 -#define MNG_FN_GET_SIGTYPE 402 -#define MNG_FN_GET_IMAGETYPE 403 -#define MNG_FN_GET_IMAGEWIDTH 404 -#define MNG_FN_GET_IMAGEHEIGHT 405 -#define MNG_FN_GET_TICKS 406 -#define MNG_FN_GET_FRAMECOUNT 407 -#define MNG_FN_GET_LAYERCOUNT 408 -#define MNG_FN_GET_PLAYTIME 409 -#define MNG_FN_GET_SIMPLICITY 410 -#define MNG_FN_GET_CANVASSTYLE 411 -#define MNG_FN_GET_BKGDSTYLE 412 -#define MNG_FN_GET_BGCOLOR 413 -#define MNG_FN_GET_STORECHUNKS 414 -#define MNG_FN_GET_VIEWGAMMA 415 -#define MNG_FN_GET_DISPLAYGAMMA 416 -#define MNG_FN_GET_DFLTIMGGAMMA 417 -#define MNG_FN_GET_SRGB 418 -#define MNG_FN_GET_MAXCANVASWIDTH 419 -#define MNG_FN_GET_MAXCANVASHEIGHT 420 -#define MNG_FN_GET_ZLIB_LEVEL 421 -#define MNG_FN_GET_ZLIB_METHOD 422 -#define MNG_FN_GET_ZLIB_WINDOWBITS 423 -#define MNG_FN_GET_ZLIB_MEMLEVEL 424 -#define MNG_FN_GET_ZLIB_STRATEGY 425 -#define MNG_FN_GET_ZLIB_MAXIDAT 426 -#define MNG_FN_GET_JPEG_DCTMETHOD 427 -#define MNG_FN_GET_JPEG_QUALITY 428 -#define MNG_FN_GET_JPEG_SMOOTHING 429 -#define MNG_FN_GET_JPEG_PROGRESSIVE 430 -#define MNG_FN_GET_JPEG_OPTIMIZED 431 -#define MNG_FN_GET_JPEG_MAXJDAT 432 -#define MNG_FN_GET_SPEED 433 -#define MNG_FN_GET_IMAGELEVEL 434 -#define MNG_FN_GET_SUSPENSIONMODE 435 -#define MNG_FN_GET_STARTTIME 436 -#define MNG_FN_GET_RUNTIME 437 -#define MNG_FN_GET_CURRENTFRAME 438 -#define MNG_FN_GET_CURRENTLAYER 439 -#define MNG_FN_GET_CURRENTPLAYTIME 440 -#define MNG_FN_GET_SECTIONBREAKS 441 -#define MNG_FN_GET_ALPHADEPTH 442 -#define MNG_FN_GET_BITDEPTH 443 -#define MNG_FN_GET_COLORTYPE 444 -#define MNG_FN_GET_COMPRESSION 445 -#define MNG_FN_GET_FILTER 446 -#define MNG_FN_GET_INTERLACE 447 -#define MNG_FN_GET_ALPHABITDEPTH 448 -#define MNG_FN_GET_ALPHACOMPRESSION 449 -#define MNG_FN_GET_ALPHAFILTER 450 -#define MNG_FN_GET_ALPHAINTERLACE 451 -#define MNG_FN_GET_USEBKGD 452 -#define MNG_FN_GET_REFRESHPASS 453 -#define MNG_FN_GET_CACHEPLAYBACK 454 -#define MNG_FN_GET_DOPROGRESSIVE 455 -#define MNG_FN_GET_LASTBACKCHUNK 456 -#define MNG_FN_GET_LASTSEEKNAME 457 -#define MNG_FN_GET_TOTALFRAMES 458 -#define MNG_FN_GET_TOTALLAYERS 459 -#define MNG_FN_GET_TOTALPLAYTIME 460 -#define MNG_FN_GET_CRCMODE 461 -#define MNG_FN_GET_CURRFRAMDELAY 462 - -#define MNG_FN_STATUS_ERROR 481 -#define MNG_FN_STATUS_READING 482 -#define MNG_FN_STATUS_SUSPENDBREAK 483 -#define MNG_FN_STATUS_CREATING 484 -#define MNG_FN_STATUS_WRITING 485 -#define MNG_FN_STATUS_DISPLAYING 486 -#define MNG_FN_STATUS_RUNNING 487 -#define MNG_FN_STATUS_TIMERBREAK 488 -#define MNG_FN_STATUS_DYNAMIC 489 -#define MNG_FN_STATUS_RUNNINGEVENT 490 - -/* ************************************************************************** */ - -#define MNG_FN_ITERATE_CHUNKS 601 -#define MNG_FN_COPY_CHUNK 602 - -#define MNG_FN_GETCHUNK_IHDR 701 -#define MNG_FN_GETCHUNK_PLTE 702 -#define MNG_FN_GETCHUNK_IDAT 703 -#define MNG_FN_GETCHUNK_IEND 704 -#define MNG_FN_GETCHUNK_TRNS 705 -#define MNG_FN_GETCHUNK_GAMA 706 -#define MNG_FN_GETCHUNK_CHRM 707 -#define MNG_FN_GETCHUNK_SRGB 708 -#define MNG_FN_GETCHUNK_ICCP 709 -#define MNG_FN_GETCHUNK_TEXT 710 -#define MNG_FN_GETCHUNK_ZTXT 711 -#define MNG_FN_GETCHUNK_ITXT 712 -#define MNG_FN_GETCHUNK_BKGD 713 -#define MNG_FN_GETCHUNK_PHYS 714 -#define MNG_FN_GETCHUNK_SBIT 715 -#define MNG_FN_GETCHUNK_SPLT 716 -#define MNG_FN_GETCHUNK_HIST 717 -#define MNG_FN_GETCHUNK_TIME 718 -#define MNG_FN_GETCHUNK_MHDR 719 -#define MNG_FN_GETCHUNK_MEND 720 -#define MNG_FN_GETCHUNK_LOOP 721 -#define MNG_FN_GETCHUNK_ENDL 722 -#define MNG_FN_GETCHUNK_DEFI 723 -#define MNG_FN_GETCHUNK_BASI 724 -#define MNG_FN_GETCHUNK_CLON 725 -#define MNG_FN_GETCHUNK_PAST 726 -#define MNG_FN_GETCHUNK_DISC 727 -#define MNG_FN_GETCHUNK_BACK 728 -#define MNG_FN_GETCHUNK_FRAM 729 -#define MNG_FN_GETCHUNK_MOVE 730 -#define MNG_FN_GETCHUNK_CLIP 731 -#define MNG_FN_GETCHUNK_SHOW 732 -#define MNG_FN_GETCHUNK_TERM 733 -#define MNG_FN_GETCHUNK_SAVE 734 -#define MNG_FN_GETCHUNK_SEEK 735 -#define MNG_FN_GETCHUNK_EXPI 736 -#define MNG_FN_GETCHUNK_FPRI 737 -#define MNG_FN_GETCHUNK_NEED 738 -#define MNG_FN_GETCHUNK_PHYG 739 -#define MNG_FN_GETCHUNK_JHDR 740 -#define MNG_FN_GETCHUNK_JDAT 741 -#define MNG_FN_GETCHUNK_JSEP 742 -#define MNG_FN_GETCHUNK_DHDR 743 -#define MNG_FN_GETCHUNK_PROM 744 -#define MNG_FN_GETCHUNK_IPNG 745 -#define MNG_FN_GETCHUNK_PPLT 746 -#define MNG_FN_GETCHUNK_IJNG 747 -#define MNG_FN_GETCHUNK_DROP 748 -#define MNG_FN_GETCHUNK_DBYK 749 -#define MNG_FN_GETCHUNK_ORDR 750 -#define MNG_FN_GETCHUNK_UNKNOWN 751 -#define MNG_FN_GETCHUNK_MAGN 752 -#define MNG_FN_GETCHUNK_JDAA 753 -#define MNG_FN_GETCHUNK_EVNT 754 -#define MNG_FN_GETCHUNK_MPNG 755 - -#define MNG_FN_GETCHUNK_PAST_SRC 781 -#define MNG_FN_GETCHUNK_SAVE_ENTRY 782 -#define MNG_FN_GETCHUNK_PPLT_ENTRY 783 -#define MNG_FN_GETCHUNK_ORDR_ENTRY 784 -#define MNG_FN_GETCHUNK_EVNT_ENTRY 785 -#define MNG_FN_GETCHUNK_MPNG_FRAME 786 - -#define MNG_FN_PUTCHUNK_IHDR 801 -#define MNG_FN_PUTCHUNK_PLTE 802 -#define MNG_FN_PUTCHUNK_IDAT 803 -#define MNG_FN_PUTCHUNK_IEND 804 -#define MNG_FN_PUTCHUNK_TRNS 805 -#define MNG_FN_PUTCHUNK_GAMA 806 -#define MNG_FN_PUTCHUNK_CHRM 807 -#define MNG_FN_PUTCHUNK_SRGB 808 -#define MNG_FN_PUTCHUNK_ICCP 809 -#define MNG_FN_PUTCHUNK_TEXT 810 -#define MNG_FN_PUTCHUNK_ZTXT 811 -#define MNG_FN_PUTCHUNK_ITXT 812 -#define MNG_FN_PUTCHUNK_BKGD 813 -#define MNG_FN_PUTCHUNK_PHYS 814 -#define MNG_FN_PUTCHUNK_SBIT 815 -#define MNG_FN_PUTCHUNK_SPLT 816 -#define MNG_FN_PUTCHUNK_HIST 817 -#define MNG_FN_PUTCHUNK_TIME 818 -#define MNG_FN_PUTCHUNK_MHDR 819 -#define MNG_FN_PUTCHUNK_MEND 820 -#define MNG_FN_PUTCHUNK_LOOP 821 -#define MNG_FN_PUTCHUNK_ENDL 822 -#define MNG_FN_PUTCHUNK_DEFI 823 -#define MNG_FN_PUTCHUNK_BASI 824 -#define MNG_FN_PUTCHUNK_CLON 825 -#define MNG_FN_PUTCHUNK_PAST 826 -#define MNG_FN_PUTCHUNK_DISC 827 -#define MNG_FN_PUTCHUNK_BACK 828 -#define MNG_FN_PUTCHUNK_FRAM 829 -#define MNG_FN_PUTCHUNK_MOVE 830 -#define MNG_FN_PUTCHUNK_CLIP 831 -#define MNG_FN_PUTCHUNK_SHOW 832 -#define MNG_FN_PUTCHUNK_TERM 833 -#define MNG_FN_PUTCHUNK_SAVE 834 -#define MNG_FN_PUTCHUNK_SEEK 835 -#define MNG_FN_PUTCHUNK_EXPI 836 -#define MNG_FN_PUTCHUNK_FPRI 837 -#define MNG_FN_PUTCHUNK_NEED 838 -#define MNG_FN_PUTCHUNK_PHYG 839 -#define MNG_FN_PUTCHUNK_JHDR 840 -#define MNG_FN_PUTCHUNK_JDAT 841 -#define MNG_FN_PUTCHUNK_JSEP 842 -#define MNG_FN_PUTCHUNK_DHDR 843 -#define MNG_FN_PUTCHUNK_PROM 844 -#define MNG_FN_PUTCHUNK_IPNG 845 -#define MNG_FN_PUTCHUNK_PPLT 846 -#define MNG_FN_PUTCHUNK_IJNG 847 -#define MNG_FN_PUTCHUNK_DROP 848 -#define MNG_FN_PUTCHUNK_DBYK 849 -#define MNG_FN_PUTCHUNK_ORDR 850 -#define MNG_FN_PUTCHUNK_UNKNOWN 851 -#define MNG_FN_PUTCHUNK_MAGN 852 -#define MNG_FN_PUTCHUNK_JDAA 853 -#define MNG_FN_PUTCHUNK_EVNT 854 -#define MNG_FN_PUTCHUNK_MPNG 855 - -#define MNG_FN_PUTCHUNK_PAST_SRC 881 -#define MNG_FN_PUTCHUNK_SAVE_ENTRY 882 -#define MNG_FN_PUTCHUNK_PPLT_ENTRY 883 -#define MNG_FN_PUTCHUNK_ORDR_ENTRY 884 -#define MNG_FN_PUTCHUNK_EVNT_ENTRY 885 -#define MNG_FN_PUTCHUNK_MPNG_FRAME 886 - -/* ************************************************************************** */ - -#define MNG_FN_GETIMGDATA_SEQ 901 -#define MNG_FN_GETIMGDATA_CHUNKSEQ 902 -#define MNG_FN_GETIMGDATA_CHUNK 903 - -#define MNG_FN_PUTIMGDATA_IHDR 951 -#define MNG_FN_PUTIMGDATA_JHDR 952 -#define MNG_FN_PUTIMGDATA_BASI 953 -#define MNG_FN_PUTIMGDATA_DHDR 954 - -#define MNG_FN_UPDATEMNGHEADER 981 -#define MNG_FN_UPDATEMNGSIMPLICITY 982 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_RAW_CHUNK 1001 -#define MNG_FN_READ_GRAPHIC 1002 -#define MNG_FN_DROP_CHUNKS 1003 -#define MNG_FN_PROCESS_ERROR 1004 -#define MNG_FN_CLEAR_CMS 1005 -#define MNG_FN_DROP_OBJECTS 1006 -#define MNG_FN_READ_CHUNK 1007 -#define MNG_FN_LOAD_BKGDLAYER 1008 -#define MNG_FN_NEXT_FRAME 1009 -#define MNG_FN_NEXT_LAYER 1010 -#define MNG_FN_INTERFRAME_DELAY 1011 -#define MNG_FN_DISPLAY_IMAGE 1012 -#define MNG_FN_DROP_IMGOBJECTS 1013 -#define MNG_FN_DROP_ANIOBJECTS 1014 -#define MNG_FN_INFLATE_BUFFER 1015 -#define MNG_FN_DEFLATE_BUFFER 1016 -#define MNG_FN_WRITE_RAW_CHUNK 1017 -#define MNG_FN_WRITE_GRAPHIC 1018 -#define MNG_FN_SAVE_STATE 1019 -#define MNG_FN_RESTORE_STATE 1020 -#define MNG_FN_DROP_SAVEDATA 1021 -#define MNG_FN_EXECUTE_DELTA_IMAGE 1022 -#define MNG_FN_PROCESS_DISPLAY 1023 -#define MNG_FN_CLEAR_CANVAS 1024 -#define MNG_FN_READ_DATABUFFER 1025 -#define MNG_FN_STORE_ERROR 1026 -#define MNG_FN_DROP_INVALID_OBJECTS 1027 -#define MNG_FN_RELEASE_PUSHDATA 1028 -#define MNG_FN_READ_DATA 1029 -#define MNG_FN_READ_CHUNK_CRC 1030 -#define MNG_FN_RELEASE_PUSHCHUNK 1031 - -/* ************************************************************************** */ - -#define MNG_FN_DISPLAY_RGB8 1101 -#define MNG_FN_DISPLAY_RGBA8 1102 -#define MNG_FN_DISPLAY_ARGB8 1103 -#define MNG_FN_DISPLAY_BGR8 1104 -#define MNG_FN_DISPLAY_BGRA8 1105 -#define MNG_FN_DISPLAY_ABGR8 1106 -#define MNG_FN_DISPLAY_RGB16 1107 -#define MNG_FN_DISPLAY_RGBA16 1108 -#define MNG_FN_DISPLAY_ARGB16 1109 -#define MNG_FN_DISPLAY_BGR16 1110 -#define MNG_FN_DISPLAY_BGRA16 1111 -#define MNG_FN_DISPLAY_ABGR16 1112 -#define MNG_FN_DISPLAY_INDEX8 1113 -#define MNG_FN_DISPLAY_INDEXA8 1114 -#define MNG_FN_DISPLAY_AINDEX8 1115 -#define MNG_FN_DISPLAY_GRAY8 1116 -#define MNG_FN_DISPLAY_GRAY16 1117 -#define MNG_FN_DISPLAY_GRAYA8 1118 -#define MNG_FN_DISPLAY_GRAYA16 1119 -#define MNG_FN_DISPLAY_AGRAY8 1120 -#define MNG_FN_DISPLAY_AGRAY16 1121 -#define MNG_FN_DISPLAY_DX15 1122 -#define MNG_FN_DISPLAY_DX16 1123 -#define MNG_FN_DISPLAY_RGB8_A8 1124 -#define MNG_FN_DISPLAY_BGRA8PM 1125 -#define MNG_FN_DISPLAY_BGRX8 1126 -#define MNG_FN_DISPLAY_RGB565 1127 -#define MNG_FN_DISPLAY_RGBA565 1128 -#define MNG_FN_DISPLAY_BGR565 1129 -#define MNG_FN_DISPLAY_BGRA565 1130 -#define MNG_FN_DISPLAY_RGBA8_PM 1131 -#define MNG_FN_DISPLAY_ARGB8_PM 1132 -#define MNG_FN_DISPLAY_ABGR8_PM 1133 -#define MNG_FN_DISPLAY_BGR565_A8 1134 -#define MNG_FN_DISPLAY_RGB555 1135 -#define MNG_FN_DISPLAY_BGR555 1136 - -/* ************************************************************************** */ - -#define MNG_FN_INIT_FULL_CMS 1201 -#define MNG_FN_CORRECT_FULL_CMS 1202 -#define MNG_FN_INIT_GAMMA_ONLY 1204 -#define MNG_FN_CORRECT_GAMMA_ONLY 1205 -#define MNG_FN_CORRECT_APP_CMS 1206 -#define MNG_FN_INIT_FULL_CMS_OBJ 1207 -#define MNG_FN_INIT_GAMMA_ONLY_OBJ 1208 -#define MNG_FN_INIT_APP_CMS 1209 -#define MNG_FN_INIT_APP_CMS_OBJ 1210 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_G1 1301 -#define MNG_FN_PROCESS_G2 1302 -#define MNG_FN_PROCESS_G4 1303 -#define MNG_FN_PROCESS_G8 1304 -#define MNG_FN_PROCESS_G16 1305 -#define MNG_FN_PROCESS_RGB8 1306 -#define MNG_FN_PROCESS_RGB16 1307 -#define MNG_FN_PROCESS_IDX1 1308 -#define MNG_FN_PROCESS_IDX2 1309 -#define MNG_FN_PROCESS_IDX4 1310 -#define MNG_FN_PROCESS_IDX8 1311 -#define MNG_FN_PROCESS_GA8 1312 -#define MNG_FN_PROCESS_GA16 1313 -#define MNG_FN_PROCESS_RGBA8 1314 -#define MNG_FN_PROCESS_RGBA16 1315 - -/* ************************************************************************** */ - -#define MNG_FN_INIT_G1_NI 1401 -#define MNG_FN_INIT_G1_I 1402 -#define MNG_FN_INIT_G2_NI 1403 -#define MNG_FN_INIT_G2_I 1404 -#define MNG_FN_INIT_G4_NI 1405 -#define MNG_FN_INIT_G4_I 1406 -#define MNG_FN_INIT_G8_NI 1407 -#define MNG_FN_INIT_G8_I 1408 -#define MNG_FN_INIT_G16_NI 1409 -#define MNG_FN_INIT_G16_I 1410 -#define MNG_FN_INIT_RGB8_NI 1411 -#define MNG_FN_INIT_RGB8_I 1412 -#define MNG_FN_INIT_RGB16_NI 1413 -#define MNG_FN_INIT_RGB16_I 1414 -#define MNG_FN_INIT_IDX1_NI 1415 -#define MNG_FN_INIT_IDX1_I 1416 -#define MNG_FN_INIT_IDX2_NI 1417 -#define MNG_FN_INIT_IDX2_I 1418 -#define MNG_FN_INIT_IDX4_NI 1419 -#define MNG_FN_INIT_IDX4_I 1420 -#define MNG_FN_INIT_IDX8_NI 1421 -#define MNG_FN_INIT_IDX8_I 1422 -#define MNG_FN_INIT_GA8_NI 1423 -#define MNG_FN_INIT_GA8_I 1424 -#define MNG_FN_INIT_GA16_NI 1425 -#define MNG_FN_INIT_GA16_I 1426 -#define MNG_FN_INIT_RGBA8_NI 1427 -#define MNG_FN_INIT_RGBA8_I 1428 -#define MNG_FN_INIT_RGBA16_NI 1429 -#define MNG_FN_INIT_RGBA16_I 1430 - -#define MNG_FN_INIT_ROWPROC 1497 -#define MNG_FN_NEXT_ROW 1498 -#define MNG_FN_CLEANUP_ROWPROC 1499 - -/* ************************************************************************** */ - -#define MNG_FN_FILTER_A_ROW 1501 -#define MNG_FN_FILTER_SUB 1502 -#define MNG_FN_FILTER_UP 1503 -#define MNG_FN_FILTER_AVERAGE 1504 -#define MNG_FN_FILTER_PAETH 1505 - -#define MNG_FN_INIT_ROWDIFFERING 1551 -#define MNG_FN_DIFFER_G1 1552 -#define MNG_FN_DIFFER_G2 1553 -#define MNG_FN_DIFFER_G4 1554 -#define MNG_FN_DIFFER_G8 1555 -#define MNG_FN_DIFFER_G16 1556 -#define MNG_FN_DIFFER_RGB8 1557 -#define MNG_FN_DIFFER_RGB16 1558 -#define MNG_FN_DIFFER_IDX1 1559 -#define MNG_FN_DIFFER_IDX2 1560 -#define MNG_FN_DIFFER_IDX4 1561 -#define MNG_FN_DIFFER_IDX8 1562 -#define MNG_FN_DIFFER_GA8 1563 -#define MNG_FN_DIFFER_GA16 1564 -#define MNG_FN_DIFFER_RGBA8 1565 -#define MNG_FN_DIFFER_RGBA16 1566 - -/* ************************************************************************** */ - -#define MNG_FN_CREATE_IMGDATAOBJECT 1601 -#define MNG_FN_FREE_IMGDATAOBJECT 1602 -#define MNG_FN_CLONE_IMGDATAOBJECT 1603 -#define MNG_FN_CREATE_IMGOBJECT 1604 -#define MNG_FN_FREE_IMGOBJECT 1605 -#define MNG_FN_FIND_IMGOBJECT 1606 -#define MNG_FN_CLONE_IMGOBJECT 1607 -#define MNG_FN_RESET_OBJECTDETAILS 1608 -#define MNG_FN_RENUM_IMGOBJECT 1609 -#define MNG_FN_PROMOTE_IMGOBJECT 1610 -#define MNG_FN_MAGNIFY_IMGOBJECT 1611 -#define MNG_FN_COLORCORRECT_OBJECT 1612 - -/* ************************************************************************** */ - -#define MNG_FN_STORE_G1 1701 -#define MNG_FN_STORE_G2 1702 -#define MNG_FN_STORE_G4 1703 -#define MNG_FN_STORE_G8 1704 -#define MNG_FN_STORE_G16 1705 -#define MNG_FN_STORE_RGB8 1706 -#define MNG_FN_STORE_RGB16 1707 -#define MNG_FN_STORE_IDX1 1708 -#define MNG_FN_STORE_IDX2 1709 -#define MNG_FN_STORE_IDX4 1710 -#define MNG_FN_STORE_IDX8 1711 -#define MNG_FN_STORE_GA8 1712 -#define MNG_FN_STORE_GA16 1713 -#define MNG_FN_STORE_RGBA8 1714 -#define MNG_FN_STORE_RGBA16 1715 - -#define MNG_FN_RETRIEVE_G8 1751 -#define MNG_FN_RETRIEVE_G16 1752 -#define MNG_FN_RETRIEVE_RGB8 1753 -#define MNG_FN_RETRIEVE_RGB16 1754 -#define MNG_FN_RETRIEVE_IDX8 1755 -#define MNG_FN_RETRIEVE_GA8 1756 -#define MNG_FN_RETRIEVE_GA16 1757 -#define MNG_FN_RETRIEVE_RGBA8 1758 -#define MNG_FN_RETRIEVE_RGBA16 1759 - -#define MNG_FN_DELTA_G1 1771 -#define MNG_FN_DELTA_G2 1772 -#define MNG_FN_DELTA_G4 1773 -#define MNG_FN_DELTA_G8 1774 -#define MNG_FN_DELTA_G16 1775 -#define MNG_FN_DELTA_RGB8 1776 -#define MNG_FN_DELTA_RGB16 1777 -#define MNG_FN_DELTA_IDX1 1778 -#define MNG_FN_DELTA_IDX2 1779 -#define MNG_FN_DELTA_IDX4 1780 -#define MNG_FN_DELTA_IDX8 1781 -#define MNG_FN_DELTA_GA8 1782 -#define MNG_FN_DELTA_GA16 1783 -#define MNG_FN_DELTA_RGBA8 1784 -#define MNG_FN_DELTA_RGBA16 1785 - -/* ************************************************************************** */ - -#define MNG_FN_CREATE_ANI_LOOP 1801 -#define MNG_FN_CREATE_ANI_ENDL 1802 -#define MNG_FN_CREATE_ANI_DEFI 1803 -#define MNG_FN_CREATE_ANI_BASI 1804 -#define MNG_FN_CREATE_ANI_CLON 1805 -#define MNG_FN_CREATE_ANI_PAST 1806 -#define MNG_FN_CREATE_ANI_DISC 1807 -#define MNG_FN_CREATE_ANI_BACK 1808 -#define MNG_FN_CREATE_ANI_FRAM 1809 -#define MNG_FN_CREATE_ANI_MOVE 1810 -#define MNG_FN_CREATE_ANI_CLIP 1811 -#define MNG_FN_CREATE_ANI_SHOW 1812 -#define MNG_FN_CREATE_ANI_TERM 1813 -#define MNG_FN_CREATE_ANI_SAVE 1814 -#define MNG_FN_CREATE_ANI_SEEK 1815 -#define MNG_FN_CREATE_ANI_GAMA 1816 -#define MNG_FN_CREATE_ANI_CHRM 1817 -#define MNG_FN_CREATE_ANI_SRGB 1818 -#define MNG_FN_CREATE_ANI_ICCP 1819 -#define MNG_FN_CREATE_ANI_PLTE 1820 -#define MNG_FN_CREATE_ANI_TRNS 1821 -#define MNG_FN_CREATE_ANI_BKGD 1822 -#define MNG_FN_CREATE_ANI_DHDR 1823 -#define MNG_FN_CREATE_ANI_PROM 1824 -#define MNG_FN_CREATE_ANI_IPNG 1825 -#define MNG_FN_CREATE_ANI_IJNG 1826 -#define MNG_FN_CREATE_ANI_PPLT 1827 -#define MNG_FN_CREATE_ANI_MAGN 1828 - -#define MNG_FN_CREATE_ANI_IMAGE 1891 -#define MNG_FN_CREATE_EVENT 1892 - -/* ************************************************************************** */ - -#define MNG_FN_FREE_ANI_LOOP 1901 -#define MNG_FN_FREE_ANI_ENDL 1902 -#define MNG_FN_FREE_ANI_DEFI 1903 -#define MNG_FN_FREE_ANI_BASI 1904 -#define MNG_FN_FREE_ANI_CLON 1905 -#define MNG_FN_FREE_ANI_PAST 1906 -#define MNG_FN_FREE_ANI_DISC 1907 -#define MNG_FN_FREE_ANI_BACK 1908 -#define MNG_FN_FREE_ANI_FRAM 1909 -#define MNG_FN_FREE_ANI_MOVE 1910 -#define MNG_FN_FREE_ANI_CLIP 1911 -#define MNG_FN_FREE_ANI_SHOW 1912 -#define MNG_FN_FREE_ANI_TERM 1913 -#define MNG_FN_FREE_ANI_SAVE 1914 -#define MNG_FN_FREE_ANI_SEEK 1915 -#define MNG_FN_FREE_ANI_GAMA 1916 -#define MNG_FN_FREE_ANI_CHRM 1917 -#define MNG_FN_FREE_ANI_SRGB 1918 -#define MNG_FN_FREE_ANI_ICCP 1919 -#define MNG_FN_FREE_ANI_PLTE 1920 -#define MNG_FN_FREE_ANI_TRNS 1921 -#define MNG_FN_FREE_ANI_BKGD 1922 -#define MNG_FN_FREE_ANI_DHDR 1923 -#define MNG_FN_FREE_ANI_PROM 1924 -#define MNG_FN_FREE_ANI_IPNG 1925 -#define MNG_FN_FREE_ANI_IJNG 1926 -#define MNG_FN_FREE_ANI_PPLT 1927 -#define MNG_FN_FREE_ANI_MAGN 1928 - -#define MNG_FN_FREE_ANI_IMAGE 1991 -#define MNG_FN_FREE_EVENT 1992 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_ANI_LOOP 2001 -#define MNG_FN_PROCESS_ANI_ENDL 2002 -#define MNG_FN_PROCESS_ANI_DEFI 2003 -#define MNG_FN_PROCESS_ANI_BASI 2004 -#define MNG_FN_PROCESS_ANI_CLON 2005 -#define MNG_FN_PROCESS_ANI_PAST 2006 -#define MNG_FN_PROCESS_ANI_DISC 2007 -#define MNG_FN_PROCESS_ANI_BACK 2008 -#define MNG_FN_PROCESS_ANI_FRAM 2009 -#define MNG_FN_PROCESS_ANI_MOVE 2010 -#define MNG_FN_PROCESS_ANI_CLIP 2011 -#define MNG_FN_PROCESS_ANI_SHOW 2012 -#define MNG_FN_PROCESS_ANI_TERM 2013 -#define MNG_FN_PROCESS_ANI_SAVE 2014 -#define MNG_FN_PROCESS_ANI_SEEK 2015 -#define MNG_FN_PROCESS_ANI_GAMA 2016 -#define MNG_FN_PROCESS_ANI_CHRM 2017 -#define MNG_FN_PROCESS_ANI_SRGB 2018 -#define MNG_FN_PROCESS_ANI_ICCP 2019 -#define MNG_FN_PROCESS_ANI_PLTE 2020 -#define MNG_FN_PROCESS_ANI_TRNS 2021 -#define MNG_FN_PROCESS_ANI_BKGD 2022 -#define MNG_FN_PROCESS_ANI_DHDR 2023 -#define MNG_FN_PROCESS_ANI_PROM 2024 -#define MNG_FN_PROCESS_ANI_IPNG 2025 -#define MNG_FN_PROCESS_ANI_IJNG 2026 -#define MNG_FN_PROCESS_ANI_PPLT 2027 -#define MNG_FN_PROCESS_ANI_MAGN 2028 - -#define MNG_FN_PROCESS_ANI_IMAGE 2091 -#define MNG_FN_PROCESS_EVENT 2092 - -/* ************************************************************************** */ - -#define MNG_FN_RESTORE_BACKIMAGE 2101 -#define MNG_FN_RESTORE_BACKCOLOR 2102 -#define MNG_FN_RESTORE_BGCOLOR 2103 -#define MNG_FN_RESTORE_RGB8 2104 -#define MNG_FN_RESTORE_BGR8 2105 -#define MNG_FN_RESTORE_BKGD 2106 -#define MNG_FN_RESTORE_BGRX8 2107 -#define MNG_FN_RESTORE_RGB565 2108 -#define MNG_FN_RESTORE_BGR565 2109 - -/* ************************************************************************** */ - -#define MNG_FN_INIT_IHDR 2201 -#define MNG_FN_INIT_PLTE 2202 -#define MNG_FN_INIT_IDAT 2203 -#define MNG_FN_INIT_IEND 2204 -#define MNG_FN_INIT_TRNS 2205 -#define MNG_FN_INIT_GAMA 2206 -#define MNG_FN_INIT_CHRM 2207 -#define MNG_FN_INIT_SRGB 2208 -#define MNG_FN_INIT_ICCP 2209 -#define MNG_FN_INIT_TEXT 2210 -#define MNG_FN_INIT_ZTXT 2211 -#define MNG_FN_INIT_ITXT 2212 -#define MNG_FN_INIT_BKGD 2213 -#define MNG_FN_INIT_PHYS 2214 -#define MNG_FN_INIT_SBIT 2215 -#define MNG_FN_INIT_SPLT 2216 -#define MNG_FN_INIT_HIST 2217 -#define MNG_FN_INIT_TIME 2218 -#define MNG_FN_INIT_MHDR 2219 -#define MNG_FN_INIT_MEND 2220 -#define MNG_FN_INIT_LOOP 2221 -#define MNG_FN_INIT_ENDL 2222 -#define MNG_FN_INIT_DEFI 2223 -#define MNG_FN_INIT_BASI 2224 -#define MNG_FN_INIT_CLON 2225 -#define MNG_FN_INIT_PAST 2226 -#define MNG_FN_INIT_DISC 2227 -#define MNG_FN_INIT_BACK 2228 -#define MNG_FN_INIT_FRAM 2229 -#define MNG_FN_INIT_MOVE 2230 -#define MNG_FN_INIT_CLIP 2231 -#define MNG_FN_INIT_SHOW 2232 -#define MNG_FN_INIT_TERM 2233 -#define MNG_FN_INIT_SAVE 2234 -#define MNG_FN_INIT_SEEK 2235 -#define MNG_FN_INIT_EXPI 2236 -#define MNG_FN_INIT_FPRI 2237 -#define MNG_FN_INIT_NEED 2238 -#define MNG_FN_INIT_PHYG 2239 -#define MNG_FN_INIT_JHDR 2240 -#define MNG_FN_INIT_JDAT 2241 -#define MNG_FN_INIT_JSEP 2242 -#define MNG_FN_INIT_DHDR 2243 -#define MNG_FN_INIT_PROM 2244 -#define MNG_FN_INIT_IPNG 2245 -#define MNG_FN_INIT_PPLT 2246 -#define MNG_FN_INIT_IJNG 2247 -#define MNG_FN_INIT_DROP 2248 -#define MNG_FN_INIT_DBYK 2249 -#define MNG_FN_INIT_ORDR 2250 -#define MNG_FN_INIT_UNKNOWN 2251 -#define MNG_FN_INIT_MAGN 2252 -#define MNG_FN_INIT_JDAA 2253 -#define MNG_FN_INIT_EVNT 2254 -#define MNG_FN_INIT_MPNG 2255 - -/* ************************************************************************** */ - -#define MNG_FN_ASSIGN_IHDR 2301 -#define MNG_FN_ASSIGN_PLTE 2302 -#define MNG_FN_ASSIGN_IDAT 2303 -#define MNG_FN_ASSIGN_IEND 2304 -#define MNG_FN_ASSIGN_TRNS 2305 -#define MNG_FN_ASSIGN_GAMA 2306 -#define MNG_FN_ASSIGN_CHRM 2307 -#define MNG_FN_ASSIGN_SRGB 2308 -#define MNG_FN_ASSIGN_ICCP 2309 -#define MNG_FN_ASSIGN_TEXT 2310 -#define MNG_FN_ASSIGN_ZTXT 2311 -#define MNG_FN_ASSIGN_ITXT 2312 -#define MNG_FN_ASSIGN_BKGD 2313 -#define MNG_FN_ASSIGN_PHYS 2314 -#define MNG_FN_ASSIGN_SBIT 2315 -#define MNG_FN_ASSIGN_SPLT 2316 -#define MNG_FN_ASSIGN_HIST 2317 -#define MNG_FN_ASSIGN_TIME 2318 -#define MNG_FN_ASSIGN_MHDR 2319 -#define MNG_FN_ASSIGN_MEND 2320 -#define MNG_FN_ASSIGN_LOOP 2321 -#define MNG_FN_ASSIGN_ENDL 2322 -#define MNG_FN_ASSIGN_DEFI 2323 -#define MNG_FN_ASSIGN_BASI 2324 -#define MNG_FN_ASSIGN_CLON 2325 -#define MNG_FN_ASSIGN_PAST 2326 -#define MNG_FN_ASSIGN_DISC 2327 -#define MNG_FN_ASSIGN_BACK 2328 -#define MNG_FN_ASSIGN_FRAM 2329 -#define MNG_FN_ASSIGN_MOVE 2330 -#define MNG_FN_ASSIGN_CLIP 2331 -#define MNG_FN_ASSIGN_SHOW 2332 -#define MNG_FN_ASSIGN_TERM 2333 -#define MNG_FN_ASSIGN_SAVE 2334 -#define MNG_FN_ASSIGN_SEEK 2335 -#define MNG_FN_ASSIGN_EXPI 2336 -#define MNG_FN_ASSIGN_FPRI 2337 -#define MNG_FN_ASSIGN_NEED 2338 -#define MNG_FN_ASSIGN_PHYG 2339 -#define MNG_FN_ASSIGN_JHDR 2340 -#define MNG_FN_ASSIGN_JDAT 2341 -#define MNG_FN_ASSIGN_JSEP 2342 -#define MNG_FN_ASSIGN_DHDR 2343 -#define MNG_FN_ASSIGN_PROM 2344 -#define MNG_FN_ASSIGN_IPNG 2345 -#define MNG_FN_ASSIGN_PPLT 2346 -#define MNG_FN_ASSIGN_IJNG 2347 -#define MNG_FN_ASSIGN_DROP 2348 -#define MNG_FN_ASSIGN_DBYK 2349 -#define MNG_FN_ASSIGN_ORDR 2350 -#define MNG_FN_ASSIGN_UNKNOWN 2351 -#define MNG_FN_ASSIGN_MAGN 2352 -#define MNG_FN_ASSIGN_JDAA 2353 -#define MNG_FN_ASSIGN_EVNT 2354 -#define MNG_FN_ASSIGN_MPNG 2355 - -/* ************************************************************************** */ - -#define MNG_FN_FREE_IHDR 2401 -#define MNG_FN_FREE_PLTE 2402 -#define MNG_FN_FREE_IDAT 2403 -#define MNG_FN_FREE_IEND 2404 -#define MNG_FN_FREE_TRNS 2405 -#define MNG_FN_FREE_GAMA 2406 -#define MNG_FN_FREE_CHRM 2407 -#define MNG_FN_FREE_SRGB 2408 -#define MNG_FN_FREE_ICCP 2409 -#define MNG_FN_FREE_TEXT 2410 -#define MNG_FN_FREE_ZTXT 2411 -#define MNG_FN_FREE_ITXT 2412 -#define MNG_FN_FREE_BKGD 2413 -#define MNG_FN_FREE_PHYS 2414 -#define MNG_FN_FREE_SBIT 2415 -#define MNG_FN_FREE_SPLT 2416 -#define MNG_FN_FREE_HIST 2417 -#define MNG_FN_FREE_TIME 2418 -#define MNG_FN_FREE_MHDR 2419 -#define MNG_FN_FREE_MEND 2420 -#define MNG_FN_FREE_LOOP 2421 -#define MNG_FN_FREE_ENDL 2422 -#define MNG_FN_FREE_DEFI 2423 -#define MNG_FN_FREE_BASI 2424 -#define MNG_FN_FREE_CLON 2425 -#define MNG_FN_FREE_PAST 2426 -#define MNG_FN_FREE_DISC 2427 -#define MNG_FN_FREE_BACK 2428 -#define MNG_FN_FREE_FRAM 2429 -#define MNG_FN_FREE_MOVE 2430 -#define MNG_FN_FREE_CLIP 2431 -#define MNG_FN_FREE_SHOW 2432 -#define MNG_FN_FREE_TERM 2433 -#define MNG_FN_FREE_SAVE 2434 -#define MNG_FN_FREE_SEEK 2435 -#define MNG_FN_FREE_EXPI 2436 -#define MNG_FN_FREE_FPRI 2437 -#define MNG_FN_FREE_NEED 2438 -#define MNG_FN_FREE_PHYG 2439 -#define MNG_FN_FREE_JHDR 2440 -#define MNG_FN_FREE_JDAT 2441 -#define MNG_FN_FREE_JSEP 2442 -#define MNG_FN_FREE_DHDR 2443 -#define MNG_FN_FREE_PROM 2444 -#define MNG_FN_FREE_IPNG 2445 -#define MNG_FN_FREE_PPLT 2446 -#define MNG_FN_FREE_IJNG 2447 -#define MNG_FN_FREE_DROP 2448 -#define MNG_FN_FREE_DBYK 2449 -#define MNG_FN_FREE_ORDR 2450 -#define MNG_FN_FREE_UNKNOWN 2451 -#define MNG_FN_FREE_MAGN 2452 -#define MNG_FN_FREE_JDAA 2453 -#define MNG_FN_FREE_EVNT 2454 -#define MNG_FN_FREE_MPNG 2455 - -/* ************************************************************************** */ - -#define MNG_FN_READ_IHDR 2601 -#define MNG_FN_READ_PLTE 2602 -#define MNG_FN_READ_IDAT 2603 -#define MNG_FN_READ_IEND 2604 -#define MNG_FN_READ_TRNS 2605 -#define MNG_FN_READ_GAMA 2606 -#define MNG_FN_READ_CHRM 2607 -#define MNG_FN_READ_SRGB 2608 -#define MNG_FN_READ_ICCP 2609 -#define MNG_FN_READ_TEXT 2610 -#define MNG_FN_READ_ZTXT 2611 -#define MNG_FN_READ_ITXT 2612 -#define MNG_FN_READ_BKGD 2613 -#define MNG_FN_READ_PHYS 2614 -#define MNG_FN_READ_SBIT 2615 -#define MNG_FN_READ_SPLT 2616 -#define MNG_FN_READ_HIST 2617 -#define MNG_FN_READ_TIME 2618 -#define MNG_FN_READ_MHDR 2619 -#define MNG_FN_READ_MEND 2620 -#define MNG_FN_READ_LOOP 2621 -#define MNG_FN_READ_ENDL 2622 -#define MNG_FN_READ_DEFI 2623 -#define MNG_FN_READ_BASI 2624 -#define MNG_FN_READ_CLON 2625 -#define MNG_FN_READ_PAST 2626 -#define MNG_FN_READ_DISC 2627 -#define MNG_FN_READ_BACK 2628 -#define MNG_FN_READ_FRAM 2629 -#define MNG_FN_READ_MOVE 2630 -#define MNG_FN_READ_CLIP 2631 -#define MNG_FN_READ_SHOW 2632 -#define MNG_FN_READ_TERM 2633 -#define MNG_FN_READ_SAVE 2634 -#define MNG_FN_READ_SEEK 2635 -#define MNG_FN_READ_EXPI 2636 -#define MNG_FN_READ_FPRI 2637 -#define MNG_FN_READ_NEED 2638 -#define MNG_FN_READ_PHYG 2639 -#define MNG_FN_READ_JHDR 2640 -#define MNG_FN_READ_JDAT 2641 -#define MNG_FN_READ_JSEP 2642 -#define MNG_FN_READ_DHDR 2643 -#define MNG_FN_READ_PROM 2644 -#define MNG_FN_READ_IPNG 2645 -#define MNG_FN_READ_PPLT 2646 -#define MNG_FN_READ_IJNG 2647 -#define MNG_FN_READ_DROP 2648 -#define MNG_FN_READ_DBYK 2649 -#define MNG_FN_READ_ORDR 2650 -#define MNG_FN_READ_UNKNOWN 2651 -#define MNG_FN_READ_MAGN 2652 -#define MNG_FN_READ_JDAA 2653 -#define MNG_FN_READ_EVNT 2654 -#define MNG_FN_READ_MPNG 2655 - -/* ************************************************************************** */ - -#define MNG_FN_WRITE_IHDR 2801 -#define MNG_FN_WRITE_PLTE 2802 -#define MNG_FN_WRITE_IDAT 2803 -#define MNG_FN_WRITE_IEND 2804 -#define MNG_FN_WRITE_TRNS 2805 -#define MNG_FN_WRITE_GAMA 2806 -#define MNG_FN_WRITE_CHRM 2807 -#define MNG_FN_WRITE_SRGB 2808 -#define MNG_FN_WRITE_ICCP 2809 -#define MNG_FN_WRITE_TEXT 2810 -#define MNG_FN_WRITE_ZTXT 2811 -#define MNG_FN_WRITE_ITXT 2812 -#define MNG_FN_WRITE_BKGD 2813 -#define MNG_FN_WRITE_PHYS 2814 -#define MNG_FN_WRITE_SBIT 2815 -#define MNG_FN_WRITE_SPLT 2816 -#define MNG_FN_WRITE_HIST 2817 -#define MNG_FN_WRITE_TIME 2818 -#define MNG_FN_WRITE_MHDR 2819 -#define MNG_FN_WRITE_MEND 2820 -#define MNG_FN_WRITE_LOOP 2821 -#define MNG_FN_WRITE_ENDL 2822 -#define MNG_FN_WRITE_DEFI 2823 -#define MNG_FN_WRITE_BASI 2824 -#define MNG_FN_WRITE_CLON 2825 -#define MNG_FN_WRITE_PAST 2826 -#define MNG_FN_WRITE_DISC 2827 -#define MNG_FN_WRITE_BACK 2828 -#define MNG_FN_WRITE_FRAM 2829 -#define MNG_FN_WRITE_MOVE 2830 -#define MNG_FN_WRITE_CLIP 2831 -#define MNG_FN_WRITE_SHOW 2832 -#define MNG_FN_WRITE_TERM 2833 -#define MNG_FN_WRITE_SAVE 2834 -#define MNG_FN_WRITE_SEEK 2835 -#define MNG_FN_WRITE_EXPI 2836 -#define MNG_FN_WRITE_FPRI 2837 -#define MNG_FN_WRITE_NEED 2838 -#define MNG_FN_WRITE_PHYG 2839 -#define MNG_FN_WRITE_JHDR 2840 -#define MNG_FN_WRITE_JDAT 2841 -#define MNG_FN_WRITE_JSEP 2842 -#define MNG_FN_WRITE_DHDR 2843 -#define MNG_FN_WRITE_PROM 2844 -#define MNG_FN_WRITE_IPNG 2845 -#define MNG_FN_WRITE_PPLT 2846 -#define MNG_FN_WRITE_IJNG 2847 -#define MNG_FN_WRITE_DROP 2848 -#define MNG_FN_WRITE_DBYK 2849 -#define MNG_FN_WRITE_ORDR 2850 -#define MNG_FN_WRITE_UNKNOWN 2851 -#define MNG_FN_WRITE_MAGN 2852 -#define MNG_FN_WRITE_JDAA 2853 -#define MNG_FN_WRITE_EVNT 2854 -#define MNG_FN_WRITE_MPNG 2855 - -/* ************************************************************************** */ - -#define MNG_FN_ZLIB_INITIALIZE 3001 -#define MNG_FN_ZLIB_CLEANUP 3002 -#define MNG_FN_ZLIB_INFLATEINIT 3003 -#define MNG_FN_ZLIB_INFLATEROWS 3004 -#define MNG_FN_ZLIB_INFLATEDATA 3005 -#define MNG_FN_ZLIB_INFLATEFREE 3006 -#define MNG_FN_ZLIB_DEFLATEINIT 3007 -#define MNG_FN_ZLIB_DEFLATEROWS 3008 -#define MNG_FN_ZLIB_DEFLATEDATA 3009 -#define MNG_FN_ZLIB_DEFLATEFREE 3010 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_DISPLAY_IHDR 3201 -#define MNG_FN_PROCESS_DISPLAY_PLTE 3202 -#define MNG_FN_PROCESS_DISPLAY_IDAT 3203 -#define MNG_FN_PROCESS_DISPLAY_IEND 3204 -#define MNG_FN_PROCESS_DISPLAY_TRNS 3205 -#define MNG_FN_PROCESS_DISPLAY_GAMA 3206 -#define MNG_FN_PROCESS_DISPLAY_CHRM 3207 -#define MNG_FN_PROCESS_DISPLAY_SRGB 3208 -#define MNG_FN_PROCESS_DISPLAY_ICCP 3209 -#define MNG_FN_PROCESS_DISPLAY_BKGD 3210 -#define MNG_FN_PROCESS_DISPLAY_PHYS 3211 -#define MNG_FN_PROCESS_DISPLAY_SBIT 3212 -#define MNG_FN_PROCESS_DISPLAY_SPLT 3213 -#define MNG_FN_PROCESS_DISPLAY_HIST 3214 -#define MNG_FN_PROCESS_DISPLAY_MHDR 3215 -#define MNG_FN_PROCESS_DISPLAY_MEND 3216 -#define MNG_FN_PROCESS_DISPLAY_LOOP 3217 -#define MNG_FN_PROCESS_DISPLAY_ENDL 3218 -#define MNG_FN_PROCESS_DISPLAY_DEFI 3219 -#define MNG_FN_PROCESS_DISPLAY_BASI 3220 -#define MNG_FN_PROCESS_DISPLAY_CLON 3221 -#define MNG_FN_PROCESS_DISPLAY_PAST 3222 -#define MNG_FN_PROCESS_DISPLAY_DISC 3223 -#define MNG_FN_PROCESS_DISPLAY_BACK 3224 -#define MNG_FN_PROCESS_DISPLAY_FRAM 3225 -#define MNG_FN_PROCESS_DISPLAY_MOVE 3226 -#define MNG_FN_PROCESS_DISPLAY_CLIP 3227 -#define MNG_FN_PROCESS_DISPLAY_SHOW 3228 -#define MNG_FN_PROCESS_DISPLAY_TERM 3229 -#define MNG_FN_PROCESS_DISPLAY_SAVE 3230 -#define MNG_FN_PROCESS_DISPLAY_SEEK 3231 -#define MNG_FN_PROCESS_DISPLAY_EXPI 3232 -#define MNG_FN_PROCESS_DISPLAY_FPRI 3233 -#define MNG_FN_PROCESS_DISPLAY_NEED 3234 -#define MNG_FN_PROCESS_DISPLAY_PHYG 3235 -#define MNG_FN_PROCESS_DISPLAY_JHDR 3236 -#define MNG_FN_PROCESS_DISPLAY_JDAT 3237 -#define MNG_FN_PROCESS_DISPLAY_JSEP 3238 -#define MNG_FN_PROCESS_DISPLAY_DHDR 3239 -#define MNG_FN_PROCESS_DISPLAY_PROM 3240 -#define MNG_FN_PROCESS_DISPLAY_IPNG 3241 -#define MNG_FN_PROCESS_DISPLAY_PPLT 3242 -#define MNG_FN_PROCESS_DISPLAY_IJNG 3243 -#define MNG_FN_PROCESS_DISPLAY_DROP 3244 -#define MNG_FN_PROCESS_DISPLAY_DBYK 3245 -#define MNG_FN_PROCESS_DISPLAY_ORDR 3246 -#define MNG_FN_PROCESS_DISPLAY_MAGN 3247 -#define MNG_FN_PROCESS_DISPLAY_JDAA 3248 - -/* ************************************************************************** */ - -#define MNG_FN_JPEG_INITIALIZE 3401 -#define MNG_FN_JPEG_CLEANUP 3402 -#define MNG_FN_JPEG_DECOMPRESSINIT 3403 -#define MNG_FN_JPEG_DECOMPRESSDATA 3404 -#define MNG_FN_JPEG_DECOMPRESSFREE 3405 - -#define MNG_FN_STORE_JPEG_G8 3501 -#define MNG_FN_STORE_JPEG_RGB8 3502 -#define MNG_FN_STORE_JPEG_G12 3503 -#define MNG_FN_STORE_JPEG_RGB12 3504 -#define MNG_FN_STORE_JPEG_GA8 3505 -#define MNG_FN_STORE_JPEG_RGBA8 3506 -#define MNG_FN_STORE_JPEG_GA12 3507 -#define MNG_FN_STORE_JPEG_RGBA12 3508 -#define MNG_FN_STORE_JPEG_G8_ALPHA 3509 -#define MNG_FN_STORE_JPEG_RGB8_ALPHA 3510 - -#define MNG_FN_INIT_JPEG_A1_NI 3511 -#define MNG_FN_INIT_JPEG_A2_NI 3512 -#define MNG_FN_INIT_JPEG_A4_NI 3513 -#define MNG_FN_INIT_JPEG_A8_NI 3514 -#define MNG_FN_INIT_JPEG_A16_NI 3515 - -#define MNG_FN_STORE_JPEG_G8_A1 3521 -#define MNG_FN_STORE_JPEG_G8_A2 3522 -#define MNG_FN_STORE_JPEG_G8_A4 3523 -#define MNG_FN_STORE_JPEG_G8_A8 3524 -#define MNG_FN_STORE_JPEG_G8_A16 3525 - -#define MNG_FN_STORE_JPEG_RGB8_A1 3531 -#define MNG_FN_STORE_JPEG_RGB8_A2 3532 -#define MNG_FN_STORE_JPEG_RGB8_A4 3533 -#define MNG_FN_STORE_JPEG_RGB8_A8 3534 -#define MNG_FN_STORE_JPEG_RGB8_A16 3535 - -#define MNG_FN_STORE_JPEG_G12_A1 3541 -#define MNG_FN_STORE_JPEG_G12_A2 3542 -#define MNG_FN_STORE_JPEG_G12_A4 3543 -#define MNG_FN_STORE_JPEG_G12_A8 3544 -#define MNG_FN_STORE_JPEG_G12_A16 3545 - -#define MNG_FN_STORE_JPEG_RGB12_A1 3551 -#define MNG_FN_STORE_JPEG_RGB12_A2 3552 -#define MNG_FN_STORE_JPEG_RGB12_A4 3553 -#define MNG_FN_STORE_JPEG_RGB12_A8 3554 -#define MNG_FN_STORE_JPEG_RGB12_A16 3555 - -#define MNG_FN_NEXT_JPEG_ALPHAROW 3591 -#define MNG_FN_NEXT_JPEG_ROW 3592 -#define MNG_FN_DISPLAY_JPEG_ROWS 3593 - -/* ************************************************************************** */ - -#define MNG_FN_MAGNIFY_G8_X1 3701 -#define MNG_FN_MAGNIFY_G8_X2 3702 -#define MNG_FN_MAGNIFY_RGB8_X1 3703 -#define MNG_FN_MAGNIFY_RGB8_X2 3704 -#define MNG_FN_MAGNIFY_GA8_X1 3705 -#define MNG_FN_MAGNIFY_GA8_X2 3706 -#define MNG_FN_MAGNIFY_GA8_X3 3707 -#define MNG_FN_MAGNIFY_GA8_X4 3708 -#define MNG_FN_MAGNIFY_RGBA8_X1 3709 -#define MNG_FN_MAGNIFY_RGBA8_X2 3710 -#define MNG_FN_MAGNIFY_RGBA8_X3 3711 -#define MNG_FN_MAGNIFY_RGBA8_X4 3712 -#define MNG_FN_MAGNIFY_G8_X3 3713 -#define MNG_FN_MAGNIFY_RGB8_X3 3714 -#define MNG_FN_MAGNIFY_GA8_X5 3715 -#define MNG_FN_MAGNIFY_RGBA8_X5 3716 - -#define MNG_FN_MAGNIFY_G16_X1 3725 -#define MNG_FN_MAGNIFY_G16_X2 3726 -#define MNG_FN_MAGNIFY_RGB16_X1 3727 -#define MNG_FN_MAGNIFY_RGB16_X2 3728 -#define MNG_FN_MAGNIFY_GA16_X1 3729 -#define MNG_FN_MAGNIFY_GA16_X2 3730 -#define MNG_FN_MAGNIFY_GA16_X3 3731 -#define MNG_FN_MAGNIFY_GA16_X4 3732 -#define MNG_FN_MAGNIFY_RGBA16_X1 3733 -#define MNG_FN_MAGNIFY_RGBA16_X2 3734 -#define MNG_FN_MAGNIFY_RGBA16_X3 3735 -#define MNG_FN_MAGNIFY_RGBA16_X4 3736 -#define MNG_FN_MAGNIFY_G16_X3 3737 -#define MNG_FN_MAGNIFY_RGB16_X3 3738 -#define MNG_FN_MAGNIFY_GA16_X5 3739 -#define MNG_FN_MAGNIFY_RGBA16_X5 3740 - -#define MNG_FN_MAGNIFY_G8_Y1 3751 -#define MNG_FN_MAGNIFY_G8_Y2 3752 -#define MNG_FN_MAGNIFY_RGB8_Y1 3753 -#define MNG_FN_MAGNIFY_RGB8_Y2 3754 -#define MNG_FN_MAGNIFY_GA8_Y1 3755 -#define MNG_FN_MAGNIFY_GA8_Y2 3756 -#define MNG_FN_MAGNIFY_GA8_Y3 3757 -#define MNG_FN_MAGNIFY_GA8_Y4 3758 -#define MNG_FN_MAGNIFY_RGBA8_Y1 3759 -#define MNG_FN_MAGNIFY_RGBA8_Y2 3760 -#define MNG_FN_MAGNIFY_RGBA8_Y3 3761 -#define MNG_FN_MAGNIFY_RGBA8_Y4 3762 -#define MNG_FN_MAGNIFY_G8_Y3 3763 -#define MNG_FN_MAGNIFY_RGB8_Y3 3764 -#define MNG_FN_MAGNIFY_GA8_Y5 3765 -#define MNG_FN_MAGNIFY_RGBA8_Y5 3766 - -#define MNG_FN_MAGNIFY_G16_Y1 3775 -#define MNG_FN_MAGNIFY_G16_Y2 3776 -#define MNG_FN_MAGNIFY_RGB16_Y1 3777 -#define MNG_FN_MAGNIFY_RGB16_Y2 3778 -#define MNG_FN_MAGNIFY_GA16_Y1 3779 -#define MNG_FN_MAGNIFY_GA16_Y2 3780 -#define MNG_FN_MAGNIFY_GA16_Y3 3781 -#define MNG_FN_MAGNIFY_GA16_Y4 3782 -#define MNG_FN_MAGNIFY_RGBA16_Y1 3783 -#define MNG_FN_MAGNIFY_RGBA16_Y2 3784 -#define MNG_FN_MAGNIFY_RGBA16_Y3 3785 -#define MNG_FN_MAGNIFY_RGBA16_Y4 3786 -#define MNG_FN_MAGNIFY_G16_Y3 3787 -#define MNG_FN_MAGNIFY_RGB16_Y3 3788 -#define MNG_FN_MAGNIFY_GA16_Y5 3789 -#define MNG_FN_MAGNIFY_RGBA16_Y5 3790 - -/* ************************************************************************** */ - -#define MNG_FN_DELTA_G1_G1 3801 -#define MNG_FN_DELTA_G2_G2 3802 -#define MNG_FN_DELTA_G4_G4 3803 -#define MNG_FN_DELTA_G8_G8 3804 -#define MNG_FN_DELTA_G16_G16 3805 -#define MNG_FN_DELTA_RGB8_RGB8 3806 -#define MNG_FN_DELTA_RGB16_RGB16 3807 -#define MNG_FN_DELTA_GA8_GA8 3808 -#define MNG_FN_DELTA_GA8_G8 3809 -#define MNG_FN_DELTA_GA8_A8 3810 -#define MNG_FN_DELTA_GA16_GA16 3811 -#define MNG_FN_DELTA_GA16_G16 3812 -#define MNG_FN_DELTA_GA16_A16 3813 -#define MNG_FN_DELTA_RGBA8_RGBA8 3814 -#define MNG_FN_DELTA_RGBA8_RGB8 3815 -#define MNG_FN_DELTA_RGBA8_A8 3816 -#define MNG_FN_DELTA_RGBA16_RGBA16 3817 -#define MNG_FN_DELTA_RGBA16_RGB16 3818 -#define MNG_FN_DELTA_RGBA16_A16 3819 - -#define MNG_FN_PROMOTE_G8_G8 3901 -#define MNG_FN_PROMOTE_G8_G16 3902 -#define MNG_FN_PROMOTE_G16_G16 3903 -#define MNG_FN_PROMOTE_G8_GA8 3904 -#define MNG_FN_PROMOTE_G8_GA16 3905 -#define MNG_FN_PROMOTE_G16_GA16 3906 -#define MNG_FN_PROMOTE_G8_RGB8 3907 -#define MNG_FN_PROMOTE_G8_RGB16 3908 -#define MNG_FN_PROMOTE_G16_RGB16 3909 -#define MNG_FN_PROMOTE_G8_RGBA8 3910 -#define MNG_FN_PROMOTE_G8_RGBA16 3911 -#define MNG_FN_PROMOTE_G16_RGBA16 3912 -#define MNG_FN_PROMOTE_GA8_GA16 3913 -#define MNG_FN_PROMOTE_GA8_RGBA8 3914 -#define MNG_FN_PROMOTE_GA8_RGBA16 3915 -#define MNG_FN_PROMOTE_GA16_RGBA16 3916 -#define MNG_FN_PROMOTE_RGB8_RGB16 3917 -#define MNG_FN_PROMOTE_RGB8_RGBA8 3918 -#define MNG_FN_PROMOTE_RGB8_RGBA16 3919 -#define MNG_FN_PROMOTE_RGB16_RGBA16 3920 -#define MNG_FN_PROMOTE_RGBA8_RGBA16 3921 -#define MNG_FN_PROMOTE_IDX8_RGB8 3922 -#define MNG_FN_PROMOTE_IDX8_RGB16 3923 -#define MNG_FN_PROMOTE_IDX8_RGBA8 3924 -#define MNG_FN_PROMOTE_IDX8_RGBA16 3925 - -#define MNG_FN_SCALE_G1_G2 4001 -#define MNG_FN_SCALE_G1_G4 4002 -#define MNG_FN_SCALE_G1_G8 4003 -#define MNG_FN_SCALE_G1_G16 4004 -#define MNG_FN_SCALE_G2_G4 4005 -#define MNG_FN_SCALE_G2_G8 4006 -#define MNG_FN_SCALE_G2_G16 4007 -#define MNG_FN_SCALE_G4_G8 4008 -#define MNG_FN_SCALE_G4_G16 4009 -#define MNG_FN_SCALE_G8_G16 4010 -#define MNG_FN_SCALE_GA8_GA16 4011 -#define MNG_FN_SCALE_RGB8_RGB16 4012 -#define MNG_FN_SCALE_RGBA8_RGBA16 4013 - -#define MNG_FN_SCALE_G2_G1 4021 -#define MNG_FN_SCALE_G4_G1 4022 -#define MNG_FN_SCALE_G8_G1 4023 -#define MNG_FN_SCALE_G16_G1 4024 -#define MNG_FN_SCALE_G4_G2 4025 -#define MNG_FN_SCALE_G8_G2 4026 -#define MNG_FN_SCALE_G16_G2 4027 -#define MNG_FN_SCALE_G8_G4 4028 -#define MNG_FN_SCALE_G16_G4 4029 -#define MNG_FN_SCALE_G16_G8 4030 -#define MNG_FN_SCALE_GA16_GA8 4031 -#define MNG_FN_SCALE_RGB16_RGB8 4032 -#define MNG_FN_SCALE_RGBA16_RGBA8 4033 - -#define MNG_FN_COMPOSEOVER_RGBA8 4501 -#define MNG_FN_COMPOSEOVER_RGBA16 4502 -#define MNG_FN_COMPOSEUNDER_RGBA8 4503 -#define MNG_FN_COMPOSEUNDER_RGBA16 4504 - -#define MNG_FN_FLIP_RGBA8 4521 -#define MNG_FN_FLIP_RGBA16 4522 -#define MNG_FN_TILE_RGBA8 4523 -#define MNG_FN_TILE_RGBA16 4524 - -/* ************************************************************************** */ -/* * * */ -/* * Trace string-table entry * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct { - mng_uint32 iFunction; - mng_pchar zTracetext; - } mng_trace_entry; -typedef mng_trace_entry const * mng_trace_entryp; - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_TRACE_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_trace_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_types.h b/Engine/lib/lmng/libmng_types.h deleted file mode 100644 index 81fb29f52..000000000 --- a/Engine/lib/lmng/libmng_types.h +++ /dev/null @@ -1,574 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_types.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : type specifications * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Specification of the types used by the library * */ -/* * Creates platform-independant structure * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added iteratechunk callback definition * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - improved definitions for DLL support * */ -/* * - added 8-bit palette definition * */ -/* * - added general array definitions * */ -/* * - added MNG_NULL definition * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - changed most callback prototypes to allow the app * */ -/* * to report errors during callback processing * */ -/* * 0.5.1 - 05/16/2000 - G.Juyn * */ -/* * - moved standard header includes into this file * */ -/* * (stdlib/mem for mem-mngmt & math for fp gamma-calc) * */ -/* * * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - B003 - fixed problem with being proprietary * */ -/* * to Borland platform * */ -/* * - added helper definitions for JNG (IJG-based) * */ -/* * - fixed support for IJGSRC6B * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added default IJG compression parameters and such * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed inclusion for memcpy (contributed by Tim Rowley) * */ -/* * - added mng_int32p (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - removed SWAP_ENDIAN reference (contributed by Tim Rowley)* */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added speedtype to facilitate testing * */ -/* * 0.5.3 - 06/27/2000 - G.Juyn * */ -/* * - added typedef for mng_size_t * */ -/* * - changed size parameter for memory callbacks to * */ -/* * mng_size_t * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - changed definition of 32-bit ints (64-bit platforms) * */ -/* * - changed definition of mng_handle (64-bit platforms) * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - changed definition of mng_handle (again) * */ -/* * - swapped refresh parameters * */ -/* * - added inclusion of stdlib.h for abs() * */ -/* * * */ -/* * 0.9.0 - 06/30/2000 - G.Juyn * */ -/* * - changed refresh parameters to 'x,y,width,height' * */ -/* * 0.9.1 - 07/10/2000 - G.Juyn * */ -/* * - added suspendbuffer constants * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 09/11/2000 - G.Juyn * */ -/* * - added export of zlib functions from windows dll * */ -/* * - fixed inclusion parameters once again to make those * */ -/* * external libs work together * */ -/* * - re-fixed fixed inclusion parameters * */ -/* * (these freeking libraries make me mad) * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * * */ -/* * 0.9.4 - 11/20/2000 - R.Giles * */ -/* * - fixed inclusion of lcms header for non-windows platforms * */ -/* * 0.9.4 - 12/12/2000 - G.Juyn * */ -/* * - changed callback convention for MSVC (Thanks Chad) * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added processterm callback * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - changed inclusion of lcms.h for Linux platforms * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * 1.0.6 - 06/15/2003 - R.Giles * */ -/* * - lcms.h inclusion is generally no longer prefixed * */ -/* * 1.0.6 - 07/07/2003 - G. R-P. * */ -/* * - added png_imgtypes enumeration * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 08/01/2004 - G.Juyn * */ -/* * - added support for 3+byte pixelsize for JPEG's * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - inclusion of zlib/lcms/ijgsrc6b with <> instead of "" * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef _libmng_types_h_ -#define _libmng_types_h_ - -/* ************************************************************************** */ - -#ifdef __BORLANDC__ -#pragma option -AT /* turn off strict ANSI-C for the moment */ -#endif - -#ifndef WIN32 -#if defined(_WIN32) || defined(__WIN32__) || defined(_Windows) || defined(_WINDOWS) -#define WIN32 /* gather them into a single define */ -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Here's where the external & standard libs are embedded * */ -/* * * */ -/* * (it can be a bit of a pain in the lower-back to get them to work * */ -/* * together) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef WIN32 /* only include needed stuff */ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#endif - -#ifdef MNG_USE_DLL -#ifdef MNG_SKIP_ZLIB -#undef MNG_INCLUDE_ZLIB -#endif -#ifdef MNG_SKIP_LCMS -#undef MNG_INCLUDE_LCMS -#endif -#ifdef MNG_SKIP_IJG6B -#undef MNG_INCLUDE_IJG6B -#endif -#endif - -#ifdef MNG_INCLUDE_ZLIB /* zlib by Mark Adler & Jean-loup Gailly */ -#include -#endif - -#ifdef MNG_INCLUDE_LCMS /* little cms by Marti Maria Saguer */ -#ifndef ZLIB_DLL -#undef FAR -#endif -#include -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_INCLUDE_IJG6B /* IJG's jpgsrc6b */ -#include -#ifdef MNG_USE_SETJMP -#include /* needed for error-recovery (blergh) */ -#else -#ifdef WIN32 -#define USE_WINDOWS_MESSAGEBOX /* display a messagebox under Windoze */ -#endif -#endif /* MNG_USE_SETJMP */ -#ifdef FAR -#undef FAR /* possibly defined by zlib or lcms */ -#endif -#define JPEG_INTERNAL_OPTIONS /* for RGB_PIXELSIZE */ -#include /* all that for JPEG support :-) */ -#endif /* MNG_INCLUDE_IJG6B */ - -#if defined(MNG_INTERNAL_MEMMNGMT) || defined(MNG_INCLUDE_FILTERS) -#include /* "calloc" & "free" & "abs" */ -#endif - -#include /* get proper integer widths */ - -#ifdef WIN32 -#if defined __BORLANDC__ -#include /* defines "memcpy" for BCB */ -#else -#include /* defines "memcpy" for other win32 platforms */ -#endif -#include /* "strncmp" + "strcmp" */ -#else /* WIN32 */ -#ifdef BSD -#include /* defines "memcpy", etc for BSD (?) */ -#else -#include /* defines "memcpy", etc for all others (???) */ -#endif -#endif /* WIN32 */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -#include /* fp gamma-calculation */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Platform-dependant stuff * */ -/* * * */ -/* ************************************************************************** */ - -/* TODO: this may require some elaboration for other platforms; - only works with BCB for now */ - -#ifndef MNG_DLL -#if defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_DLL -#endif -#endif - -#define MNG_LOCAL static - -#if defined(MNG_DLL) && defined(WIN32) /* setup DLL calling conventions */ -#define MNG_DECL __stdcall -#if defined(MNG_BUILD_DLL) -#define MNG_EXT __declspec(dllexport) -#elif defined(MNG_USE_DLL) -#define MNG_EXT __declspec(dllimport) -#else -#define MNG_EXT -#endif -#ifdef MNG_STRICT_ANSI -#undef MNG_STRICT_ANSI /* can't do strict-ANSI with this DLL-stuff */ -#endif -#else -#define MNG_DECL /* dummies for non-DLL */ -#define MNG_EXT -#endif /* MNG_DLL && WIN32 */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* now force ANSI-C from here on */ -#endif - -/* ************************************************************************** */ - -#if USHRT_MAX == 0xffffffffU /* get the proper 32-bit width !!! */ -typedef unsigned short mng_uint32; -typedef signed short mng_int32; -#elif UINT_MAX == 0xffffffffU -typedef unsigned int mng_uint32; -typedef signed int mng_int32; -#elif ULONG_MAX == 0xffffffffU -typedef unsigned long mng_uint32; -typedef signed long mng_int32; -#else -#error "Sorry, I can't find any 32-bit integers on this platform." -#endif - -typedef signed short mng_int16; /* other basic integers */ -typedef unsigned short mng_uint16; -typedef signed char mng_int8; -typedef unsigned char mng_uint8; - -typedef double mng_float; /* basic float */ - -typedef size_t mng_size_t; /* size field for memory allocation */ - -typedef char * mng_pchar; /* string */ -typedef void * mng_ptr; /* generic pointer */ -typedef void (*mng_fptr) (void); /* generic function pointer */ - -/* ************************************************************************** */ -/* * * */ -/* * Platform-independant from here * */ -/* * * */ -/* ************************************************************************** */ - -typedef mng_uint32 * mng_uint32p; /* pointer to unsigned longs */ -typedef mng_int32 * mng_int32p; /* pointer to longs */ -typedef mng_uint16 * mng_uint16p; /* pointer to unsigned words */ -typedef mng_uint8 * mng_uint8p; /* pointer to unsigned bytes */ - -typedef mng_int8 mng_bool; /* booleans */ - -struct mng_data_struct; -typedef struct mng_data_struct * mng_handle; /* generic handle */ - -typedef mng_int32 mng_retcode; /* generic return code */ -typedef mng_int32 mng_chunkid; /* 4-byte chunkname identifier */ -typedef mng_ptr mng_chunkp; /* pointer to a chunk-structure */ -typedef mng_ptr mng_objectp; /* pointer to an object-structure */ - -typedef mng_chunkid * mng_chunkidp; /* pointer to chunkid */ - -typedef struct { /* 8-bit palette element */ - mng_uint8 iRed; - mng_uint8 iGreen; - mng_uint8 iBlue; - } mng_palette8e; -typedef mng_palette8e mng_palette8[256]; /* 8-bit palette */ -typedef mng_palette8e * mng_palette8ep; - -typedef mng_uint8 mng_uint8arr[256]; /* generic arrays */ -typedef mng_uint8 mng_uint8arr4[4]; -typedef mng_uint16 mng_uint16arr[256]; -typedef mng_uint32 mng_uint32arr2[2]; - -/* ************************************************************************** */ - -#define MNG_FALSE 0 -#define MNG_TRUE 1 -#define MNG_NULL 0 - -#define MNG_SUSPENDBUFFERSIZE 32768 -#define MNG_SUSPENDREQUESTSIZE 1024 - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB - -/* size of temporary zlib buffer for deflate processing */ -#define MNG_ZLIB_MAXBUF 8192 - -/* default zlib compression parameters for deflateinit2 */ -#define MNG_ZLIB_LEVEL 9 /* level */ -#define MNG_ZLIB_METHOD Z_DEFLATED /* method */ -#define MNG_ZLIB_WINDOWBITS 15 /* window size */ -#define MNG_ZLIB_MEMLEVEL 9 /* memory level */ -#define MNG_ZLIB_STRATEGY Z_DEFAULT_STRATEGY /* strategy */ - -#define MNG_MAX_IDAT_SIZE 4096 /* maximum size of IDAT data */ - -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -#ifdef MNG_INCLUDE_IJG6B /* IJG helper defs */ -typedef struct jpeg_compress_struct mngjpeg_comp; -typedef struct jpeg_decompress_struct mngjpeg_decomp; -typedef struct jpeg_error_mgr mngjpeg_error; -typedef struct jpeg_source_mgr mngjpeg_source; - -typedef mngjpeg_comp * mngjpeg_compp; -typedef mngjpeg_decomp * mngjpeg_decompp; -typedef mngjpeg_error * mngjpeg_errorp; -typedef mngjpeg_source * mngjpeg_sourcep; - -typedef J_DCT_METHOD mngjpeg_dctmethod; - -/* default IJG parameters for compression */ -#define MNG_JPEG_DCT JDCT_DEFAULT /* DCT algorithm (JDCT_ISLOW) */ -#define MNG_JPEG_QUALITY 100 /* quality 0..100; 100=best */ -#define MNG_JPEG_SMOOTHING 0 /* default no smoothing */ -#define MNG_JPEG_PROGRESSIVE MNG_FALSE /* default is just baseline */ -#define MNG_JPEG_OPTIMIZED MNG_FALSE /* default is not optimized */ -#endif /* MNG_INCLUDE_IJG6B */ - -#define MNG_JPEG_MAXBUF 65500 /* max size of temp JPEG buffer */ -#define MNG_MAX_JDAT_SIZE 4096 /* maximum size of JDAT data */ - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS -typedef cmsHPROFILE mng_cmsprof; /* little CMS helper defs */ -typedef cmsHTRANSFORM mng_cmstrans; -typedef cmsCIExyY mng_CIExyY; -typedef cmsCIExyYTRIPLE mng_CIExyYTRIPLE; -typedef LPGAMMATABLE mng_gammatabp; -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ - - /* enumeration of known graphics types */ -enum mng_imgtypes {mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - ,mng_it_mpng -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - ,mng_it_ang -#endif - }; -typedef enum mng_imgtypes mng_imgtype; - - /* enumeration of animation speed-types */ -enum mng_speedtypes {mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest}; -typedef enum mng_speedtypes mng_speedtype; - -#ifdef MNG_OPTIMIZE_CHUNKREADER - /* enumeration object-creation indicators */ -enum mng_createobjtypes {mng_create_none, mng_create_always, mng_create_ifglobal}; -typedef enum mng_createobjtypes mng_createobjtype; -#endif - -/* ************************************************************************** */ - -/* enumeration of PNG image types */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT -enum png_imgtypes - { - png_g1, - png_g2, - png_g4, - png_g8, - png_rgb8, - png_idx1, - png_idx2, - png_idx4, - png_idx8, - png_ga8, - png_rgba8, -#ifdef MNG_INCLUDE_JNG - png_jpeg_a1, - png_jpeg_a2, - png_jpeg_a4, - png_jpeg_a8, -#endif -#ifndef MNG_NO_16BIT_SUPPORT - png_g16, - png_ga16, - png_rgb16, - png_rgba16, -#ifdef MNG_INCLUDE_JNG - png_jpeg_a16, -#endif -#endif - png_none - }; - -typedef enum png_imgtypes png_imgtype; -#endif -/* ************************************************************************** */ - - /* memory management callbacks */ -typedef mng_ptr (MNG_DECL *mng_memalloc) (mng_size_t iLen); -typedef void (MNG_DECL *mng_memfree) (mng_ptr iPtr, - mng_size_t iLen); - -typedef void (MNG_DECL *mng_releasedata) (mng_ptr pUserdata, - mng_ptr pData, - mng_size_t iLength); - - /* I/O management callbacks */ -#ifndef MNG_NO_OPEN_CLOSE_STREAM -typedef mng_bool (MNG_DECL *mng_openstream) (mng_handle hHandle); -typedef mng_bool (MNG_DECL *mng_closestream) (mng_handle hHandle); -#endif -typedef mng_bool (MNG_DECL *mng_readdata) (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead); -typedef mng_bool (MNG_DECL *mng_writedata) (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten); - - /* error & trace processing callbacks */ -typedef mng_bool (MNG_DECL *mng_errorproc) (mng_handle hHandle, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext); -typedef mng_bool (MNG_DECL *mng_traceproc) (mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname); - - /* read processing callbacks */ -typedef mng_bool (MNG_DECL *mng_processheader) (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight); -typedef mng_bool (MNG_DECL *mng_processtext) (mng_handle hHandle, - mng_uint8 iType, - mng_pchar zKeyword, - mng_pchar zText, - mng_pchar zLanguage, - mng_pchar zTranslation); -typedef mng_bool (MNG_DECL *mng_processsave) (mng_handle hHandle); -typedef mng_bool (MNG_DECL *mng_processseek) (mng_handle hHandle, - mng_pchar zName); -typedef mng_bool (MNG_DECL *mng_processneed) (mng_handle hHandle, - mng_pchar zKeyword); -typedef mng_bool (MNG_DECL *mng_processmend) (mng_handle hHandle, - mng_uint32 iIterationsdone, - mng_uint32 iIterationsleft); -typedef mng_bool (MNG_DECL *mng_processunknown) (mng_handle hHandle, - mng_chunkid iChunkid, - mng_uint32 iRawlen, - mng_ptr pRawdata); -typedef mng_bool (MNG_DECL *mng_processterm) (mng_handle hHandle, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax); - - /* display processing callbacks */ -typedef mng_ptr (MNG_DECL *mng_getcanvasline) (mng_handle hHandle, - mng_uint32 iLinenr); -typedef mng_ptr (MNG_DECL *mng_getbkgdline) (mng_handle hHandle, - mng_uint32 iLinenr); -typedef mng_ptr (MNG_DECL *mng_getalphaline) (mng_handle hHandle, - mng_uint32 iLinenr); -typedef mng_bool (MNG_DECL *mng_refresh) (mng_handle hHandle, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight); - - /* timer management callbacks */ -typedef mng_uint32 (MNG_DECL *mng_gettickcount) (mng_handle hHandle); -typedef mng_bool (MNG_DECL *mng_settimer) (mng_handle hHandle, - mng_uint32 iMsecs); - - /* color management callbacks */ -typedef mng_bool (MNG_DECL *mng_processgamma) (mng_handle hHandle, - mng_uint32 iGamma); -typedef mng_bool (MNG_DECL *mng_processchroma) (mng_handle hHandle, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey); -typedef mng_bool (MNG_DECL *mng_processsrgb) (mng_handle hHandle, - mng_uint8 iRenderingintent); -typedef mng_bool (MNG_DECL *mng_processiccp) (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile); -typedef mng_bool (MNG_DECL *mng_processarow) (mng_handle hHandle, - mng_uint32 iRowsamples, - mng_bool bIsRGBA16, - mng_ptr pRow); - - /* chunk access callback(s) */ -typedef mng_bool (MNG_DECL *mng_iteratechunk) (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq); - -/* ************************************************************************** */ - -#endif /* _libmng_types_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_write.c b/Engine/lib/lmng/libmng_write.c deleted file mode 100644 index 79ff54438..000000000 --- a/Engine/lib/lmng/libmng_write.c +++ /dev/null @@ -1,198 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_write.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Write management (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the write management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/16/2000 - G.Juyn * */ -/* * - moved the actual write_graphic functionality from * */ -/* * mng_hlapi to its appropriate function here * */ -/* * * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed writing of signature * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.8 - 07/06/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * - defend against using undefined Open/Closestream function * */ -/* * 1.0.8 - 08/02/2004 - G.Juyn * */ -/* * - added conditional to allow easier writing of large MNG's * */ -/* * * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#include "libmng_chunk_io.h" -#include "libmng_write.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -mng_retcode mng_drop_chunks (mng_datap pData) -{ - mng_chunkp pChunk; - mng_chunkp pNext; - mng_cleanupchunk fCleanup; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_START); -#endif - - pChunk = pData->pFirstchunk; /* and get first stored chunk (if any) */ - - while (pChunk) /* more chunks to discard ? */ - { - pNext = ((mng_chunk_headerp)pChunk)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_chunk_headerp)pChunk)->fCleanup; - fCleanup (pData, pChunk); - - pChunk = pNext; /* neeeext */ - } - - pData->pFirstchunk = MNG_NULL; - pData->pLastchunk = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_write_graphic (mng_datap pData) -{ - mng_chunkp pChunk; - mng_retcode iRetcode; - mng_uint32 iWritten; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GRAPHIC, MNG_LC_START); -#endif - - pChunk = pData->pFirstchunk; /* we'll start with the first, thank you */ - - if (pChunk) /* is there anything to write ? */ - { /* open the file */ - if (!pData->bWriting) - { -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fOpenstream && !pData->fOpenstream ((mng_handle)pData)) - MNG_ERROR (pData, MNG_APPIOERROR); -#endif - { - pData->bWriting = MNG_TRUE; /* indicate writing */ - pData->iWritebufsize = 32768; /* get a temporary write buffer */ - /* reserve 12 bytes for length, chunkname & crc */ - MNG_ALLOC (pData, pData->pWritebuf, pData->iWritebufsize+12); - - /* write the signature */ - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_IHDR) - mng_put_uint32 (pData->pWritebuf, PNG_SIG); - else - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_JHDR) - mng_put_uint32 (pData->pWritebuf, JNG_SIG); - else - mng_put_uint32 (pData->pWritebuf, MNG_SIG); - - mng_put_uint32 (pData->pWritebuf+4, POST_SIG); - - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, 8, &iWritten)) - { - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12); - MNG_ERROR (pData, MNG_APPIOERROR); - } - - if (iWritten != 8) /* disk full ? */ - { - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12); - MNG_ERROR (pData, MNG_OUTPUTERROR); - } - } - } - - while (pChunk) /* so long as there's something to write */ - { /* let's call its output routine */ - iRetcode = ((mng_chunk_headerp)pChunk)->fWrite (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* neeeext */ - pChunk = ((mng_chunk_headerp)pChunk)->pNext; - } - - if (!pData->bCreating) - { /* free the temporary buffer */ - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12); - - pData->bWriting = MNG_FALSE; /* done writing */ - /* close the stream now */ -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fClosestream && !pData->fClosestream ((mng_handle)pData)) - MNG_ERROR (pData, MNG_APPIOERROR); -#endif - - } else { - /* cleanup the written chunks */ - iRetcode = mng_drop_chunks (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GRAPHIC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - diff --git a/Engine/lib/lmng/libmng_write.h b/Engine/lib/lmng/libmng_write.h deleted file mode 100644 index df058fb77..000000000 --- a/Engine/lib/lmng/libmng_write.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_write.h copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Write management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the write management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_write_h_ -#define _libmng_write_h_ - -/* ************************************************************************** */ - -mng_retcode mng_drop_chunks (mng_datap pData); - -mng_retcode mng_write_graphic (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_write_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_zlib.c b/Engine/lib/lmng/libmng_zlib.c deleted file mode 100644 index 7d102e160..000000000 --- a/Engine/lib/lmng/libmng_zlib.c +++ /dev/null @@ -1,607 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_zlib.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : ZLIB library interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the ZLIB library interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - filled the deflatedata routine * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - fixed for JNG alpha handling * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - moved init of default zlib parms from here to * */ -/* * "mng_hlapi.c" * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/08/2000 - G.Juyn * */ -/* * - fixed compiler-warnings from Mozilla * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - added warning for too much IDAT data * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_NO_16BIT_SUPPORT support * */ -/* * * */ -/* * 1.0.9 - 10/09/2004 - G.R-P * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT support * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_pixels.h" -#include "libmng_filter.h" -#include "libmng_zlib.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB - -/* ************************************************************************** */ - -voidpf mngzlib_alloc (voidpf pData, - uInt iCount, - uInt iSize) -{ - voidpf pPtr; /* temporary space */ - -#ifdef MNG_INTERNAL_MEMMNGMT - pPtr = calloc (iCount, iSize); /* local allocation */ -#else - if (((mng_datap)pData)->fMemalloc) /* callback function set ? */ - pPtr = ((mng_datap)pData)->fMemalloc (iCount * iSize); - else - pPtr = Z_NULL; /* can't allocate! */ -#endif - - return pPtr; /* return the result */ -} - -/* ************************************************************************** */ - -void mngzlib_free (voidpf pData, - voidpf pAddress) -{ -#ifdef MNG_INTERNAL_MEMMNGMT - free (pAddress); /* free locally */ -#else - if (((mng_datap)pData)->fMemfree) /* callback set? */ - ((mng_datap)pData)->fMemfree (pAddress, 1); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_initialize (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INITIALIZE, MNG_LC_START); -#endif - -#ifdef MNG_INTERNAL_MEMMNGMT - pData->sZlib.zalloc = Z_NULL; /* let zlib figure out memory management */ - pData->sZlib.zfree = Z_NULL; - pData->sZlib.opaque = Z_NULL; -#else /* use user-provided callbacks */ - pData->sZlib.zalloc = mngzlib_alloc; - pData->sZlib.zfree = mngzlib_free; - pData->sZlib.opaque = (voidpf)pData; -#endif - - pData->bInflating = MNG_FALSE; /* not performing any action yet */ - pData->bDeflating = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INITIALIZE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_cleanup (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_CLEANUP, MNG_LC_START); -#endif - - if (pData->bInflating) /* force zlib cleanup */ - mngzlib_inflatefree (pData); - if (pData->bDeflating) - mngzlib_deflatefree (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_CLEANUP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_inflateinit (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEINIT, MNG_LC_START); -#endif - /* initialize zlib structures and such */ - iZrslt = inflateInit (&pData->sZlib); - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - - pData->bInflating = MNG_TRUE; /* really inflating something now */ - pData->sZlib.next_out = 0; /* force JIT initialization */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode mngzlib_inflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ - int iZrslt; - mng_retcode iRslt; - mng_ptr pSwap; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEROWS, MNG_LC_START); -#endif - - pData->sZlib.next_in = pIndata; /* let zlib know where to get stuff */ - pData->sZlib.avail_in = (uInt)iInlen; - - if (pData->sZlib.next_out == 0) /* initialize output variables ? */ - { /* let zlib know where to store stuff */ - pData->sZlib.next_out = pData->pWorkrow; - pData->sZlib.avail_out = (uInt)(pData->iRowsize + pData->iPixelofs); -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth < 8) - pData->sZlib.avail_out = (uInt)((pData->iPNGdepth*pData->iRowsize + 7)/8 - + pData->iPixelofs); -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - pData->sZlib.avail_out = (uInt)(2*pData->iRowsize + pData->iPixelofs); -#endif - } - - do - { /* now inflate a row */ - iZrslt = inflate (&pData->sZlib, Z_SYNC_FLUSH); - /* produced a full row ? */ - if (((iZrslt == Z_OK) || (iZrslt == Z_STREAM_END)) && - (pData->sZlib.avail_out == 0)) - { /* image not completed yet ? */ - if (pData->iRow < (mng_int32)pData->iDataheight) - { -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth == 1) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (pData->iRowsize+7)/8; - - for (iX = ((pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>7)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>6)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>5)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>3)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>1)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&1); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 2) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (2*pData->iRowsize+7)/8; - - for (iX = ((2*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (2*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>6)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&3); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 4) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (4*pData->iRowsize+7)/8; - - for (iX = ((4*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (4*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>4)&0x0f); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&0x0f); - if (iX-- <= 0) - break; - pSrc++; - } - } - if (pData->iPNGdepth < 8 && pData->iColortype == 0) - { - /* Expand samples to 8-bit by LBR */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - - for (iX = pData->iRowsize; iX > 0; iX--) - *pSrc++ *= multiplier[pData->iPNGdepth]; - } -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - { - /* Reduce Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc; - - for (iX = pData->iRowsize; iX > 0; iX--) - { - *pDest = *pSrc; - pDest++; - pSrc+=2; - } - } -#endif - -#ifdef FILTER192 /* has leveling info ? */ - if (pData->iFilterofs == MNG_FILTER_DIFFERING) - iRslt = init_rowdiffering (pData); - else -#endif - iRslt = MNG_NOERROR; - /* filter the row if necessary */ - if ((!iRslt) && (pData->iFilterofs < pData->iPixelofs ) && - (*(pData->pWorkrow + pData->iFilterofs)) ) - iRslt = mng_filter_a_row (pData); - else - iRslt = MNG_NOERROR; - /* additional leveling/differing ? */ - if ((!iRslt) && (pData->fDifferrow)) - { - iRslt = ((mng_differrow)pData->fDifferrow) (pData); - - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* make sure we're processing the right data */ - } - - if (!iRslt) - { -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) /* is JNG alpha-channel ? */ - { /* just store in object ? */ - if ((!iRslt) && (pData->fStorerow)) - iRslt = ((mng_storerow)pData->fStorerow) (pData); - } - else -#endif /* MNG_INCLUDE_JNG */ - { /* process this row */ - if ((!iRslt) && (pData->fProcessrow)) - iRslt = ((mng_processrow)pData->fProcessrow) (pData); - /* store in object ? */ - if ((!iRslt) && (pData->fStorerow)) - iRslt = ((mng_storerow)pData->fStorerow) (pData); - /* color correction ? */ - if ((!iRslt) && (pData->fCorrectrow)) - iRslt = ((mng_correctrow)pData->fCorrectrow) (pData); - /* slap onto canvas ? */ - if ((!iRslt) && (pData->fDisplayrow)) - { - iRslt = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRslt) /* check progressive display refresh */ - iRslt = mng_display_progressive_check (pData); - - } - } - } - - if (iRslt) /* on error bail out */ - MNG_ERROR (pData, iRslt); - - if (!pData->fDifferrow) /* swap row-pointers */ - { - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* so prev points to the processed row! */ - } - - iRslt = mng_next_row (pData); /* adjust variables for next row */ - - if (iRslt) /* on error bail out */ - MNG_ERROR (pData, iRslt); - } - /* let zlib know where to store next output */ - pData->sZlib.next_out = pData->pWorkrow; - pData->sZlib.avail_out = (uInt)(pData->iRowsize + pData->iPixelofs); -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth < 8) - pData->sZlib.avail_out = (uInt)((pData->iPNGdepth*pData->iRowsize + 7)/8 - + pData->iPixelofs); -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - pData->sZlib.avail_out = (uInt)(2*pData->iRowsize + pData->iPixelofs); -#endif - } - } /* until some error or EOI - or all pixels received */ - while ( (iZrslt == Z_OK) && (pData->sZlib.avail_in > 0) && - ( (pData->iRow < (mng_int32)pData->iDataheight) || - ( (pData->iPass >= 0) && (pData->iPass < 7) ) ) ); - /* on error bail out */ - if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END)) - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - /* too much data ? */ - if ((iZrslt == Z_OK) && (pData->sZlib.avail_in > 0)) - MNG_WARNING (pData, MNG_TOOMUCHIDAT); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEROWS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_retcode mngzlib_inflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEDATA, MNG_LC_START); -#endif - /* let zlib know where to get stuff */ - pData->sZlib.next_in = pIndata; - pData->sZlib.avail_in = (uInt)iInlen; - /* now inflate the data in one go! */ - iZrslt = inflate (&pData->sZlib, Z_FINISH); - /* not enough room in output-buffer ? */ - if ((iZrslt == Z_BUF_ERROR) || (pData->sZlib.avail_in > 0)) - return MNG_BUFOVERFLOW; - /* on error bail out */ - if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END)) - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_inflatefree (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEFREE, MNG_LC_START); -#endif - - pData->bInflating = MNG_FALSE; /* stopped it */ - - iZrslt = inflateEnd (&pData->sZlib); /* let zlib cleanup its own stuff */ - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflateinit (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEINIT, MNG_LC_START); -#endif - /* initialize zlib structures and such */ - iZrslt = deflateInit2 (&pData->sZlib, pData->iZlevel, pData->iZmethod, - pData->iZwindowbits, pData->iZmemlevel, - pData->iZstrategy); - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - - pData->bDeflating = MNG_TRUE; /* really deflating something now */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEROWS, MNG_LC_START); -#endif - - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEROWS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEDATA, MNG_LC_START); -#endif - - pData->sZlib.next_in = pIndata; /* let zlib know where to get stuff */ - pData->sZlib.avail_in = (uInt)iInlen; - /* now deflate the data in one go! */ - iZrslt = deflate (&pData->sZlib, Z_FINISH); - /* not enough room in output-buffer ? */ - if ((iZrslt == Z_BUF_ERROR) || (pData->sZlib.avail_in > 0)) - return MNG_BUFOVERFLOW; - /* on error bail out */ - if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END)) - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflatefree (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEFREE, MNG_LC_START); -#endif - - iZrslt = deflateEnd (&pData->sZlib); /* let zlib cleanup its own stuff */ - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - - pData->bDeflating = MNG_FALSE; /* stopped it */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_zlib.h b/Engine/lib/lmng/libmng_zlib.h deleted file mode 100644 index cfc391823..000000000 --- a/Engine/lib/lmng/libmng_zlib.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_zlib.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : ZLIB package interface (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the ZLIB package interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_zlib_h_ -#define _libmng_zlib_h_ - -/* ************************************************************************** */ - -mng_retcode mngzlib_initialize (mng_datap pData); -mng_retcode mngzlib_cleanup (mng_datap pData); - -mng_retcode mngzlib_inflateinit (mng_datap pData); -mng_retcode mngzlib_inflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_inflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_inflatefree (mng_datap pData); - -mng_retcode mngzlib_deflateinit (mng_datap pData); -mng_retcode mngzlib_deflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_deflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_deflatefree (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_zlib_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/makefiles/Makefile.am b/Engine/lib/lmng/makefiles/Makefile.am deleted file mode 100644 index b53523e9a..000000000 --- a/Engine/lib/lmng/makefiles/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = 1.3 foreign no-dependencies - -# include the app subdirectories in the distribution -EXTRA_DIST = makefiles doc contrib - - -# libmng release @VERSION@ -libmng_la_LDFLAGS = -version-info 1:0:0 - -lib_LTLIBRARIES = libmng.la - -include_HEADERS = libmng.h libmng_conf.h libmng_types.h -noinst_HEADERS = libmng_chunk_io.h libmng_chunk_prc.h libmng_chunks.h \ - libmng_cms.h libmng_data.h libmng_display.h libmng_dither.h \ - libmng_error.h libmng_filter.h libmng_jpeg.h libmng_memory.h \ - libmng_object_prc.h libmng_objects.h libmng_pixels.h \ - libmng_read.h libmng_trace.h libmng_write.h libmng_zlib.h - -libmng_la_SOURCES = libmng_callback_xs.c libmng_chunk_io.c \ - libmng_chunk_prc.c libmng_chunk_xs.c libmng_cms.c \ - libmng_display.c libmng_dither.c libmng_error.c \ - libmng_filter.c libmng_hlapi.c libmng_jpeg.c \ - libmng_object_prc.c libmng_pixels.c libmng_prop_xs.c \ - libmng_read.c libmng_trace.c libmng_write.c libmng_zlib.c - -man_MANS = doc/man/libmng.3 doc/man/jng.5 doc/man/mng.5 - diff --git a/Engine/lib/lmng/makefiles/README b/Engine/lib/lmng/makefiles/README deleted file mode 100644 index 63faaafb0..000000000 --- a/Engine/lib/lmng/makefiles/README +++ /dev/null @@ -1,27 +0,0 @@ -For conditions of distribution and use, see copyright notice in libmng.h -or the file LICENSE in the top-level directory of the source distribution. - -This directory hosts the makefiles for a number of supported platforms. - -If you're using a system with POSIX shell capabilities, you can use the -'configure' script in the top-level directory, or generate it by running -'autogen.sh' if you have the necessary tools installed. - -Otherwise, copy the module for your environment (or the closest thing) -into the libmng source-directory and change it to your needs. If you -create a new file for a platform not on the list send it to me (gerard @ -libmng.com) and I'll be happy to include it in the next release! - - -Current files: - -makefile.bcb3 - Borland C++ Builder -makefile.vcwin32 - Microsoft Visual C++ -makefile.unix - generic Unix -makefile.linux - Linux ELF (builds shared library) -makefile.dj - DJGPP -makefile.mingw - builds a static library for mingw32 -makefile.mingwdll - builds a dynamic library for mingw32 -makefile.irix - builds a static library for SGI/IRIX (6.5.21) - -Makefile.am, configure.in and acinclude.m4 (if present) - automake/autoconf source diff --git a/Engine/lib/lmng/makefiles/configure.in b/Engine/lib/lmng/makefiles/configure.in deleted file mode 100644 index e7cb75c00..000000000 --- a/Engine/lib/lmng/makefiles/configure.in +++ /dev/null @@ -1,193 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT -AC_CONFIG_SRCDIR([libmng.h]) -AC_PREREQ(2.52) - -dnl this call will define PACKAGE and VERSION -dnl please use this as the primary reference for the version number -AM_INIT_AUTOMAKE(libmng, 1.0.9) - -dnl pass the version string on the the makefiles -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) - -dnl Checks for programs. -AC_PROG_CC -AC_ISC_POSIX -AM_C_PROTOTYPES -if test "x$U" != "x"; then - AC_MSG_ERROR(Compiler not ANSI compliant) -fi -AM_PROG_LIBTOOL -AC_PROG_INSTALL - -dnl support for files >2GB -AC_SYS_LARGEFILE - -dnl Check for required header files -AC_HEADER_STDC - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST - -dnl need pow and fabs -AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm")) - - -dnl what functionality we want to add (read, write, display). -dnl all on by default. see libmng_conf.h for full descriptions - -dnl not building a standard shared object? -AC_ARG_ENABLE(buildso, -[ --disable-buildso disable building standard shared object]) -if test "x$enable_buildso" != "xno"; then - AC_DEFINE(MNG_BUILD_SO) -fi - -dnl we only support the full mng spec for now (no LC or VLC) -AC_DEFINE(MNG_SUPPORT_FULL) - -dnl remove support in library to read images? -AC_ARG_ENABLE(read, -[ --disable-read remove read support from library]) -if test "x$enable_read" != "xno"; then - AC_DEFINE(MNG_SUPPORT_READ) -fi - -dnl remove support in library to write images? -AC_ARG_ENABLE(write, -[ --disable-write remove write support from library]) -if test "x$enable_write" != "xno"; then - AC_DEFINE(MNG_SUPPORT_WRITE) -fi - -dnl remove support in library to display images? -AC_ARG_ENABLE(display, -[ --disable-display remove display support from library]) -if test "x$enable_display" != "xno"; then - AC_DEFINE(MNG_SUPPORT_DISPLAY) -fi - -dnl remove support for 'dynamic' MNG? -AC_ARG_ENABLE(dynamic, -[ --disable-dynamic remove dynamic MNG support from library]) -if test "x$enable_dynamic" != "xno"; then - AC_DEFINE(MNG_SUPPORT_DYNAMICMNG) -fi - -dnl remove support in library to access chunks? -AC_ARG_ENABLE(chunks, -[ --disable-chunks remove support for chunk access]) -if test "x$enable_chunks" != "xno"; then - AC_DEFINE(MNG_ACCESS_CHUNKS) -fi - -dnl disable support for accessing chunks that have been previously read? -AC_ARG_ENABLE(storechunks, -[ --disable-storechunks remove support for access of previous chunks]) -if test "x$enable_storechunks" != "xno"; then - AC_DEFINE(MNG_STORE_CHUNKS) -fi - -dnl enable support for debug tracing callbacks and messages? -AC_ARG_ENABLE(trace, -[ --enable-trace include support for debug tracing callbacks],[ -if test "x$enable_trace" = "xyes"; then - AC_DEFINE(MNG_SUPPORT_TRACE) - AC_DEFINE(MNG_TRACE_TELLTALE) -fi -]) - -dnl verbose error text -dnl this should always be on -AC_DEFINE(MNG_ERROR_TELLTALE) - - -dnl libz is required. -AC_ARG_WITH(zlib, -[ --with-zlib[=DIR] use zlib include/library files in DIR],[ - if test -d "$withval"; then - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - fi -]) -AC_CHECK_HEADER(zlib.h, - AC_CHECK_LIB(z, gzread, , AC_MSG_ERROR(zlib library not found)), - AC_MSG_ERROR(zlib header not found) -) - -dnl check for jpeg library -AC_ARG_WITH(jpeg, -[ --with-jpeg[=DIR] use jpeg include/library files in DIR], -[with_jpeg=$withval],[with_jpeg=_auto]) - - if test "x$with_jpeg" != "xno" -a "x$with_jpeg" != "xyes" -a \ - "x$with_jpeg" != "x_auto"; then - # Save in case test with directory specified fails - _cppflags=${CPPFLAGS} - _ldflags=${LDFLAGS} - _restore=1 - - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - else - _restore=0 - fi - - if test "x$with_jpeg" != "xno"; then - AC_CHECK_HEADER(jpeglib.h, - AC_CHECK_LIB(jpeg, jpeg_read_header, [ - LIBS="$LIBS -ljpeg" - AC_DEFINE(HAVE_LIBJPEG) - _restore=0 - ], - AC_MSG_WARN(jpeg library not found)), - AC_MSG_WARN(jpeg header not found) - ) - fi - - test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags - -dnl check for lcms library -AC_ARG_WITH(lcms, -[ --with-lcms[=DIR] use lcms include/library files in DIR], -[with_lcms=$withval],[with_lcms=_auto]) - - if test "x$with_lcms" != "xno" -a "x$with_lcms" != "xyes" -a \ - "x$with_lcms" != "x_auto"; then - # Save in case test with directory specified fails - _cppflags=$CPPFLAGS - _ldflags=$LDFLAGS - _restore=1 - - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - else - _restore=0 - fi - - if test "x$with_lcms" != "xno"; then - AC_CHECK_HEADER(lcms.h, [ - have_lcms=yes - AC_CHECK_LIB(lcms, cmsCreateRGBProfile, [ - LIBS="$LIBS -llcms" - AC_DEFINE(HAVE_LIBLCMS) - dnl for now this implies MNG_INCLUDE_LCMS in the headers: - AC_DEFINE(MNG_FULL_CMS) - _restore=0 - have_lcms=yes - ],[ - have_lcms=no - ]) - ]) - dnl give feedback only if the user asked specifically for lcms - if test "x$with_lcms" != "x_auto" -a "x$have_lcms" != "xyes"; then - AC_MSG_WARN([lcms not found... disabling CMS support]) - fi - fi - - test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags - -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/Engine/lib/lmng/makefiles/makefile.bcb3 b/Engine/lib/lmng/makefiles/makefile.bcb3 deleted file mode 100644 index 3ddcb2d13..000000000 --- a/Engine/lib/lmng/makefiles/makefile.bcb3 +++ /dev/null @@ -1,108 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for Borland C++ Builder. -# it works (at least) with Borland C++ Builder v3 - -# Configuration options are now in mng_conf.h -# this option forces dll compatibility -MNGOPT = -DMNG_BUILD_DLL - -# The name of your C compiler: -CC= bcc32 - -# compiler options: -CFLAGS= -WD -O2 -Hc -w-par -k -y -v -vi -c -tWD \ - -wuse -wucp -wstv -wstu -wsig -wpin -wnod -wnak -wdef -wcln -wbbf -wasm -wamp \ - -wamb -Tkh30000 -ff -5 -I.;..\zlib;..\jpgsrc6b;..\lcms\include $(MNGOPT) - -# source files -SOURCES= libmng_hlapi.c libmng_callback_xs.c libmng_prop_xs.c libmng_chunk_xs.c \ - libmng_chunk_descr.c libmng_read.c libmng_write.c libmng_display.c \ - libmng_object_prc.c libmng_chunk_prc.c libmng_chunk_io.c libmng_error.c \ - libmng_trace.c libmng_pixels.c libmng_filter.c libmng_dither.c \ - libmng_zlib.c libmng_jpeg.c libmng_cms.c - -# object files -OBJECTS= libmng_hlapi.obj libmng_callback_xs.obj libmng_prop_xs.obj libmng_chunk_xs.obj \ - libmng_chunk_descr.obj libmng_read.obj libmng_write.obj libmng_display.obj \ - libmng_object_prc.obj libmng_chunk_prc.obj libmng_chunk_io.obj libmng_error.obj \ - libmng_trace.obj libmng_pixels.obj libmng_filter.obj libmng_dither.obj \ - libmng_zlib.obj libmng_jpeg.obj libmng_cms.obj - -# type dependancies -.c.obj: - $(CC) $(CFLAGS) -c{ $<} - -# make options -all: libmng.lib - -clean: - - del *.obj - - del libmng.lib - -# file dependancies -libmng.lib: $(OBJECTS) - - del libmng.lib - tlib libmng.lib /E /C @&&| -+libmng_hlapi.obj +libmng_callback_xs.obj +libmng_prop_xs.obj +libmng_chunk_xs.obj & -+libmng_read.obj +libmng_write.obj +libmng_display.obj & -+libmng_object_prc.obj +libmng_chunk_prc.obj +libmng_chunk_io.obj +libmng_error.obj & -+libmng_trace.obj +libmng_pixels.obj +libmng_filter.obj +libmng_dither.obj & -+libmng_zlib.obj +libmng_jpeg.obj +libmng_cms.obj -| - -libmng_hlapi.obj: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.obj: libmng_callback_xs.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.obj: libmng_prop_xs.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.obj: libmng_chunk_xs.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_error.h libmng_trace.h -libmng_read.obj: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.obj: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.obj: libmng_display.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h \ - libmng_pixels.h libmng_display.h -libmng_object_prc.obj: libmng_object_prc.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.obj: libmng_chunk_descr.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_prc.obj: libmng_chunk_prc.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.obj: libmng_chunk_io.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h libmng_chunks.h \ - libmng_chunk_io.h libmng_chunk_prc libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.obj: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.obj: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.obj: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.obj: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.obj: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.obj: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.obj: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_pixels.h libmng_jpeg.h -libmng_cms.obj: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.dj b/Engine/lib/lmng/makefiles/makefile.dj deleted file mode 100644 index 2cef08881..000000000 --- a/Engine/lib/lmng/makefiles/makefile.dj +++ /dev/null @@ -1,155 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# This makefile have been tested on DJGPP v2 -# (Based on makefile.linux since both are GNU compilers) -# -# By Silvio Fonseca - gissi@sti.com.br - -#compiler -CC=gcc - -#default build options -OPTIONS= - -#DJGPP directory -prefix=C:/DJGPP -installprefix=C:\DJGPP - -#ZLIB Library and includes -ZLIBLIB=$(prefix)/lib -#ZLIBLIB=../zlib -ZLIBINC=$(prefix)/include -#ZLIBINC=../zlib - -#Jpeg library and includes -JPEGLIB=$(prefix)/lib -#JPEGLIB=../jpgsrc -JPEGINC=$(prefix)/include -#JPEGINC=../jpgsrc - -#Lcms library and includes -LCMSLIB=$(prefix)/lib -#LCMSLIB=../lcms -LCMSINC=$(prefix)/include -#LCMSINC=../lcms - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes #-Wconversion - -CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -funroll-loops \ - $(OPTIONS) $(ALIGN) # $(WARNMORE) -g -LDFLAGS=-L. -Wl,-rpath,. \ - -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ - -L$(JPEGLIB) -Wl,-rpath,$(JPEGLIB) \ - -L$(LCMSLIB) -Wl,-rpath,$(LCMSLIB) \ - -lmng -lz -ljpeg -llcms -lm -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -OBJSDLL = $(OBJS:.0=.pic.o) - -.SUFFIXES: .c .o .pic.o - -.c.pic.o: - $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c - -all: libmng.a - -libmng.a: $(OBJS) - ar rc $@ $(OBJS) - ranlib $@ - -install: libmng.a - -@md $(installprefix)\include $(installprefix)\lib - copy libmng.h $(installprefix)\include - copy libmng_conf.h $(installprefix)\include - copy libmng_types.h $(installprefix)\include - copy libmng.a $(installprefix)\lib - -clean: - del *.o - del libmng.a - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o libmng_hlapi.pic.o: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o libmng_callback_xs.pic.o: libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o libmng_prop_xs.pic.o: libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o libmng_chunk_xs.pic.o: libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o libmng_read.pic.o: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o libmng_write.pic.o: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o libmng_display.pic.o: libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o libmng_object_prc.pic.o: libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o libmng_chunk_descr.pic.o: libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h \ - libmng_chunk_prc.h libmng_memory.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o libmng_chunk_prc.pic.o: libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o libmng_chunk_io.pic.o: libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o libmng_error.pic.o: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o libmng_trace.pic.o: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o libmng_pixels.pic.o: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o libmng_filter.pic.o: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o libmng_dither.pic.o: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o libmng_zlib.pic.o: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o libmng_jpeg.pic.o: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o libmng_cms.pic.o: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.linux b/Engine/lib/lmng/makefiles/makefile.linux deleted file mode 100644 index e06a8294c..000000000 --- a/Engine/lib/lmng/makefiles/makefile.linux +++ /dev/null @@ -1,180 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for Linux ELF with gcc -# -# (this file is heavily copied from makefile.linux in the libpng package) - -# compiler -CC=gcc - -# default build options (this forces shared library compatibility!!) -#OPTIONS = -DMNG_BUILD_SO -OPTIONS = -DMNG_BUILD_SO -DMNG_FULL_CMS - -# where "make install" puts libmng.a,libmng.so*,libmng.h,libmng_conf.h,libmng_types.h -prefix=/usr/local - -# Where the zlib library and include files are located -#ZLIBLIB=../zlib -#ZLIBINC=../zlib -ZLIBLIB=/usr/local/lib -ZLIBINC=/usr/local/include - -# Where the jpeg library and include files are located -#JPEGLIB=../jpgsrc -#JPEGINC=../jpgsrc -JPEGLIB=/usr/local/lib -JPEGINC=/usr/local/include - -# Where the lcms library and include files are located -#LCMSLIB=../lcms/lib -#LCMSINC=../lcms/source -LCMSLIB=/usr/local/lib -LCMSINC=/usr/local/include - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes #-Wconversion - -# for pgcc version 2.95.1, -O3 is buggy; don't use it. - -CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -funroll-loops \ - $(OPTIONS) $(ALIGN) # $(WARNMORE) -g -LDFLAGS=-L. -Wl,-rpath,. \ - -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ - -L$(JPEGLIB) -Wl,-rpath,$(JPEGLIB) \ - -L$(LCMSLIB) -Wl,-rpath,$(LCMSLIB) \ - -lmng -lz -ljpeg -llcms -lm - -RANLIB=ranlib -#RANLIB=echo - -# current version numbers -MNGMAJ = 1 -MNGMIN = 1.0.9 -MNGVER = $(MNGMAJ).$(MNGMIN) - -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -OBJSDLL = $(OBJS:.0=.pic.o) - -.SUFFIXES: .c .o .pic.o - -.c.pic.o: - $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c - -all: libmng.a libmng.so - -libmng.a: $(OBJS) - ar rc $@ $(OBJS) - $(RANLIB) $@ - -libmng.so: libmng.so.$(MNGMAJ) - ln -sf libmng.so.$(MNGMAJ) libmng.so - -libmng.so.$(MNGMAJ): libmng.so.$(MNGVER) - ln -sf libmng.so.$(MNGVER) libmng.so.$(MNGMAJ) - -libmng.so.$(MNGVER): $(OBJSDLL) -# $(CC) -shared -Wl,-soname,libmng.so.$(MNGMAJ) -o libmng.so.$(MNGVER) \ -# $(OBJSDLL) -L$(ZLIBLIB) -L$(JPEGLIB) -L$(LCMSLIB) -lz -lm -lc - $(CC) -shared -Wl,-soname,libmng.so.$(MNGMAJ) -o libmng.so.$(MNGVER) \ - $(OBJSDLL) -L$(ZLIBLIB) -L$(JPEGLIB) -ljpeg -L$(LCMSLIB) -llcms \ - -lz -lm -lc - -install: libmng.a libmng.so.$(MNGVER) - -@mkdir $(INCPATH) $(LIBPATH) - cp libmng.h libmng_conf.h libmng_types.h $(INCPATH) - chmod 644 $(INCPATH)/libmng.h $(INCPATH)/libmng_conf.h $(INCPATH)/libmng_types.h - cp libmng.a libmng.so.$(MNGVER) $(LIBPATH) - chmod 755 $(LIBPATH)/libmng.so.$(MNGVER) - -@/bin/rm -f $(LIBPATH)/libmng.so.$(MNGMAJ) $(LIBPATH)/libmng.so - (cd $(LIBPATH); ln -sf libmng.so.$(MNGVER) libmng.so.$(MNGMAJ); \ - ln -sf libmng.so.$(MNGMAJ) libmng.so) - -clean: - /bin/rm -f *.o libmng.a libmng.so* - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o libmng_hlapi.pic.o: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o libmng_callback_xs.pic.o: libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o libmng_prop_xs.pic.o: libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o libmng_chunk_xs.pic.o: libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o libmng_read.pic.o: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o libmng_write.pic.o: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o libmng_display.pic.o: libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o libmng_object_prc.pic.o: libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o libmng_chunk_descr.pic.o: libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h libmng_memory.h \ - libmng_chunk_prc.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o libmng_chunk_prc.pic.o: libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o libmng_chunk_io.pic.o: libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o libmng_error.pic.o: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o libmng_trace.pic.o: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o libmng_pixels.pic.o: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o libmng_filter.pic.o: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o libmng_dither.pic.o: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o libmng_zlib.pic.o: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o libmng_jpeg.pic.o: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o libmng_cms.pic.o: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.mingw b/Engine/lib/lmng/makefiles/makefile.mingw deleted file mode 100644 index 703ae3059..000000000 --- a/Engine/lib/lmng/makefiles/makefile.mingw +++ /dev/null @@ -1,164 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is for MinGW32, it have been tested with gcc 2.95.3, -# binutils 2.11.90 and mingw-runtime 1.0 -# -# By Benoit Blanchon - benoit.blanchon@laposte.net -# -# Note : this makefile builds a static library; although it's seems to be -# possible to build working DLL and import lib, I didn't manage do to it. -# If you do, please let me know. - -# outputs -LIBMNG_A = libmng.a -INSTALL_PREFIX = C:/MinGW/ -# maybe you sould replace with anti-slashes - -# default build options -OPTIONS = -DMNG_NO_CMS -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS - -# Where the zlib library and include files are located -ZLIBLIB=-lz -#ZLIBLIB=-L../zlib -lz -#ZLIBINC=-I../zlib - -# Where the jpeg library and include files are located -JPEGLIB=-ljpeg -#JPEGLIB=-L../jpgsrc -ljpeg -#JPEGINC=-I../jpgsrc - -# Where the lcms library and include files are located -#LCMSLIB=-llcms -#LCMSLIB=-L../lcms/lib -llcms -#LCMSINC=-I../lcms/source - -# file deletion command -RM=rm -f -#RM=del - -# directory creation command -MKDIR=mkdir -p - -# file copy command -COPY=cp -#COPY=copy - -# compiler -CC=gcc - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN) -LDFLAGS=-L. -lmng $(ZLIBLIB) $(JPEGLIB) $(LCMSLIB) -lm - -# library (.a) file creation command -AR= ar rc -# second step in .a creation (use "touch" if not needed) -AR2= ranlib - -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -.SUFFIXES: .c .o - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c - -all: $(LIBMNG_A) - -$(LIBMNG_A) : $(OBJS) - $(RM) $@ - $(AR) $@ $(OBJS) - $(AR2) $@ - -install : $(LIBMNG_A) - $(MKDIR) $(INSTALL_PREFIX)include - $(COPY) libmng.h $(INSTALL_PREFIX)include - $(COPY) libmng_conf.h $(INSTALL_PREFIX)include - $(COPY) libmng_types.h $(INSTALL_PREFIX)include - $(MKDIR) $(INSTALL_PREFIX)lib - $(COPY) $(LIBMNG_A) $(INSTALL_PREFIX)lib - -clean: - $(RM) *.o - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o : libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o : libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o : libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o : libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o : libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o : libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o : libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o : libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o : libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h \ - libmng_chunk_prc.h libmng_memory.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o : libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o : libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o : libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o : libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o : libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o : libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o : libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o : libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o : libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o : libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.mingwdll b/Engine/lib/lmng/makefiles/makefile.mingwdll deleted file mode 100644 index 283721828..000000000 --- a/Engine/lib/lmng/makefiles/makefile.mingwdll +++ /dev/null @@ -1,158 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is for MinGW32, it has been tested with gcc 3.1, -# binutils 2.12.90 and mingw-runtime 2.0 -# -# By Benoit Blanchon - benoit.blanchon@laposte.net -# DLL mods by F. Richter -# - -# outputs -LIBMNG_A = libmng.a -LIBMNG_DLL = libmng.1.dll -INSTALL_PREFIX = C:/MinGW/ -# maybe you sould replace with anti-slashes - -# default build options -OPTIONS = -DMNG_BUILD_DLL -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS - -# Where the zlib library and include files are located -ZLIBLIB=-lz -#ZLIBLIB=-L../zlib -lz -#ZLIBINC=-I../zlib - -# Where the jpeg library and include files are located -JPEGLIB=-ljpeg -#JPEGLIB=-L../jpgsrc -ljpeg -#JPEGINC=-I../jpgsrc - -# Where the lcms library and include files are located -#LCMSLIB=-llcms -LCMSLIB=-L../lcms/lib -llcms -LCMSINC=-I../lcms/source - -# file deletion command -RM=rm -f -#RM=del - -# directory creation command -MKDIR=mkdir -p - -# file copy command -COPY=cp -#COPY=copy - -# compiler -CC=gcc - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN) -s -LDFLAGS=-L. -lmng $(ZLIBLIB) $(JPEGLIB) $(LCMSLIB) -lm -s - -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -.SUFFIXES: .c .o - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c - -all: $(LIBMNG_A) - -$(LIBMNG_A): $(LIBMNG_DLL) - -$(LIBMNG_DLL) : $(OBJS) - dllwrap --implib=$(LIBMNG_A) --dllname=$(LIBMNG_DLL) $(OBJS) $(LDFLAGS) - -install : $(LIBMNG_A) - $(MKDIR) $(INSTALL_PREFIX)include - $(COPY) libmng.h $(INSTALL_PREFIX)include - $(COPY) libmng_conf.h $(INSTALL_PREFIX)include - $(COPY) libmng_types.h $(INSTALL_PREFIX)include - $(MKDIR) $(INSTALL_PREFIX)lib - $(COPY) $(LIBMNG_A) $(INSTALL_PREFIX)lib - -clean: - $(RM) *.o - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o : libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o : libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o : libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o : libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o : libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o : libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o : libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o : libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o : libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h \ - libmng_chunk_prc.h libmng_memory.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o : libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o : libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o : libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o : libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o : libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o : libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o : libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o : libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o : libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o : libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.qnx b/Engine/lib/lmng/makefiles/makefile.qnx deleted file mode 100644 index 28f18d763..000000000 --- a/Engine/lib/lmng/makefiles/makefile.qnx +++ /dev/null @@ -1,160 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for QNX Neutrino - -# Configuration options are now in libmng_conf.h - -# The architecture of your target -# one of arm, mips, ppc, sh, x86 -ARCH = mips - -# The name of the library -LIBNAME = libmng -ARNAME = $(LIBNAME).a -SONAME = $(LIBNAME).so - -# current version numbers -MNGMAJ = 1 -MNGMIN = 0.9 -MNGVER = $(MNGMAJ).$(MNGMIN) - -# The artefact output folder -OBJDIR = bin - -# Location of jpeg header files -JPEG_INC = $(QNX_TARGET)/usr/include/jpeg - -# Location of zlib header files -ZLIB_INC = $(QNX_TARGET)/usr/include - -# Location of lcms header files -# (switch on MNG_FULL_CMS in libmng_conf.h if you want to use this) -LCMS_INC = $(QNX_TARGET)/usr/include/lcms - -# default build defines -DEF = -DEF_SO = -DMNG_BUILD_SO - -# compiler options: -CFLAGS = -O2 -funroll-loops - -# include paths -INC = -I$(ZLIB_INC) -I$(JPEG_INC) - -# The name of your C compiler: -CC = nto$(ARCH)-gcc - -# source files -SRC= \ - libmng_callback_xs.c \ - libmng_chunk_io.c \ - libmng_chunk_descr.c \ - libmng_chunk_prc.c \ - libmng_chunk_xs.c \ - libmng_cms.c \ - libmng_display.c \ - libmng_dither.c \ - libmng_error.c \ - libmng_filter.c \ - libmng_hlapi.c \ - libmng_jpeg.c \ - libmng_object_prc.c \ - libmng_pixels.c \ - libmng_prop_xs.c \ - libmng_read.c \ - libmng_trace.c \ - libmng_write.c \ - libmng_zlib.c - -# object files -OBJ=$(addprefix $(OBJDIR)/$(ARCH)/, $(SRC:%.c=%.o)) - -# object files for shared object -OBJ_SO=$(addprefix $(OBJDIR)/$(ARCH)/, $(SRC:%.c=%.pic.o)) - -# type dependancies -$(OBJDIR)/$(ARCH)/%.o: %.c - $(CC) $(CFLAGS) $(INC) $(DEF) -o $@ -c $< - -$(OBJDIR)/$(ARCH)/%.pic.o: %.c - $(CC) $(CFLAGS) $(INC) $(DEF_SO) -fPIC -o $@ -c $< - -all: init $(ARNAME) $(SONAME) - -init: - if [ ! -d $(OBJDIR)/$(ARCH) ]; then mkdir -p $(OBJDIR)/$(ARCH); fi - -$(ARNAME): $(OBJ) - ar r $(OBJDIR)/$(ARCH)/$(ARNAME) $(OBJ) - -$(SONAME): $(SONAME).$(MNGMAJ) - ln -sf $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGMAJ) $(OBJDIR)/$(ARCH)/$(SONAME) - -$(SONAME).$(MNGMAJ): $(SONAME).$(MNGVER) - ln -sf $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGVER) $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGMAJ) - -$(SONAME).$(MNGVER): $(OBJ_SO) - $(CC) -shared -Wl,-soname,$(SONAME).$(MNGMAJ) -o $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGVER) $(OBJ_SO) \ - -lz -lm -ljpeg -# -lz -lm -ljpeg -llcms - -clean: - rm -f $(OBJ) $(OBJ_SO) - rm -f $(OBJDIR)/$(ARCH)/$(ARNAME) $(OBJDIR)/$(ARCH)/$(SONAME)* - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o libmng_hlapi.pic.o: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o libmng_callback_xs.pic.o: libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o libmng_prop_xs.pic.o: libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o libmng_chunk_xs.pic.o: libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o libmng_read.pic.o: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o libmng_write.pic.o: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o libmng_display.pic.o: libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o libmng_object_prc.pic.o: libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o libmng_chunk_descr.pic.o: libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h libmng_memory.h \ - libmng_chunk_prc.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o libmng_chunk_prc.pic.o: libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o libmng_chunk_io.pic.o: libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o libmng_error.pic.o: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o libmng_trace.pic.o: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o libmng_pixels.pic.o: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o libmng_filter.pic.o: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o libmng_dither.pic.o: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o libmng_zlib.pic.o: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o libmng_jpeg.pic.o: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o libmng_cms.pic.o: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h diff --git a/Engine/lib/lmng/makefiles/makefile.unix b/Engine/lib/lmng/makefiles/makefile.unix deleted file mode 100644 index 4d3fd97f4..000000000 --- a/Engine/lib/lmng/makefiles/makefile.unix +++ /dev/null @@ -1,67 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for generic unix - -# Configuration options are now in libmng_conf.h - -# The name of your C compiler: -CC= cc - -# Location of jpeg header files -JPEG_INC= /cs/include/jpeg - -# Location of zlib header files -ZLIB_INC= /cs/include - -# Location of lcms header files -# (switch on MNG_FULL_CMS in libmng_conf.h if you want to use this) -LCMS_INC= /ltmp/lcms-1.06/source - -# compiler options: -CFLAGS= -O -I. -I$(ZLIB_INC) -I$(JPEG_INC) -I$(LCMS_INC) - -# source files -SOURCES= \ - libmng_callback_xs.c \ - libmng_chunk_io.c \ - libmng_chunk_descr.c \ - libmng_chunk_prc.c \ - libmng_chunk_xs.c \ - libmng_cms.c \ - libmng_display.c \ - libmng_dither.c \ - libmng_error.c \ - libmng_filter.c \ - libmng_hlapi.c \ - libmng_jpeg.c \ - libmng_object_prc.c \ - libmng_pixels.c \ - libmng_prop_xs.c \ - libmng_read.c \ - libmng_trace.c \ - libmng_write.c \ - libmng_zlib.c - -# object files -OBJECTS= $(SOURCES:%.c=%.o) - -# type dependancies -.c.o: - $(CC) $(CFLAGS) -c $< - -all: libmng.a - -clean: - /bin/rm -f $(OBJECTS) - /bin/rm -f libmng.a - /bin/rm -f *~ core - -libmng.a: $(OBJECTS) - ar r libmng.a $(OBJECTS) - -depend: - makedepend -- $(CFLAGS) $(IFLAGS) -- *.c - -# DO NOT DELETE diff --git a/Engine/lib/lmng/makefiles/makefile.vcwin32 b/Engine/lib/lmng/makefiles/makefile.vcwin32 deleted file mode 100644 index 6f9c2c047..000000000 --- a/Engine/lib/lmng/makefiles/makefile.vcwin32 +++ /dev/null @@ -1,99 +0,0 @@ -# makefile for libmng -# Copyright (C) 2000 AM(s98t269@stmail.eng.kagawa-u.ac.jp) -# For conditions of distribution and use, see copyright notice in libmng.h -# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib -# Assumes that libjpeg.lib, *.h have been copied to ..\jpgsrc6b -# Assumes that lcmsdll.lib and lcmsstat.lib have been copied to ..\lcms\lib\msvc -# To use, do "nmake /f makefiles\makefile.vcwin32" - -# -------- Microsoft Visual C++ 4.0 and later, no assembler code -------- - -CFLAGS= -Ox -GA3s -nologo -W3 -I..\zlib -I..\jpgsrc6b -I..\lcms\include - -CC=cl -LD=link -LDFLAGS= -O=.obj - -#uncomment next to put error messages in a file -#ERRFILE= >> mngerrs - -# variables -OBJS1 = libmng_callback_xs$(O) libmng_chunk_io$(O) libmng_chunk_prc$(O) libmng_chunk_descr$(0) -OBJS2 = libmng_chunk_xs$(O) libmng_cms$(O) libmng_display$(O) libmng_dither$(O) -OBJS3 = libmng_error$(O) libmng_filter$(O) libmng_hlapi$(O) libmng_jpeg$(O) -OBJS4 = libmng_object_prc$(O) libmng_pixels$(O) libmng_prop_xs$(O) -OBJS5 = libmng_read$(O) libmng_trace$(O) libmng_write$(O) libmng_zlib$(O) - -all: libmng.lib - -libmng_callback_xs$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_io$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_descr$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_prc$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_xs$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_cms$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_display$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_dither$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_error$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_filter$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_hlapi$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_jpeg$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_object_prc$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_pixels$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_prop_xs$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_read$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_trace$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_write$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_zlib$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng.lib: $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) - echo something to del > libmng.lib - del libmng.lib - lib /OUT:libmng.lib $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) - -mngtest.exe: mngtest.obj libmng.lib - $(LD) $(LDFLAGS) mngtest.obj libmng.lib ..\zlib\zlib.lib /OUT:mngtest.exe /SUBSYSTEM:CONSOLE - -test: mngtest.exe - mngtest - -# End of makefile for libmng - diff --git a/Engine/lib/lmng/special/mozcfg/mozlibmngconf.h b/Engine/lib/lmng/special/mozcfg/mozlibmngconf.h deleted file mode 100644 index 431b2eaf2..000000000 --- a/Engine/lib/lmng/special/mozcfg/mozlibmngconf.h +++ /dev/null @@ -1,218 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : mozlibmngconf.h copyright (c) G.R-P 2003-2005 * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : special config file for Mozilla * */ -/* * * */ -/* * author : Glenn Randers-Pehrson * */ -/* * * */ -/* * comment : This is the configuration file designed to minimize * */ -/* * footprint for the integration with Mozilla. * */ -/* * * */ -/* * changes : * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef _mozlibmng_conf_h_ -#define _mozlibmng_conf_h_ - -/* Mozilla defines */ - -/* One or none of these may be defined via MNG_CFLAGS in "configure" */ - -#if defined(MNG_BUILD_RAW_MNG) || \ - defined(MNG_BUILD_FULL_MNG) || \ - defined(MNG_BUILD_MOZ_MNG) || \ - defined(MNG_BUILD_MOZ_NO_JNG) || \ - defined(MNG_BUILD_WEB_MNG) || \ - defined(MNG_BUILD_WEB_NO_JNG) || \ - defined(MNG_BUILD_LC) || \ - defined(MNG_BUILD_LC_NO_JNG) || \ - defined(MNG_BUILD_VLC) -# define MNG_BUILD_DEFINED -#endif - -#ifndef MNG_BUILD_DEFINED -#define MNG_BUILD_FULL_MNG -#define MNG_BUILD_DEFINED -#endif - -#if defined(MNG_BUILD_FULL_MNG) -#define MNG_DISABLE_UNUSED -#endif - -#if defined(MNG_BUILD_MOZ_MNG) -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#endif - -#if defined(MNG_BUILD_MOZ_NO_JNG) -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_JNG -#endif - -#if defined(MNG_BUILD_WEB_MNG) -#define MNG_DISABLE_UNUSED -#define MNG_DISABLE_DELTA_PNG -#define MNG_ENABLE_FOOTPRINT -#define MNG_SKIPCHUNK_MAGN -#endif - -#if defined(MNG_BUILD_WEB_NO_JNG) -#define MNG_DISABLE_UNUSED -#define MNG_DISABLE_DELTA_PNG -#define MNG_ENABLE_FOOTPRINT -#define MNG_SKIPCHUNK_MAGN -#define MNG_DISABLE_JNG -#endif - -#if defined(MNG_BUILD_LC) -#define MNG_DISABLE_DELTA_PNG -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_16_BIT -#define MNG_DISABLE_NON_LC -#endif - -#if defined(MNG_BUILD_LC_NO_JNG) -#define MNG_DISABLE_DELTA_PNG -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_16_BIT -#define MNG_DISABLE_JNG -#define MNG_DISABLE_NON_LC -#endif - -#if defined(MNG_BUILD_VLC) -#define MNG_DISABLE_DELTA_PNG -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_16_BIT -#define MNG_DISABLE_JNG -#define MNG_DISABLE_NON_LC -#define MNG_DISABLE_NON_VLC -#endif - -#if defined(MNG_ENABLE_FOOTPRINT) -/* Perform footprint optimizations */ -#define MNG_OPTIMIZE_FOOTPRINT_COMPOSE -#define MNG_OPTIMIZE_FOOTPRINT_DIV -#define MNG_OPTIMIZE_FOOTPRINT_SWITCH -#define MNG_DECREMENT_LOOPS -#define MNG_USE_ZLIB_CRC -#define MNG_OPTIMIZE_FOOTPRINT_INIT -#define MNG_OPTIMIZE_FOOTPRINT_MAGN -#define MNG_OPTIMIZE_OBJCLEANUP -#define MNG_OPTIMIZE_CHUNKINITFREE -#define MNG_OPTIMIZE_CHUNKASSIGN -#endif - -#if defined(MNG_DISABLE_UNUSED) -/* Eliminate unused features from libmng */ -#define MNG_NO_VERSION_QUERY_SUPPORT -#define MNG_NO_OLD_VERSIONS - -#ifdef MOZ_CAIRO_GFX -#define MNG_SKIPCANVAS_RGB8 -#define MNG_SKIPCANVAS_RGB8_A8 -#else -#define MNG_SKIPCANVAS_BGRA8_PM -#endif - -#define MNG_SKIPCANVAS_ABGR8 -#define MNG_SKIPCANVAS_ARGB8 -#define MNG_SKIPCANVAS_BGR8 -#define MNG_SKIPCANVAS_BGRX8 -#define MNG_SKIPCANVAS_BGRA8 -#define MNG_SKIPCANVAS_RGBA8_PM -#define MNG_SKIPCANVAS_ARGB8_PM -#define MNG_SKIPCANVAS_ABGR8_PM -#define MNG_SKIPCANVAS_RGBA8 -#define MNG_SKIPCANVAS_RGB555 -#define MNG_SKIPCANVAS_BGR555 -#define MNG_SKIPCANVAS_RGB565 -#define MNG_SKIPCANVAS_BGR565 -#define MNG_SKIPCANVAS_RGBA565 -#define MNG_SKIPCANVAS_BGRA565 -#define MNG_SKIPCANVAS_BGR565_A8 -#define MNG_SKIP_MAXCANVAS -#define MNG_SKIPCHUNK_tEXt -#define MNG_SKIPCHUNK_zTXt -#define MNG_SKIPCHUNK_iTXt -#define MNG_SKIPCHUNK_bKGD -#define MNG_SKIPCHUNK_cHRM -#define MNG_SKIPCHUNK_hIST -#define MNG_SKIPCHUNK_iCCP -#define MNG_SKIPCHUNK_pHYs -#define MNG_SKIPCHUNK_sBIT -#define MNG_SKIPCHUNK_sPLT -#define MNG_SKIPCHUNK_tIME -#define MNG_SKIPCHUNK_evNT -#define MNG_SKIPCHUNK_eXPI -#define MNG_SKIPCHUNK_fPRI -#define MNG_SKIPCHUNK_nEED -#define MNG_SKIPCHUNK_pHYg -/* Eliminate "critical" but safe-to-ignore chunks (see mng_read_unknown()) */ -#define MNG_SKIPCHUNK_SAVE -#define MNG_SKIPCHUNK_SEEK -#define MNG_SKIPCHUNK_DBYK -#define MNG_SKIPCHUNK_ORDR -/* Eliminate unused zlib and jpeg "get" and "set" accessors */ -#define MNG_NO_ACCESS_ZLIB -#define MNG_NO_ACCESS_JPEG -/* Eliminate other unused features */ -#define MNG_NO_SUPPORT_FUNCQUERY -#define MNG_NO_DISPLAY_GO_SUPPORTED -#define MNG_NO_CURRENT_INFO -#define MNG_NO_DFLT_INFO -#define MNG_NO_LOOP_SIGNALS_SUPPORTED -#define MNG_NO_OPEN_CLOSE_STREAM -#endif - -#if defined(MNG_DISABLE_16_BIT) -/* Eliminate 16-bit support from libmng */ -#define MNG_NO_16BIT_SUPPORT -#endif - -#if defined(MNG_DISABLE_DELTA_PNG) -/* Eliminate Delta-PNG feature from libmng */ -#define MNG_NO_DELTA_PNG -#endif - -#if defined(MNG_DISABLE_NON_LC) -/* Eliminate non-MNG-LC chunks */ -#define MNG_SKIPCHUNK_BASI -#define MNG_SKIPCHUNK_CLIP -#define MNG_SKIPCHUNK_CLON -#define MNG_SKIPCHUNK_DISC -#define MNG_SKIPCHUNK_MOVE -#define MNG_SKIPCHUNK_SHOW -#define MNG_SKIPCHUNK_PAST -#endif - -#if defined(MNG_DISABLE_JNG) -/* If you change this you should also manually remove or restore - jng-recognition in mozilla/modules/libpr0n/src/imgLoader.cpp */ -#define MNG_NO_INCLUDE_JNG -#endif - -#if defined(MNG_DISABLE_NON_VLC) -/* Eliminate non-MNG-VLC chunks */ -#define MNG_SKIPCHUNK_DEFI -#define MNG_SKIPCHUNK_FRAM -#define MNG_SKIPCHUNK_LOOP -#define MNG_SKIPCHUNK_MAGN -#endif - -#if defined(MNG_DISABLE_OPTIONAL_VLC) -/* Eliminate optional MNG-VLC chunks */ -#define MNG_SKIPCHUNK_TERM -#define MNG_SKIPCHUNK_BACK -#define MNG_SKIPCHUNK_gAMA -#define MNG_SKIPCHUNK_sRGB -#endif - -#endif /* _mozlibmng_conf_h */ diff --git a/Engine/lib/lmng/unmaintained/autogen.sh b/Engine/lib/lmng/unmaintained/autogen.sh deleted file mode 100644 index 308ae3739..000000000 --- a/Engine/lib/lmng/unmaintained/autogen.sh +++ /dev/null @@ -1,50 +0,0 @@ -# autogen.sh -# -# invoke the auto* tools to create the configureation system - -# move out configure.in -if ! test -f configure.in; then - echo "copying configure.in" - ln -s makefiles/configure.in . -fi - -# move out the macros and run aclocal -if test ! -f acinclude.m4 -a -r makefiles/acinclude.m4; then - echo "copying configure macros" - ln -s makefiles/acinclude.m4 . -fi - -# copy up our Makefile template -if ! test -f Makefile.am; then - echo "copying automake template" - ln -s makefiles/Makefile.am . -fi - -echo "running aclocal" -aclocal - -# libtool is named glibtool on MacOS X -for LIBTOOLIZE in libtoolize glibtoolize nope; do - ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break -done -if test x$LIBTOOLIZE = xnope; then - echo "error: Could not find libtoolize in the path!" - echo " You'll need to install a copy of libtool before continuing" - echo " with the generation of the build system." - echo - exit 1 -fi - -echo "running $LIBTOOLIZE" -$LIBTOOLIZE --automake - -echo "running automake" -automake --foreign --add-missing - -echo "building configure script" -autoconf - -# and finally invoke our new configure -./configure $* - -# end diff --git a/Engine/lib/lpng/ANNOUNCE b/Engine/lib/lpng/ANNOUNCE index 330fd1078..0f66c0d1d 100644 --- a/Engine/lib/lpng/ANNOUNCE +++ b/Engine/lib/lpng/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.25 - September 1, 2016 +Libpng 1.6.34 - September 29, 2017 This is a public release of libpng, intended for use in production codes. @@ -7,30 +7,26 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.6.25.tar.xz (LZMA-compressed, recommended) - libpng-1.6.25.tar.gz + libpng-1.6.34.tar.xz (LZMA-compressed, recommended) + libpng-1.6.34.tar.gz Source files with CRLF line endings (for Windows), without the "configure" script - lpng1625.7z (LZMA-compressed, recommended) - lpng1625.zip + lpng1634.7z (LZMA-compressed, recommended) + lpng1634.zip Other information: - libpng-1.6.25-README.txt - libpng-1.6.25-LICENSE.txt - libpng-1.6.25-*.asc (armored detached GPG signatures) + libpng-1.6.34-README.txt + libpng-1.6.34-LICENSE.txt + libpng-1.6.34-*.asc (armored detached GPG signatures) -Changes since the last public release (1.6.24): - Reject oversized iCCP profile immediately. - Cleaned up PNG_DEBUG compile of pngtest.c. - Conditionally compile png_inflate(). - Don't install pngcp; it conflicts with pngcp in the pngtools package. - Minor editing of INSTALL, (whitespace, added copyright line) - Added MIPS support (Mandar Sahastrabuddhe ). - Rebased contrib/intel/intel_sse.patch after the MIPS implementation. +Changes since the last public release (1.6.33): + Removed contrib/pngsuite/i*.png; some of these were incorrect and caused + test failures. +Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe) diff --git a/Engine/lib/lpng/CHANGES b/Engine/lib/lpng/CHANGES index 923fc5054..4b8211891 100644 --- a/Engine/lib/lpng/CHANGES +++ b/Engine/lib/lpng/CHANGES @@ -593,7 +593,7 @@ Version 1.0.5e [November 30, 1999] with trailing compressed parts easier in the future, and added new functions png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP, png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond). - NOTE: Applications that write text chunks MUST define png_text->lang + NOTE: Applications that write text chunks MUST define png_text->lang before calling png_set_text(). It must be set to NULL if you want to write tEXt or zTXt chunks. If you want your application to be able to run with older versions of libpng, use @@ -833,7 +833,7 @@ Version 1.0.7beta11 [May 7, 2000] Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes which are no longer used. Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is - defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED + defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXt_SUPPORTED is defined. Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory overrun when old applications fill the info_ptr->text structure directly. @@ -5703,6 +5703,344 @@ Version 1.6.25rc05 [August 30, 2016] Version 1.6.25 [September 1, 2016] No changes. +Version 1.6.26beta01 [September 26, 2016] + Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo, + bugfix by John Bowler). + Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL + has allocated memory that libpng needs to free. + Conditionally compile png_set_benign_errors() in pngread.c and pngtest.c + Issue a png_benign_error instead of a png_error on ADLER32 mismatch + while decoding compressed data chunks. + Changed PNG_ZLIB_VERNUM to ZLIB_VERNUM in pngpriv.h, pngstruct.h, and + pngrutil.c. + If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE, + ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs. + Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error(). + Add tests/badcrc.png and tests/badadler.png to tests/pngtest. + Merged pngtest.c with libpng-1.7.0beta84/pngtest.c + +Version 1.6.26beta02 [October 1, 2016] + Updated the documentation about CRC and ADLER32 handling. + Quieted 117 warnings from clang-3.8 in pngtrans.c, pngread.c, + pngwrite.c, pngunknown.c, and pngvalid.c. + Quieted 58 (out of 144) -Wconversion compiler warnings by changing + flag definitions in pngpriv.h from 0xnnnn to 0xnnnnU and trivial changes + in png.c, pngread.c, and pngwutil.c. + +Version 1.6.26beta03 [October 2, 2016] + Removed contrib/libtests/*.orig and *.rej that slipped into the tarballs. + Quieted the 86 remaining -Wconversion compiler warnings by + revising the png_isaligned() macro and trivial changes in png.c, + pngerror.c, pngget.c, pngmem.c, pngset.c, pngrtran.c, pngrutil.c, + pngwtran.c, pngwrite.c, and pngwutil.c. + +Version 1.6.26beta04 [October 3, 2016] + Quieted (bogus?) clang warnings about "absolute value has no effect" + when PNG_USE_ABS is defined. + Fixed offsets in contrib/intel/intel_sse.patch + +Version 1.6.26beta05 [October 6, 2016] + Changed integer constant 4294967294 to unsigned 4294967294U in pngconf.h + to avoid a signed/unsigned compare in the preprocessor. + +Version 1.6.26beta06 [October 7, 2016] + Use zlib-1.2.8.1 inflateValidate() instead of inflateReset2() to + optionally avoid ADLER32 evaluation. + +Version 1.6.26rc01 [October 12, 2016] + No changes. + +Version 1.6.26 [October 20, 2016] + Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c + Despammed email addresses (replaced "@" with " at "). + +Version 1.6.27beta01 [November 2, 2016] + Restrict the new ADLER32-skipping to IDAT chunks. It broke iCCP chunk + handling: an erroneous iCCP chunk would throw a png_error and reject the + entire PNG image instead of rejecting just the iCCP chunk with a warning, + if built with zlib-1.2.8.1. + +Version 1.6.27rc01 [December 27, 2016] + Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Fixes + an endless loop when handling erroneous ADLER32 checksums; bug + introduced in libpng-1.6.26. + Removed the use of a macro containing the pre-processor 'defined' + operator. It is unclear whether this is valid; a macro that + "generates" 'defined' is not permitted, but the use of the word + "generates" within the C90 standard seems to imply more than simple + substitution of an expression itself containing a well-formed defined + operation. + Added ARM support to CMakeLists.txt (Andreas Franek). + +Version 1.6.27 [December 29, 2016] + Fixed a potential null pointer dereference in png_set_text_2() (bug report + and patch by Patrick Keshishian, CVE-2016-10087). + +Version 1.6.28rc01 [January 3, 2017] + Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna). + Added option to Cmake build allowing a custom location of zlib to be + specified in a scenario where libpng is being built as a subproject + alongside zlib by another project (Sam Serrels). + Changed png_ptr->options from a png_byte to png_uint_32, to accomodate + up to 16 options. + +Version 1.6.28rc02 [January 4, 2017] + Added "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna). + Moved SSE2 optimization code into the main libpng source directory. + Configure libpng with "configure --enable-intel-sse" or compile + libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it. + +Version 1.6.28rc03 [January 4, 2017] + Backed out the SSE optimization and last CMakeLists.txt to allow time for QA. + +Version 1.6.28 [January 5, 2017] + No changes. + +Version 1.6.29beta01 [January 12, 2017] + Readded "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna). + Moved SSE2 optimization code into the main libpng source directory. + Configure libpng with "configure --enable-intel-sse" or compile + libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it. + Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt). + +Version 1.6.29beta02 [February 22, 2017] + Avoid conditional directives that break statements in pngrutil.c (Romero + Malaquias) + The contrib/examples/pngtopng.c recovery code was in the wrong "if" + branches; the comments were correct. + Added code for PowerPC VSX optimisation (Vadim Barkov). + +Version 1.6.29beta03 [March 1, 2017] + Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer). + Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c + because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1, + as suggested in zlib FAQ, item 24. + Suppress clang warnings about implicit sign changes in png.c + +Version 1.6.29 [March 16, 2017] + No changes. + +Version 1.6.30beta01 [April 1, 2017] + Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in + makefile.linux and makefile.solaris-x86 (Cosmin). + Revised documentation of png_get_error_ptr() in the libpng manual. + Silence clang -Wcomma and const drop warnings (Viktor Szakats). + Update Sourceforge URLs in documentation (https instead of http). + +Version 1.6.30beta02 [April 22, 2017] + Document need to check for integer overflow when allocating a pixel + buffer for multiple rows in contrib/gregbook, contrib/pngminus, + example.c, and in the manual (suggested by Jaeseung Choi). This + is similar to the bug reported against pngquant in CVE-2016-5735. + Removed reference to the obsolete PNG_SAFE_LIMITS macro in the documentation. + +Version 1.6.30beta03 [May 22, 2017] + Check for integer overflow in contrib/visupng and contrib/tools/genpng. + Do not double evaluate CMAKE_SYSTEM_PROCESSOR in CMakeLists.txt. + Test CMAKE_HOST_WIN32 instead of WIN32 in CMakeLists.txt. + Fix some URL in documentation. + +Version 1.6.30beta04 [June 7, 2017] + Avoid writing an empty IDAT when the last IDAT exactly fills the + compression buffer (bug report by Brian Baird). This bug was + introduced in libpng-1.6.0. + +Version 1.6.30rc01 [June 14, 2017] + No changes. + +Version 1.6.30rc02 [June 25, 2017] + Update copyright year in pnglibconf.h, make ltmain.sh executable. + Add a reference to the libpng.download site in README. + +Version 1.6.30 [June 28, 2017] + No changes. + +Version 1.6.31beta01 [July 5, 2017] + Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it; + bug report by Michael Felt). + Revised pngpriv.h to work around failure to compile arm/filter_neon.S + ("typedef" directive is unrecognized by the assembler). The problem + was introduced in libpng-1.6.30beta01. + Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx). + Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish). + +Version 1.6.31beta02 [July 8, 2017] + Added instructions for disabling hardware optimizations in INSTALL. + Added "--enable-hardware-optimizations" configuration flag to enable + or disable all hardware optimizations with one flag. + +Version 1.6.31beta03 [July 9, 2017] + Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms. + Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent + possible integer overflow (Bug report by John Bowler). + Quieted "declaration after statement" warnings in intel/filter_sse2.c. + Added scripts/makefile-linux-opt, which has hardware optimizations enabled. + +Version 1.6.31beta04 [July 11, 2017] + Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when + integers appear on both sides of a compare. Worked around the others by + forcing the strict-overflow setting in the relevant functions to a level + where they are not reported (John Bowler). + Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like + the space. + Worked around some C-style casts from (void*) because g++ 5.4.0 objects + to them. + Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint + overflow' check that is on by default with -Wall -Wextra. + +Version 1.6.31beta05 [July 13, 2017] + Added eXIf chunk support. + +Version 1.6.31beta06 [July 17, 2017] + Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm + tags) to pngtest.png. + +Version 1.6.31beta07 [July 18, 2017] + Revised the eXIf chunk in pngtest.png to fix "Bad IFD1 Directory" warning. + +Version 1.6.31rc01 [July 19, 2017] + No changes. + +Version 1.6.31rc02 [July 25, 2017] + Fixed typo in example.c (png_free_image should be png_image_free) (Bug + report by John Smith) + +Version 1.6.31 [July 27, 2017] + No changes. + +Version 1.6.32beta01 [July 31, 2017] + Avoid possible NULL dereference in png_handle_eXIf when benign_errors + are allowed. Avoid leaking the input buffer "eXIf_buf". + Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif + to arguments for png_get_eXIf() and png_set_eXIf(). + Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in + pngwrite.c, and made various other fixes to png_write_eXIf(). + Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and + png_set_eXIf_1(), respectively, to avoid breaking API compatibility + with libpng-1.6.31. + +Version 1.6.32beta02 [August 1, 2017] + Updated contrib/libtests/pngunknown.c with eXIf chunk. + +Version 1.6.32beta03 [August 2, 2017] + Initialized btoa[] in pngstest.c + Stop memory leak when returning from png_handle_eXIf() with an error + (Bug report from the OSS-fuzz project). + +Version 1.6.32beta04 [August 2, 2017] + Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Update libpng.3 and libpng-manual.txt about eXIf functions. + +Version 1.6.32beta05 [August 2, 2017] + Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. + +Version 1.6.32beta06 [August 2, 2017] + Removed png_get_eXIf_1() and png_set_eXIf_1(). + +Version 1.6.32beta07 [August 3, 2017] + Check length of all chunks except IDAT against user limit to fix an + OSS-fuzz issue (Fixes CVE-2017-12652). + +Version 1.6.32beta08 [August 3, 2017] + Check length of IDAT against maximum possible IDAT size, accounting + for height, rowbytes, interlacing and zlib/deflate overhead. + Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf) + does not work (the eXIf chunk data can contain zeroes). + +Version 1.6.32beta09 [August 3, 2017] + Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation, + no longer using deprecated cmake LOCATION feature (Clifford Yapp). + Fixed five-byte error in the calculation of IDAT maximum possible size. + +Version 1.6.32beta10 [August 5, 2017] + Moved chunk-length check into a png_check_chunk_length() private + function (Suggested by Max Stepin). + Moved bad pngs from tests to contrib/libtests/crashers + Moved testing of bad pngs into a separate tests/pngtest-badpngs script + Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL + in the output but PASS for the libpng test. + Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp). + Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the + num_exif argument to png_get_eXIf_1() (Github Issue 171). + +Version 1.6.32beta11 [August 7, 2017] + Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks(). + Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers. + Make pngtest --strict, --relax, --xfail options imply -m (multiple). + Removed unused chunk_name parameter from png_check_chunk_length(). + Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak. + Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue. + Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR. + Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue. + Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account + for the minimum 'deflate' stream, and relocate the test to a point + after the keyword has been read. + Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM". + +Version 1.6.32rc01 [August 18, 2017] + Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers, + one for each known chunk type, with length = 2GB-1. + Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts + in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706, + and 162707). + Renamed chunks in contrib/testpngs/crashers to avoid having files whose + names differ only in case; this causes problems with some platforms + (github issue #172). + +Version 1.6.32rc02 [August 22, 2017] + Added contrib/oss-fuzz directory which contains files used by the oss-fuzz + project (https://github.com/google/oss-fuzz/tree/master/projects/libpng). + +Version 1.6.32 [August 24, 2017] + No changes. + +Version 1.6.33beta01 [August 28, 2017] + Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing + parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse). + Fixed off-by-one error in png_do_check_palette_indexes() (Bug report + by Mick P., Source Forge Issue #269). + +Version 1.6.33beta02 [September 3, 2017] + Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc + to fix shortlived oss-fuzz issue 3234. + Compute a larger limit on IDAT because some applications write a deflate + buffer for each row (Bug report by Andrew Church). + Use current date (DATE) instead of release-date (RDATE) in last + changed date of contrib/oss-fuzz files. + Enabled ARM support in CMakeLists.txt (Bernd Kuhls). + +Version 1.6.33beta03 [September 14, 2017] + Fixed incorrect typecast of some arguments to png_malloc() and + png_calloc() that were png_uint_32 instead of png_alloc_size_t + (Bug report by "irwir" in Github libpng issue #175). + Use pnglibconf.h.prebuilt when building for ANDROID with cmake (Github + issue 162, by rcdailey). + +Version 1.6.33rc01 [September 20, 2017] + Initialize memory allocated by png_inflate to zero, using memset, to + stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2() + due to truncated iTXt or zTXt chunk. + Initialize memory allocated by png_read_buffer to zero, using memset, to + stop an oss-fuzz "use of uninitialized value" detection in + png_icc_check_tag_table() due to truncated iCCP chunk. + Removed a redundant test (suggested by "irwir" in Github issue #180). + +Version 1.6.33rc02 [September 23, 2017] + Added an interlaced version of each file in contrib/pngsuite. + Relocate new memset() call in pngrutil.c. + Removed more redundant tests (suggested by "irwir" in Github issue #180). + Add support for loading images with associated alpha in the Simplified + API (Samuel Williams). + +Version 1.6.33 [September 28, 2017] + Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 state. + Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc + Add end_info structure and png_read_end() to the libpng fuzzer. + +Version 1.6.34 [September 29, 2017] + Removed contrib/pngsuite/i*.png; some of these were incorrect and caused + test failures. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/Engine/lib/lpng/CMakeLists.txt b/Engine/lib/lpng/CMakeLists.txt index eb63b2bfe..48c6fa287 100644 --- a/Engine/lib/lpng/CMakeLists.txt +++ b/Engine/lib/lpng/CMakeLists.txt @@ -1,17 +1,18 @@ # CMakeLists.txt -# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson +# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson # Written by Christian Ehrlicher, 2007 # Revised by Roger Lowman, 2009-2010 # Revised by Clifford Yapp, 2011-2012 # Revised by Roger Leigh, 2016 +# Revised by Andreas Franek, 2016 # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer # and license in png.h -cmake_minimum_required(VERSION 2.8.3) -cmake_policy(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.0.2) +cmake_policy(VERSION 3.0.2) # Set MacOSX @rpath usage globally. if (POLICY CMP0020) @@ -30,18 +31,27 @@ endif(POLICY CMP0054) set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo") -project(libpng C) +project(libpng ASM C) enable_testing() set(PNGLIB_MAJOR 1) set(PNGLIB_MINOR 6) -set(PNGLIB_RELEASE 25) +set(PNGLIB_RELEASE 34) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) +include(GNUInstallDirs) + # needed packages -find_package(ZLIB REQUIRED) -include_directories(${ZLIB_INCLUDE_DIR}) + +#Allow users to specify location of Zlib, +# Useful if zlib is being built alongside this as a sub-project +option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF) + +IF(NOT PNG_BUILD_ZLIB) + find_package(ZLIB REQUIRED) + include_directories(${ZLIB_INCLUDE_DIR}) +ENDIF(NOT PNG_BUILD_ZLIB) if(NOT WIN32) find_library(M_LIBRARY @@ -66,9 +76,116 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF) option(PNG_DEBUG "Build with debug output" OFF) option(PNGARG "Disable ANSI-C prototypes" OFF) +option(PNG_HARDWARE_OPTIMIZATIONS "Enable Hardware Optimizations" ON) + + set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names") set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings") +if(PNG_HARDWARE_OPTIMIZATIONS) +# set definitions and sources for arm +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") + set(PNG_ARM_NEON_POSSIBLE_VALUES check on off) + set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations: + check: (default) use internal checking code; + off: disable the optimizations; + on: turn on unconditionally.") + set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS + ${PNG_ARM_NEON_POSSIBLE_VALUES}) + list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_ARM_NEON} STREQUAL "no") + set(libpng_arm_sources + arm/arm_init.c + arm/filter_neon.S + arm/filter_neon_intrinsics.c) + + if(${PNG_ARM_NEON} STREQUAL "on") + add_definitions(-DPNG_ARM_NEON_OPT=2) + elseif(${PNG_ARM_NEON} STREQUAL "check") + add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED) + endif() + else() + add_definitions(-DPNG_ARM_NEON_OPT=0) + endif() +endif() + +# set definitions and sources for powerpc +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*" ) + set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off) + set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations: + off: disable the optimizations.") + set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS + ${PNG_POWERPC_VSX_POSSIBLE_VALUES}) + list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "no") + set(libpng_powerpc_sources + powerpc/powerpc_init.c + powerpc/filter_vsx_intrinsics.c) + if(${PNG_POWERPC_VSX} STREQUAL "on") + add_definitions(-DPNG_POWERPC_VSX_OPT=2) + endif() + else() + add_definitions(-DPNG_POWERPC_VSX_OPT=0) + endif() +endif() + +# set definitions and sources for intel +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*" ) + set(PNG_INTEL_SSE_POSSIBLE_VALUES on off) + set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations: + off: disable the optimizations") + set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS + ${PNG_INTEL_SSE_POSSIBLE_VALUES}) + list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_INTEL_SSE} STREQUAL "no") + set(libpng_intel_sources + intel/intel_init.c + intel/filter_sse2_intrinsics.c) + if(${PNG_INTEL_SSE} STREQUAL "on") + add_definitions(-DPNG_INTEL_SSE_OPT=1) + endif() + else() + add_definitions(-DPNG_INTEL_SSE_OPT=0) + endif() +endif() + +# set definitions and sources for MIPS +if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*" ) + set(PNG_MIPS_MSA_POSSIBLE_VALUES on off) + set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations: + off: disable the optimizations") + set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS + ${PNG_MIPS_MSA_POSSIBLE_VALUES}) + list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_MIPS_MSA} STREQUAL "no") + set(libpng_mips_sources + mips/mips_init.c + mips/filter_msa_intrinsics.c) + if(${PNG_MIPS_MSA} STREQUAL "on") + add_definitions(-DPNG_MIPS_MSA_OPT=2) + endif() + else() + add_definitions(-DPNG_MIPS_MSA_OPT=0) + endif() +endif() +endif(PNG_HARDWARE_OPTIMIZATIONS) + # SET LIBNAME set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) @@ -145,7 +262,7 @@ find_program(AWK NAMES gawk awk) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -if(NOT AWK) +if(NOT AWK OR ANDROID) # No awk available to generate sources; use pre-built pnglibconf.h configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h) @@ -324,7 +441,7 @@ else() "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out") -endif(NOT AWK) +endif(NOT AWK OR ANDROID) # OUR SOURCES set(libpng_public_hdrs @@ -338,7 +455,7 @@ set(libpng_private_hdrs pnginfo.h pngstruct.h ) -if(AWK) +if(AWK AND NOT ANDROID) list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h") endif() set(libpng_sources @@ -359,6 +476,10 @@ set(libpng_sources pngwrite.c pngwtran.c pngwutil.c + ${libpng_arm_sources} + ${libpng_intel_sources} + ${libpng_mips_sources} + ${libpng_powerpc_sources} ) set(pngtest_sources pngtest.c @@ -634,31 +755,58 @@ if(PNG_SHARED) list(APPEND PNG_BIN_TARGETS png-fix-itxt) endif() -# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set -IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib") -ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - # Set a variable with CMake code which: # Creates a symlink from src to dest (if possible) or alternatively # copies if different. -macro(CREATE_SYMLINK SRC_FILE DEST_FILE) - FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}) - if(WIN32 AND NOT CYGWIN AND NOT MSYS) - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE} - DEPENDS ${PNG_LIB_TARGETS} - ) - ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}) - else(WIN32 AND NOT CYGWIN AND NOT MSYS) - get_filename_component(LINK_TARGET "${SRC_FILE}" NAME) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif(WIN32 AND NOT CYGWIN AND NOT MSYS) -endmacro() +include(CMakeParseArguments) + +function(CREATE_SYMLINK DEST_FILE) + + cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN}) + + if(NOT S_TARGET AND NOT S_FILE) + message(FATAL_ERROR "Specify either a TARGET or a FILE for CREATE_SYMLINK to link to.") + endif(NOT S_TARGET AND NOT S_FILE) + + if(S_TARGET AND S_FILE) + message(FATAL_ERROR "CREATE_SYMLINK called with both source file ${S_FILE} and build target ${S_TARGET} arguments - can only handle 1 type per call.") + endif(S_TARGET AND S_FILE) + + if(S_FILE) + # If we don't need to symlink something that's coming from a build target, + # we can go ahead and symlink/copy at configure time. + + if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + execute_process( + COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ) + else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + execute_process( + COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ) + endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + endif(S_FILE) + + if(S_TARGET) + # We need to use generator expressions, which can be a bit tricky, so for + # simplicity make the symlink a POST_BUILD step and use the TARGET + # signature of add_custom_command. + + if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + add_custom_command(TARGET ${S_TARGET} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ $/${DEST_FILE} + ) + else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + add_custom_command(TARGET ${S_TARGET} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E create_symlink $ $/${DEST_FILE} + ) + endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + + endif(S_TARGET) + +endfunction() # Create source generation scripts. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in @@ -686,17 +834,17 @@ if(NOT WIN32 OR CYGWIN OR MINGW) set(LIBS "-lz -lm") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) - CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc) + CREATE_SYMLINK(libpng.pc FILE ${PNGLIB_NAME}.pc) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) - CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config) + CREATE_SYMLINK(libpng-config FILE ${PNGLIB_NAME}-config) endif(NOT WIN32 OR CYGWIN OR MINGW) # SET UP LINKS if(PNG_SHARED) set_target_properties(png PROPERTIES -# VERSION 16.${PNGLIB_RELEASE}.1.6.25 +# VERSION 16.${PNGLIB_RELEASE}.1.6.34 VERSION 16.${PNGLIB_RELEASE}.0 SOVERSION 16 CLEAN_DIRECT_OUTPUT 1) @@ -723,26 +871,20 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) if(PNG_SHARED) # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin if(CYGWIN OR MINGW) - get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE}) - CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + CREATE_SYMLINK(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png) + install(FILES $/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(CYGWIN OR MINGW) if(NOT WIN32) - get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE}) - CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + CREATE_SYMLINK(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png) + install(FILES $/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(NOT WIN32) endif(PNG_SHARED) if(PNG_STATIC) if(NOT WIN32 OR CYGWIN OR MINGW) - get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE}) - CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + CREATE_SYMLINK( libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) + install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(NOT WIN32 OR CYGWIN OR MINGW) endif() endif() @@ -772,7 +914,7 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3) install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5) # Install pkg-config files - if(NOT WIN32 OR CYGWIN OR MINGW) + if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config @@ -781,7 +923,7 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) - endif(NOT WIN32 OR CYGWIN OR MINGW) + endif(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) endif() # On versions of CMake that support it, create an export file CMake @@ -801,4 +943,3 @@ endif() # to create msvc import lib for mingw compiled shared lib # pexports libpng.dll > libpng.def # lib /def:libpng.def /machine:x86 - diff --git a/Engine/lib/lpng/INSTALL b/Engine/lib/lpng/INSTALL index 58ec0b60a..e8edb7240 100644 --- a/Engine/lib/lpng/INSTALL +++ b/Engine/lib/lpng/INSTALL @@ -16,10 +16,11 @@ Contents XI. Prepending a prefix to exported symbols XII. Configuring for compiler xxx: XIII. Removing unwanted object code - XIV. Changes to the build and configuration of libpng in libpng-1.5.x - XV. Setjmp/longjmp issues - XVI. Common linking failures - XVII. Other sources of information about libpng + XIV. Enabling or disabling hardware optimizations + XV. Changes to the build and configuration of libpng in libpng-1.5.x + XVI. Setjmp/longjmp issues + XVII. Common linking failures + XVIII. Other sources of information about libpng I. Simple installation @@ -78,8 +79,8 @@ Or you can use one of the "projects" in the "projects" directory. Before installing libpng, you must first install zlib, if it is not already on your system. zlib can usually be found -wherever you got libpng; otherwise go to http://zlib.net. You can place -zlib in the same directory as libpng or in another directory. +wherever you got libpng; otherwise go to https://zlib.net/. You can +place zlib in the same directory as libpng or in another directory. If your system already has a preinstalled zlib you will still need to have access to the zlib.h and zconf.h include files that @@ -281,7 +282,57 @@ library to fail if they call functions not available in your library. The size of the library itself should not be an issue, because only those sections that are actually used will be loaded into memory. -XIV. Changes to the build and configuration of libpng in libpng-1.5.x +XIV. Enabling or disabling hardware optimizations + +Certain hardware capabilites, such as the Intel SSE instructions, +are normally detected at run time. Enable them with configure options +such as one of + + --enable-arm-neon=yes + --enable-mips-msa=yes + --enable-intel-sse=yes + --enable-powerpc-vsx=yes + +or enable them all at once with + + --enable-hardware-optimizations=yes + +or, if you are not using "configure", you can use one +or more of + + CPPFLAGS += "-DPNG_ARM_NEON" + CPPFLAGS += "-DPNG_MIPS_MSA" + CPPFLAGS += "-DPNG_INTEL_SSE" + CPPFLAGS += "-DPNG_POWERPC_VSX" + +See for example scripts/makefile.linux-opt + +If you wish to avoid using them, +you can disable them via the configure option + + --disable-hardware-optimizations + +to disable them all, or + + --enable-intel-sse=no + +to disable a particular one, +or via compiler-command options such as + + CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0, + -DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0" + +If you are using cmake, hardware optimizations are "on" +by default. To disable them, use + + cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \ + -DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no + +or disable them all at once with + + cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no + +XV. Changes to the build and configuration of libpng in libpng-1.5.x Details of internal changes to the library code can be found in the CHANGES file and in the GIT repository logs. These will be of no concern to the vast @@ -372,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built libpng, because than the settings would not accurately reflect the settings that were used to build libpng. -XV. Setjmp/longjmp issues +XVI. Setjmp/longjmp issues Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() is known to be not thread-safe on some platforms and we don't know of @@ -390,7 +441,7 @@ This requires setjmp/longjmp, so you must either build the library with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined. -XVI. Common linking failures +XVII. Common linking failures If your application fails to find libpng or zlib entries while linking: @@ -402,7 +453,7 @@ If your application fails to find libpng or zlib entries while linking: If you are using the vstudio project, observe the WARNING in project/vstudio/README.txt. -XVII. Other sources of information about libpng: +XVIII. Other sources of information about libpng: Further information can be found in the README and libpng-manual.txt files, in the individual makefiles, in png.h, and the manual pages diff --git a/Engine/lib/lpng/LICENSE b/Engine/lib/lpng/LICENSE index d48a293cd..4cda4fa0a 100644 --- a/Engine/lib/lpng/LICENSE +++ b/Engine/lib/lpng/LICENSE @@ -10,8 +10,8 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are -Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are +libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are +Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: @@ -22,6 +22,9 @@ added to the list of Contributing Authors: Cosmin Truta Gilles Vollant James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: @@ -127,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and Glenn Randers-Pehrson glennrp at users.sourceforge.net -September 1, 2016 +September 29, 2017 diff --git a/Engine/lib/lpng/README b/Engine/lib/lpng/README index 17bca9a5f..0da5a5ef8 100644 --- a/Engine/lib/lpng/README +++ b/Engine/lib/lpng/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.25 - September 1, 2016 (shared library 16.0) +README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. @@ -23,7 +23,7 @@ earlier versions if you are using a shared library. The type of the png_uint_32, which will affect shared-library applications that use this function. -To avoid problems with changes to the internals of png info_struct, +To avoid problems with changes to the internals of the png info_struct, new APIs have been made available in 0.95 to avoid direct application access to info_ptr. These functions are the png_set_ and png_get_ functions. These functions should be used when @@ -88,11 +88,11 @@ zlib should be available at the same place that libpng is, or at zlib.net. You may also want a copy of the PNG specification. It is available as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find -these at http://www.libpng.org/pub/png/documents/ +these at http://www.libpng.org/pub/png/pngdocs.html . -This code is currently being archived at libpng.sf.net in the -[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it -in any of those places, e-mail me, and I'll help you find it. +This code is currently being archived at libpng.sourceforge.io in the +[DOWNLOAD] area, and at http://libpng.download/src . If you +can't find it in any of those places, e-mail me, and I'll help you find it. I am not a lawyer, but I believe that the Export Control Classification Number (ECCN) for libpng is EAR99, which means not subject to export @@ -179,14 +179,16 @@ Files in this distribution: pngwtran.c => Write data transformations pngwutil.c => Write utility functions arm => Contains optimized code for the ARM platform + powerpc => Contains optimized code for the PowerPC platform contrib => Contributions arm-neon => Optimized code for ARM-NEON platform + powerpc-vsx => Optimized code for POWERPC-VSX platform examples => Example programs gregbook => source code for PNG reading and writing, from Greg Roelofs' "PNG: The Definitive Guide", O'Reilly, 1999 - intel => Optimized code for INTEL-SSE2 platform libtests => Test programs + mips-msa => Optimized code for MIPS-MSA platform pngminim => Minimal decoder, encoder, and progressive decoder programs demonstrating use of pngusr.dfa pngminus => Simple pnm2png and png2pnm programs @@ -194,6 +196,8 @@ Files in this distribution: testpngs tools => Various tools visupng => Contains a MSVC workspace for VisualPng + intel => Optimized code for INTEL-SSE2 platform + mips => Optimized code for MIPS platform projects => Contains project files and workspaces for building a DLL owatcom => Contains a WATCOM project for building libpng diff --git a/Engine/lib/lpng/TODO b/Engine/lib/lpng/TODO index cdb9e1fa8..36d6092a2 100644 --- a/Engine/lib/lpng/TODO +++ b/Engine/lib/lpng/TODO @@ -7,7 +7,7 @@ Fix problem with C++ and EXTERN "C". cHRM transformation. Remove setjmp/longjmp usage in favor of returning error codes. As a start on this, minimize the use of png_error(), replacing them with - png_warning(); return(0; or similar. + png_warning(); return(0); or similar. Palette creation. Add "grayscale->palette" transformation and "palette->grayscale" detection. Improved dithering. @@ -24,7 +24,7 @@ Use greater precision when changing to linear gamma for compositing against background and doing rgb-to-gray transformation. Investigate pre-incremented loop counters and other loop constructions. Add interpolated method of handling interlacing. -Switch to the simpler zlib (zlib/libpng) license if legally possible. Extend pngvalid.c to validate more of the libpng transformations. +Refactor preprocessor conditionals to compile entire statements */ diff --git a/Engine/lib/lpng/configure b/Engine/lib/lpng/configure index 010a4cb5e..e69de29bb 100644 --- a/Engine/lib/lpng/configure +++ b/Engine/lib/lpng/configure @@ -1,19 +0,0 @@ - -echo " - There is no \"configure\" script in this distribution (*.zip or *.7z) of - libpng-1.6.25. - - Instead, please copy the appropriate makefile for your system from the - \"scripts\" directory. Read the INSTALL file for more details. - - Update, July 2004: you can get a \"configure\" based distribution - from the libpng distribution sites. Download the file - libpng-1.6.25.tar.gz or libpng-1.6.25.tar.xz. - - If the line endings in the files look funny, which is likely to be the - case if you were trying to run \"configure\" on a Linux machine, you may - wish to get the other distribution of libpng. It is available in both - tar.gz/tar.xz (UNIX style line endings, with \"configure\") and .7z/.zip - (DOS style line endings, without \"configure\") formats. -" - diff --git a/Engine/lib/lpng/example.c b/Engine/lib/lpng/example.c new file mode 100644 index 000000000..99d2f054a --- /dev/null +++ b/Engine/lib/lpng/example.c @@ -0,0 +1,1066 @@ + +#if 0 /* in case someone actually tries to compile this */ + +/* example.c - an example of using libpng + * Last changed in libpng 1.6.24 [August 4, 2016] + * Maintained 1998-2016 Glenn Randers-Pehrson + * Maintained 1996, 1997 Andreas Dilger) + * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * To the extent possible under law, the authors have waived + * all copyright and related or neighboring rights to this file. + * This work is published from: United States. + */ + +/* This is an example of how to use libpng to read and write PNG files. + * The file libpng-manual.txt is much more verbose then this. If you have not + * read it, do so first. This was designed to be a starting point of an + * implementation. This is not officially part of libpng, is hereby placed + * in the public domain, and therefore does not require a copyright notice. + * + * This file does not currently compile, because it is missing certain + * parts, like allocating memory to hold an image. You will have to + * supply these parts to get it to compile. For an example of a minimal + * working PNG reader/writer, see pngtest.c, included in this distribution; + * see also the programs in the contrib directory. + */ + +/* The simple, but restricted, approach to reading a PNG file or data stream + * just requires two function calls, as in the following complete program. + * Writing a file just needs one function call, so long as the data has an + * appropriate layout. + * + * The following code reads PNG image data from a file and writes it, in a + * potentially new format, to a new file. While this code will compile there is + * minimal (insufficient) error checking; for a more realistic version look at + * contrib/examples/pngtopng.c + */ +#include +#include +#include +#include +#include +#include + +int main(int argc, const char **argv) +{ + if (argc == 3) + { + png_image image; /* The control structure used by libpng */ + + /* Initialize the 'png_image' structure. */ + memset(&image, 0, (sizeof image)); + image.version = PNG_IMAGE_VERSION; + + /* The first argument is the file to read: */ + if (png_image_begin_read_from_file(&image, argv[1]) != 0) + { + png_bytep buffer; + + /* Set the format in which to read the PNG file; this code chooses a + * simple sRGB format with a non-associated alpha channel, adequate to + * store most images. + */ + image.format = PNG_FORMAT_RGBA; + + /* Now allocate enough memory to hold the image in this format; the + * PNG_IMAGE_SIZE macro uses the information about the image (width, + * height and format) stored in 'image'. + */ + buffer = malloc(PNG_IMAGE_SIZE(image)); + + /* If enough memory was available read the image in the desired format + * then write the result out to the new file. 'background' is not + * necessary when reading the image because the alpha channel is + * preserved; if it were to be removed, for example if we requested + * PNG_FORMAT_RGB, then either a solid background color would have to + * be supplied or the output buffer would have to be initialized to the + * actual background of the image. + * + * The fourth argument to png_image_finish_read is the 'row_stride' - + * this is the number of components allocated for the image in each + * row. It has to be at least as big as the value returned by + * PNG_IMAGE_ROW_STRIDE, but if you just allocate space for the + * default, minimum, size using PNG_IMAGE_SIZE as above you can pass + * zero. + * + * The final argument is a pointer to a buffer for the colormap; + * colormaps have exactly the same format as a row of image pixels (so + * you choose what format to make the colormap by setting + * image.format). A colormap is only returned if + * PNG_FORMAT_FLAG_COLORMAP is also set in image.format, so in this + * case NULL is passed as the final argument. If you do want to force + * all images into an index/color-mapped format then you can use: + * + * PNG_IMAGE_COLORMAP_SIZE(image) + * + * to find the maximum size of the colormap in bytes. + */ + if (buffer != NULL && + png_image_finish_read(&image, NULL/*background*/, buffer, + 0/*row_stride*/, NULL/*colormap*/) != 0) + { + /* Now write the image out to the second argument. In the write + * call 'convert_to_8bit' allows 16-bit data to be squashed down to + * 8 bits; this isn't necessary here because the original read was + * to the 8-bit format. + */ + if (png_image_write_to_file(&image, argv[2], 0/*convert_to_8bit*/, + buffer, 0/*row_stride*/, NULL/*colormap*/) != 0) + { + /* The image has been written successfully. */ + exit(0); + } + } + + else + { + /* Calling png_image_free is optional unless the simplified API was + * not run to completion. In this case if there wasn't enough + * memory for 'buffer' we didn't complete the read, so we must free + * the image: + */ + if (buffer == NULL) + png_image_free(&image); + + else + free(buffer); + } + + /* Something went wrong reading or writing the image. libpng stores a + * textual message in the 'png_image' structure: + */ + fprintf(stderr, "pngtopng: error: %s\n", image.message); + exit (1); + } + + fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n"); + exit(1); +} + +/* That's it ;-) Of course you probably want to do more with PNG files than + * just converting them all to 32-bit RGBA PNG files; you can do that between + * the call to png_image_finish_read and png_image_write_to_file. You can also + * ask for the image data to be presented in a number of different formats. You + * do this by simply changing the 'format' parameter set before allocating the + * buffer. + * + * The format parameter consists of five flags that define various aspects of + * the image, you can simply add these together to get the format or you can use + * one of the predefined macros from png.h (as above): + * + * PNG_FORMAT_FLAG_COLOR: if set the image will have three color components per + * pixel (red, green and blue), if not set the image will just have one + * luminance (grayscale) component. + * + * PNG_FORMAT_FLAG_ALPHA: if set each pixel in the image will have an additional + * alpha value; a linear value that describes the degree the image pixel + * covers (overwrites) the contents of the existing pixel on the display. + * + * PNG_FORMAT_FLAG_LINEAR: if set the components of each pixel will be returned + * as a series of 16-bit linear values, if not set the components will be + * returned as a series of 8-bit values encoded according to the 'sRGB' + * standard. The 8-bit format is the normal format for images intended for + * direct display, because almost all display devices do the inverse of the + * sRGB transformation to the data they receive. The 16-bit format is more + * common for scientific data and image data that must be further processed; + * because it is linear simple math can be done on the component values. + * Regardless of the setting of this flag the alpha channel is always linear, + * although it will be 8 bits or 16 bits wide as specified by the flag. + * + * PNG_FORMAT_FLAG_BGR: if set the components of a color pixel will be returned + * in the order blue, then green, then red. If not set the pixel components + * are in the order red, then green, then blue. + * + * PNG_FORMAT_FLAG_AFIRST: if set the alpha channel (if present) precedes the + * color or grayscale components. If not set the alpha channel follows the + * components. + * + * You do not have to read directly from a file. You can read from memory or, + * on systems that support it, from a FILE*. This is controlled by + * the particular png_image_read_from_ function you call at the start. Likewise + * on write you can write to a FILE* if your system supports it. Check the + * macro PNG_STDIO_SUPPORTED to see if stdio support has been included in your + * libpng build. + * + * If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data you may need to write it in + * the 8-bit format for display. You do this by setting the convert_to_8bit + * flag to 'true'. + * + * Don't repeatedly convert between the 8-bit and 16-bit forms. There is + * significant data loss when 16-bit data is converted to the 8-bit encoding and + * the current libpng implementation of conversion to 16-bit is also + * significantly lossy. The latter will be fixed in the future, but the former + * is unavoidable - the 8-bit format just doesn't have enough resolution. + */ + +/* If your program needs more information from the PNG data it reads, or if you + * need to do more complex transformations, or minimize transformations, on the + * data you read, then you must use one of the several lower level libpng + * interfaces. + * + * All these interfaces require that you do your own error handling - your + * program must be able to arrange for control to return to your own code any + * time libpng encounters a problem. There are several ways to do this, but the + * standard way is to use the ANSI-C (C90) interface to establish a + * return point within your own code. You must do this if you do not use the + * simplified interface (above). + * + * The first step is to include the header files you need, including the libpng + * header file. Include any standard headers and feature test macros your + * program requires before including png.h: + */ +#include + + /* The png_jmpbuf() macro, used in error handling, became available in + * libpng version 1.0.6. If you want to be able to run your code with older + * versions of libpng, you must define the macro yourself (but only if it + * is not already defined by libpng!). + */ + +#ifndef png_jmpbuf +# define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf) +#endif + +/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp() + * returns zero if the image is a PNG and nonzero if it isn't a PNG. + * + * The function check_if_png() shown here, but not used, returns nonzero (true) + * if the file can be opened and is a PNG, 0 (false) otherwise. + * + * If this call is successful, and you are going to keep the file open, + * you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once + * you have created the png_ptr, so that libpng knows your application + * has read that many bytes from the start of the file. Make sure you + * don't call png_set_sig_bytes() with more than 8 bytes read or give it + * an incorrect number of bytes read, or you will either have read too + * many bytes (your fault), or you are telling libpng to read the wrong + * number of magic bytes (also your fault). + * + * Many applications already read the first 2 or 4 bytes from the start + * of the image to determine the file type, so it would be easiest just + * to pass the bytes to png_sig_cmp() or even skip that if you know + * you have a PNG file, and call png_set_sig_bytes(). + */ +#define PNG_BYTES_TO_CHECK 4 +int check_if_png(char *file_name, FILE **fp) +{ + char buf[PNG_BYTES_TO_CHECK]; + + /* Open the prospective PNG file. */ + if ((*fp = fopen(file_name, "rb")) == NULL) + return 0; + + /* Read in some of the signature bytes */ + if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK) + return 0; + + /* Compare the first PNG_BYTES_TO_CHECK bytes of the signature. + Return nonzero (true) if they match */ + + return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK)); +} + +/* Read a PNG file. You may want to return an error code if the read + * fails (depending upon the failure). There are two "prototypes" given + * here - one where we are given the filename, and we need to open the + * file, and the other where we are given an open file (possibly with + * some or all of the magic bytes read - see comments above). + */ +#ifdef open_file /* prototype 1 */ +void read_png(char *file_name) /* We need to open the file */ +{ + png_structp png_ptr; + png_infop info_ptr; + int sig_read = 0; + png_uint_32 width, height; + int bit_depth, color_type, interlace_type; + FILE *fp; + + if ((fp = fopen(file_name, "rb")) == NULL) + return (ERROR); + +#else no_open_file /* prototype 2 */ +void read_png(FILE *fp, int sig_read) /* File is already open */ +{ + png_structp png_ptr; + png_infop info_ptr; + png_uint_32 width, height; + int bit_depth, color_type, interlace_type; +#endif no_open_file /* Only use one prototype! */ + + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also supply the + * the compiler header file version, so that we know if the application + * was compiled with a compatible version of the library. REQUIRED + */ + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (png_ptr == NULL) + { + fclose(fp); + return (ERROR); + } + + /* Allocate/initialize the memory for image information. REQUIRED. */ + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) + { + fclose(fp); + png_destroy_read_struct(&png_ptr, NULL, NULL); + return (ERROR); + } + + /* Set error handling if you are using the setjmp/longjmp method (this is + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in the png_create_read_struct() earlier. + */ + + if (setjmp(png_jmpbuf(png_ptr))) + { + /* Free all of the memory associated with the png_ptr and info_ptr */ + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + fclose(fp); + /* If we get here, we had a problem reading the file */ + return (ERROR); + } + + /* One of the following I/O initialization methods is REQUIRED */ +#ifdef streams /* PNG file I/O method 1 */ + /* Set up the input control if you are using standard C streams */ + png_init_io(png_ptr, fp); + +#else no_streams /* PNG file I/O method 2 */ + /* If you are using replacement read functions, instead of calling + * png_init_io() here you would call: + */ + png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn); + /* where user_io_ptr is a structure you want available to the callbacks */ +#endif no_streams /* Use only one I/O method! */ + + /* If we have already read some of the signature */ + png_set_sig_bytes(png_ptr, sig_read); + +#ifdef hilevel + /* + * If you have enough memory to read in the entire image at once, + * and you need to specify only transforms that can be controlled + * with one of the PNG_TRANSFORM_* bits (this presently excludes + * quantizing, filling, setting background, and doing gamma + * adjustment), then you can read the entire image (including + * pixels) into the info structure with this call: + */ + png_read_png(png_ptr, info_ptr, png_transforms, NULL); + +#else + /* OK, you're doing it the hard way, with the lower-level functions */ + + /* The call to png_read_info() gives us all of the information from the + * PNG file before the first IDAT (image data chunk). REQUIRED + */ + png_read_info(png_ptr, info_ptr); + + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, + &interlace_type, NULL, NULL); + + /* Set up the data transformations you want. Note that these are all + * optional. Only call them if you want/need them. Many of the + * transformations only work on specific types of images, and many + * are mutually exclusive. + */ + + /* Tell libpng to strip 16 bits/color files down to 8 bits/color. + * Use accurate scaling if it's available, otherwise just chop off the + * low byte. + */ +#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED + png_set_scale_16(png_ptr); +#else + png_set_strip_16(png_ptr); +#endif + + /* Strip alpha bytes from the input data without combining with the + * background (not recommended). + */ + png_set_strip_alpha(png_ptr); + + /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single + * byte into separate bytes (useful for paletted and grayscale images). + */ + png_set_packing(png_ptr); + + /* Change the order of packed pixels to least significant bit first + * (not useful if you are using png_set_packing). */ + png_set_packswap(png_ptr); + + /* Expand paletted colors into true RGB triplets */ + if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(png_ptr); + + /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ + if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) + png_set_expand_gray_1_2_4_to_8(png_ptr); + + /* Expand paletted or RGB images with transparency to full alpha channels + * so the data will be available as RGBA quartets. + */ + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) != 0) + png_set_tRNS_to_alpha(png_ptr); + + /* Set the background color to draw transparent and alpha images over. + * It is possible to set the red, green, and blue components directly + * for paletted images instead of supplying a palette index. Note that + * even if the PNG file supplies a background, you are not required to + * use it - you should use the (solid) application background if it has one. + */ + + png_color_16 my_background, *image_background; + + if (png_get_bKGD(png_ptr, info_ptr, &image_background) != 0) + png_set_background(png_ptr, image_background, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + else + png_set_background(png_ptr, &my_background, + PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); + + /* Some suggestions as to how to get a screen gamma value + * + * Note that screen gamma is the display_exponent, which includes + * the CRT_exponent and any correction for viewing conditions + */ + if (/* We have a user-defined screen gamma value */) + { + screen_gamma = user-defined screen_gamma; + } + /* This is one way that applications share the same screen gamma value */ + else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL) + { + screen_gamma = atof(gamma_str); + } + /* If we don't have another value */ + else + { + screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor + in a dimly lit room */ + screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */ + } + + /* Tell libpng to handle the gamma conversion for you. The final call + * is a good guess for PC generated images, but it should be configurable + * by the user at run time by the user. It is strongly suggested that + * your application support gamma correction. + */ + + int intent; + + if (png_get_sRGB(png_ptr, info_ptr, &intent) != 0) + png_set_gamma(png_ptr, screen_gamma, PNG_DEFAULT_sRGB); + else + { + double image_gamma; + if (png_get_gAMA(png_ptr, info_ptr, &image_gamma) != 0) + png_set_gamma(png_ptr, screen_gamma, image_gamma); + else + png_set_gamma(png_ptr, screen_gamma, 0.45455); + } + +#ifdef PNG_READ_QUANTIZE_SUPPORTED + /* Quantize RGB files down to 8-bit palette or reduce palettes + * to the number of colors available on your screen. + */ + if ((color_type & PNG_COLOR_MASK_COLOR) != 0) + { + int num_palette; + png_colorp palette; + + /* This reduces the image to the application supplied palette */ + if (/* We have our own palette */) + { + /* An array of colors to which the image should be quantized */ + png_color std_color_cube[MAX_SCREEN_COLORS]; + + png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS, + MAX_SCREEN_COLORS, NULL, 0); + } + /* This reduces the image to the palette supplied in the file */ + else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) != 0) + { + png_uint_16p histogram = NULL; + + png_get_hIST(png_ptr, info_ptr, &histogram); + + png_set_quantize(png_ptr, palette, num_palette, + max_screen_colors, histogram, 0); + } + } +#endif /* READ_QUANTIZE */ + + /* Invert monochrome files to have 0 as white and 1 as black */ + png_set_invert_mono(png_ptr); + + /* If you want to shift the pixel values from the range [0,255] or + * [0,65535] to the original [0,7] or [0,31], or whatever range the + * colors were originally in: + */ + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT) != 0) + { + png_color_8p sig_bit_p; + + png_get_sBIT(png_ptr, info_ptr, &sig_bit_p); + png_set_shift(png_ptr, sig_bit_p); + } + + /* Flip the RGB pixels to BGR (or RGBA to BGRA) */ + if ((color_type & PNG_COLOR_MASK_COLOR) != 0) + png_set_bgr(png_ptr); + + /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ + png_set_swap_alpha(png_ptr); + + /* Swap bytes of 16-bit files to least significant byte first */ + png_set_swap(png_ptr); + + /* Add filler (or alpha) byte (before/after each RGB triplet) */ + png_set_filler(png_ptr, 0xffff, PNG_FILLER_AFTER); + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* Turn on interlace handling. REQUIRED if you are not using + * png_read_image(). To see how to handle interlacing passes, + * see the png_read_row() method below: + */ + number_passes = png_set_interlace_handling(png_ptr); +#else /* !READ_INTERLACING */ + number_passes = 1; +#endif /* READ_INTERLACING */ + + + /* Optional call to gamma correct and add the background to the palette + * and update info structure. REQUIRED if you are expecting libpng to + * update the palette for you (ie you selected such a transform above). + */ + png_read_update_info(png_ptr, info_ptr); + + /* Allocate the memory to hold the image using the fields of info_ptr. */ + + /* The easiest way to read the image: */ + png_bytep row_pointers[height]; + + /* Clear the pointer array */ + for (row = 0; row < height; row++) + row_pointers[row] = NULL; + + for (row = 0; row < height; row++) + row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, + info_ptr)); + + /* Now it's time to read the image. One of these methods is REQUIRED */ +#ifdef entire /* Read the entire image in one go */ + png_read_image(png_ptr, row_pointers); + +#else no_entire /* Read the image one or more scanlines at a time */ + /* The other way to read images - deal with interlacing: */ + + for (pass = 0; pass < number_passes; pass++) + { +#ifdef single /* Read the image a single row at a time */ + for (y = 0; y < height; y++) + { + png_read_rows(png_ptr, &row_pointers[y], NULL, 1); + } + +#else no_single /* Read the image several rows at a time */ + for (y = 0; y < height; y += number_of_rows) + { +#ifdef sparkle /* Read the image using the "sparkle" effect. */ + png_read_rows(png_ptr, &row_pointers[y], NULL, + number_of_rows); +#else no_sparkle /* Read the image using the "rectangle" effect */ + png_read_rows(png_ptr, NULL, &row_pointers[y], + number_of_rows); +#endif no_sparkle /* Use only one of these two methods */ + } + + /* If you want to display the image after every pass, do so here */ +#endif no_single /* Use only one of these two methods */ + } +#endif no_entire /* Use only one of these two methods */ + + /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ + png_read_end(png_ptr, info_ptr); +#endif hilevel + + /* At this point you have read the entire image */ + + /* Clean up after the read, and free any memory allocated - REQUIRED */ + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + + /* Close the file */ + fclose(fp); + + /* That's it */ + return (OK); +} + +/* Progressively read a file */ + +int +initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) +{ + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also check that + * the library version is compatible in case we are using dynamically + * linked libraries. + */ + *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (*png_ptr == NULL) + { + *info_ptr = NULL; + return (ERROR); + } + + *info_ptr = png_create_info_struct(png_ptr); + + if (*info_ptr == NULL) + { + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + if (setjmp(png_jmpbuf((*png_ptr)))) + { + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + /* This one's new. You will need to provide all three + * function callbacks, even if you aren't using them all. + * If you aren't using all functions, you can specify NULL + * parameters. Even when all three functions are NULL, + * you need to call png_set_progressive_read_fn(). + * These functions shouldn't be dependent on global or + * static variables if you are decoding several images + * simultaneously. You should store stream specific data + * in a separate struct, given as the second parameter, + * and retrieve the pointer from inside the callbacks using + * the function png_get_progressive_ptr(png_ptr). + */ + png_set_progressive_read_fn(*png_ptr, (void *)stream_data, + info_callback, row_callback, end_callback); + + return (OK); +} + +int +process_data(png_structp *png_ptr, png_infop *info_ptr, + png_bytep buffer, png_uint_32 length) +{ + if (setjmp(png_jmpbuf((*png_ptr)))) + { + /* Free the png_ptr and info_ptr memory on error */ + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + /* This one's new also. Simply give it chunks of data as + * they arrive from the data stream (in order, of course). + * On segmented machines, don't give it any more than 64K. + * The library seems to run fine with sizes of 4K, although + * you can give it much less if necessary (I assume you can + * give it chunks of 1 byte, but I haven't tried with less + * than 256 bytes yet). When this function returns, you may + * want to display any rows that were generated in the row + * callback, if you aren't already displaying them there. + */ + png_process_data(*png_ptr, *info_ptr, buffer, length); + return (OK); +} + +info_callback(png_structp png_ptr, png_infop info) +{ + /* Do any setup here, including setting any of the transformations + * mentioned in the Reading PNG files section. For now, you _must_ + * call either png_start_read_image() or png_read_update_info() + * after all the transformations are set (even if you don't set + * any). You may start getting rows before png_process_data() + * returns, so this is your last chance to prepare for that. + */ +} + +row_callback(png_structp png_ptr, png_bytep new_row, + png_uint_32 row_num, int pass) +{ + /* + * This function is called for every row in the image. If the + * image is interlaced, and you turned on the interlace handler, + * this function will be called for every row in every pass. + * + * In this function you will receive a pointer to new row data from + * libpng called new_row that is to replace a corresponding row (of + * the same data format) in a buffer allocated by your application. + * + * The new row data pointer "new_row" may be NULL, indicating there is + * no new data to be replaced (in cases of interlace loading). + * + * If new_row is not NULL then you need to call + * png_progressive_combine_row() to replace the corresponding row as + * shown below: + */ + + /* Get pointer to corresponding row in our + * PNG read buffer. + */ + png_bytep old_row = ((png_bytep *)our_data)[row_num]; + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* If both rows are allocated then copy the new row + * data to the corresponding row data. + */ + if ((old_row != NULL) && (new_row != NULL)) + png_progressive_combine_row(png_ptr, old_row, new_row); + + /* + * The rows and passes are called in order, so you don't really + * need the row_num and pass, but I'm supplying them because it + * may make your life easier. + * + * For the non-NULL rows of interlaced images, you must call + * png_progressive_combine_row() passing in the new row and the + * old row, as demonstrated above. You can call this function for + * NULL rows (it will just return) and for non-interlaced images + * (it just does the memcpy for you) if it will make the code + * easier. Thus, you can just do this for all cases: + */ + + png_progressive_combine_row(png_ptr, old_row, new_row); + + /* where old_row is what was displayed for previous rows. Note + * that the first pass (pass == 0 really) will completely cover + * the old row, so the rows do not have to be initialized. After + * the first pass (and only for interlaced images), you will have + * to pass the current row as new_row, and the function will combine + * the old row and the new row. + */ +#endif /* READ_INTERLACING */ +} + +end_callback(png_structp png_ptr, png_infop info) +{ + /* This function is called when the whole image has been read, + * including any chunks after the image (up to and including + * the IEND). You will usually have the same info chunk as you + * had in the header, although some data may have been added + * to the comments and time fields. + * + * Most people won't do much here, perhaps setting a flag that + * marks the image as finished. + */ +} + +/* Write a png file */ +void write_png(char *file_name /* , ... other image information ... */) +{ + FILE *fp; + png_structp png_ptr; + png_infop info_ptr; + png_colorp palette; + + /* Open the file */ + fp = fopen(file_name, "wb"); + if (fp == NULL) + return (ERROR); + + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also check that + * the library version is compatible with the one used at compile time, + * in case we are using dynamically linked libraries. REQUIRED. + */ + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (png_ptr == NULL) + { + fclose(fp); + return (ERROR); + } + + /* Allocate/initialize the image information data. REQUIRED */ + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) + { + fclose(fp); + png_destroy_write_struct(&png_ptr, NULL); + return (ERROR); + } + + /* Set error handling. REQUIRED if you aren't supplying your own + * error handling functions in the png_create_write_struct() call. + */ + if (setjmp(png_jmpbuf(png_ptr))) + { + /* If we get here, we had a problem writing the file */ + fclose(fp); + png_destroy_write_struct(&png_ptr, &info_ptr); + return (ERROR); + } + + /* One of the following I/O initialization functions is REQUIRED */ + +#ifdef streams /* I/O initialization method 1 */ + /* Set up the output control if you are using standard C streams */ + png_init_io(png_ptr, fp); + +#else no_streams /* I/O initialization method 2 */ + /* If you are using replacement write functions, instead of calling + * png_init_io() here you would call + */ + png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, + user_IO_flush_function); + /* where user_io_ptr is a structure you want available to the callbacks */ +#endif no_streams /* Only use one initialization method */ + +#ifdef hilevel + /* This is the easy way. Use it if you already have all the + * image info living in the structure. You could "|" many + * PNG_TRANSFORM flags into the png_transforms integer here. + */ + png_write_png(png_ptr, info_ptr, png_transforms, NULL); + +#else + /* This is the hard way */ + + /* Set the image information here. Width and height are up to 2^31, + * bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on + * the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, + * PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, + * or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or + * PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST + * currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED + */ + png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, + PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + /* Set the palette if there is one. REQUIRED for indexed-color images */ + palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH + * (sizeof (png_color))); + /* ... Set palette colors ... */ + png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); + /* You must not free palette here, because png_set_PLTE only makes a link to + * the palette that you malloced. Wait until you are about to destroy + * the png structure. + */ + + /* Optional significant bit (sBIT) chunk */ + png_color_8 sig_bit; + + /* If we are dealing with a grayscale image then */ + sig_bit.gray = true_bit_depth; + + /* Otherwise, if we are dealing with a color image then */ + sig_bit.red = true_red_bit_depth; + sig_bit.green = true_green_bit_depth; + sig_bit.blue = true_blue_bit_depth; + + /* If the image has an alpha channel then */ + sig_bit.alpha = true_alpha_bit_depth; + + png_set_sBIT(png_ptr, info_ptr, &sig_bit); + + + /* Optional gamma chunk is strongly suggested if you have any guess + * as to the correct gamma of the image. + */ + png_set_gAMA(png_ptr, info_ptr, gamma); + + /* Optionally write comments into the image */ + { + png_text text_ptr[3]; + + char key0[]="Title"; + char text0[]="Mona Lisa"; + text_ptr[0].key = key0; + text_ptr[0].text = text0; + text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[0].itxt_length = 0; + text_ptr[0].lang = NULL; + text_ptr[0].lang_key = NULL; + + char key1[]="Author"; + char text1[]="Leonardo DaVinci"; + text_ptr[1].key = key1; + text_ptr[1].text = text1; + text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[1].itxt_length = 0; + text_ptr[1].lang = NULL; + text_ptr[1].lang_key = NULL; + + char key2[]="Description"; + char text2[]=""; + text_ptr[2].key = key2; + text_ptr[2].text = text2; + text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; + text_ptr[2].itxt_length = 0; + text_ptr[2].lang = NULL; + text_ptr[2].lang_key = NULL; + + png_set_text(write_ptr, write_info_ptr, text_ptr, 3); + } + + /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */ + + /* Note that if sRGB is present the gAMA and cHRM chunks must be ignored + * on read and, if your application chooses to write them, they must + * be written in accordance with the sRGB profile + */ + + /* Write the file header information. REQUIRED */ + png_write_info(png_ptr, info_ptr); + + /* If you want, you can write the info in two steps, in case you need to + * write your private chunk ahead of PLTE: + * + * png_write_info_before_PLTE(write_ptr, write_info_ptr); + * write_my_chunk(); + * png_write_info(png_ptr, info_ptr); + * + * However, given the level of known- and unknown-chunk support in 1.2.0 + * and up, this should no longer be necessary. + */ + + /* Once we write out the header, the compression type on the text + * chunk gets changed to PNG_TEXT_COMPRESSION_NONE_WR or + * PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again + * at the end. + */ + + /* Set up the transformations you want. Note that these are + * all optional. Only call them if you want them. + */ + + /* Invert monochrome pixels */ + png_set_invert_mono(png_ptr); + + /* Shift the pixels up to a legal bit depth and fill in + * as appropriate to correctly scale the image. + */ + png_set_shift(png_ptr, &sig_bit); + + /* Pack pixels into bytes */ + png_set_packing(png_ptr); + + /* Swap location of alpha bytes from ARGB to RGBA */ + png_set_swap_alpha(png_ptr); + + /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into + * RGB (4 channels -> 3 channels). The second parameter is not used. + */ + png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); + + /* Flip BGR pixels to RGB */ + png_set_bgr(png_ptr); + + /* Swap bytes of 16-bit files to most significant byte first */ + png_set_swap(png_ptr); + + /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */ + png_set_packswap(png_ptr); + + /* Turn on interlace handling if you are not using png_write_image() */ + if (interlacing != 0) + number_passes = png_set_interlace_handling(png_ptr); + + else + number_passes = 1; + + /* The easiest way to write the image (you may have a different memory + * layout, however, so choose what fits your needs best). You need to + * use the first method if you aren't handling interlacing yourself. + */ + png_uint_32 k, height, width; + + /* In this example, "image" is a one-dimensional array of bytes */ + + /* Guard against integer overflow */ + if (height > PNG_SIZE_MAX/(width*bytes_per_pixel)) { + png_error(png_ptr, "Image_data buffer would be too large"); + } + png_byte image[height*width*bytes_per_pixel]; + + png_bytep row_pointers[height]; + + if (height > PNG_UINT_32_MAX/(sizeof (png_bytep))) + png_error (png_ptr, "Image is too tall to process in memory"); + + /* Set up pointers into your "image" byte array */ + for (k = 0; k < height; k++) + row_pointers[k] = image + k*width*bytes_per_pixel; + + /* One of the following output methods is REQUIRED */ + +#ifdef entire /* Write out the entire image data in one call */ + png_write_image(png_ptr, row_pointers); + + /* The other way to write the image - deal with interlacing */ + +#else no_entire /* Write out the image data by one or more scanlines */ + + /* The number of passes is either 1 for non-interlaced images, + * or 7 for interlaced images. + */ + for (pass = 0; pass < number_passes; pass++) + { + /* Write a few rows at a time. */ + png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows); + + /* If you are only writing one row at a time, this works */ + for (y = 0; y < height; y++) + png_write_rows(png_ptr, &row_pointers[y], 1); + } +#endif no_entire /* Use only one output method */ + + /* You can write optional chunks like tEXt, zTXt, and tIME at the end + * as well. Shouldn't be necessary in 1.2.0 and up as all the public + * chunks are supported and you can use png_set_unknown_chunks() to + * register unknown chunks into the info structure to be written out. + */ + + /* It is REQUIRED to call this to finish writing the rest of the file */ + png_write_end(png_ptr, info_ptr); +#endif hilevel + + /* If you png_malloced a palette, free it here (don't free info_ptr->palette, + * as recommended in versions 1.0.5m and earlier of this example; if + * libpng mallocs info_ptr->palette, libpng will free it). If you + * allocated it with malloc() instead of png_malloc(), use free() instead + * of png_free(). + */ + png_free(png_ptr, palette); + palette = NULL; + + /* Similarly, if you png_malloced any data that you passed in with + * png_set_something(), such as a hist or trans array, free it here, + * when you can be sure that libpng is through with it. + */ + png_free(png_ptr, trans); + trans = NULL; + /* Whenever you use png_free() it is a good idea to set the pointer to + * NULL in case your application inadvertently tries to png_free() it + * again. When png_free() sees a NULL it returns without action, thus + * avoiding the double-free security problem. + */ + + /* Clean up after the write, and free any memory allocated */ + png_destroy_write_struct(&png_ptr, &info_ptr); + + /* Close the file */ + fclose(fp); + + /* That's it */ + return (OK); +} + +#endif /* if 0 */ diff --git a/Engine/lib/lpng/libpng-manual.txt b/Engine/lib/lpng/libpng-manual.txt index d969f96d3..d4407ef2e 100644 --- a/Engine/lib/lpng/libpng-manual.txt +++ b/Engine/lib/lpng/libpng-manual.txt @@ -1,9 +1,9 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.25 - September 1, 2016 + libpng version 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson This document is released under the libpng license. For conditions of distribution and use, see the disclaimer @@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.25 - September 1, 2016 + libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson libpng 1.0 beta 6 - version 0.96 - May 28, 1997 Updated and distributed by Andreas Dilger @@ -66,17 +66,17 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at -. +. It is technically equivalent to the PNG specification (second edition) but has some additional material. -The PNG-1.0 specification is available as RFC 2083 - and as a -W3C Recommendation . +The PNG-1.0 specification is available as RFC 2083 + and as a +W3C Recommendation . Some additional chunks are described in the special-purpose public chunks documents at @@ -101,7 +101,7 @@ majority of the needs of its users. Libpng uses zlib for its compression and decompression of PNG files. Further information about zlib, and the latest version of zlib, can -be found at the zlib home page, . +be found at the zlib home page, . The zlib compression utility is a general purpose utility that is useful for more than PNG files, and can be used without libpng. See the documentation delivered with zlib for more details. @@ -467,8 +467,9 @@ the default, use The values for png_set_crc_action() say how libpng is to handle CRC errors in ancillary and critical chunks, and whether to use the data contained -therein. Note that it is impossible to "discard" data in a critical -chunk. +therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error +is handled while reading the IDAT chunk. Note that it is impossible to +"discard" data in a critical chunk. Choices for (int) crit_action are PNG_CRC_DEFAULT 0 error/quit @@ -485,6 +486,9 @@ Choices for (int) ancil_action are PNG_CRC_QUIET_USE 4 quiet/use data PNG_CRC_NO_CHANGE 5 use the current value +When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32 +checksums are not only ignored, but they are not evaluated. + Setting up callback code You can set up a callback function to handle any unknown chunks in the @@ -684,8 +688,9 @@ where 0x7fffffffL means unlimited. You can retrieve this limit with chunk_cache_max = png_get_chunk_cache_max(png_ptr); Libpng imposes a limit of 8 Megabytes (8,000,000 bytes) on the amount of -memory that a compressed chunk other than IDAT can occupy, when decompressed. -You can change this limit with +memory that any chunk other than IDAT can occupy, originally or when +decompressed (prior to libpng-1.6.32 the limit was only applied to compressed +chunks after decompression). You can change this limit with png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); @@ -981,8 +986,17 @@ premultiplication. png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); -This is the default libpng handling of the alpha channel - it is not -pre-multiplied into the color components. In addition the call states +Choices for the alpha_mode are + + PNG_ALPHA_PNG 0 /* according to the PNG standard */ + PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ + PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ + PNG_ALPHA_PREMULTIPLIED 1 /* as above */ + PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ + PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ + +PNG_ALPHA_PNG is the default libpng handling of the alpha channel. It is not +pre-multiplied into the color components. In addition the call states that the output is for a sRGB system and causes all PNG files without gAMA chunks to be assumed to be encoded using sRGB. @@ -997,7 +1011,7 @@ early Mac systems behaved. This is the classic Jim Blinn approach and will work in academic environments where everything is done by the book. It has the shortcoming of assuming that input PNG data with no gamma information is linear - this -is unlikely to be correct unless the PNG files where generated locally. +is unlikely to be correct unless the PNG files were generated locally. Most of the time the output precision will be so low as to show significant banding in dark areas of the image. @@ -1186,7 +1200,20 @@ row_pointers prior to calling png_read_png() with png_set_rows(png_ptr, info_ptr, &row_pointers); Alternatively you could allocate your image in one big block and define -row_pointers[i] to point into the proper places in your block. +row_pointers[i] to point into the proper places in your block, but first +be sure that your platform is able to allocate such a large buffer: + + /* Guard against integer overflow */ + if (height > PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + + png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size); + + for (int i=0; i PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + Remember: Before you call png_read_update_info(), the png_get_*() functions return the values corresponding to the original PNG image. After you call png_read_update_info the values refer to the image @@ -2466,6 +2513,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_eXIf, PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_pCAL, PNG_INFO_sRGB, @@ -3065,6 +3113,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); + + exif - Exif profile (array of + png_byte) (PNG_INFO_eXIf) + png_set_hIST(png_ptr, info_ptr, hist); hist - histogram of palette (array of @@ -3820,7 +3873,7 @@ PNG_FORMAT_FLAG_LINEAR flag below. When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. When an alpha channel is present it is expected to denote pixel coverage @@ -4084,7 +4137,7 @@ READ APIs When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. WRITE APIS @@ -4242,8 +4295,6 @@ functions after png_create_*_struct() has been called by calling: png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn); - png_voidp error_ptr = png_get_error_ptr(png_ptr); - If NULL is supplied for either error_fn or warning_fn, then the libpng default function will be used, calling fprintf() and/or longjmp() if a problem is encountered. The replacement error functions should have @@ -4255,6 +4306,11 @@ parameters as follows: void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg); +Then, within your user_error_fn or user_warning_fn, you can retrieve +the error_ptr if you need it, by calling + + png_voidp error_ptr = png_get_error_ptr(png_ptr); + The motivation behind using setjmp() and longjmp() is the C++ throw and catch exception handling methods. This makes the code much easier to write, as there is no need to check every return code of every function call. @@ -4262,7 +4318,7 @@ However, there are some uncertainties about the status of local variables after a longjmp, so the user may want to be careful about doing anything after setjmp returns non-zero besides returning itself. Consult your compiler documentation for more details. For an alternative approach, you -may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net), +may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/), which is illustrated in pngvalid.c and in contrib/visupng. Beginning in libpng-1.4.0, the png_set_benign_errors() API became available. @@ -4490,7 +4546,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature and the MHDR and MEND chunks. Libpng does not provide support for these or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at -http://www.libmng.com) instead. +https://www.libmng.com/) instead. VIII. Changes to Libpng from version 0.88 @@ -4913,18 +4969,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said that it could be used to override them. Now this function will reduce or increase the limits. -Starting in libpng-1.5.10, the user limits can be set en masse with the -configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled, -a set of "safe" limits is applied in pngpriv.h. These can be overridden by -application calls to png_set_user_limits(), png_set_user_chunk_cache_max(), -and/or png_set_user_malloc_max() that increase or decrease the limits. Also, -in libpng-1.5.10 the default width and height limits were increased -from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the -limits are now - default safe +Starting in libpng-1.5.22, default user limits were established. These +can be overridden by application calls to png_set_user_limits(), +png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max(). +The limits are now + max possible default png_user_width_max 0x7fffffff 1,000,000 png_user_height_max 0x7fffffff 1,000,000 - png_user_chunk_cache_max 0 (unlimited) 128 + png_user_chunk_cache_max 0 (unlimited) 1000 png_user_chunk_malloc_max 0 (unlimited) 8,000,000 The png_set_option() function (and the "options" member of the png struct) was @@ -5174,6 +5226,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length PLTE chunk found in an input PNG is silently truncated. +Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not +attempt to decode the Exif profile; it simply returns a byte array +containing the profile to the calling application which must do its own +decoding. + XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never @@ -5190,27 +5247,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only) at - git://git.code.sf.net/p/libpng/code + https://github.com/glennrp/libpng or + https://git.code.sf.net/p/libpng/code.git -or you can browse it with a web browser by selecting the "code" button at +or you can browse it with a web browser at - https://sourceforge.net/projects/libpng + https://github.com/glennrp/libpng or + https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to glennrp at users.sourceforge.net or to png-mng-implement at lists.sourceforge.net or you can upload them to the libpng bug tracker at - http://libpng.sourceforge.net + https://libpng.sourceforge.io/ + +or as a "pull request" to + + https://github.com/glennrp/libpng/pulls We also accept patches built from the tar or zip distributions, and simple verbal discriptions of bug fixes, reported either to the SourceForge bug tracker, to the png-mng-implement at lists.sf.net -mailing list, or directly to glennrp. +mailing list, as github issues, or directly to glennrp. XV. Coding style Our coding style is similar to the "Allman" style -(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly +(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly braces on separate lines: if (condition) @@ -5311,7 +5374,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as though it were a function. Control keywords if, for, while, and switch are always followed by a space -to distinguish them from function calls, which have no trailing space. +to distinguish them from function calls, which have no trailing space. We put a space after each comma and after each semicolon in "for" statements, and we put spaces before and after each @@ -5335,8 +5398,9 @@ with an even number of lower-case hex digits, and to make them unsigned We prefer to use underscores rather than camelCase in names, except for a few type names that we inherit from zlib.h. -We prefer "if (something != 0)" and "if (something == 0)" -over "if (something)" and if "(!something)", respectively. +We prefer "if (something != 0)" and "if (something == 0)" over +"if (something)" and if "(!something)", respectively, and for pointers +we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)". We do not use the TAB character for indentation in the C sources. @@ -5350,7 +5414,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.25 are Y2K compliant. It is my belief that earlier +upward through 1.6.34 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer diff --git a/Engine/lib/lpng/libpng.3 b/Engine/lib/lpng/libpng.3 index 4893dc9d7..3c8d62ab2 100644 --- a/Engine/lib/lpng/libpng.3 +++ b/Engine/lib/lpng/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "September 1, 2016" +.TH LIBPNG 3 "September 29, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34 .SH SYNOPSIS \fB #include \fP @@ -97,6 +97,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 \fBpng_byte png_get_header_version (png_const_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_eXIf (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fI*exif\fP\fB);\fP + +\fBpng_uint_32 png_get_eXIf_1 (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_unit_32 \fP\fI*num_exif\fP\fB, png_bytep \fI*exif\fP\fB);\fP + \fBpng_uint_32 png_get_hIST (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP \fBpng_uint_32 png_get_iCCP (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_bytepp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP @@ -347,6 +351,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 \fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP +\fBvoid png_set_eXIf (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fIexif\fP\fB);\fP + +\fBvoid png_set_eXIf_1 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, const png_uint_32 \fP\fInum_exif\fP\fB, png_bytep \fIexif\fP\fB);\fP + \fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP \fBvoid png_set_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_const_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_const_bytep \fP\fIprofile\fP\fB, png_uint_32 \fIproflen\fP\fB);\fP @@ -510,10 +518,10 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.25 - September 1, 2016 + libpng version 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson This document is released under the libpng license. For conditions of distribution and use, see the disclaimer @@ -521,9 +529,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.25 - September 1, 2016 + libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson libpng 1.0 beta 6 - version 0.96 - May 28, 1997 Updated and distributed by Andreas Dilger @@ -576,17 +584,17 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at -. +. It is technically equivalent to the PNG specification (second edition) but has some additional material. -The PNG-1.0 specification is available as RFC 2083 - and as a -W3C Recommendation . +The PNG-1.0 specification is available as RFC 2083 + and as a +W3C Recommendation . Some additional chunks are described in the special-purpose public chunks documents at @@ -611,7 +619,7 @@ majority of the needs of its users. Libpng uses zlib for its compression and decompression of PNG files. Further information about zlib, and the latest version of zlib, can -be found at the zlib home page, . +be found at the zlib home page, . The zlib compression utility is a general purpose utility that is useful for more than PNG files, and can be used without libpng. See the documentation delivered with zlib for more details. @@ -977,8 +985,9 @@ the default, use The values for png_set_crc_action() say how libpng is to handle CRC errors in ancillary and critical chunks, and whether to use the data contained -therein. Note that it is impossible to "discard" data in a critical -chunk. +therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error +is handled while reading the IDAT chunk. Note that it is impossible to +"discard" data in a critical chunk. Choices for (int) crit_action are PNG_CRC_DEFAULT 0 error/quit @@ -995,6 +1004,9 @@ Choices for (int) ancil_action are PNG_CRC_QUIET_USE 4 quiet/use data PNG_CRC_NO_CHANGE 5 use the current value +When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32 +checksums are not only ignored, but they are not evaluated. + .SS Setting up callback code You can set up a callback function to handle any unknown chunks in the @@ -1194,8 +1206,9 @@ where 0x7fffffffL means unlimited. You can retrieve this limit with chunk_cache_max = png_get_chunk_cache_max(png_ptr); Libpng imposes a limit of 8 Megabytes (8,000,000 bytes) on the amount of -memory that a compressed chunk other than IDAT can occupy, when decompressed. -You can change this limit with +memory that any chunk other than IDAT can occupy, originally or when +decompressed (prior to libpng-1.6.32 the limit was only applied to compressed +chunks after decompression). You can change this limit with png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); @@ -1491,8 +1504,17 @@ premultiplication. png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); -This is the default libpng handling of the alpha channel - it is not -pre-multiplied into the color components. In addition the call states +Choices for the alpha_mode are + + PNG_ALPHA_PNG 0 /* according to the PNG standard */ + PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ + PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ + PNG_ALPHA_PREMULTIPLIED 1 /* as above */ + PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ + PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ + +PNG_ALPHA_PNG is the default libpng handling of the alpha channel. It is not +pre-multiplied into the color components. In addition the call states that the output is for a sRGB system and causes all PNG files without gAMA chunks to be assumed to be encoded using sRGB. @@ -1507,7 +1529,7 @@ early Mac systems behaved. This is the classic Jim Blinn approach and will work in academic environments where everything is done by the book. It has the shortcoming of assuming that input PNG data with no gamma information is linear - this -is unlikely to be correct unless the PNG files where generated locally. +is unlikely to be correct unless the PNG files were generated locally. Most of the time the output precision will be so low as to show significant banding in dark areas of the image. @@ -1696,7 +1718,20 @@ row_pointers prior to calling png_read_png() with png_set_rows(png_ptr, info_ptr, &row_pointers); Alternatively you could allocate your image in one big block and define -row_pointers[i] to point into the proper places in your block. +row_pointers[i] to point into the proper places in your block, but first +be sure that your platform is able to allocate such a large buffer: + + /* Guard against integer overflow */ + if (height > PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + + png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size); + + for (int i=0; i PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + Remember: Before you call png_read_update_info(), the png_get_*() functions return the values corresponding to the original PNG image. After you call png_read_update_info the values refer to the image @@ -2976,6 +3031,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_eXIf, PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_pCAL, PNG_INFO_sRGB, @@ -3575,6 +3631,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); + + exif - Exif profile (array of + png_byte) (PNG_INFO_eXIf) + png_set_hIST(png_ptr, info_ptr, hist); hist - histogram of palette (array of @@ -4330,7 +4391,7 @@ PNG_FORMAT_FLAG_LINEAR flag below. When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. When an alpha channel is present it is expected to denote pixel coverage @@ -4594,7 +4655,7 @@ READ APIs When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. WRITE APIS @@ -4752,8 +4813,6 @@ functions after png_create_*_struct() has been called by calling: png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn); - png_voidp error_ptr = png_get_error_ptr(png_ptr); - If NULL is supplied for either error_fn or warning_fn, then the libpng default function will be used, calling fprintf() and/or longjmp() if a problem is encountered. The replacement error functions should have @@ -4765,6 +4824,11 @@ parameters as follows: void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg); +Then, within your user_error_fn or user_warning_fn, you can retrieve +the error_ptr if you need it, by calling + + png_voidp error_ptr = png_get_error_ptr(png_ptr); + The motivation behind using setjmp() and longjmp() is the C++ throw and catch exception handling methods. This makes the code much easier to write, as there is no need to check every return code of every function call. @@ -4772,7 +4836,7 @@ However, there are some uncertainties about the status of local variables after a longjmp, so the user may want to be careful about doing anything after setjmp returns non-zero besides returning itself. Consult your compiler documentation for more details. For an alternative approach, you -may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net), +may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/), which is illustrated in pngvalid.c and in contrib/visupng. Beginning in libpng-1.4.0, the png_set_benign_errors() API became available. @@ -5000,7 +5064,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature and the MHDR and MEND chunks. Libpng does not provide support for these or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at -http://www.libmng.com) instead. +https://www.libmng.com/) instead. .SH VIII. Changes to Libpng from version 0.88 @@ -5423,18 +5487,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said that it could be used to override them. Now this function will reduce or increase the limits. -Starting in libpng-1.5.10, the user limits can be set en masse with the -configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled, -a set of "safe" limits is applied in pngpriv.h. These can be overridden by -application calls to png_set_user_limits(), png_set_user_chunk_cache_max(), -and/or png_set_user_malloc_max() that increase or decrease the limits. Also, -in libpng-1.5.10 the default width and height limits were increased -from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the -limits are now - default safe +Starting in libpng-1.5.22, default user limits were established. These +can be overridden by application calls to png_set_user_limits(), +png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max(). +The limits are now + max possible default png_user_width_max 0x7fffffff 1,000,000 png_user_height_max 0x7fffffff 1,000,000 - png_user_chunk_cache_max 0 (unlimited) 128 + png_user_chunk_cache_max 0 (unlimited) 1000 png_user_chunk_malloc_max 0 (unlimited) 8,000,000 The png_set_option() function (and the "options" member of the png struct) was @@ -5684,6 +5744,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length PLTE chunk found in an input PNG is silently truncated. +Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not +attempt to decode the Exif profile; it simply returns a byte array +containing the profile to the calling application which must do its own +decoding. + .SH XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never @@ -5700,27 +5765,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only) at - git://git.code.sf.net/p/libpng/code + https://github.com/glennrp/libpng or + https://git.code.sf.net/p/libpng/code.git -or you can browse it with a web browser by selecting the "code" button at +or you can browse it with a web browser at - https://sourceforge.net/projects/libpng + https://github.com/glennrp/libpng or + https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to glennrp at users.sourceforge.net or to png-mng-implement at lists.sourceforge.net or you can upload them to the libpng bug tracker at - http://libpng.sourceforge.net + https://libpng.sourceforge.io/ + +or as a "pull request" to + + https://github.com/glennrp/libpng/pulls We also accept patches built from the tar or zip distributions, and simple verbal discriptions of bug fixes, reported either to the SourceForge bug tracker, to the png-mng-implement at lists.sf.net -mailing list, or directly to glennrp. +mailing list, as github issues, or directly to glennrp. .SH XV. Coding style Our coding style is similar to the "Allman" style -(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly +(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly braces on separate lines: if (condition) @@ -5821,7 +5892,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as though it were a function. Control keywords if, for, while, and switch are always followed by a space -to distinguish them from function calls, which have no trailing space. +to distinguish them from function calls, which have no trailing space. We put a space after each comma and after each semicolon in "for" statements, and we put spaces before and after each @@ -5845,8 +5916,9 @@ with an even number of lower-case hex digits, and to make them unsigned We prefer to use underscores rather than camelCase in names, except for a few type names that we inherit from zlib.h. -We prefer "if (something != 0)" and "if (something == 0)" -over "if (something)" and if "(!something)", respectively. +We prefer "if (something != 0)" and "if (something == 0)" over +"if (something)" and if "(!something)", respectively, and for pointers +we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)". We do not use the TAB character for indentation in the C sources. @@ -5860,7 +5932,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.25 are Y2K compliant. It is my belief that earlier +upward through 1.6.34 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer @@ -5958,11 +6030,11 @@ the first widely used release: ... 1.0.19 10 10019 10.so.0.19[.0] ... - 1.2.56 13 10256 12.so.0.56[.0] + 1.2.59 13 10259 12.so.0.59[.0] ... - 1.5.27 15 10527 15.so.15.27[.0] + 1.5.30 15 10530 15.so.15.30[.0] ... - 1.6.25 16 10625 16.so.16.25[.0] + 1.6.34 16 10634 16.so.16.34[.0] Henceforth the source version will match the shared-library minor and patch numbers; the shared-library major version number will be @@ -5979,7 +6051,7 @@ release number plus "betaNN" or "rcNN". .LP .IR libpng : .IP -http://libpng.sourceforge.net (follow the [DOWNLOAD] link) +https://libpng.sourceforge.io/ (follow the [DOWNLOAD] link) http://www.libpng.org/pub/png .LP @@ -5989,7 +6061,7 @@ http://www.libpng.org/pub/png .I libpng or at .br -ftp://ftp.info-zip.org/pub/infozip/zlib +https://zlib.net/ .LP .IR PNG specification: RFC 2083 @@ -5998,11 +6070,11 @@ ftp://ftp.info-zip.org/pub/infozip/zlib .I libpng or at .br -ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt +https://www.ietf.org/rfc/rfc2083.txt .br or (as a W3C Recommendation) at .br -http://www.w3.org/TR/REC-png.html +https://www.w3.org/TR/REC-png.html .LP In the case of any inconsistency between the PNG specification @@ -6018,7 +6090,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.6.25 - September 1, 2016: +Libpng version 1.6.34 - September 29, 2017: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6043,8 +6115,8 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are -Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are +libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are +Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: @@ -6055,6 +6127,9 @@ added to the list of Contributing Authors: Cosmin Truta Gilles Vollant James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: @@ -6168,7 +6243,7 @@ files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). Glenn Randers-Pehrson glennrp at users.sourceforge.net -September 1, 2016 +September 29, 2017 .\" end of man page diff --git a/Engine/lib/lpng/libpng.pc.in b/Engine/lib/lpng/libpng.pc.in index 3e7e2c58a..9708e9af2 100644 --- a/Engine/lib/lpng/libpng.pc.in +++ b/Engine/lib/lpng/libpng.pc.in @@ -6,6 +6,7 @@ includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ Name: libpng Description: Loads and saves PNG files Version: @PNGLIB_VERSION@ +Requires: zlib Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ Libs.private: @LIBS@ Cflags: -I${includedir} diff --git a/Engine/lib/lpng/libpngpf.3 b/Engine/lib/lpng/libpngpf.3 index 3d6eab5dc..8cea87a71 100644 --- a/Engine/lib/lpng/libpngpf.3 +++ b/Engine/lib/lpng/libpngpf.3 @@ -1,11 +1,11 @@ -.TH LIBPNGPF 3 "September 1, 2016" +.TH LIBPNGPF 3 "April 1, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34 (private functions) .SH SYNOPSIS -\fB#include \fI"pngpriv.h" +\fB\fB#include \fI\fI"pngpriv.h" -\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fIfunction. +\fB\fBAs of libpng version \fP\fI\fP\fI1.5.1\fP\fB\fP\fB, this section is no longer \fP\fI\fP\fImaintained\fP\fB\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fI\fIfunction. .SH DESCRIPTION The functions previously listed here are used privately by libpng and are not diff --git a/Engine/lib/lpng/png.5 b/Engine/lib/lpng/png.5 index 16d213cc5..b0cbd2cfa 100644 --- a/Engine/lib/lpng/png.5 +++ b/Engine/lib/lpng/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "September 1, 2016" +.TH PNG 5 "April 1, 2017" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION @@ -23,11 +23,11 @@ platforms. PNG specification (second edition), November 2003: .IP .br - text != 0 && + if (info_ptr->text != NULL && ((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0) { if (num != -1) @@ -477,6 +497,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, png_free(png_ptr, info_ptr->text); info_ptr->text = NULL; info_ptr->num_text = 0; + info_ptr->max_text = 0; } } #endif @@ -541,7 +562,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, #ifdef PNG_sPLT_SUPPORTED /* Free a given sPLT entry, or (if num == -1) all sPLT entries */ - if (info_ptr->splt_palettes != 0 && + if (info_ptr->splt_palettes != NULL && ((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0) { if (num != -1) @@ -571,7 +592,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, #endif #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED - if (info_ptr->unknown_chunks != 0 && + if (info_ptr->unknown_chunks != NULL && ((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0) { if (num != -1) @@ -594,6 +615,26 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, } #endif +#ifdef PNG_eXIf_SUPPORTED + /* Free any eXIf entry */ + if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0) + { +# ifdef PNG_READ_eXIf_SUPPORTED + if (info_ptr->eXIf_buf) + { + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; + } +# endif + if (info_ptr->exif) + { + png_free(png_ptr, info_ptr->exif); + info_ptr->exif = NULL; + } + info_ptr->valid &= ~PNG_INFO_eXIf; + } +#endif + #ifdef PNG_hIST_SUPPORTED /* Free any hIST entry */ if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0) @@ -617,7 +658,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, /* Free any image bits attached to the info structure */ if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0) { - if (info_ptr->row_pointers != 0) + if (info_ptr->row_pointers != NULL) { png_uint_32 row; for (row = 0; row < info_ptr->height; row++) @@ -684,7 +725,7 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp) void PNGAPI png_save_int_32(png_bytep buf, png_int_32 i) { - png_save_uint_32(buf, i); + png_save_uint_32(buf, (png_uint_32)i); } # endif @@ -775,15 +816,15 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.25 - September 1, 2016" PNG_STRING_NEWLINE \ - "Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \ + "libpng version 1.6.34 - September 29, 2017" PNG_STRING_NEWLINE \ + "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.25 - September 1, 2016\ - Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\ + return "libpng version 1.6.34 - September 29, 2017\ + Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; # endif @@ -1872,12 +1913,12 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace, */ if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST) return png_icc_profile_error(png_ptr, colorspace, "sRGB", - (unsigned)intent, "invalid sRGB rendering intent"); + (png_alloc_size_t)intent, "invalid sRGB rendering intent"); if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 && colorspace->rendering_intent != intent) return png_icc_profile_error(png_ptr, colorspace, "sRGB", - (unsigned)intent, "inconsistent rendering intents"); + (png_alloc_size_t)intent, "inconsistent rendering intents"); if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0) { @@ -1938,7 +1979,6 @@ icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace, if (profile_length < 132) return png_icc_profile_error(png_ptr, colorspace, name, profile_length, "too short"); - return 1; } @@ -2183,15 +2223,6 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace, * being in range. All defined tag types have an 8 byte header - a 4 byte * type signature then 0. */ - if ((tag_start & 3) != 0) - { - /* CNHP730S.icc shipped with Microsoft Windows 64 violates this, it is - * only a warning here because libpng does not care about the - * alignment. - */ - (void)png_icc_profile_error(png_ptr, NULL, name, tag_id, - "ICC profile tag start not a multiple of 4"); - } /* This is a hard error; potentially it can cause read outside the * profile. @@ -2199,6 +2230,16 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace, if (tag_start > profile_length || tag_length > profile_length - tag_start) return png_icc_profile_error(png_ptr, colorspace, name, tag_id, "ICC profile tag outside profile"); + + if ((tag_start & 3) != 0) + { + /* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is + * only a warning here because libpng does not care about the + * alignment. + */ + (void)png_icc_profile_error(png_ptr, NULL, name, tag_id, + "ICC profile tag start not a multiple of 4"); + } } return 1; /* success, maybe with warnings */ @@ -2529,7 +2570,7 @@ png_check_IHDR(png_const_structrp png_ptr, error = 1; } - if (png_gt(((width + 7) & (~7)), + if (png_gt(((width + 7) & (~7U)), ((PNG_SIZE_MAX - 48 /* big_row_buf hack */ - 1) /* filter byte */ @@ -2831,7 +2872,7 @@ png_pow10(int power) if (power < 0) { if (power < DBL_MIN_10_EXP) return 0; - recip = 1, power = -power; + recip = 1; power = -power; } if (power > 0) @@ -2856,6 +2897,14 @@ png_pow10(int power) /* Function to format a floating point value in ASCII with a given * precision. */ +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic push +/* The problem arises below with exp_b10, which can never overflow because it + * comes, originally, from frexp and is therefore limited to a range which is + * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)). + */ +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ void /* PRIVATE */ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double fp, unsigned int precision) @@ -2909,7 +2958,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double test = png_pow10(exp_b10+1); if (test <= DBL_MAX) - ++exp_b10, base = test; + { + ++exp_b10; base = test; + } else break; @@ -2923,7 +2974,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * test on DBL_MAX above. */ fp /= base; - while (fp >= 1) fp /= 10, ++exp_b10; + while (fp >= 1) + { + fp /= 10; ++exp_b10; + } /* Because of the code above fp may, at this point, be * less than .1, this is ok because the code below can @@ -2940,7 +2994,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */ { - czero = -exp_b10; /* PLUS 2 digits: TOTAL 3 */ + czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */ exp_b10 = 0; /* Dot added below before first output. */ } else @@ -2974,7 +3028,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Rounding up to 10, handle that here. */ if (czero > 0) { - --czero, d = 1; + --czero; d = 1; if (cdigits == 0) --clead; } else @@ -2988,7 +3042,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, else if (ch == 46) { - ch = *--ascii, ++size; + ch = *--ascii; ++size; /* Advance exp_b10 to '1', so that the * decimal point happens after the * previous digit. @@ -3015,7 +3069,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, int ch = *--ascii; if (ch == 46) - ++size, exp_b10 = 1; + { + ++size; exp_b10 = 1; + } /* Else lost a leading zero, so 'exp_b10' is * still ok at (-1) @@ -3051,21 +3107,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ if (exp_b10 != (-1)) { - if (exp_b10 == 0) *ascii++ = 46, --size; + if (exp_b10 == 0) + { + *ascii++ = 46; --size; + } /* PLUS 1: TOTAL 4 */ --exp_b10; } - *ascii++ = 48, --czero; + *ascii++ = 48; --czero; } if (exp_b10 != (-1)) { if (exp_b10 == 0) - *ascii++ = 46, --size; /* counted above */ + { + *ascii++ = 46; --size; /* counted above */ + } --exp_b10; } - *ascii++ = (char)(48 + (int)d), ++cdigits; + *ascii++ = (char)(48 + (int)d); ++cdigits; } } while (cdigits+czero < precision+clead && fp > DBL_MIN); @@ -3074,7 +3135,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Check for an exponent, if we don't need one we are * done and just need to terminate the string. At - * this point exp_b10==(-1) is effectively if flag - it got + * this point exp_b10==(-1) is effectively a flag - it got * to '-1' because of the decrement after outputting * the decimal point above (the exponent required is * *not* -1!) @@ -3088,7 +3149,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * zeros were *not* output, so this doesn't increase * the output count. */ - while (--exp_b10 >= 0) *ascii++ = 48; + while (exp_b10-- > 0) *ascii++ = 48; *ascii = 0; @@ -3106,7 +3167,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ size -= cdigits; - *ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */ + *ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */ /* The following use of an unsigned temporary avoids ambiguities in * the signed arithmetic on exp_b10 and permits GCC at least to do @@ -3117,12 +3178,12 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, if (exp_b10 < 0) { - *ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */ - uexp_b10 = -exp_b10; + *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */ + uexp_b10 = 0U-exp_b10; } else - uexp_b10 = exp_b10; + uexp_b10 = 0U+exp_b10; cdigits = 0; @@ -3165,6 +3226,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ # endif /* FLOATING_POINT */ @@ -3184,9 +3248,11 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, /* Avoid overflow here on the minimum integer. */ if (fp < 0) - *ascii++ = 45, num = -fp; + { + *ascii++ = 45; num = (png_uint_32)(-fp); + } else - num = fp; + num = (png_uint_32)fp; if (num <= 0x80000000) /* else overflowed */ { @@ -3222,7 +3288,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, * then ndigits digits to first: */ i = 5; - while (ndigits < i) *ascii++ = 48, --i; + while (ndigits < i) + { + *ascii++ = 48; --i; + } while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } @@ -3273,6 +3342,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text) * the nearest .00001). Overflow and divide by zero are signalled in * the result, a boolean - true on success, false on overflow. */ +#if GCC_STRICT_OVERFLOW /* from above */ +/* It is not obvious which comparison below gets optimized in such a way that + * signed overflow would change the result; looking through the code does not + * reveal any tests which have the form GCC complains about, so presumably the + * optimizer is moving an add or subtract into the 'if' somewhere. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ int png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, png_int_32 divisor) @@ -3387,6 +3465,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, return 0; } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ #endif /* READ_GAMMA || INCH_CONVERSIONS */ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) @@ -3680,7 +3761,7 @@ png_log16bit(png_uint_32 x) * of getting this accuracy in practice. * * To deal with this the following exp() function works out the exponent of the - * frational part of the logarithm by using an accurate 32-bit value from the + * fractional part of the logarithm by using an accurate 32-bit value from the * top four fractional bits then multiplying in the remaining bits. */ static const png_uint_32 @@ -4259,13 +4340,13 @@ png_set_option(png_structrp png_ptr, int option, int onoff) if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT && (option & 1) == 0) { - int mask = 3 << option; - int setting = (2 + (onoff != 0)) << option; - int current = png_ptr->options; + png_uint_32 mask = 3U << option; + png_uint_32 setting = (2U + (onoff != 0)) << option; + png_uint_32 current = png_ptr->options; - png_ptr->options = (png_byte)(((current & ~mask) | setting) & 0xff); + png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff); - return (current & mask) >> option; + return (int)(current & mask) >> option; } return PNG_OPTION_INVALID; @@ -4277,7 +4358,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff) defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) /* sRGB conversion tables; these are machine generated with the code in * contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the - * specification (see the article at http://en.wikipedia.org/wiki/SRGB) + * specification (see the article at https://en.wikipedia.org/wiki/SRGB) * is used, not the gamma=1/2.2 approximation use elsewhere in libpng. * The sRGB to linear table is exact (to the nearest 16-bit linear fraction). * The inverse (linear to sRGB) table has accuracies as follows: diff --git a/Engine/lib/lpng/png.h b/Engine/lib/lpng/png.h index e1f59c310..4c873f5c2 100644 --- a/Engine/lib/lpng/png.h +++ b/Engine/lib/lpng/png.h @@ -1,9 +1,9 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.25, September 1, 2016 + * libpng version 1.6.34, September 29, 2017 * - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.25, September 1, 2016: + * libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,12 +25,8 @@ * * This code is released under the libpng license. * - * Some files in the "contrib" directory and some configure-generated - * files that are distributed with libpng have other copyright owners and - * are released under other open source licenses. - * - * libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are - * Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are + * libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are + * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals * added to the list of Contributing Authors: @@ -42,6 +38,8 @@ * Gilles Vollant * James Yu * Mandar Sahastrabuddhe + * Google Inc. + * Vadim Barkov * * and with the following additions to the disclaimer: * @@ -52,10 +50,10 @@ * risk of satisfactory quality, performance, accuracy, and effort is with * the user. * - * Some files in the "contrib" directory have other copyright owners and + * Some files in the "contrib" directory and some configure-generated + * files that are distributed with libpng have other copyright owners and * are released under other open source licenses. * - * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from * libpng-0.96, and are distributed according to the same disclaimer and @@ -66,9 +64,6 @@ * Glenn Randers-Pehrson * Willem van Schaik * - * Some files in the "scripts" directory have different copyright owners - * but are also released under this license. - * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, * and are distributed according to the same disclaimer and license as @@ -214,11 +209,11 @@ * ... * 1.0.19 10 10019 10.so.0.19[.0] * ... - * 1.2.56 13 10256 12.so.0.56[.0] + * 1.2.59 13 10257 12.so.0.59[.0] * ... - * 1.5.27 15 10527 15.so.15.27[.0] + * 1.5.30 15 10527 15.so.15.30[.0] * ... - * 1.6.25 16 10625 16.so.16.25[.0] + * 1.6.34 16 10633 16.so.16.34[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -239,20 +234,20 @@ * * See libpng.txt or libpng.3 for more information. The PNG specification * is available as a W3C Recommendation and as an ISO Specification, - * 4294967294 +#if UINT_MAX > 4294967294U typedef unsigned int png_uint_32; -#elif ULONG_MAX > 4294967294 +#elif ULONG_MAX > 4294967294U typedef unsigned long int png_uint_32; #else # error "libpng requires an unsigned 32-bit (or more) type" diff --git a/Engine/lib/lpng/pngerror.c b/Engine/lib/lpng/pngerror.c index f13b76443..ad48bfb98 100644 --- a/Engine/lib/lpng/pngerror.c +++ b/Engine/lib/lpng/pngerror.c @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02u: /* Expects at least 2 digits. */ mincount = 2; - /* FALL THROUGH */ + /* FALLTHROUGH */ case PNG_NUMBER_FORMAT_u: *--end = digits[number % 10]; @@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02x: /* This format expects at least two digits */ mincount = 2; - /* FALL THROUGH */ + /* FALLTHROUGH */ case PNG_NUMBER_FORMAT_x: *--end = digits[number & 0xf]; @@ -573,7 +573,7 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN) { # define fixed_message "fixed point overflow in " # define fixed_message_ln ((sizeof fixed_message)-1) - int iin; + unsigned int iin; char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT]; memcpy(msg, fixed_message, fixed_message_ln); iin = 0; diff --git a/Engine/lib/lpng/pngget.c b/Engine/lib/lpng/pngget.c index b3c6863f4..26e9fb1c3 100644 --- a/Engine/lib/lpng/pngget.c +++ b/Engine/lib/lpng/pngget.c @@ -1,8 +1,8 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -338,7 +338,7 @@ ppi_from_ppm(png_uint_32 ppm) png_fixed_point result; if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127, 5000) != 0) - return result; + return (png_uint_32)result; /* Overflow. */ return 0; @@ -773,6 +773,35 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, } #endif +#ifdef PNG_eXIf_SUPPORTED +png_uint_32 PNGAPI +png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + png_bytep *exif) +{ + png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1"); + PNG_UNUSED(info_ptr) + PNG_UNUSED(exif) + return 0; +} + +png_uint_32 PNGAPI +png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr, + png_uint_32 *num_exif, png_bytep *exif) +{ + png_debug1(1, "in %s retrieval function", "eXIf"); + + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL) + { + *num_exif = info_ptr->num_exif; + *exif = info_ptr->exif; + return (PNG_INFO_eXIf); + } + + return (0); +} +#endif + #ifdef PNG_hIST_SUPPORTED png_uint_32 PNGAPI png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, diff --git a/Engine/lib/lpng/pnginfo.h b/Engine/lib/lpng/pnginfo.h index 361ed8be7..d5f6149db 100644 --- a/Engine/lib/lpng/pnginfo.h +++ b/Engine/lib/lpng/pnginfo.h @@ -185,6 +185,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ #endif +#ifdef PNG_eXIf_SUPPORTED + int num_exif; /* Added at libpng-1.6.31 */ + png_bytep exif; +# ifdef PNG_READ_eXIf_SUPPORTED + png_bytep eXIf_buf; /* Added at libpng-1.6.32 */ +# endif +#endif + #ifdef PNG_hIST_SUPPORTED /* The hIST chunk contains the relative frequency or importance of the * various palette entries, so that a viewer can intelligently select a diff --git a/Engine/lib/lpng/pngmem.c b/Engine/lib/lpng/pngmem.c index 7053ec96f..ff3ef7e88 100644 --- a/Engine/lib/lpng/pngmem.c +++ b/Engine/lib/lpng/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.6.24 [August 4, 2016%] + * Last changed in libpng 1.6.26 [October 20, 2016] * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -109,7 +109,7 @@ static png_voidp png_malloc_array_checked(png_const_structrp png_ptr, int nelements, size_t element_size) { - png_alloc_size_t req = nelements; /* known to be > 0 */ + png_alloc_size_t req = (png_alloc_size_t)nelements; /* known to be > 0 */ if (req <= PNG_SIZE_MAX/element_size) return png_malloc_base(png_ptr, req * element_size); diff --git a/Engine/lib/lpng/pngnow.png b/Engine/lib/lpng/pngnow.png new file mode 100644 index 000000000..82793ebdd Binary files /dev/null and b/Engine/lib/lpng/pngnow.png differ diff --git a/Engine/lib/lpng/pngpread.c b/Engine/lib/lpng/pngpread.c index 794352f42..fbe361dc3 100644 --- a/Engine/lib/lpng/pngpread.c +++ b/Engine/lib/lpng/pngpread.c @@ -1,8 +1,8 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -189,6 +189,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) png_crc_read(png_ptr, chunk_tag, 4); png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_check_chunk_name(png_ptr, png_ptr->chunk_name); + png_check_chunk_length(png_ptr, png_ptr->push_length); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; } @@ -684,7 +685,12 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, png_warning(png_ptr, "Truncated compressed data in IDAT"); else - png_error(png_ptr, "Decompression error in IDAT"); + { + if (ret == Z_DATA_ERROR) + png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch"); + else + png_error(png_ptr, "Decompression error in IDAT"); + } /* Skip the check on unprocessed input */ return; diff --git a/Engine/lib/lpng/pngpriv.h b/Engine/lib/lpng/pngpriv.h index bed1cabe7..1f2e90f2b 100644 --- a/Engine/lib/lpng/pngpriv.h +++ b/Engine/lib/lpng/pngpriv.h @@ -1,8 +1,8 @@ /* pngpriv.h - private declarations for use inside libpng * - * Last changed in libpng 1.6.25 [September 1, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -35,7 +35,9 @@ * Windows/Visual Studio) there is no effect; the OS specific tests below are * still required (as of 2011-05-02.) */ -#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#endif #ifndef PNG_VERSION_INFO_ONLY /* Standard library headers not required by png.h: */ @@ -190,6 +192,50 @@ # endif #endif +#ifndef PNG_POWERPC_VSX_OPT +# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__) +# define PNG_POWERPC_VSX_OPT 2 +# else +# define PNG_POWERPC_VSX_OPT 0 +# endif +#endif + +#ifndef PNG_INTEL_SSE_OPT +# ifdef PNG_INTEL_SSE + /* Only check for SSE if the build configuration has been modified to + * enable SSE optimizations. This means that these optimizations will + * be off by default. See contrib/intel for more details. + */ +# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \ + defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_OPT 1 +# endif +# endif +#endif + +#if PNG_INTEL_SSE_OPT > 0 +# ifndef PNG_INTEL_SSE_IMPLEMENTATION +# if defined(__SSE4_1__) || defined(__AVX__) + /* We are not actually using AVX, but checking for AVX is the best + way we can detect SSE4.1 and SSSE3 on MSVC. + */ +# define PNG_INTEL_SSE_IMPLEMENTATION 3 +# elif defined(__SSSE3__) +# define PNG_INTEL_SSE_IMPLEMENTATION 2 +# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_IMPLEMENTATION 1 +# else +# define PNG_INTEL_SSE_IMPLEMENTATION 0 +# endif +# endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2 +# endif +#endif + #if PNG_MIPS_MSA_OPT > 0 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa # ifndef PNG_MIPS_MSA_IMPLEMENTATION @@ -210,6 +256,11 @@ # endif #endif /* PNG_MIPS_MSA_OPT > 0 */ +#if PNG_POWERPC_VSX_OPT > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx +# define PNG_POWERPC_VSX_IMPLEMENTATION 1 +#endif + /* Is this a build of a DLL where compilation of the object modules requires * different preprocessor settings to those required for a simple library? If @@ -403,25 +454,6 @@ # define png_fixed_error(s1,s2) png_err(s1) #endif -/* C allows up-casts from (void*) to any pointer and (const void*) to any - * pointer to a const object. C++ regards this as a type error and requires an - * explicit, static, cast and provides the static_cast<> rune to ensure that - * const is not cast away. - */ -#ifdef __cplusplus -# define png_voidcast(type, value) static_cast(value) -# define png_constcast(type, value) const_cast(value) -# define png_aligncast(type, value) \ - static_cast(static_cast(value)) -# define png_aligncastconst(type, value) \ - static_cast(static_cast(value)) -#else -# define png_voidcast(type, value) (value) -# define png_constcast(type, value) ((type)(value)) -# define png_aligncast(type, value) ((void*)(value)) -# define png_aligncastconst(type, value) ((const void*)(value)) -#endif /* __cplusplus */ - /* Some fixed point APIs are still required even if not exported because * they get used by the corresponding floating point APIs. This magic * deals with this: @@ -436,6 +468,35 @@ /* Other defines specific to compilers can go here. Try to keep * them inside an appropriate ifdef/endif pair for portability. */ + +/* C allows up-casts from (void*) to any pointer and (const void*) to any + * pointer to a const object. C++ regards this as a type error and requires an + * explicit, static, cast and provides the static_cast<> rune to ensure that + * const is not cast away. + */ +#ifdef __cplusplus +# define png_voidcast(type, value) static_cast(value) +# define png_constcast(type, value) const_cast(value) +# define png_aligncast(type, value) \ + static_cast(static_cast(value)) +# define png_aligncastconst(type, value) \ + static_cast(static_cast(value)) +#else +# define png_voidcast(type, value) (value) +# ifdef _WIN64 +# ifdef __GNUC__ + typedef unsigned long long png_ptruint; +# else + typedef unsigned __int64 png_ptruint; +# endif +# else + typedef unsigned long png_ptruint; +# endif +# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value)) +# define png_aligncast(type, value) ((void*)(value)) +# define png_aligncastconst(type, value) ((const void*)(value)) +#endif /* __cplusplus */ + #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) /* png.c requires the following ANSI-C constants if the conversion of @@ -533,7 +594,8 @@ /* This implicitly assumes alignment is always to a power of 2. */ #ifdef png_alignof # define png_isaligned(ptr, type)\ - ((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0) + (((type)((const char*)ptr-(const char*)0) & \ + (type)(png_alignof(type)-1)) == 0) #else # define png_isaligned(ptr, type) 0 #endif @@ -550,92 +612,92 @@ * are defined in png.h because they need to be visible to applications * that call png_set_unknown_chunk(). */ -/* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */ -/* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */ -#define PNG_HAVE_IDAT 0x04 -/* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */ -#define PNG_HAVE_IEND 0x10 - /* 0x20 (unused) */ - /* 0x40 (unused) */ - /* 0x80 (unused) */ -#define PNG_HAVE_CHUNK_HEADER 0x100 -#define PNG_WROTE_tIME 0x200 -#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 -#define PNG_BACKGROUND_IS_GRAY 0x800 -#define PNG_HAVE_PNG_SIGNATURE 0x1000 -#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ - /* 0x4000 (unused) */ -#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */ +/* #define PNG_HAVE_IHDR 0x01U (defined in png.h) */ +/* #define PNG_HAVE_PLTE 0x02U (defined in png.h) */ +#define PNG_HAVE_IDAT 0x04U +/* #define PNG_AFTER_IDAT 0x08U (defined in png.h) */ +#define PNG_HAVE_IEND 0x10U + /* 0x20U (unused) */ + /* 0x40U (unused) */ + /* 0x80U (unused) */ +#define PNG_HAVE_CHUNK_HEADER 0x100U +#define PNG_WROTE_tIME 0x200U +#define PNG_WROTE_INFO_BEFORE_PLTE 0x400U +#define PNG_BACKGROUND_IS_GRAY 0x800U +#define PNG_HAVE_PNG_SIGNATURE 0x1000U +#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */ + /* 0x4000U (unused) */ +#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */ /* Flags for the transformations the PNG library does on the image data */ -#define PNG_BGR 0x0001 -#define PNG_INTERLACE 0x0002 -#define PNG_PACK 0x0004 -#define PNG_SHIFT 0x0008 -#define PNG_SWAP_BYTES 0x0010 -#define PNG_INVERT_MONO 0x0020 -#define PNG_QUANTIZE 0x0040 -#define PNG_COMPOSE 0x0080 /* Was PNG_BACKGROUND */ -#define PNG_BACKGROUND_EXPAND 0x0100 -#define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */ -#define PNG_16_TO_8 0x0400 /* Becomes 'chop' in 1.5.4 */ -#define PNG_RGBA 0x0800 -#define PNG_EXPAND 0x1000 -#define PNG_GAMMA 0x2000 -#define PNG_GRAY_TO_RGB 0x4000 -#define PNG_FILLER 0x8000 -#define PNG_PACKSWAP 0x10000 -#define PNG_SWAP_ALPHA 0x20000 -#define PNG_STRIP_ALPHA 0x40000 -#define PNG_INVERT_ALPHA 0x80000 -#define PNG_USER_TRANSFORM 0x100000 -#define PNG_RGB_TO_GRAY_ERR 0x200000 -#define PNG_RGB_TO_GRAY_WARN 0x400000 -#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */ -#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */ -#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */ -#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */ -#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */ - /* 0x8000000 unused */ - /* 0x10000000 unused */ - /* 0x20000000 unused */ - /* 0x40000000 unused */ +#define PNG_BGR 0x0001U +#define PNG_INTERLACE 0x0002U +#define PNG_PACK 0x0004U +#define PNG_SHIFT 0x0008U +#define PNG_SWAP_BYTES 0x0010U +#define PNG_INVERT_MONO 0x0020U +#define PNG_QUANTIZE 0x0040U +#define PNG_COMPOSE 0x0080U /* Was PNG_BACKGROUND */ +#define PNG_BACKGROUND_EXPAND 0x0100U +#define PNG_EXPAND_16 0x0200U /* Added to libpng 1.5.2 */ +#define PNG_16_TO_8 0x0400U /* Becomes 'chop' in 1.5.4 */ +#define PNG_RGBA 0x0800U +#define PNG_EXPAND 0x1000U +#define PNG_GAMMA 0x2000U +#define PNG_GRAY_TO_RGB 0x4000U +#define PNG_FILLER 0x8000U +#define PNG_PACKSWAP 0x10000U +#define PNG_SWAP_ALPHA 0x20000U +#define PNG_STRIP_ALPHA 0x40000U +#define PNG_INVERT_ALPHA 0x80000U +#define PNG_USER_TRANSFORM 0x100000U +#define PNG_RGB_TO_GRAY_ERR 0x200000U +#define PNG_RGB_TO_GRAY_WARN 0x400000U +#define PNG_RGB_TO_GRAY 0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */ +#define PNG_ENCODE_ALPHA 0x800000U /* Added to libpng-1.5.4 */ +#define PNG_ADD_ALPHA 0x1000000U /* Added to libpng-1.2.7 */ +#define PNG_EXPAND_tRNS 0x2000000U /* Added to libpng-1.2.9 */ +#define PNG_SCALE_16_TO_8 0x4000000U /* Added to libpng-1.5.4 */ + /* 0x8000000U unused */ + /* 0x10000000U unused */ + /* 0x20000000U unused */ + /* 0x40000000U unused */ /* Flags for png_create_struct */ -#define PNG_STRUCT_PNG 0x0001 -#define PNG_STRUCT_INFO 0x0002 +#define PNG_STRUCT_PNG 0x0001U +#define PNG_STRUCT_INFO 0x0002U /* Flags for the png_ptr->flags rather than declaring a byte for each one */ -#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 -#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */ - /* 0x0004 unused */ -#define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */ - /* 0x0010 unused */ - /* 0x0020 unused */ -#define PNG_FLAG_ROW_INIT 0x0040 -#define PNG_FLAG_FILLER_AFTER 0x0080 -#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 -#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 -#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 -#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 -#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */ -#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */ -#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */ -/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 */ -/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 */ -#define PNG_FLAG_LIBRARY_MISMATCH 0x20000 -#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000 -#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000 -#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000 /* Added to libpng-1.4.0 */ -#define PNG_FLAG_APP_WARNINGS_WARN 0x200000 /* Added to libpng-1.6.0 */ -#define PNG_FLAG_APP_ERRORS_WARN 0x400000 /* Added to libpng-1.6.0 */ - /* 0x800000 unused */ - /* 0x1000000 unused */ - /* 0x2000000 unused */ - /* 0x4000000 unused */ - /* 0x8000000 unused */ - /* 0x10000000 unused */ - /* 0x20000000 unused */ - /* 0x40000000 unused */ +#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001U +#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002U /* Added to libpng-1.6.0 */ + /* 0x0004U unused */ +#define PNG_FLAG_ZSTREAM_ENDED 0x0008U /* Added to libpng-1.6.0 */ + /* 0x0010U unused */ + /* 0x0020U unused */ +#define PNG_FLAG_ROW_INIT 0x0040U +#define PNG_FLAG_FILLER_AFTER 0x0080U +#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100U +#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200U +#define PNG_FLAG_CRC_CRITICAL_USE 0x0400U +#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800U +#define PNG_FLAG_ASSUME_sRGB 0x1000U /* Added to libpng-1.5.4 */ +#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000U /* Added to libpng-1.5.4 */ +#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000U /* Added to libpng-1.5.4 */ +/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000U */ +/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000U */ +#define PNG_FLAG_LIBRARY_MISMATCH 0x20000U +#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000U +#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U +#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U /* Added to libpng-1.4.0 */ +#define PNG_FLAG_APP_WARNINGS_WARN 0x200000U /* Added to libpng-1.6.0 */ +#define PNG_FLAG_APP_ERRORS_WARN 0x400000U /* Added to libpng-1.6.0 */ + /* 0x800000U unused */ + /* 0x1000000U unused */ + /* 0x2000000U unused */ + /* 0x4000000U unused */ + /* 0x8000000U unused */ + /* 0x10000000U unused */ + /* 0x20000000U unused */ + /* 0x40000000U unused */ #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ PNG_FLAG_CRC_ANCILLARY_NOWARN) @@ -669,6 +731,24 @@ ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \ (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) ) +/* This returns the number of trailing bits in the last byte of a row, 0 if the + * last byte is completely full of pixels. It is, in principle, (pixel_bits x + * width) % 8, but that would overflow for large 'width'. The second macro is + * the same except that it returns the number of unused bits in the last byte; + * (8-TRAILBITS), but 0 when TRAILBITS is 0. + * + * NOTE: these macros are intended to be self-evidently correct and never + * overflow on the assumption that pixel_bits is in the range 0..255. The + * arguments are evaluated only once and they can be signed (e.g. as a result of + * the integral promotions). The result of the expression always has type + * (png_uint_32), however the compiler always knows it is in the range 0..7. + */ +#define PNG_TRAILBITS(pixel_bits, width) \ + (((pixel_bits) * ((width) % (png_uint_32)8)) % 8) + +#define PNG_PADBITS(pixel_bits, width) \ + ((8 - PNG_TRAILBITS(pixel_bits, width)) % 8) + /* PNG_OUT_OF_RANGE returns true if value is outside the range * ideal-delta..ideal+delta. Each argument is evaluated twice. * "ideal" and "delta" should be constants, normally simple @@ -762,6 +842,7 @@ #define png_PLTE PNG_U32( 80, 76, 84, 69) #define png_bKGD PNG_U32( 98, 75, 71, 68) #define png_cHRM PNG_U32( 99, 72, 82, 77) +#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */ #define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */ #define png_gAMA PNG_U32(103, 65, 77, 65) #define png_gIFg PNG_U32(103, 73, 70, 103) @@ -1062,6 +1143,11 @@ PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr, int intent),PNG_EMPTY); #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED +PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr, + png_bytep exif, int num_exif),PNG_EMPTY); +#endif + #ifdef PNG_WRITE_iCCP_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr, png_const_charp name, png_const_bytep profile), PNG_EMPTY); @@ -1237,6 +1323,38 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); #endif +#if PNG_POWERPC_VSX_OPT > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info, + png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + +#if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + /* Choose the best filter to use and filter the row data */ PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY); @@ -1263,7 +1381,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr), /* Initialize the row buffers, etc. */ PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY); -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush), PNG_EMPTY); # define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush) @@ -1329,6 +1447,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); #endif +#ifdef PNG_READ_eXIf_SUPPORTED +PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr, + png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); @@ -1404,8 +1527,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); #endif -PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr, - png_uint_32 chunk_name),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr, + const png_uint_32 chunk_name),PNG_EMPTY); + +PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr, + const png_uint_32 chunk_length),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); @@ -1972,6 +2098,11 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon, PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); #endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, + (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); +# endif #endif PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, diff --git a/Engine/lib/lpng/pngread.c b/Engine/lib/lpng/pngread.c index 100032692..da32e9ad9 100644 --- a/Engine/lib/lpng/pngread.c +++ b/Engine/lib/lpng/pngread.c @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.33 [September 28, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -175,6 +175,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr) png_handle_cHRM(png_ptr, info_ptr, length); #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (chunk_name == png_eXIf) + png_handle_eXIf(png_ptr, info_ptr, length); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED else if (chunk_name == png_gAMA) png_handle_gAMA(png_ptr, info_ptr, length); @@ -359,9 +364,9 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) { - png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1); - png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3); - png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5); + png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1); + png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3); + png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5); png_uint_32 red = (s0 + s1 + 65536) & 0xffff; png_uint_32 blue = (s2 + s1 + 65536) & 0xffff; *(rp ) = (png_byte)((red >> 8) & 0xff); @@ -534,6 +539,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) png_error(png_ptr, "Invalid attempt to read row data"); /* Fill the row with IDAT data: */ + png_ptr->row_buf[0]=255; /* to force error if no data was found */ png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1); if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) @@ -842,6 +848,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr) png_handle_cHRM(png_ptr, info_ptr, length); #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (chunk_name == png_eXIf) + png_handle_eXIf(png_ptr, info_ptr, length); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED else if (chunk_name == png_gAMA) png_handle_gAMA(png_ptr, info_ptr, length); @@ -1393,7 +1404,9 @@ png_image_read_header(png_voidp argument) png_structrp png_ptr = image->opaque->png_ptr; png_inforp info_ptr = image->opaque->info_ptr; +#ifdef PNG_BENIGN_ERRORS_SUPPORTED png_set_benign_errors(png_ptr, 1/*warn*/); +#endif png_read_info(png_ptr, info_ptr); /* Do this the fast way; just read directly out of png_struct. */ @@ -1431,7 +1444,7 @@ png_image_read_header(png_voidp argument) break; case PNG_COLOR_TYPE_PALETTE: - cmap_entries = png_ptr->num_palette; + cmap_entries = (png_uint_32)png_ptr->num_palette; break; default: @@ -1881,7 +1894,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: if (alpha < 65535) @@ -1903,7 +1916,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: if (alpha < 65535) @@ -1932,6 +1945,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_byte)alpha; + /* FALLTHROUGH */ case 3: entry[afirst + (2 ^ bgr)] = (png_byte)blue; entry[afirst + 1] = (png_byte)green; @@ -1940,6 +1954,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_byte)alpha; + /* FALLTHROUGH */ case 1: entry[afirst] = (png_byte)green; break; @@ -1966,7 +1981,7 @@ make_gray_file_colormap(png_image_read_control *display) for (i=0; i<256; ++i) png_create_colormap_entry(display, i, i, i, i, 255, P_FILE); - return i; + return (int)i; } static int @@ -1977,7 +1992,7 @@ make_gray_colormap(png_image_read_control *display) for (i=0; i<256; ++i) png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB); - return i; + return (int)i; } #define PNG_GRAY_COLORMAP_ENTRIES 256 @@ -2031,7 +2046,7 @@ make_ga_colormap(png_image_read_control *display) P_sRGB); } - return i; + return (int)i; } #define PNG_GA_COLORMAP_ENTRIES 256 @@ -2056,7 +2071,7 @@ make_rgb_colormap(png_image_read_control *display) } } - return i; + return (int)i; } #define PNG_RGB_COLORMAP_ENTRIES 216 @@ -2249,7 +2264,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "gray[16] color-map: too few entries"); - cmap_entries = make_gray_colormap(display); + cmap_entries = (unsigned int)make_gray_colormap(display); if (png_ptr->num_trans > 0) { @@ -2347,7 +2362,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "gray+alpha color-map: too few entries"); - cmap_entries = make_ga_colormap(display); + cmap_entries = (unsigned int)make_ga_colormap(display); background_index = PNG_CMAP_GA_BACKGROUND; output_processing = PNG_CMAP_GA; @@ -2381,7 +2396,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "gray-alpha color-map: too few entries"); - cmap_entries = make_gray_colormap(display); + cmap_entries = (unsigned int)make_gray_colormap(display); if (output_encoding == P_LINEAR) { @@ -2520,7 +2535,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "rgb[ga] color-map: too few entries"); - cmap_entries = make_ga_colormap(display); + cmap_entries = (unsigned int)make_ga_colormap(display); background_index = PNG_CMAP_GA_BACKGROUND; output_processing = PNG_CMAP_GA; } @@ -2546,12 +2561,12 @@ png_image_read_colormap(png_voidp argument) png_ptr->num_trans > 0) && png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0) { - cmap_entries = make_gray_file_colormap(display); + cmap_entries = (unsigned int)make_gray_file_colormap(display); data_encoding = P_FILE; } else - cmap_entries = make_gray_colormap(display); + cmap_entries = (unsigned int)make_gray_colormap(display); /* But if the input has alpha or transparency it must be removed */ @@ -2639,7 +2654,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries) png_error(png_ptr, "rgb+alpha color-map: too few entries"); - cmap_entries = make_rgb_colormap(display); + cmap_entries = (unsigned int)make_rgb_colormap(display); /* Add a transparent entry. */ png_create_colormap_entry(display, cmap_entries, 255, 255, @@ -2688,7 +2703,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries) png_error(png_ptr, "rgb-alpha color-map: too few entries"); - cmap_entries = make_rgb_colormap(display); + cmap_entries = (unsigned int)make_rgb_colormap(display); png_create_colormap_entry(display, cmap_entries, back_r, back_g, back_b, 0/*unused*/, output_encoding); @@ -2773,7 +2788,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_RGB_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "rgb color-map: too few entries"); - cmap_entries = make_rgb_colormap(display); + cmap_entries = (unsigned int)make_rgb_colormap(display); output_processing = PNG_CMAP_RGB; } } @@ -2797,11 +2812,11 @@ png_image_read_colormap(png_voidp argument) output_processing = PNG_CMAP_NONE; data_encoding = P_FILE; /* Don't change from color-map indices */ - cmap_entries = png_ptr->num_palette; + cmap_entries = (unsigned int)png_ptr->num_palette; if (cmap_entries > 256) cmap_entries = 256; - if (cmap_entries > image->colormap_entries) + if (cmap_entries > (unsigned int)image->colormap_entries) png_error(png_ptr, "palette color-map: too few entries"); for (i=0; i < cmap_entries; ++i) @@ -2859,7 +2874,7 @@ png_image_read_colormap(png_voidp argument) case P_sRGB: /* Change to 8-bit sRGB */ png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB); - /* FALL THROUGH */ + /* FALLTHROUGH */ case P_FILE: if (png_ptr->bit_depth > 8) @@ -2913,7 +2928,7 @@ png_image_read_colormap(png_voidp argument) png_error(png_ptr, "bad background index (internal error)"); } - display->colormap_processing = output_processing; + display->colormap_processing = (int)output_processing; return 1/*ok*/; } @@ -3177,8 +3192,7 @@ png_image_read_colormapped(png_voidp argument) image->colormap_entries == 244 /* 216 + 1 + 27 */) break; - /* goto bad_output; */ - /* FALL THROUGH */ + goto bad_output; default: bad_output: @@ -3222,14 +3236,14 @@ png_image_read_colormapped(png_voidp argument) else { - png_alloc_size_t row_bytes = display->row_bytes; + png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes; while (--passes >= 0) { png_uint_32 y = image->height; png_bytep row = png_voidcast(png_bytep, display->first_row); - while (y-- > 0) + for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); row += row_bytes; @@ -3557,8 +3571,9 @@ png_image_read_background(png_voidp argument) * stride which was multiplied by 2 (below) to get row_bytes. */ ptrdiff_t step_row = display->row_bytes / 2; - int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; - unsigned int outchannels = 1+preserve_alpha; + unsigned int preserve_alpha = (image->format & + PNG_FORMAT_FLAG_ALPHA) != 0; + unsigned int outchannels = 1U+preserve_alpha; int swap_alpha = 0; # ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED @@ -3744,7 +3759,13 @@ png_image_read_direct(png_voidp argument) mode = PNG_ALPHA_PNG; output_gamma = PNG_DEFAULT_sRGB; } - + + if ((change & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) + { + mode = PNG_ALPHA_OPTIMIZED; + change &= ~PNG_FORMAT_FLAG_ASSOCIATED_ALPHA; + } + /* If 'do_local_background' is set check for the presence of gamma * correction; this is part of the work-round for the libpng bug * described above. @@ -3970,6 +3991,10 @@ png_image_read_direct(png_voidp argument) else if (do_local_compose != 0) /* internal error */ png_error(png_ptr, "png_image_read: alpha channel lost"); + if ((format & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) { + info_format |= PNG_FORMAT_FLAG_ASSOCIATED_ALPHA; + } + if (info_ptr->bit_depth == 16) info_format |= PNG_FORMAT_FLAG_LINEAR; @@ -4055,14 +4080,14 @@ png_image_read_direct(png_voidp argument) else { - png_alloc_size_t row_bytes = display->row_bytes; + png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes; while (--passes >= 0) { png_uint_32 y = image->height; png_bytep row = png_voidcast(png_bytep, display->first_row); - while (y-- > 0) + for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); row += row_bytes; @@ -4091,7 +4116,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, * bits; this is just to verify that the 'row_stride' argument can be * represented. */ - if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */ + if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; const png_uint_32 png_row_stride = image->width * channels; @@ -4100,10 +4125,10 @@ png_image_finish_read(png_imagep image, png_const_colorp background, row_stride = (png_int_32)/*SAFE*/png_row_stride; if (row_stride < 0) - check = -row_stride; + check = (png_uint_32)(-row_stride); else - check = row_stride; + check = (png_uint_32)row_stride; /* This verifies 'check', the absolute value of the actual stride * passed in and detects overflow in the application calculation (i.e. @@ -4128,7 +4153,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, * accomodated on 64-bit systems. */ if (image->height <= - 0xFFFFFFFFU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check) + 0xffffffffU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check) { if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 || (image->colormap_entries > 0 && colormap != NULL)) diff --git a/Engine/lib/lpng/pngrtran.c b/Engine/lib/lpng/pngrtran.c index 748ffb3ed..c18965031 100644 --- a/Engine/lib/lpng/pngrtran.c +++ b/Engine/lib/lpng/pngrtran.c @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.33 [September 28, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action) case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */ png_warning(png_ptr, "Can't discard critical data on CRC error"); + /* FALLTHROUGH */ case PNG_CRC_ERROR_QUIT: /* Error/quit */ case PNG_CRC_DEFAULT: @@ -429,7 +430,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, int i; png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); for (i = 0; i < num_palette; i++) png_ptr->quantize_index[i] = (png_byte)i; } @@ -446,7 +447,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize an array to sort colors */ png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); /* Initialize the quantize_sort array */ for (i = 0; i < num_palette; i++) @@ -580,9 +581,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize palette index arrays */ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * + (sizeof (png_byte)))); png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * + (sizeof (png_byte)))); /* Initialize the sort array */ for (i = 0; i < num_palette; i++) @@ -591,7 +594,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, png_ptr->palette_to_index[i] = (png_byte)i; } - hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 * + hash = (png_dsortpp)png_calloc(png_ptr, (png_alloc_size_t)(769 * (sizeof (png_dsortp)))); num_new_palette = num_palette; @@ -622,7 +625,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, { t = (png_dsortp)png_malloc_warn(png_ptr, - (png_uint_32)(sizeof (png_dsort))); + (png_alloc_size_t)(sizeof (png_dsort))); if (t == NULL) break; @@ -747,9 +750,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, png_size_t num_entries = ((png_size_t)1 << total_bits); png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr, - (png_uint_32)(num_entries * (sizeof (png_byte)))); + (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); - distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries * + distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); memset(distance, 0xff, num_entries * (sizeof (png_byte))); @@ -1253,7 +1256,7 @@ png_init_rgb_transformations(png_structrp png_ptr) default: case 8: - /* FALL THROUGH (Already 8 bits) */ + /* FALLTHROUGH */ /* (Already 8 bits) */ case 16: /* Already a full 16 bits */ @@ -2150,7 +2153,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row) { png_bytep sp = row + (png_size_t)((row_width - 1) >> 3); png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07); + png_uint_32 shift = 7U - ((row_width + 7U) & 0x07); for (i = 0; i < row_width; i++) { *dp = (png_byte)((*sp >> shift) & 0x01); @@ -2174,7 +2177,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row) png_bytep sp = row + (png_size_t)((row_width - 1) >> 2); png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1); for (i = 0; i < row_width; i++) { *dp = (png_byte)((*sp >> shift) & 0x03); @@ -2197,7 +2200,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row) { png_bytep sp = row + (png_size_t)((row_width - 1) >> 1); png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); + png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2); for (i = 0; i < row_width; i++) { *dp = (png_byte)((*sp >> shift) & 0x0f); @@ -2934,7 +2937,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) * using the equation given in Poynton's ColorFAQ of 1998-01-04 at * (THIS LINK IS DEAD June 2008 but * versions dated 1998 through November 2002 have been archived at - * http://web.archive.org/web/20000816232553/http://www.inforamp.net/ + * https://web.archive.org/web/20000816232553/www.inforamp.net/ * ~poynton/notes/colour_and_gamma/ColorFAQ.txt ) * Charles Poynton poynton at poynton.com * @@ -3223,7 +3226,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x7f7f >> (7 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3252,7 +3256,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x3f3f >> (6 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)png_ptr->background.gray << shift; *sp = (png_byte)(tmp & 0xff); } @@ -3262,7 +3267,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) unsigned int g = (gamma_table [p | (p << 2) | (p << 4) | (p << 6)] >> 6) & 0x03; unsigned int tmp = *sp & (0x3f3f >> (6 - shift)); - tmp |= g << shift; + tmp |= (unsigned int)(g << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3288,7 +3293,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x3f3f >> (6 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)png_ptr->background.gray << shift; *sp = (png_byte)(tmp & 0xff); } @@ -3318,7 +3324,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3328,7 +3335,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) unsigned int g = (gamma_table[p | (p << 4)] >> 4) & 0x0f; unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= g << shift; + tmp |= (unsigned int)(g << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3354,7 +3361,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } @@ -4297,7 +4305,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, if (num_trans > 0) { sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { @@ -4458,7 +4466,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, { gray = gray & 0xff; sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 1) - 1; + dp = row + ((png_size_t)row_width << 1) - 1; for (i = 0; i < row_width; i++) { @@ -4514,7 +4522,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green = (png_byte)(trans_color->green & 0xff); png_byte blue = (png_byte)(trans_color->blue & 0xff); sp = row + (png_size_t)row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) @@ -4537,7 +4545,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green_low = (png_byte)(trans_color->green & 0xff); png_byte blue_low = (png_byte)(trans_color->blue & 0xff); sp = row + row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 3) - 1; + dp = row + ((png_size_t)row_width << 3) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 5) == red_high && @@ -4596,7 +4604,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row) png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */ png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */ while (dp > sp) - dp[-2] = dp[-1] = *--sp, dp -= 2; + { + dp[-2] = dp[-1] = *--sp; dp -= 2; + } row_info->rowbytes *= 2; row_info->bit_depth = 16; diff --git a/Engine/lib/lpng/pngrutil.c b/Engine/lib/lpng/pngrutil.c index 3eaa635ad..8692933bd 100644 --- a/Engine/lib/lpng/pngrutil.c +++ b/Engine/lib/lpng/pngrutil.c @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.25 [September 1, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.33 [September 28, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -86,7 +86,7 @@ png_get_int_32)(png_const_bytep buf) { png_uint_32 uval = png_get_uint_32(buf); if ((uval & 0x80000000) == 0) /* non-negative */ - return uval; + return (png_int_32)uval; uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */ if ((uval & 0x80000000) == 0) /* no overflow */ @@ -181,6 +181,9 @@ png_read_chunk_header(png_structrp png_ptr) /* Check to see if chunk name is valid. */ png_check_chunk_name(png_ptr, png_ptr->chunk_name); + /* Check for too-large chunk length */ + png_check_chunk_length(png_ptr, length); + #ifdef PNG_IO_STATE_SUPPORTED png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA; #endif @@ -311,6 +314,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn) if (buffer != NULL) { + memset(buffer, 0, new_size); /* just in case */ png_ptr->read_buffer = buffer; png_ptr->read_buffer_size = new_size; } @@ -370,11 +374,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) */ { int ret; /* zlib return code */ -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 + int window_bits = 0; # if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW) - int window_bits; - if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) == PNG_OPTION_ON) { @@ -384,13 +387,11 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) else { - window_bits = 0; png_ptr->zstream_start = 1; } -# else -# define window_bits 0 # endif -#endif + +#endif /* ZLIB_VERNUM >= 0x1240 */ /* Set this for safety, just in case the previous owner left pointers to * memory allocations. @@ -402,25 +403,32 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0) { -#if PNG_ZLIB_VERNUM < 0x1240 - ret = inflateReset(&png_ptr->zstream); -#else +#if ZLIB_VERNUM >= 0x1240 ret = inflateReset2(&png_ptr->zstream, window_bits); +#else + ret = inflateReset(&png_ptr->zstream); #endif } else { -#if PNG_ZLIB_VERNUM < 0x1240 - ret = inflateInit(&png_ptr->zstream); -#else +#if ZLIB_VERNUM >= 0x1240 ret = inflateInit2(&png_ptr->zstream, window_bits); +#else + ret = inflateInit(&png_ptr->zstream); #endif if (ret == Z_OK) png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED; } +#if ZLIB_VERNUM >= 0x1290 && \ + defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) + if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON) + /* Turn off validation of the ADLER32 checksum in IDAT chunks */ + ret = inflateValidate(&png_ptr->zstream, 0); +#endif + if (ret == Z_OK) png_ptr->zowner = owner; @@ -435,7 +443,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) #endif } -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 /* Handle the start of the inflate stream if we called inflateInit2(strm,0); * in this case some zlib versions skip validation of the CINFO field and, in * certain circumstances, libpng may end up displaying an invalid image, in @@ -666,6 +674,8 @@ png_decompress_chunk(png_structrp png_ptr, if (text != NULL) { + memset(text, 0, buffer_size); + ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/, png_ptr->read_buffer + prefix_size, &lzsize, text + prefix_size, newlength); @@ -713,7 +723,7 @@ png_decompress_chunk(png_structrp png_ptr, * the extra space may otherwise be used as a Trojan Horse. */ if (ret == Z_STREAM_END && - chunklength - prefix_size != lzsize) + chunklength - prefix_size != lzsize) png_chunk_benign_error(png_ptr, "extra compressed data"); } @@ -729,9 +739,7 @@ png_decompress_chunk(png_structrp png_ptr, { /* inflateReset failed, store the error message */ png_zstream_error(png_ptr, ret); - - if (ret == Z_STREAM_END) - ret = PNG_UNEXPECTED_ZLIB_RETURN; + ret = PNG_UNEXPECTED_ZLIB_RETURN; } } @@ -823,7 +831,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size, return Z_STREAM_ERROR; } } -#endif +#endif /* READ_iCCP */ /* Read and check the IDHR chunk */ @@ -1011,7 +1019,7 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) #endif { - png_crc_finish(png_ptr, (int) length - num * 3); + png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3)); } #ifndef PNG_READ_OPT_PLTE_SUPPORTED @@ -1373,11 +1381,13 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) * chunk is just ignored, so does not invalidate the color space. An * alternative is to set the 'invalid' flags at the start of this routine * and only clear them in they were not set before and all the tests pass. - * The minimum 'deflate' stream is assumed to be just the 2 byte header and - * 4 byte checksum. The keyword must be at least one character and there is - * a terminator (0) byte and the compression method. */ - if (length < 9) + + /* The keyword must be at least one character and there is a + * terminator (0) byte and the compression method byte, and the + * 'zlib' datastream is at least 11 bytes. + */ + if (length < 14) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "too short"); @@ -1409,6 +1419,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) png_crc_read(png_ptr, (png_bytep)keyword, read_length); length -= read_length; + /* The minimum 'zlib' stream is assumed to be just the 2 byte header, + * 5 bytes minimum 'deflate' stream, and the 4 byte checksum. + */ + if (length < 11) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "too short"); + return; + } + keyword_length = 0; while (keyword_length < 80 && keyword_length < read_length && keyword[keyword_length] != 0) @@ -1427,7 +1447,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK) { - Byte profile_header[132]; + Byte profile_header[132]={0}; Byte local_buffer[PNG_INFLATE_BUF_SIZE]; png_alloc_size_t size = (sizeof profile_header); @@ -1457,7 +1477,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) /* Now read the tag table; a variable size buffer is * needed at this point, allocate one for the whole * profile. The header check has already validated - * that none of these stuff will overflow. + * that none of this stuff will overflow. */ const png_uint_32 tag_count = png_get_uint_32( profile_header+128); @@ -1564,19 +1584,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) return; } } - - else if (size > 0) - errmsg = "truncated"; - -#ifndef __COVERITY__ - else + if (errmsg == NULL) errmsg = png_ptr->zstream.msg; -#endif } - /* else png_icc_check_tag_table output an error */ } - else /* profile truncated */ errmsg = png_ptr->zstream.msg; } @@ -1717,13 +1729,13 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) data_length = length - (png_uint_32)(entry_start - buffer); /* Integrity-check the data length */ - if ((data_length % entry_size) != 0) + if ((data_length % (unsigned int)entry_size) != 0) { png_warning(png_ptr, "sPLT chunk has bad length"); return; } - dl = (png_int_32)(data_length / entry_size); + dl = (png_uint_32)(data_length / (unsigned int)entry_size); max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry)); if (dl > max_dl) @@ -1732,10 +1744,10 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) return; } - new_palette.nentries = (png_int_32)(data_length / entry_size); + new_palette.nentries = (png_int_32)(data_length / (unsigned int)entry_size); - new_palette.entries = (png_sPLT_entryp)png_malloc_warn( - png_ptr, new_palette.nentries * (sizeof (png_sPLT_entry))); + new_palette.entries = (png_sPLT_entryp)png_malloc_warn(png_ptr, + (png_alloc_size_t) new_palette.nentries * (sizeof (png_sPLT_entry))); if (new_palette.entries == NULL) { @@ -2005,6 +2017,69 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) } #endif +#ifdef PNG_READ_eXIf_SUPPORTED +void /* PRIVATE */ +png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) +{ + unsigned int i; + + png_debug(1, "in png_handle_eXIf"); + + if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) + png_chunk_error(png_ptr, "missing IHDR"); + + if (length < 2) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "too short"); + return; + } + + else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "duplicate"); + return; + } + + info_ptr->free_me |= PNG_FREE_EXIF; + + info_ptr->eXIf_buf = png_voidcast(png_bytep, + png_malloc_warn(png_ptr, length)); + + if (info_ptr->eXIf_buf == NULL) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "out of memory"); + return; + } + + for (i = 0; i < length; i++) + { + png_byte buf[1]; + png_crc_read(png_ptr, buf, 1); + info_ptr->eXIf_buf[i] = buf[0]; + if (i == 1 && buf[0] != 'M' && buf[0] != 'I' + && info_ptr->eXIf_buf[0] != buf[0]) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "incorrect byte-order specifier"); + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; + return; + } + } + + if (png_crc_finish(png_ptr, 0) != 0) + return; + + png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf); + + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; +} +#endif + #ifdef PNG_READ_hIST_SUPPORTED void /* PRIVATE */ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) @@ -2533,6 +2608,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) png_ptr->mode |= PNG_AFTER_IDAT; + /* Note, "length" is sufficient here; we won't be adding + * a null terminator later. + */ buffer = png_read_buffer(png_ptr, length, 2/*silent*/); if (buffer == NULL) @@ -2579,23 +2657,28 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_text text; - /* It worked; png_ptr->read_buffer now looks like a tEXt chunk except - * for the extra compression type byte and the fact that it isn't - * necessarily '\0' terminated. - */ - buffer = png_ptr->read_buffer; - buffer[uncompressed_length+(keyword_length+2)] = 0; + if (png_ptr->read_buffer == NULL) + errmsg="Read failure in png_handle_zTXt"; + else + { + /* It worked; png_ptr->read_buffer now looks like a tEXt chunk + * except for the extra compression type byte and the fact that + * it isn't necessarily '\0' terminated. + */ + buffer = png_ptr->read_buffer; + buffer[uncompressed_length+(keyword_length+2)] = 0; - text.compression = PNG_TEXT_COMPRESSION_zTXt; - text.key = (png_charp)buffer; - text.text = (png_charp)(buffer + keyword_length+2); - text.text_length = uncompressed_length; - text.itxt_length = 0; - text.lang = NULL; - text.lang_key = NULL; + text.compression = PNG_TEXT_COMPRESSION_zTXt; + text.key = (png_charp)buffer; + text.text = (png_charp)(buffer + keyword_length+2); + text.text_length = uncompressed_length; + text.itxt_length = 0; + text.lang = NULL; + text.lang_key = NULL; - if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) - errmsg = "insufficient memory"; + if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) + errmsg = "insufficient memory"; + } } else @@ -2971,7 +3054,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, case 2: png_ptr->user_chunk_cache_max = 1; png_chunk_benign_error(png_ptr, "no space in chunk cache"); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: /* NOTE: prior to 1.6.0 this case resulted in an unknown critical * chunk being skipped, now there will be a hard error below. @@ -2980,7 +3063,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, default: /* not at limit */ --(png_ptr->user_chunk_cache_max); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 0: /* no limit */ # endif /* USER_LIMITS */ /* Here when the limit isn't reached or when limits are compiled @@ -3031,20 +3114,58 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, */ void /* PRIVATE */ -png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name) +png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) { int i; + png_uint_32 cn=chunk_name; png_debug(1, "in png_check_chunk_name"); for (i=1; i<=4; ++i) { - int c = chunk_name & 0xff; + int c = cn & 0xff; if (c < 65 || c > 122 || (c > 90 && c < 97)) png_chunk_error(png_ptr, "invalid chunk type"); - chunk_name >>= 8; + cn >>= 8; + } +} + +void /* PRIVATE */ +png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) +{ + png_alloc_size_t limit = PNG_UINT_31_MAX; + +# ifdef PNG_SET_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_malloc_max > 0 && + png_ptr->user_chunk_malloc_max < limit) + limit = png_ptr->user_chunk_malloc_max; +# elif PNG_USER_CHUNK_MALLOC_MAX > 0 + if (PNG_USER_CHUNK_MALLOC_MAX < limit) + limit = PNG_USER_CHUNK_MALLOC_MAX; +# endif + if (png_ptr->chunk_name == png_IDAT) + { + png_alloc_size_t idat_limit = PNG_UINT_31_MAX; + size_t row_factor = + (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1) + + 1 + (png_ptr->interlaced? 6: 0)); + if (png_ptr->height > PNG_UINT_32_MAX/row_factor) + idat_limit=PNG_UINT_31_MAX; + else + idat_limit = png_ptr->height * row_factor; + row_factor = row_factor > 32566? 32566 : row_factor; + idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */ + idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX; + limit = limit < idat_limit? idat_limit : limit; + } + + if (length > limit) + { + png_debug2(0," length = %lu, limit = %lu", + (unsigned long)length,(unsigned long)limit); + png_chunk_error(png_ptr, "chunk data is too large"); } } @@ -3099,7 +3220,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) # ifdef PNG_READ_PACKSWAP_SUPPORTED if ((png_ptr->transformations & PNG_PACKSWAP) != 0) /* little-endian byte */ - end_mask = 0xff << end_mask; + end_mask = (unsigned int)(0xff << end_mask); else /* big-endian byte */ # endif @@ -3373,7 +3494,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */ do { - dp[0] = sp[0], dp[1] = sp[1]; + dp[0] = sp[0]; dp[1] = sp[1]; if (row_width <= bytes_to_jump) return; @@ -3394,7 +3515,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */ for (;;) { - dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2]; + dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2]; if (row_width <= bytes_to_jump) return; @@ -3545,7 +3666,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Offset to next interlace block */ - static PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_read_interlace"); if (row != NULL && row_info != NULL) @@ -3560,9 +3681,10 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3); png_bytep dp = row + (png_size_t)((final_width - 1) >> 3); - int sshift, dshift; - int s_start, s_end, s_inc; - int jstop = png_pass_inc[pass]; + unsigned int sshift, dshift; + unsigned int s_start, s_end; + int s_inc; + int jstop = (int)png_pass_inc[pass]; png_byte v; png_uint_32 i; int j; @@ -3570,8 +3692,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, #ifdef PNG_READ_PACKSWAP_SUPPORTED if ((transformations & PNG_PACKSWAP) != 0) { - sshift = (int)((row_info->width + 7) & 0x07); - dshift = (int)((final_width + 7) & 0x07); + sshift = ((row_info->width + 7) & 0x07); + dshift = ((final_width + 7) & 0x07); s_start = 7; s_end = 0; s_inc = -1; @@ -3580,8 +3702,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = 7 - (int)((row_info->width + 7) & 0x07); - dshift = 7 - (int)((final_width + 7) & 0x07); + sshift = 7 - ((row_info->width + 7) & 0x07); + dshift = 7 - ((final_width + 7) & 0x07); s_start = 0; s_end = 7; s_inc = 1; @@ -3593,7 +3715,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, for (j = 0; j < jstop; j++) { unsigned int tmp = *dp & (0x7f7f >> (7 - dshift)); - tmp |= v << dshift; + tmp |= (unsigned int)(v << dshift); *dp = (png_byte)(tmp & 0xff); if (dshift == s_end) @@ -3603,7 +3725,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - dshift += s_inc; + dshift = (unsigned int)((int)dshift + s_inc); } if (sshift == s_end) @@ -3613,7 +3735,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - sshift += s_inc; + sshift = (unsigned int)((int)sshift + s_inc); } break; } @@ -3622,16 +3744,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2); png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2); - int sshift, dshift; - int s_start, s_end, s_inc; - int jstop = png_pass_inc[pass]; + unsigned int sshift, dshift; + unsigned int s_start, s_end; + int s_inc; + int jstop = (int)png_pass_inc[pass]; png_uint_32 i; #ifdef PNG_READ_PACKSWAP_SUPPORTED if ((transformations & PNG_PACKSWAP) != 0) { - sshift = (int)(((row_info->width + 3) & 0x03) << 1); - dshift = (int)(((final_width + 3) & 0x03) << 1); + sshift = (((row_info->width + 3) & 0x03) << 1); + dshift = (((final_width + 3) & 0x03) << 1); s_start = 6; s_end = 0; s_inc = -2; @@ -3640,8 +3763,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1); - dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1); + sshift = ((3 - ((row_info->width + 3) & 0x03)) << 1); + dshift = ((3 - ((final_width + 3) & 0x03)) << 1); s_start = 0; s_end = 6; s_inc = 2; @@ -3656,7 +3779,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, for (j = 0; j < jstop; j++) { unsigned int tmp = *dp & (0x3f3f >> (6 - dshift)); - tmp |= v << dshift; + tmp |= (unsigned int)(v << dshift); *dp = (png_byte)(tmp & 0xff); if (dshift == s_end) @@ -3666,7 +3789,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - dshift += s_inc; + dshift = (unsigned int)((int)dshift + s_inc); } if (sshift == s_end) @@ -3676,7 +3799,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - sshift += s_inc; + sshift = (unsigned int)((int)sshift + s_inc); } break; } @@ -3685,16 +3808,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1); png_bytep dp = row + (png_size_t)((final_width - 1) >> 1); - int sshift, dshift; - int s_start, s_end, s_inc; + unsigned int sshift, dshift; + unsigned int s_start, s_end; + int s_inc; png_uint_32 i; - int jstop = png_pass_inc[pass]; + int jstop = (int)png_pass_inc[pass]; #ifdef PNG_READ_PACKSWAP_SUPPORTED if ((transformations & PNG_PACKSWAP) != 0) { - sshift = (int)(((row_info->width + 1) & 0x01) << 2); - dshift = (int)(((final_width + 1) & 0x01) << 2); + sshift = (((row_info->width + 1) & 0x01) << 2); + dshift = (((final_width + 1) & 0x01) << 2); s_start = 4; s_end = 0; s_inc = -4; @@ -3703,8 +3827,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2); - dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2); + sshift = ((1 - ((row_info->width + 1) & 0x01)) << 2); + dshift = ((1 - ((final_width + 1) & 0x01)) << 2); s_start = 0; s_end = 4; s_inc = 4; @@ -3718,7 +3842,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, for (j = 0; j < jstop; j++) { unsigned int tmp = *dp & (0xf0f >> (4 - dshift)); - tmp |= v << dshift; + tmp |= (unsigned int)(v << dshift); *dp = (png_byte)(tmp & 0xff); if (dshift == s_end) @@ -3728,7 +3852,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - dshift += s_inc; + dshift = (unsigned int)((int)dshift + s_inc); } if (sshift == s_end) @@ -3738,7 +3862,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - sshift += s_inc; + sshift = (unsigned int)((int)sshift + s_inc); } break; } @@ -3752,7 +3876,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; - int jstop = png_pass_inc[pass]; + int jstop = (int)png_pass_inc[pass]; png_uint_32 i; for (i = 0; i < row_info->width; i++) @@ -3880,7 +4004,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row, /* Find the best predictor, the least of pa, pb, pc favoring the earlier * ones in the case of a tie. */ - if (pb < pa) pa = pb, a = b; + if (pb < pa) + { + pa = pb; a = b; + } if (pc < pa) a = c; /* Calculate the current pixel in a, and move the previous row pixel to c @@ -3896,7 +4023,7 @@ static void png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, png_const_bytep prev_row) { - int bpp = (row_info->pixel_depth + 7) >> 3; + unsigned int bpp = (row_info->pixel_depth + 7) >> 3; png_bytep rp_end = row + bpp; /* Process the first pixel in the row completely (this is the same as 'up' @@ -3909,7 +4036,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, } /* Remainder */ - rp_end += row_info->rowbytes - bpp; + rp_end = rp_end + (row_info->rowbytes - bpp); while (row < rp_end) { @@ -3932,7 +4059,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, pc = (p + pc) < 0 ? -(p + pc) : p + pc; #endif - if (pb < pa) pa = pb, a = b; + if (pb < pa) + { + pa = pb; a = b; + } if (pc < pa) a = c; a += *row; @@ -4254,7 +4384,7 @@ png_read_start_row(png_structrp png_ptr) /* Offset to next interlace block in the y direction */ static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; - int max_pixel_depth; + unsigned int max_pixel_depth; png_size_t row_bytes; png_debug(1, "in png_read_start_row"); @@ -4283,7 +4413,7 @@ png_read_start_row(png_structrp png_ptr) png_ptr->iwidth = png_ptr->width; } - max_pixel_depth = png_ptr->pixel_depth; + max_pixel_depth = (unsigned int)png_ptr->pixel_depth; /* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of * calculations to calculate the final pixel depth, then @@ -4418,7 +4548,7 @@ png_read_start_row(png_structrp png_ptr) defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0) { - int user_pixel_depth = png_ptr->user_transform_depth * + unsigned int user_pixel_depth = png_ptr->user_transform_depth * png_ptr->user_transform_channels; if (user_pixel_depth > max_pixel_depth) @@ -4440,7 +4570,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) * for safety's sake */ row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) + - 1 + ((max_pixel_depth + 7) >> 3); + 1 + ((max_pixel_depth + 7) >> 3U); #ifdef PNG_MAX_MALLOC_64K if (row_bytes > (png_uint_32)65536L) @@ -4509,7 +4639,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) * does not, so free the read buffer now regardless; the sequential reader * reallocates it on demand. */ - if (png_ptr->read_buffer != 0) + if (png_ptr->read_buffer != NULL) { png_bytep buffer = png_ptr->read_buffer; diff --git a/Engine/lib/lpng/pngset.c b/Engine/lib/lpng/pngset.c index cccd9cdc7..6f3a1ee11 100644 --- a/Engine/lib/lpng/pngset.c +++ b/Engine/lib/lpng/pngset.c @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -134,6 +134,53 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #endif /* cHRM */ +#ifdef PNG_eXIf_SUPPORTED +void PNGAPI +png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + const png_bytep eXIf_buf) +{ + png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1"); + PNG_UNUSED(info_ptr) + PNG_UNUSED(eXIf_buf) +} + +void PNGAPI +png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, + const png_uint_32 num_exif, const png_bytep eXIf_buf) +{ + int i; + + png_debug1(1, "in %s storage function", "eXIf"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (info_ptr->exif) + { + png_free(png_ptr, info_ptr->exif); + info_ptr->exif = NULL; + } + + info_ptr->num_exif = num_exif; + + info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, + info_ptr->num_exif)); + + if (info_ptr->exif == NULL) + { + png_warning(png_ptr, "Insufficient memory for eXIf chunk data"); + return; + } + + info_ptr->free_me |= PNG_FREE_EXIF; + + for (i = 0; i < (int) info_ptr->num_exif; i++) + info_ptr->exif[i] = eXIf_buf[i]; + + info_ptr->valid |= PNG_INFO_eXIf; +} +#endif /* eXIf */ + #ifdef PNG_gAMA_SUPPORTED void PNGFAPI png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr, @@ -283,17 +330,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, /* Check that the type matches the specification. */ if (type < 0 || type > 3) - png_error(png_ptr, "Invalid pCAL equation type"); + { + png_chunk_report(png_ptr, "Invalid pCAL equation type", + PNG_CHUNK_WRITE_ERROR); + return; + } if (nparams < 0 || nparams > 255) - png_error(png_ptr, "Invalid pCAL parameter count"); + { + png_chunk_report(png_ptr, "Invalid pCAL parameter count", + PNG_CHUNK_WRITE_ERROR); + return; + } /* Validate params[nparams] */ for (i=0; ipcal_purpose = png_voidcast(png_charp, @@ -301,8 +360,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, if (info_ptr->pcal_purpose == NULL) { - png_warning(png_ptr, "Insufficient memory for pCAL purpose"); - + png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose", + PNG_CHUNK_WRITE_ERROR); return; } @@ -331,7 +390,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, memcpy(info_ptr->pcal_units, units, length); info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr, - (png_size_t)((nparams + 1) * (sizeof (png_charp))))); + (png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp))))); if (info_ptr->pcal_params == NULL) { @@ -340,7 +399,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, return; } - memset(info_ptr->pcal_params, 0, (nparams + 1) * (sizeof (png_charp))); + memset(info_ptr->pcal_params, 0, ((unsigned int)nparams + 1) * + (sizeof (png_charp))); for (i = 0; i < nparams; i++) { @@ -563,7 +623,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr, PNG_MAX_PALETTE_LENGTH * (sizeof (png_color)))); if (num_palette > 0) - memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color))); + memcpy(png_ptr->palette, palette, (unsigned int)num_palette * + (sizeof (png_color))); info_ptr->palette = png_ptr->palette; info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette; @@ -1080,7 +1141,7 @@ png_set_sPLT(png_const_structrp png_ptr, * checked it when doing the allocation. */ memcpy(np->entries, entries->entries, - entries->nentries * sizeof (png_sPLT_entry)); + (unsigned int)entries->nentries * sizeof (png_sPLT_entry)); /* Note that 'continue' skips the advance of the out pointer and out * count, so an invalid entry is not added. @@ -1088,8 +1149,9 @@ png_set_sPLT(png_const_structrp png_ptr, info_ptr->valid |= PNG_INFO_sPLT; ++(info_ptr->splt_palettes_num); ++np; + ++entries; } - while (++entries, --nentries); + while (--nentries); if (nentries > 0) png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR); @@ -1249,7 +1311,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr, { png_app_error(png_ptr, "invalid unknown chunk location"); /* Fake out the pre 1.6.0 behavior: */ - if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */ + if (((unsigned int)location & PNG_HAVE_IDAT) != 0) /* undocumented! */ location = PNG_AFTER_IDAT; else @@ -1340,6 +1402,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, static PNG_CONST png_byte chunks_to_ignore[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ + 101, 88, 73, 102, '\0', /* eXIf */ 103, 65, 77, 65, '\0', /* gAMA */ 104, 73, 83, 84, '\0', /* hIST */ 105, 67, 67, 80, '\0', /* iCCP */ @@ -1373,7 +1436,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, return; } - num_chunks = num_chunks_in; + num_chunks = (unsigned int)num_chunks_in; } old_num_chunks = png_ptr->num_chunk_list; @@ -1563,7 +1626,7 @@ void PNGAPI png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask) { if (png_ptr != NULL && info_ptr != NULL) - info_ptr->valid &= ~mask; + info_ptr->valid &= (unsigned int)(~mask); } @@ -1682,14 +1745,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) png_byte ch = (png_byte)*key++; if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/)) - *new_key++ = ch, ++key_len, space = 0; + { + *new_key++ = ch; ++key_len; space = 0; + } else if (space == 0) { /* A space or an invalid character when one wasn't seen immediately * before; output just a space. */ - *new_key++ = 32, ++key_len, space = 1; + *new_key++ = 32; ++key_len; space = 1; /* If the character was not a space then it is invalid. */ if (ch != 32) @@ -1702,7 +1767,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) if (key_len > 0 && space != 0) /* trailing space */ { - --key_len, --new_key; + --key_len; --new_key; if (bad_character == 0) bad_character = 32; } diff --git a/Engine/lib/lpng/pngstruct.h b/Engine/lib/lpng/pngstruct.h index 2b0eb4902..d83f97125 100644 --- a/Engine/lib/lpng/pngstruct.h +++ b/Engine/lib/lpng/pngstruct.h @@ -1,8 +1,8 @@ /* pngstruct.h - header file for PNG reference library * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -263,7 +263,7 @@ struct png_struct_def /* pixel depth used for the row buffers */ png_byte transformed_pixel_depth; /* pixel depth after read/write transforms */ -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 png_byte zstream_start; /* at start of an input zlib stream */ #endif /* Zlib >= 1.2.4 */ #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) @@ -353,7 +353,7 @@ struct png_struct_def /* Options */ #ifdef PNG_SET_OPTION_SUPPORTED - png_byte options; /* On/off state (up to 4 options) */ + png_uint_32 options; /* On/off state (up to 16 options) */ #endif #if PNG_LIBPNG_VER < 10700 diff --git a/Engine/lib/lpng/pngtest.c b/Engine/lib/lpng/pngtest.c index 9034d16fc..9d5075791 100644 --- a/Engine/lib/lpng/pngtest.c +++ b/Engine/lib/lpng/pngtest.c @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.6.25 [September 1, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -43,15 +43,6 @@ #include "png.h" -/* 1.6.1 added support for the configure test harness, which uses 77 to indicate - * a skipped test, in earlier versions we need to succeed on a skipped test, so: - */ -#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H) -# define SKIP 77 -#else -# define SKIP 0 -#endif - /* Known chunks that exist in pngtest.png must be supported or pngtest will fail * simply as a result of re-ordering them. This may be fixed in 1.7 * @@ -153,6 +144,7 @@ tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t) static int verbose = 0; static int strict = 0; static int relaxed = 0; +static int xfail = 0; static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */ static int error_count = 0; /* count calls to png_error */ static int warning_count = 0; /* count calls to png_warning */ @@ -472,7 +464,7 @@ pngtest_warning(png_structp png_ptr, png_const_charp message) if (test != NULL && test->file_name != NULL) name = test->file_name; - fprintf(STDERR, "%s: libpng warning: %s\n", name, message); + fprintf(STDERR, "\n%s: libpng warning: %s\n", name, message); } /* This is the default error handling function. Note that replacements for @@ -514,10 +506,10 @@ typedef struct memory_information typedef memory_information *memory_infop; static memory_infop pinformation = NULL; -static png_alloc_size_t current_allocation = 0; -static png_alloc_size_t maximum_allocation = 0; -static png_alloc_size_t total_allocation = 0; -static png_alloc_size_t num_allocations = 0; +static int current_allocation = 0; +static int maximum_allocation = 0; +static int total_allocation = 0; +static int num_allocations = 0; png_voidp PNGCBAPI png_debug_malloc PNGARG((png_structp png_ptr, png_alloc_size_t size)); @@ -604,10 +596,9 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) if (pinfo->pointer == ptr) { *ppinfo = pinfo->next; - if (current_allocation < pinfo->size) + current_allocation -= pinfo->size; + if (current_allocation < 0) fprintf(STDERR, "Duplicate free of memory\n"); - else - current_allocation -= pinfo->size; /* We must free the list element too, but first kill the memory that is to be freed. */ memset(ptr, 0x55, pinfo->size); @@ -939,12 +930,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) read_user_chunk_callback); #endif -#ifdef PNG_SET_USER_LIMITS_SUPPORTED -# ifdef CHUNK_LIMIT /* from the build, for testing */ - png_set_chunk_malloc_max(read_ptr, CHUNK_LIMIT); -# endif /* CHUNK_LIMIT */ -#endif - #ifdef PNG_SETJMP_SUPPORTED pngtest_debug("Setting jmpbuf for read struct"); if (setjmp(png_jmpbuf(read_ptr))) @@ -952,8 +937,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); png_free(read_ptr, row_buf); row_buf = NULL; + if (verbose != 0) + fprintf(STDERR, " destroy read structs\n"); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); #ifdef PNG_WRITE_SUPPORTED + if (verbose != 0) + fprintf(STDERR, " destroy write structs\n"); png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_write_struct(&write_ptr, &write_info_ptr); #endif @@ -968,11 +957,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) if (setjmp(png_jmpbuf(write_ptr))) { fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname); + if (verbose != 0) + fprintf(STDERR, " destroying read structs\n"); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); + if (verbose != 0) + fprintf(STDERR, " destroying write structs\n"); png_destroy_info_struct(write_ptr, &write_end_info_ptr); -#ifdef PNG_WRITE_SUPPORTED png_destroy_write_struct(&write_ptr, &write_info_ptr); -#endif FCLOSE(fpin); FCLOSE(fpout); return (1); @@ -980,15 +971,16 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #endif +#ifdef PNG_BENIGN_ERRORS_SUPPORTED if (strict != 0) { /* Treat png_benign_error() as errors on read */ png_set_benign_errors(read_ptr, 0); -#ifdef PNG_WRITE_SUPPORTED +# ifdef PNG_WRITE_SUPPORTED /* Treat them as errors on write */ png_set_benign_errors(write_ptr, 0); -#endif +# endif /* if strict is not set, then app warnings and errors are treated as * warnings in release builds, but not in unstable builds; this can be @@ -1001,10 +993,20 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) /* Allow application (pngtest) errors and warnings to pass */ png_set_benign_errors(read_ptr, 1); -#ifdef PNG_WRITE_SUPPORTED - png_set_benign_errors(write_ptr, 1); + /* Turn off CRC checking while reading */ + png_set_crc_action(read_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE); + +#ifdef PNG_IGNORE_ADLER32 + /* Turn off ADLER32 checking while reading */ + png_set_option(read_ptr, PNG_IGNORE_ADLER32, PNG_OPTION_ON); #endif + +# ifdef PNG_WRITE_SUPPORTED + png_set_benign_errors(write_ptr, 1); +# endif + } +#endif /* BENIGN_ERRORS */ pngtest_debug("Initializing input and output streams"); #ifdef PNG_STDIO_SUPPORTED @@ -1197,6 +1199,22 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif +#ifdef PNG_READ_eXIf_SUPPORTED + { + png_bytep exif=NULL; + png_uint_32 exif_length; + + if (png_get_eXIf_1(read_ptr, read_info_ptr, &exif_length, &exif) != 0) + { + if (exif_length > 1) + fprintf(STDERR," eXIf type %c%c, %lu bytes\n",exif[0],exif[1], + (unsigned long)exif_length); +# ifdef PNG_WRITE_eXIf_SUPPORTED + png_set_eXIf_1(write_ptr, write_info_ptr, exif_length, exif); +# endif + } + } +#endif #ifdef PNG_hIST_SUPPORTED { png_uint_16p hist; @@ -1307,10 +1325,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) { int i; - printf("\n"); + fprintf(STDERR,"\n"); for (i=0; i 1) + fprintf(STDERR," eXIf type %c%c, %lu bytes\n",exif[0],exif[1], + (unsigned long)exif_length); +# ifdef PNG_WRITE_eXIf_SUPPORTED + png_set_eXIf_1(write_ptr, write_end_info_ptr, exif_length, exif); +# endif + } + } +#endif #ifdef PNG_tIME_SUPPORTED { png_timep mod_time; @@ -1845,6 +1888,7 @@ main(int argc, char *argv[]) inname = argv[2]; strict++; relaxed = 0; + multiple=1; } else if (strcmp(argv[1], "--relaxed") == 0) @@ -1854,6 +1898,17 @@ main(int argc, char *argv[]) inname = argv[2]; strict = 0; relaxed++; + multiple=1; + } + else if (strcmp(argv[1], "--xfail") == 0) + { + status_dots_requested = 0; + verbose = 1; + inname = argv[2]; + strict = 0; + xfail++; + relaxed++; + multiple=1; } else @@ -1883,7 +1938,7 @@ main(int argc, char *argv[]) { int i; #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - png_alloc_size_t allocation_now = current_allocation; + int allocation_now = current_allocation; #endif for (i=2; ipixel_depth = 8; } @@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ sp += 2; else /* Skip initial channel and, for sp, the filler */ - sp += 4, dp += 2; + { + sp += 4; dp += 2; + } while (sp < ep) - *dp++ = *sp++, *dp++ = *sp, sp += 3; + { + *dp++ = *sp++; *dp++ = *sp; sp += 3; + } row_info->pixel_depth = 16; } @@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ ++sp; else /* Skip initial channels and, for sp, the filler */ - sp += 4, dp += 3; + { + sp += 4; dp += 3; + } /* Note that the loop adds 3 to dp and 4 to sp each time. */ while (sp < ep) - *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2; + { + *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2; + } row_info->pixel_depth = 24; } @@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ sp += 2; else /* Skip initial channels and, for sp, the filler */ - sp += 8, dp += 6; + { + sp += 8; dp += 6; + } while (sp < ep) { /* Copy 6 bytes, skip 2 */ - *dp++ = *sp++, *dp++ = *sp++; - *dp++ = *sp++, *dp++ = *sp++; - *dp++ = *sp++, *dp++ = *sp, sp += 3; + *dp++ = *sp++; *dp++ = *sp++; + *dp++ = *sp++; *dp++ = *sp++; + *dp++ = *sp++; *dp++ = *sp; sp += 3; } row_info->pixel_depth = 48; @@ -595,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) return; /* The filler channel has gone already */ /* Fix the rowbytes value. */ - row_info->rowbytes = dp-row; + row_info->rowbytes = (png_size_t)(dp-row); } #endif @@ -693,8 +707,8 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) * and this calculation is used because it avoids warnings that other * forms produced on either GCC or MSVC. */ - int padding = (-row_info->pixel_depth * row_info->width) & 7; - png_bytep rp = png_ptr->row_buf + row_info->rowbytes; + int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width); + png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1; switch (row_info->bit_depth) { diff --git a/Engine/lib/lpng/pngwrite.c b/Engine/lib/lpng/pngwrite.c index aaa2b017d..a16d77ce0 100644 --- a/Engine/lib/lpng/pngwrite.c +++ b/Engine/lib/lpng/pngwrite.c @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -237,6 +237,11 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr) png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED + if ((info_ptr->valid & PNG_INFO_eXIf) != 0) + png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); +#endif + #ifdef PNG_WRITE_hIST_SUPPORTED if ((info_ptr->valid & PNG_INFO_hIST) != 0) png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); @@ -432,6 +437,12 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) } } #endif + +#ifdef PNG_WRITE_eXIf_SUPPORTED + if ((info_ptr->valid & PNG_INFO_eXIf) != 0) + png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); +#endif + #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT); #endif @@ -666,9 +677,9 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) { - png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1); - png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3); - png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5); + png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1); + png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3); + png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5); png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL); png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL); *(rp ) = (png_byte)(red >> 8); @@ -901,7 +912,7 @@ png_set_flush(png_structrp png_ptr, int nrows) if (png_ptr == NULL) return; - png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); + png_ptr->flush_dist = (nrows < 0 ? 0 : (png_uint_32)nrows); } /* Flush the current output buffers now */ @@ -1007,8 +1018,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters) case 5: case 6: case 7: png_app_error(png_ptr, "Unknown row filter for method 0"); - /* FALL THROUGH */ #endif /* WRITE_FILTER */ + /* FALLTHROUGH */ case PNG_FILTER_VALUE_NONE: png_ptr->do_filter = PNG_FILTER_NONE; break; @@ -1525,7 +1536,8 @@ png_write_image_16bit(png_voidp argument) display->first_row); png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row); png_uint_16p row_end; - const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; + const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + 3 : 1; int aindex = 0; png_uint_32 y = image->height; @@ -1539,9 +1551,9 @@ png_write_image_16bit(png_voidp argument) ++output_row; } else - aindex = channels; + aindex = (int)channels; # else - aindex = channels; + aindex = (int)channels; # endif } @@ -1554,7 +1566,7 @@ png_write_image_16bit(png_voidp argument) */ row_end = output_row + image->width * (channels+1); - while (y-- > 0) + for (; y > 0; --y) { png_const_uint_16p in_ptr = input_row; png_uint_16p out_ptr = output_row; @@ -1575,7 +1587,7 @@ png_write_image_16bit(png_voidp argument) if (alpha > 0 && alpha < 65535) reciprocal = ((0xffff<<15)+(alpha>>1))/alpha; - c = channels; + c = (int)channels; do /* always at least one channel */ { png_uint_16 component = *in_ptr++; @@ -1610,7 +1622,7 @@ png_write_image_16bit(png_voidp argument) } png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row)); - input_row += display->row_bytes/(sizeof (png_uint_16)); + input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16)); } return 1; @@ -1683,7 +1695,8 @@ png_write_image_8bit(png_voidp argument) display->first_row); png_bytep output_row = png_voidcast(png_bytep, display->local_row); png_uint_32 y = image->height; - const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; + const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + 3 : 1; if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0) { @@ -1700,12 +1713,12 @@ png_write_image_8bit(png_voidp argument) else # endif - aindex = channels; + aindex = (int)channels; /* Use row_end in place of a loop counter: */ row_end = output_row + image->width * (channels+1); - while (y-- > 0) + for (; y > 0; --y) { png_const_uint_16p in_ptr = input_row; png_bytep out_ptr = output_row; @@ -1723,7 +1736,7 @@ png_write_image_8bit(png_voidp argument) if (alphabyte > 0 && alphabyte < 255) reciprocal = UNP_RECIPROCAL(alpha); - c = channels; + c = (int)channels; do /* always at least one channel */ *out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal); while (--c > 0); @@ -1735,7 +1748,7 @@ png_write_image_8bit(png_voidp argument) png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row)); - input_row += display->row_bytes/(sizeof (png_uint_16)); + input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16)); } /* while y */ } @@ -1746,7 +1759,7 @@ png_write_image_8bit(png_voidp argument) */ png_bytep row_end = output_row + image->width * channels; - while (y-- > 0) + for (; y > 0; --y) { png_const_uint_16p in_ptr = input_row; png_bytep out_ptr = output_row; @@ -1760,7 +1773,7 @@ png_write_image_8bit(png_voidp argument) } png_write_row(png_ptr, output_row); - input_row += display->row_bytes/(sizeof (png_uint_16)); + input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16)); } } @@ -1777,7 +1790,7 @@ png_image_set_PLTE(png_image_write_control *display) /* NOTE: the caller must check for cmap != NULL and entries != 0 */ const png_uint_32 format = image->format; - const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); + const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); # if defined(PNG_FORMAT_BGR_SUPPORTED) &&\ defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED) @@ -1809,7 +1822,7 @@ png_image_set_PLTE(png_image_write_control *display) { png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap); - entry += i * channels; + entry += (unsigned int)i * channels; if ((channels & 1) != 0) /* no alpha */ { @@ -1865,7 +1878,7 @@ png_image_set_PLTE(png_image_write_control *display) { png_const_bytep entry = png_voidcast(png_const_bytep, cmap); - entry += i * channels; + entry += (unsigned int)i * channels; switch (channels) { @@ -1873,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[afirst ? 0 : 3]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: palette[i].blue = entry[afirst + (2 ^ bgr)]; palette[i].green = entry[afirst + 1]; @@ -1884,7 +1897,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[1 ^ afirst]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: palette[i].blue = palette[i].red = palette[i].green = entry[afirst]; @@ -1910,7 +1923,7 @@ png_image_set_PLTE(png_image_write_control *display) png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS, num_trans, NULL); - image->colormap_entries = entries; + image->colormap_entries = (png_uint_32)entries; } static int @@ -1927,7 +1940,7 @@ png_image_write_main(png_voidp argument) int colormap = (format & PNG_FORMAT_FLAG_COLORMAP); int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */ int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA); - int write_16bit = linear && !colormap && (display->convert_to_8bit == 0); + int write_16bit = linear && (display->convert_to_8bit == 0); # ifdef PNG_BENIGN_ERRORS_SUPPORTED /* Make sure we error out on any bad situation */ @@ -1940,7 +1953,7 @@ png_image_write_main(png_voidp argument) { const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); - if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */ + if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; const png_uint_32 png_row_stride = image->width * channels; @@ -1949,10 +1962,10 @@ png_image_write_main(png_voidp argument) display->row_stride = (png_int_32)/*SAFE*/png_row_stride; if (display->row_stride < 0) - check = -display->row_stride; + check = (png_uint_32)(-display->row_stride); else - check = display->row_stride; + check = (png_uint_32)display->row_stride; if (check >= png_row_stride) { @@ -1960,7 +1973,7 @@ png_image_write_main(png_voidp argument) * limits the whole image size to 32 bits for API compatibility with * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro. */ - if (image->height > 0xFFFFFFFF/png_row_stride) + if (image->height > 0xffffffffU/png_row_stride) png_error(image->opaque->png_ptr, "memory image too large"); } @@ -2136,7 +2149,7 @@ png_image_write_main(png_voidp argument) ptrdiff_t row_bytes = display->row_bytes; png_uint_32 y = image->height; - while (y-- > 0) + for (; y > 0; --y) { png_write_row(png_ptr, row); row += row_bytes; diff --git a/Engine/lib/lpng/pngwtran.c b/Engine/lib/lpng/pngwtran.c index 423fb2d5b..377b43e5c 100644 --- a/Engine/lib/lpng/pngwtran.c +++ b/Engine/lib/lpng/pngwtran.c @@ -1,7 +1,7 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.6.24 [August 4, 2016] + * Last changed in libpng 1.6.26 [October 20, 2016] * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -177,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, if (row_info->color_type != PNG_COLOR_TYPE_PALETTE) { int shift_start[4], shift_dec[4]; - int channels = 0; + unsigned int channels = 0; if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0) { diff --git a/Engine/lib/lpng/pngwutil.c b/Engine/lib/lpng/pngwutil.c index 3f1ed0cc8..0d4fb1336 100644 --- a/Engine/lib/lpng/pngwutil.c +++ b/Engine/lib/lpng/pngwutil.c @@ -1,8 +1,8 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -408,7 +408,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner, png_ptr->zstream.avail_out = 0; /* Now initialize if required, setting the new parameters, otherwise just - * to a simple reset to the previous parameters. + * do a simple reset to the previous parameters. */ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0) ret = deflateReset(&png_ptr->zstream); @@ -675,6 +675,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, int interlace_type) { png_byte buf[13]; /* Buffer to store the IHDR info */ + int is_invalid_depth; png_debug(1, "in png_write_IHDR"); @@ -700,11 +701,11 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_RGB: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGB image"); png_ptr->channels = 3; @@ -726,18 +727,22 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_GRAY_ALPHA: - if (bit_depth != 8 && bit_depth != 16) + is_invalid_depth = (bit_depth != 8); +#ifdef PNG_WRITE_16BIT_SUPPORTED + is_invalid_depth = (is_invalid_depth && bit_depth != 16); +#endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); png_ptr->channels = 2; break; case PNG_COLOR_TYPE_RGB_ALPHA: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGBA image"); png_ptr->channels = 4; @@ -998,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size > 0) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->zstream.next_out = data; @@ -1044,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size > 0) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->zstream.avail_out = 0; png_ptr->zstream.next_out = NULL; png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT; @@ -1176,7 +1183,7 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette) png_byte new_name[80]; png_byte entrybuf[10]; png_size_t entry_size = (spalette->depth == 8 ? 6 : 10); - png_size_t palette_size = entry_size * spalette->nentries; + png_size_t palette_size = entry_size * (png_size_t)spalette->nentries; png_sPLT_entryp ep; #ifndef PNG_POINTER_INDEXING_SUPPORTED int i; @@ -1466,6 +1473,28 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type) } #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED +/* Write the Exif data */ +void /* PRIVATE */ +png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif) +{ + int i; + png_byte buf[1]; + + png_debug(1, "in png_write_eXIf"); + + png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif)); + + for (i = 0; i < num_exif; i++) + { + buf[0] = exif[i]; + png_write_chunk_data(png_ptr, buf, (png_size_t)1); + } + + png_write_chunk_end(png_ptr); +} +#endif + #ifdef PNG_WRITE_hIST_SUPPORTED /* Write the histogram */ void /* PRIVATE */ @@ -1743,7 +1772,7 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0, total_len = purpose_len + units_len + 10; params_len = (png_size_tp)png_malloc(png_ptr, - (png_alloc_size_t)(nparams * (sizeof (png_size_t)))); + (png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (png_size_t)))); /* Find the length of each parameter, making sure we don't count the * null terminator for the last parameter. @@ -2255,7 +2284,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, png_bytep rp, dp, lp; png_size_t i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB; @@ -2264,7 +2293,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, { v = *dp = *rp; #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2275,7 +2304,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, { v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2316,7 +2345,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes, png_bytep rp, dp, pp; png_size_t i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_UP; @@ -2326,7 +2355,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes, { v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2360,7 +2389,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, png_bytep rp, dp, pp, lp; png_uint_32 i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG; @@ -2370,7 +2399,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2382,7 +2411,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2422,7 +2451,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, png_bytep rp, dp, pp, cp, lp; png_size_t i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH; @@ -2432,7 +2461,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2465,7 +2494,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2588,14 +2617,14 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info) png_bytep rp; png_size_t sum = 0; png_size_t i; - int v; + unsigned int v; { for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++) { v = *rp; #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif diff --git a/Engine/lib/lungif/dgif_lib.c b/Engine/lib/lungif/dgif_lib.c deleted file mode 100644 index 8a8794840..000000000 --- a/Engine/lib/lungif/dgif_lib.c +++ /dev/null @@ -1,1096 +0,0 @@ -/****************************************************************************** - * "Gif-Lib" - Yet another gif library. - * - * Written by: Gershon Elber IBM PC Ver 1.1, Aug. 1990 - ****************************************************************************** - * The kernel of the GIF Decoding process can be found here. - ****************************************************************************** - * History: - * 16 Jun 89 - Version 1.0 by Gershon Elber. - * 3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names). - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#if defined (__MSDOS__) && !defined(__DJGPP__) && !defined(__GNUC__) -#include -#include -#include -#else -#include -#include -#endif /* __MSDOS__ */ - -#ifdef __MACOSX__ -#define HAVE_FCNTL_H -#define HAVE_UNISTD_H -#endif - -#ifdef HAVE_IO_H -#include -#endif - - -#ifdef HAVE_FCNTL_H -#include -#endif /* HAVE_FCNTL_H */ -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include -#include -#include "gif_lib.h" -#include "gif_lib_private.h" - -#define COMMENT_EXT_FUNC_CODE 0xfe /* Extension function code for - comment. */ - -/* avoid extra function call in case we use fread (TVT) */ -#define READ(_gif,_buf,_len) \ - (((GifFilePrivateType*)_gif->Private)->Read ? \ - ((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \ - fread(_buf,1,_len,((GifFilePrivateType*)_gif->Private)->File)) - -static int DGifGetWord(GifFileType *GifFile, GifWord *Word); -static int DGifSetupDecompress(GifFileType *GifFile); -static int DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, - int LineLen); -static int DGifGetPrefixChar(GifPrefixType *Prefix, int Code, int ClearCode); -static int DGifDecompressInput(GifFileType *GifFile, int *Code); -static int DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, - GifByteType *NextByte); -#ifndef _GBA_NO_FILEIO - -/****************************************************************************** - * Open a new gif file for read, given by its name. - * Returns GifFileType pointer dynamically allocated which serves as the gif - * info record. _GifError is cleared if succesfull. - *****************************************************************************/ -GifFileType * -DGifOpenFileName(const char *FileName) { - int FileHandle; - GifFileType *GifFile; - - if ((FileHandle = open(FileName, O_RDONLY -#if defined(__MSDOS__) || defined(_OPEN_BINARY) - | O_BINARY -#endif /* __MSDOS__ || _OPEN_BINARY */ - )) == -1) { - _GifError = D_GIF_ERR_OPEN_FAILED; - return NULL; - } - - GifFile = DGifOpenFileHandle(FileHandle); - if (GifFile == (GifFileType *)NULL) - close(FileHandle); - return GifFile; -} - -/****************************************************************************** - * Update a new gif file, given its file handle. - * Returns GifFileType pointer dynamically allocated which serves as the gif - * info record. _GifError is cleared if succesfull. - *****************************************************************************/ -GifFileType * -DGifOpenFileHandle(int FileHandle) { - - unsigned char Buf[GIF_STAMP_LEN + 1]; - GifFileType *GifFile; - GifFilePrivateType *Private; - FILE *f; - - GifFile = (GifFileType *)malloc(sizeof(GifFileType)); - if (GifFile == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return NULL; - } - - memset(GifFile, '\0', sizeof(GifFileType)); - - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); - if (Private == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - free((char *)GifFile); - return NULL; - } -#ifdef __MSDOS__ - setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */ -#endif /* __MSDOS__ */ - - f = fdopen(FileHandle, "rb"); /* Make it into a stream: */ - -#ifdef __MSDOS__ - setvbuf(f, NULL, _IOFBF, GIF_FILE_BUFFER_SIZE); /* And inc. stream - buffer. */ -#endif /* __MSDOS__ */ - - GifFile->Private = (VoidPtr)Private; - Private->FileHandle = FileHandle; - Private->File = f; - Private->FileState = FILE_STATE_READ; - Private->Read = 0; /* don't use alternate input method (TVT) */ - GifFile->UserData = 0; /* TVT */ - - /* Lets see if this is a GIF file: */ - if (READ(GifFile, Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) { - _GifError = D_GIF_ERR_READ_FAILED; - fclose(f); - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - /* The GIF Version number is ignored at this time. Maybe we should do - * something more useful with it. */ - Buf[GIF_STAMP_LEN] = 0; - if (strncmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) { - _GifError = D_GIF_ERR_NOT_GIF_FILE; - fclose(f); - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - if (DGifGetScreenDesc(GifFile) == GIF_ERROR) { - fclose(f); - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - _GifError = 0; - - return GifFile; -} - -#endif /* _GBA_NO_FILEIO */ - -/****************************************************************************** - * GifFileType constructor with user supplied input function (TVT) - *****************************************************************************/ -GifFileType * -DGifOpen(void *userData, - InputFunc readFunc) { - - unsigned char Buf[GIF_STAMP_LEN + 1]; - GifFileType *GifFile; - GifFilePrivateType *Private; - - GifFile = (GifFileType *)malloc(sizeof(GifFileType)); - if (GifFile == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return NULL; - } - - memset(GifFile, '\0', sizeof(GifFileType)); - - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); - if (!Private) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - free((char *)GifFile); - return NULL; - } - - GifFile->Private = (VoidPtr)Private; - Private->FileHandle = 0; - Private->File = 0; - Private->FileState = FILE_STATE_READ; - - Private->Read = readFunc; /* TVT */ - GifFile->UserData = userData; /* TVT */ - - /* Lets see if this is a GIF file: */ - if (READ(GifFile, Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) { - _GifError = D_GIF_ERR_READ_FAILED; - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - /* The GIF Version number is ignored at this time. Maybe we should do - * something more useful with it. */ - Buf[GIF_STAMP_LEN] = 0; - if (strncmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) { - _GifError = D_GIF_ERR_NOT_GIF_FILE; - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - if (DGifGetScreenDesc(GifFile) == GIF_ERROR) { - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - _GifError = 0; - - return GifFile; -} - -/****************************************************************************** - * This routine should be called before any other DGif calls. Note that - * this routine is called automatically from DGif file open routines. - *****************************************************************************/ -int -DGifGetScreenDesc(GifFileType * GifFile) { - - int i, BitsPerPixel; - GifByteType Buf[3]; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - /* Put the screen descriptor into the file: */ - if (DGifGetWord(GifFile, &GifFile->SWidth) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->SHeight) == GIF_ERROR) - return GIF_ERROR; - - if (READ(GifFile, Buf, 3) != 3) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - GifFile->SColorResolution = (((Buf[0] & 0x70) + 1) >> 4) + 1; - BitsPerPixel = (Buf[0] & 0x07) + 1; - GifFile->SBackGroundColor = Buf[1]; - if (Buf[0] & 0x80) { /* Do we have global color map? */ - - GifFile->SColorMap = MakeMapObject(1 << BitsPerPixel, NULL); - if (GifFile->SColorMap == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - - /* Get the global color map: */ - for (i = 0; i < GifFile->SColorMap->ColorCount; i++) { - if (READ(GifFile, Buf, 3) != 3) { - FreeMapObject(GifFile->SColorMap); - GifFile->SColorMap = NULL; - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - GifFile->SColorMap->Colors[i].Red = Buf[0]; - GifFile->SColorMap->Colors[i].Green = Buf[1]; - GifFile->SColorMap->Colors[i].Blue = Buf[2]; - } - } else { - GifFile->SColorMap = NULL; - } - - return GIF_OK; -} - -/****************************************************************************** - * This routine should be called before any attempt to read an image. - *****************************************************************************/ -int -DGifGetRecordType(GifFileType * GifFile, - GifRecordType * Type) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - - switch (Buf) { - case ',': - *Type = IMAGE_DESC_RECORD_TYPE; - break; - case '!': - *Type = EXTENSION_RECORD_TYPE; - break; - case ';': - *Type = TERMINATE_RECORD_TYPE; - break; - default: - *Type = UNDEFINED_RECORD_TYPE; - _GifError = D_GIF_ERR_WRONG_RECORD; - return GIF_ERROR; - } - - return GIF_OK; -} - -/****************************************************************************** - * This routine should be called before any attempt to read an image. - * Note it is assumed the Image desc. header (',') has been read. - *****************************************************************************/ -int -DGifGetImageDesc(GifFileType * GifFile) { - - int i, BitsPerPixel; - GifByteType Buf[3]; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - SavedImage *sp; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (DGifGetWord(GifFile, &GifFile->Image.Left) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->Image.Top) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->Image.Width) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->Image.Height) == GIF_ERROR) - return GIF_ERROR; - if (READ(GifFile, Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - BitsPerPixel = (Buf[0] & 0x07) + 1; - GifFile->Image.Interlace = (Buf[0] & 0x40); - if (Buf[0] & 0x80) { /* Does this image have local color map? */ - - /*** FIXME: Why do we check both of these in order to do this? - * Why do we have both Image and SavedImages? */ - if (GifFile->Image.ColorMap && GifFile->SavedImages == NULL) - FreeMapObject(GifFile->Image.ColorMap); - - GifFile->Image.ColorMap = MakeMapObject(1 << BitsPerPixel, NULL); - if (GifFile->Image.ColorMap == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - - /* Get the image local color map: */ - for (i = 0; i < GifFile->Image.ColorMap->ColorCount; i++) { - if (READ(GifFile, Buf, 3) != 3) { - FreeMapObject(GifFile->Image.ColorMap); - _GifError = D_GIF_ERR_READ_FAILED; - GifFile->Image.ColorMap = NULL; - return GIF_ERROR; - } - GifFile->Image.ColorMap->Colors[i].Red = Buf[0]; - GifFile->Image.ColorMap->Colors[i].Green = Buf[1]; - GifFile->Image.ColorMap->Colors[i].Blue = Buf[2]; - } - } else if (GifFile->Image.ColorMap) { - FreeMapObject(GifFile->Image.ColorMap); - GifFile->Image.ColorMap = NULL; - } - - if (GifFile->SavedImages) { - if ((GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * - (GifFile->ImageCount + 1))) == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - } else { - if ((GifFile->SavedImages = - (SavedImage *) malloc(sizeof(SavedImage))) == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - } - - sp = &GifFile->SavedImages[GifFile->ImageCount]; - memcpy(&sp->ImageDesc, &GifFile->Image, sizeof(GifImageDesc)); - if (GifFile->Image.ColorMap != NULL) { - sp->ImageDesc.ColorMap = MakeMapObject( - GifFile->Image.ColorMap->ColorCount, - GifFile->Image.ColorMap->Colors); - if (sp->ImageDesc.ColorMap == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - } - sp->RasterBits = (unsigned char *)NULL; - sp->ExtensionBlockCount = 0; - sp->ExtensionBlocks = (ExtensionBlock *) NULL; - - GifFile->ImageCount++; - - Private->PixelCount = (long)GifFile->Image.Width * - (long)GifFile->Image.Height; - - DGifSetupDecompress(GifFile); /* Reset decompress algorithm parameters. */ - - return GIF_OK; -} - -/****************************************************************************** - * Get one full scanned line (Line) of length LineLen from GIF file. - *****************************************************************************/ -int -DGifGetLine(GifFileType * GifFile, - GifPixelType * Line, - int LineLen) { - - GifByteType *Dummy; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (!LineLen) - LineLen = GifFile->Image.Width; - -#if defined(__MSDOS__) || defined(__GNUC__) - if ((Private->PixelCount -= LineLen) > 0xffff0000UL) { -#else - if ((Private->PixelCount -= LineLen) > 0xffff0000) { -#endif /* __MSDOS__ */ - _GifError = D_GIF_ERR_DATA_TOO_BIG; - return GIF_ERROR; - } - - if (DGifDecompressLine(GifFile, Line, LineLen) == GIF_OK) { - if (Private->PixelCount == 0) { - /* We probably would not be called any more, so lets clean - * everything before we return: need to flush out all rest of - * image until empty block (size 0) detected. We use GetCodeNext. */ - do - if (DGifGetCodeNext(GifFile, &Dummy) == GIF_ERROR) - return GIF_ERROR; - while (Dummy != NULL) ; - } - return GIF_OK; - } else - return GIF_ERROR; -} - -/****************************************************************************** - * Put one pixel (Pixel) into GIF file. - *****************************************************************************/ -int -DGifGetPixel(GifFileType * GifFile, - GifPixelType Pixel) { - - GifByteType *Dummy; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } -#if defined(__MSDOS__) || defined(__GNUC__) - if (--Private->PixelCount > 0xffff0000UL) -#else - if (--Private->PixelCount > 0xffff0000) -#endif /* __MSDOS__ */ - { - _GifError = D_GIF_ERR_DATA_TOO_BIG; - return GIF_ERROR; - } - - if (DGifDecompressLine(GifFile, &Pixel, 1) == GIF_OK) { - if (Private->PixelCount == 0) { - /* We probably would not be called any more, so lets clean - * everything before we return: need to flush out all rest of - * image until empty block (size 0) detected. We use GetCodeNext. */ - do - if (DGifGetCodeNext(GifFile, &Dummy) == GIF_ERROR) - return GIF_ERROR; - while (Dummy != NULL) ; - } - return GIF_OK; - } else - return GIF_ERROR; -} - -/****************************************************************************** - * Get an extension block (see GIF manual) from gif file. This routine only - * returns the first data block, and DGifGetExtensionNext should be called - * after this one until NULL extension is returned. - * The Extension should NOT be freed by the user (not dynamically allocated). - * Note it is assumed the Extension desc. header ('!') has been read. - *****************************************************************************/ -int -DGifGetExtension(GifFileType * GifFile, - int *ExtCode, - GifByteType ** Extension) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - *ExtCode = Buf; - - return DGifGetExtensionNext(GifFile, Extension); -} - -/****************************************************************************** - * Get a following extension block (see GIF manual) from gif file. This - * routine should be called until NULL Extension is returned. - * The Extension should NOT be freed by the user (not dynamically allocated). - *****************************************************************************/ -int -DGifGetExtensionNext(GifFileType * GifFile, - GifByteType ** Extension) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - if (Buf > 0) { - *Extension = Private->Buf; /* Use private unused buffer. */ - (*Extension)[0] = Buf; /* Pascal strings notation (pos. 0 is len.). */ - if (READ(GifFile, &((*Extension)[1]), Buf) != Buf) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - } else - *Extension = NULL; - - return GIF_OK; -} - -/****************************************************************************** - * This routine should be called last, to close the GIF file. - *****************************************************************************/ -int -DGifCloseFile(GifFileType * GifFile) { - - GifFilePrivateType *Private; - FILE *File; - - if (GifFile == NULL) - return GIF_ERROR; - - Private = (GifFilePrivateType *) GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - File = Private->File; - - if (GifFile->Image.ColorMap) { - FreeMapObject(GifFile->Image.ColorMap); - GifFile->Image.ColorMap = NULL; - } - - if (GifFile->SColorMap) { - FreeMapObject(GifFile->SColorMap); - GifFile->SColorMap = NULL; - } - - if (Private) { - free((char *)Private); - Private = NULL; - } - - if (GifFile->SavedImages) { - FreeSavedImages(GifFile); - GifFile->SavedImages = NULL; - } - - free(GifFile); - - if (File && (fclose(File) != 0)) { - _GifError = D_GIF_ERR_CLOSE_FAILED; - return GIF_ERROR; - } - return GIF_OK; -} - -/****************************************************************************** - * Get 2 bytes (word) from the given file: - *****************************************************************************/ -static int -DGifGetWord(GifFileType * GifFile, - GifWord *Word) { - - unsigned char c[2]; - - if (READ(GifFile, c, 2) != 2) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - - *Word = (((unsigned int)c[1]) << 8) + c[0]; - return GIF_OK; -} - -/****************************************************************************** - * Get the image code in compressed form. This routine can be called if the - * information needed to be piped out as is. Obviously this is much faster - * than decoding and encoding again. This routine should be followed by calls - * to DGifGetCodeNext, until NULL block is returned. - * The block should NOT be freed by the user (not dynamically allocated). - *****************************************************************************/ -int -DGifGetCode(GifFileType * GifFile, - int *CodeSize, - GifByteType ** CodeBlock) { - - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - *CodeSize = Private->BitsPerPixel; - - return DGifGetCodeNext(GifFile, CodeBlock); -} - -/****************************************************************************** - * Continue to get the image code in compressed form. This routine should be - * called until NULL block is returned. - * The block should NOT be freed by the user (not dynamically allocated). - *****************************************************************************/ -int -DGifGetCodeNext(GifFileType * GifFile, - GifByteType ** CodeBlock) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - - if (Buf > 0) { - *CodeBlock = Private->Buf; /* Use private unused buffer. */ - (*CodeBlock)[0] = Buf; /* Pascal strings notation (pos. 0 is len.). */ - if (READ(GifFile, &((*CodeBlock)[1]), Buf) != Buf) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - } else { - *CodeBlock = NULL; - Private->Buf[0] = 0; /* Make sure the buffer is empty! */ - Private->PixelCount = 0; /* And local info. indicate image read. */ - } - - return GIF_OK; -} - -/****************************************************************************** - * Setup the LZ decompression for this image: - *****************************************************************************/ -static int -DGifSetupDecompress(GifFileType * GifFile) { - - int i, BitsPerPixel; - GifByteType CodeSize; - GifPrefixType *Prefix; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - READ(GifFile, &CodeSize, 1); /* Read Code size from file. */ - BitsPerPixel = CodeSize; - - Private->Buf[0] = 0; /* Input Buffer empty. */ - Private->BitsPerPixel = BitsPerPixel; - Private->ClearCode = (1 << BitsPerPixel); - Private->EOFCode = Private->ClearCode + 1; - Private->RunningCode = Private->EOFCode + 1; - Private->RunningBits = BitsPerPixel + 1; /* Number of bits per code. */ - Private->MaxCode1 = 1 << Private->RunningBits; /* Max. code + 1. */ - Private->StackPtr = 0; /* No pixels on the pixel stack. */ - Private->LastCode = NO_SUCH_CODE; - Private->CrntShiftState = 0; /* No information in CrntShiftDWord. */ - Private->CrntShiftDWord = 0; - - Prefix = Private->Prefix; - for (i = 0; i <= LZ_MAX_CODE; i++) - Prefix[i] = NO_SUCH_CODE; - - return GIF_OK; -} - -/****************************************************************************** - * The LZ decompression routine: - * This version decompress the given gif file into Line of length LineLen. - * This routine can be called few times (one per scan line, for example), in - * order the complete the whole image. - *****************************************************************************/ -static int -DGifDecompressLine(GifFileType * GifFile, - GifPixelType * Line, - int LineLen) { - - int i = 0; - int j, CrntCode, EOFCode, ClearCode, CrntPrefix, LastCode, StackPtr; - GifByteType *Stack, *Suffix; - GifPrefixType *Prefix; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; - - StackPtr = Private->StackPtr; - Prefix = Private->Prefix; - Suffix = Private->Suffix; - Stack = Private->Stack; - EOFCode = Private->EOFCode; - ClearCode = Private->ClearCode; - LastCode = Private->LastCode; - - if (StackPtr != 0) { - /* Let pop the stack off before continueing to read the gif file: */ - while (StackPtr != 0 && i < LineLen) - Line[i++] = Stack[--StackPtr]; - } - - while (i < LineLen) { /* Decode LineLen items. */ - if (DGifDecompressInput(GifFile, &CrntCode) == GIF_ERROR) - return GIF_ERROR; - - if (CrntCode == EOFCode) { - /* Note however that usually we will not be here as we will stop - * decoding as soon as we got all the pixel, or EOF code will - * not be read at all, and DGifGetLine/Pixel clean everything. */ - if (i != LineLen - 1 || Private->PixelCount != 0) { - _GifError = D_GIF_ERR_EOF_TOO_SOON; - return GIF_ERROR; - } - i++; - } else if (CrntCode == ClearCode) { - /* We need to start over again: */ - for (j = 0; j <= LZ_MAX_CODE; j++) - Prefix[j] = NO_SUCH_CODE; - Private->RunningCode = Private->EOFCode + 1; - Private->RunningBits = Private->BitsPerPixel + 1; - Private->MaxCode1 = 1 << Private->RunningBits; - LastCode = Private->LastCode = NO_SUCH_CODE; - } else { - /* Its regular code - if in pixel range simply add it to output - * stream, otherwise trace to codes linked list until the prefix - * is in pixel range: */ - if (CrntCode < ClearCode) { - /* This is simple - its pixel scalar, so add it to output: */ - Line[i++] = CrntCode; - } else { - /* Its a code to needed to be traced: trace the linked list - * until the prefix is a pixel, while pushing the suffix - * pixels on our stack. If we done, pop the stack in reverse - * (thats what stack is good for!) order to output. */ - if (Prefix[CrntCode] == NO_SUCH_CODE) { - /* Only allowed if CrntCode is exactly the running code: - * In that case CrntCode = XXXCode, CrntCode or the - * prefix code is last code and the suffix char is - * exactly the prefix of last code! */ - if (CrntCode == Private->RunningCode - 2) { - CrntPrefix = LastCode; - Suffix[Private->RunningCode - 2] = - Stack[StackPtr++] = DGifGetPrefixChar(Prefix, - LastCode, - ClearCode); - } else { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - } else - CrntPrefix = CrntCode; - - /* Now (if image is O.K.) we should not get an NO_SUCH_CODE - * During the trace. As we might loop forever, in case of - * defective image, we count the number of loops we trace - * and stop if we got LZ_MAX_CODE. obviously we can not - * loop more than that. */ - j = 0; - while (j++ <= LZ_MAX_CODE && - CrntPrefix > ClearCode && CrntPrefix <= LZ_MAX_CODE) { - Stack[StackPtr++] = Suffix[CrntPrefix]; - CrntPrefix = Prefix[CrntPrefix]; - } - if (j >= LZ_MAX_CODE || CrntPrefix > LZ_MAX_CODE) { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - /* Push the last character on stack: */ - Stack[StackPtr++] = CrntPrefix; - - /* Now lets pop all the stack into output: */ - while (StackPtr != 0 && i < LineLen) - Line[i++] = Stack[--StackPtr]; - } - if (LastCode != NO_SUCH_CODE) { - Prefix[Private->RunningCode - 2] = LastCode; - - if (CrntCode == Private->RunningCode - 2) { - /* Only allowed if CrntCode is exactly the running code: - * In that case CrntCode = XXXCode, CrntCode or the - * prefix code is last code and the suffix char is - * exactly the prefix of last code! */ - Suffix[Private->RunningCode - 2] = - DGifGetPrefixChar(Prefix, LastCode, ClearCode); - } else { - Suffix[Private->RunningCode - 2] = - DGifGetPrefixChar(Prefix, CrntCode, ClearCode); - } - } - LastCode = CrntCode; - } - } - - Private->LastCode = LastCode; - Private->StackPtr = StackPtr; - - return GIF_OK; -} - -/****************************************************************************** - * Routine to trace the Prefixes linked list until we get a prefix which is - * not code, but a pixel value (less than ClearCode). Returns that pixel value. - * If image is defective, we might loop here forever, so we limit the loops to - * the maximum possible if image O.k. - LZ_MAX_CODE times. - *****************************************************************************/ -static int -DGifGetPrefixChar(GifPrefixType *Prefix, - int Code, - int ClearCode) { - - int i = 0; - - while (Code > ClearCode && i++ <= LZ_MAX_CODE) - Code = Prefix[Code]; - return Code; -} - -/****************************************************************************** - * Interface for accessing the LZ codes directly. Set Code to the real code - * (12bits), or to -1 if EOF code is returned. - *****************************************************************************/ -int -DGifGetLZCodes(GifFileType * GifFile, - int *Code) { - - GifByteType *CodeBlock; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (DGifDecompressInput(GifFile, Code) == GIF_ERROR) - return GIF_ERROR; - - if (*Code == Private->EOFCode) { - /* Skip rest of codes (hopefully only NULL terminating block): */ - do { - if (DGifGetCodeNext(GifFile, &CodeBlock) == GIF_ERROR) - return GIF_ERROR; - } while (CodeBlock != NULL) ; - - *Code = -1; - } else if (*Code == Private->ClearCode) { - /* We need to start over again: */ - Private->RunningCode = Private->EOFCode + 1; - Private->RunningBits = Private->BitsPerPixel + 1; - Private->MaxCode1 = 1 << Private->RunningBits; - } - - return GIF_OK; -} - -/****************************************************************************** - * The LZ decompression input routine: - * This routine is responsable for the decompression of the bit stream from - * 8 bits (bytes) packets, into the real codes. - * Returns GIF_OK if read succesfully. - *****************************************************************************/ -static int -DGifDecompressInput(GifFileType * GifFile, - int *Code) { - - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - GifByteType NextByte; - static unsigned short CodeMasks[] = { - 0x0000, 0x0001, 0x0003, 0x0007, - 0x000f, 0x001f, 0x003f, 0x007f, - 0x00ff, 0x01ff, 0x03ff, 0x07ff, - 0x0fff - }; - /* The image can't contain more than LZ_BITS per code. */ - if (Private->RunningBits > LZ_BITS) { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - - while (Private->CrntShiftState < Private->RunningBits) { - /* Needs to get more bytes from input stream for next code: */ - if (DGifBufferedInput(GifFile, Private->Buf, &NextByte) == GIF_ERROR) { - return GIF_ERROR; - } - Private->CrntShiftDWord |= - ((unsigned long)NextByte) << Private->CrntShiftState; - Private->CrntShiftState += 8; - } - *Code = Private->CrntShiftDWord & CodeMasks[Private->RunningBits]; - - Private->CrntShiftDWord >>= Private->RunningBits; - Private->CrntShiftState -= Private->RunningBits; - - /* If code cannot fit into RunningBits bits, must raise its size. Note - * however that codes above 4095 are used for special signaling. - * If we're using LZ_BITS bits already and we're at the max code, just - * keep using the table as it is, don't increment Private->RunningCode. - */ - if (Private->RunningCode < LZ_MAX_CODE + 2 && - ++Private->RunningCode > Private->MaxCode1 && - Private->RunningBits < LZ_BITS) { - Private->MaxCode1 <<= 1; - Private->RunningBits++; - } - return GIF_OK; -} - -/****************************************************************************** - * This routines read one gif data block at a time and buffers it internally - * so that the decompression routine could access it. - * The routine returns the next byte from its internal buffer (or read next - * block in if buffer empty) and returns GIF_OK if succesful. - *****************************************************************************/ -static int -DGifBufferedInput(GifFileType * GifFile, - GifByteType * Buf, - GifByteType * NextByte) { - - if (Buf[0] == 0) { - /* Needs to read the next buffer - this one is empty: */ - if (READ(GifFile, Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - /* There shouldn't be any empty data blocks here as the LZW spec - * says the LZW termination code should come first. Therefore we - * shouldn't be inside this routine at that point. - */ - if (Buf[0] == 0) { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - if (READ(GifFile, &Buf[1], Buf[0]) != Buf[0]) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - *NextByte = Buf[1]; - Buf[1] = 2; /* We use now the second place as last char read! */ - Buf[0]--; - } else { - *NextByte = Buf[Buf[1]++]; - Buf[0]--; - } - - return GIF_OK; -} -#ifndef _GBA_NO_FILEIO - -/****************************************************************************** - * This routine reads an entire GIF into core, hanging all its state info off - * the GifFileType pointer. Call DGifOpenFileName() or DGifOpenFileHandle() - * first to initialize I/O. Its inverse is EGifSpew(). - ******************************************************************************/ -int -DGifSlurp(GifFileType * GifFile) { - - int ImageSize; - GifRecordType RecordType; - SavedImage *sp; - GifByteType *ExtData; - SavedImage temp_save; - - temp_save.ExtensionBlocks = NULL; - temp_save.ExtensionBlockCount = 0; - - do { - if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) - return (GIF_ERROR); - - switch (RecordType) { - case IMAGE_DESC_RECORD_TYPE: - if (DGifGetImageDesc(GifFile) == GIF_ERROR) - return (GIF_ERROR); - - sp = &GifFile->SavedImages[GifFile->ImageCount - 1]; - ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height; - - sp->RasterBits = (unsigned char *)malloc(ImageSize * - sizeof(GifPixelType)); - if (sp->RasterBits == NULL) { - return GIF_ERROR; - } - if (DGifGetLine(GifFile, sp->RasterBits, ImageSize) == - GIF_ERROR) - return (GIF_ERROR); - if (temp_save.ExtensionBlocks) { - sp->ExtensionBlocks = temp_save.ExtensionBlocks; - sp->ExtensionBlockCount = temp_save.ExtensionBlockCount; - - temp_save.ExtensionBlocks = NULL; - temp_save.ExtensionBlockCount = 0; - - /* FIXME: The following is wrong. It is left in only for - * backwards compatibility. Someday it should go away. Use - * the sp->ExtensionBlocks->Function variable instead. */ - sp->Function = sp->ExtensionBlocks[0].Function; - } - break; - - case EXTENSION_RECORD_TYPE: - if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == - GIF_ERROR) - return (GIF_ERROR); - while (ExtData != NULL) { - - /* Create an extension block with our data */ - if (AddExtensionBlock(&temp_save, ExtData[0], &ExtData[1]) - == GIF_ERROR) - return (GIF_ERROR); - - if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) - return (GIF_ERROR); - temp_save.Function = 0; - } - break; - - case TERMINATE_RECORD_TYPE: - break; - - default: /* Should be trapped by DGifGetRecordType */ - break; - } - } while (RecordType != TERMINATE_RECORD_TYPE); - - /* Just in case the Gif has an extension block without an associated - * image... (Should we save this into a savefile structure with no image - * instead? Have to check if the present writing code can handle that as - * well.... */ - if (temp_save.ExtensionBlocks) - FreeExtension(&temp_save); - - return (GIF_OK); -} -#endif /* _GBA_NO_FILEIO */ diff --git a/Engine/lib/lungif/gif_err.c b/Engine/lib/lungif/gif_err.c deleted file mode 100644 index ea977bdf9..000000000 --- a/Engine/lib/lungif/gif_err.c +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * "Gif-Lib" - Yet another gif library. - * - * Written by: Gershon Elber IBM PC Ver 0.1, Jun. 1989 - ***************************************************************************** - * Handle error reporting for the GIF library. - ***************************************************************************** - * History: - * 17 Jun 89 - Version 1.0 by Gershon Elber. - ****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include "gif_lib.h" - -int _GifError = 0; - -/***************************************************************************** - * Return the last GIF error (0 if none) and reset the error. - ****************************************************************************/ -int -GifLastError(void) { - int i = _GifError; - - _GifError = 0; - - return i; -} -#ifndef _GBA_NO_FILEIO - -/***************************************************************************** - * Print the last GIF error to stderr. - ****************************************************************************/ -void -PrintGifError(void) { - char *Err; - - switch (_GifError) { - case E_GIF_ERR_OPEN_FAILED: - Err = "Failed to open given file"; - break; - case E_GIF_ERR_WRITE_FAILED: - Err = "Failed to Write to given file"; - break; - case E_GIF_ERR_HAS_SCRN_DSCR: - Err = "Screen Descriptor already been set"; - break; - case E_GIF_ERR_HAS_IMAG_DSCR: - Err = "Image Descriptor is still active"; - break; - case E_GIF_ERR_NO_COLOR_MAP: - Err = "Neither Global Nor Local color map"; - break; - case E_GIF_ERR_DATA_TOO_BIG: - Err = "#Pixels bigger than Width * Height"; - break; - case E_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Fail to allocate required memory"; - break; - case E_GIF_ERR_DISK_IS_FULL: - Err = "Write failed (disk full?)"; - break; - case E_GIF_ERR_CLOSE_FAILED: - Err = "Failed to close given file"; - break; - case E_GIF_ERR_NOT_WRITEABLE: - Err = "Given file was not opened for write"; - break; - case D_GIF_ERR_OPEN_FAILED: - Err = "Failed to open given file"; - break; - case D_GIF_ERR_READ_FAILED: - Err = "Failed to Read from given file"; - break; - case D_GIF_ERR_NOT_GIF_FILE: - Err = "Given file is NOT GIF file"; - break; - case D_GIF_ERR_NO_SCRN_DSCR: - Err = "No Screen Descriptor detected"; - break; - case D_GIF_ERR_NO_IMAG_DSCR: - Err = "No Image Descriptor detected"; - break; - case D_GIF_ERR_NO_COLOR_MAP: - Err = "Neither Global Nor Local color map"; - break; - case D_GIF_ERR_WRONG_RECORD: - Err = "Wrong record type detected"; - break; - case D_GIF_ERR_DATA_TOO_BIG: - Err = "#Pixels bigger than Width * Height"; - break; - case D_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Fail to allocate required memory"; - break; - case D_GIF_ERR_CLOSE_FAILED: - Err = "Failed to close given file"; - break; - case D_GIF_ERR_NOT_READABLE: - Err = "Given file was not opened for read"; - break; - case D_GIF_ERR_IMAGE_DEFECT: - Err = "Image is defective, decoding aborted"; - break; - case D_GIF_ERR_EOF_TOO_SOON: - Err = "Image EOF detected, before image complete"; - break; - default: - Err = NULL; - break; - } - if (Err != NULL) - fprintf(stderr, "\nGIF-LIB error: %s.\n", Err); - else - fprintf(stderr, "\nGIF-LIB undefined error %d.\n", _GifError); -} -#endif /* _GBA_NO_FILEIO */ diff --git a/Engine/lib/lungif/gif_lib.h b/Engine/lib/lungif/gif_lib.h deleted file mode 100644 index 54acd91b4..000000000 --- a/Engine/lib/lungif/gif_lib.h +++ /dev/null @@ -1,336 +0,0 @@ -/****************************************************************************** - * In order to make life a little bit easier when using the GIF file format, - * this library was written, and which does all the dirty work... - * - * Written by Gershon Elber, Jun. 1989 - * Hacks by Eric S. Raymond, Sep. 1992 - ****************************************************************************** - * History: - * 14 Jun 89 - Version 1.0 by Gershon Elber. - * 3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names) - * 15 Sep 90 - Version 2.0 by Eric S. Raymond (Changes to suoport GIF slurp) - * 26 Jun 96 - Version 3.0 by Eric S. Raymond (Full GIF89 support) - * 17 Dec 98 - Version 4.0 by Toshio Kuratomi (Fix extension writing code) - *****************************************************************************/ - -#ifndef _GIF_LIB_H_ -#define _GIF_LIB_H_ 1 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GIF_LIB_VERSION " Version 4.1, " - -#define GIF_ERROR 0 -#define GIF_OK 1 - -#ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ -#ifndef FALSE -#define FALSE 0 -#endif /* FALSE */ - -#ifndef NULL -#define NULL 0 -#endif /* NULL */ - -#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */ -#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1 -#define GIF_VERSION_POS 3 /* Version first character in stamp. */ -#define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */ -#define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */ - -#define GIF_FILE_BUFFER_SIZE 16384 /* Files uses bigger buffers than usual. */ - -typedef int GifBooleanType; -typedef unsigned char GifPixelType; -typedef unsigned char *GifRowType; -typedef unsigned char GifByteType; -#ifdef _GBA_OPTMEM - typedef unsigned short GifPrefixType; - typedef short GifWord; -#else - typedef unsigned int GifPrefixType; - typedef int GifWord; -#endif - -#define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg) -#define GIF_EXIT(Msg) { GIF_MESSAGE(Msg); exit(-3); } - -#ifdef SYSV -#define VoidPtr char * -#else -#define VoidPtr void * -#endif /* SYSV */ - -typedef struct GifColorType { - GifByteType Red, Green, Blue; -} GifColorType; - -typedef struct ColorMapObject { - int ColorCount; - int BitsPerPixel; - GifColorType *Colors; /* on malloc(3) heap */ -} ColorMapObject; - -typedef struct GifImageDesc { - GifWord Left, Top, Width, Height, /* Current image dimensions. */ - Interlace; /* Sequential/Interlaced lines. */ - ColorMapObject *ColorMap; /* The local color map */ -} GifImageDesc; - -typedef struct GifFileType { - GifWord SWidth, SHeight, /* Screen dimensions. */ - SColorResolution, /* How many colors can we generate? */ - SBackGroundColor; /* I hope you understand this one... */ - ColorMapObject *SColorMap; /* NULL if not exists. */ - int ImageCount; /* Number of current image */ - GifImageDesc Image; /* Block describing current image */ - struct SavedImage *SavedImages; /* Use this to accumulate file state */ - VoidPtr UserData; /* hook to attach user data (TVT) */ - VoidPtr Private; /* Don't mess with this! */ -} GifFileType; - -typedef enum { - UNDEFINED_RECORD_TYPE, - SCREEN_DESC_RECORD_TYPE, - IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */ - EXTENSION_RECORD_TYPE, /* Begin with '!' */ - TERMINATE_RECORD_TYPE /* Begin with ';' */ -} GifRecordType; - -/* DumpScreen2Gif routine constants identify type of window/screen to dump. - * Note all values below 1000 are reserved for the IBMPC different display - * devices (it has many!) and are compatible with the numbering TC2.0 - * (Turbo C 2.0 compiler for IBM PC) gives to these devices. - */ -typedef enum { - GIF_DUMP_SGI_WINDOW = 1000, - GIF_DUMP_X_WINDOW = 1001 -} GifScreenDumpType; - -/* func type to read gif data from arbitrary sources (TVT) */ -typedef int (*InputFunc) (GifFileType *, GifByteType *, int); - -/* func type to write gif data ro arbitrary targets. - * Returns count of bytes written. (MRB) - */ -typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int); - -/****************************************************************************** - * GIF89 extension function codes -******************************************************************************/ - -#define COMMENT_EXT_FUNC_CODE 0xfe /* comment */ -#define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control */ -#define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */ -#define APPLICATION_EXT_FUNC_CODE 0xff /* application block */ - -/****************************************************************************** - * O.K., here are the routines one can access in order to encode GIF file: - * (GIF_LIB file EGIF_LIB.C). -******************************************************************************/ - -GifFileType *EGifOpenFileName(const char *GifFileName, - int GifTestExistance); -GifFileType *EGifOpenFileHandle(int GifFileHandle); -GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc); - -int EGifSpew(GifFileType * GifFile); -void EGifSetGifVersion(const char *Version); -int EGifPutScreenDesc(GifFileType * GifFile, - int GifWidth, int GifHeight, int GifColorRes, - int GifBackGround, - const ColorMapObject * GifColorMap); -int EGifPutImageDesc(GifFileType * GifFile, int GifLeft, int GifTop, - int Width, int GifHeight, int GifInterlace, - const ColorMapObject * GifColorMap); -int EGifPutLine(GifFileType * GifFile, GifPixelType * GifLine, - int GifLineLen); -int EGifPutPixel(GifFileType * GifFile, GifPixelType GifPixel); -int EGifPutComment(GifFileType * GifFile, const char *GifComment); -int EGifPutExtensionFirst(GifFileType * GifFile, int GifExtCode, - int GifExtLen, const VoidPtr GifExtension); -int EGifPutExtensionNext(GifFileType * GifFile, int GifExtCode, - int GifExtLen, const VoidPtr GifExtension); -int EGifPutExtensionLast(GifFileType * GifFile, int GifExtCode, - int GifExtLen, const VoidPtr GifExtension); -int EGifPutExtension(GifFileType * GifFile, int GifExtCode, int GifExtLen, - const VoidPtr GifExtension); -int EGifPutCode(GifFileType * GifFile, int GifCodeSize, - const GifByteType * GifCodeBlock); -int EGifPutCodeNext(GifFileType * GifFile, - const GifByteType * GifCodeBlock); -int EGifCloseFile(GifFileType * GifFile); - -#define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ -#define E_GIF_ERR_WRITE_FAILED 2 -#define E_GIF_ERR_HAS_SCRN_DSCR 3 -#define E_GIF_ERR_HAS_IMAG_DSCR 4 -#define E_GIF_ERR_NO_COLOR_MAP 5 -#define E_GIF_ERR_DATA_TOO_BIG 6 -#define E_GIF_ERR_NOT_ENOUGH_MEM 7 -#define E_GIF_ERR_DISK_IS_FULL 8 -#define E_GIF_ERR_CLOSE_FAILED 9 -#define E_GIF_ERR_NOT_WRITEABLE 10 - -/****************************************************************************** - * O.K., here are the routines one can access in order to decode GIF file: - * (GIF_LIB file DGIF_LIB.C). - *****************************************************************************/ -#ifndef _GBA_NO_FILEIO -GifFileType *DGifOpenFileName(const char *GifFileName); -GifFileType *DGifOpenFileHandle(int GifFileHandle); -int DGifSlurp(GifFileType * GifFile); -#endif /* _GBA_NO_FILEIO */ -GifFileType *DGifOpen(void *userPtr, InputFunc readFunc); /* new one - * (TVT) */ -int DGifGetScreenDesc(GifFileType * GifFile); -int DGifGetRecordType(GifFileType * GifFile, GifRecordType * GifType); -int DGifGetImageDesc(GifFileType * GifFile); -int DGifGetLine(GifFileType * GifFile, GifPixelType * GifLine, int GifLineLen); -int DGifGetPixel(GifFileType * GifFile, GifPixelType GifPixel); -int DGifGetComment(GifFileType * GifFile, char *GifComment); -int DGifGetExtension(GifFileType * GifFile, int *GifExtCode, - GifByteType ** GifExtension); -int DGifGetExtensionNext(GifFileType * GifFile, GifByteType ** GifExtension); -int DGifGetCode(GifFileType * GifFile, int *GifCodeSize, - GifByteType ** GifCodeBlock); -int DGifGetCodeNext(GifFileType * GifFile, GifByteType ** GifCodeBlock); -int DGifGetLZCodes(GifFileType * GifFile, int *GifCode); -int DGifCloseFile(GifFileType * GifFile); - -#define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ -#define D_GIF_ERR_READ_FAILED 102 -#define D_GIF_ERR_NOT_GIF_FILE 103 -#define D_GIF_ERR_NO_SCRN_DSCR 104 -#define D_GIF_ERR_NO_IMAG_DSCR 105 -#define D_GIF_ERR_NO_COLOR_MAP 106 -#define D_GIF_ERR_WRONG_RECORD 107 -#define D_GIF_ERR_DATA_TOO_BIG 108 -#define D_GIF_ERR_NOT_ENOUGH_MEM 109 -#define D_GIF_ERR_CLOSE_FAILED 110 -#define D_GIF_ERR_NOT_READABLE 111 -#define D_GIF_ERR_IMAGE_DEFECT 112 -#define D_GIF_ERR_EOF_TOO_SOON 113 - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file QUANTIZE.C. -******************************************************************************/ -int QuantizeBuffer(unsigned int Width, unsigned int Height, - int *ColorMapSize, GifByteType * RedInput, - GifByteType * GreenInput, GifByteType * BlueInput, - GifByteType * OutputBuffer, - GifColorType * OutputColorMap); - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file QPRINTF.C. -******************************************************************************/ -extern int GifQuietPrint; - -#ifdef HAVE_STDARG_H - extern void GifQprintf(char *Format, ...); -#elif defined (HAVE_VARARGS_H) - extern void GifQprintf(); -#endif /* HAVE_STDARG_H */ - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file GIF_ERR.C. -******************************************************************************/ -#ifndef _GBA_NO_FILEIO -extern void PrintGifError(void); -#endif /* _GBA_NO_FILEIO */ -extern int GifLastError(void); - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file DEV2GIF.C. -******************************************************************************/ -extern int DumpScreen2Gif(const char *FileName, - int ReqGraphDriver, - long ReqGraphMode1, - long ReqGraphMode2, - long ReqGraphMode3); - -/***************************************************************************** - * - * Everything below this point is new after version 1.2, supporting `slurp - * mode' for doing I/O in two big belts with all the image-bashing in core. - * - *****************************************************************************/ - -/****************************************************************************** - * Color Map handling from ALLOCGIF.C - *****************************************************************************/ - -extern ColorMapObject *MakeMapObject(int ColorCount, - const GifColorType * ColorMap); -extern void FreeMapObject(ColorMapObject * Object); -extern ColorMapObject *UnionColorMap(const ColorMapObject * ColorIn1, - const ColorMapObject * ColorIn2, - GifPixelType ColorTransIn2[]); -extern int BitSize(int n); - -/****************************************************************************** - * Support for the in-core structures allocation (slurp mode). - *****************************************************************************/ - -/* This is the in-core version of an extension record */ -typedef struct { - int ByteCount; - char *Bytes; /* on malloc(3) heap */ - int Function; /* Holds the type of the Extension block. */ -} ExtensionBlock; - -/* This holds an image header, its unpacked raster bits, and extensions */ -typedef struct SavedImage { - GifImageDesc ImageDesc; - unsigned char *RasterBits; /* on malloc(3) heap */ - int Function; /* DEPRECATED: Use ExtensionBlocks[x].Function instead */ - int ExtensionBlockCount; - ExtensionBlock *ExtensionBlocks; /* on malloc(3) heap */ -} SavedImage; - -extern void ApplyTranslation(SavedImage * Image, GifPixelType Translation[]); -extern void MakeExtension(SavedImage * New, int Function); -extern int AddExtensionBlock(SavedImage * New, int Len, - unsigned char ExtData[]); -extern void FreeExtension(SavedImage * Image); -extern SavedImage *MakeSavedImage(GifFileType * GifFile, - const SavedImage * CopyFrom); -extern void FreeSavedImages(GifFileType * GifFile); - -/****************************************************************************** - * The library's internal utility font - *****************************************************************************/ - -#define GIF_FONT_WIDTH 8 -#define GIF_FONT_HEIGHT 8 -extern unsigned char AsciiTable[][GIF_FONT_WIDTH]; - -#ifdef _WIN32 - extern void DrawGifText(SavedImage * Image, -#else - extern void DrawText(SavedImage * Image, -#endif - const int x, const int y, - const char *legend, const int color); - -extern void DrawBox(SavedImage * Image, - const int x, const int y, - const int w, const int d, const int color); - -void DrawRectangle(SavedImage * Image, - const int x, const int y, - const int w, const int d, const int color); - -extern void DrawBoxedText(SavedImage * Image, - const int x, const int y, - const char *legend, - const int border, const int bg, const int fg); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* _GIF_LIB_H */ diff --git a/Engine/lib/lungif/gif_lib_private.h b/Engine/lib/lungif/gif_lib_private.h deleted file mode 100644 index 84e3738ba..000000000 --- a/Engine/lib/lungif/gif_lib_private.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _GIF_LIB_PRIVATE_H -#define _GIF_LIB_PRIVATE_H - -#include "gif_lib.h" - -#define PROGRAM_NAME "LIBUNGIF" - -#ifdef SYSV -#define VersionStr "Gif library module,\t\tEric S. Raymond\n\ - (C) Copyright 1997 Eric S. Raymond\n" -#else -#define VersionStr PROGRAM_NAME " IBMPC " GIF_LIB_VERSION \ - " Eric S. Raymond, " __DATE__ ", " \ - __TIME__ "\n" "(C) Copyright 1997 Eric S. Raymond\n" -#endif /* SYSV */ - -#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ -#define LZ_BITS 12 - -#define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ -#define FIRST_CODE 4097 /* Impossible code, to signal first. */ -#define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ - -#define FILE_STATE_WRITE 0x01 -#define FILE_STATE_SCREEN 0x02 -#define FILE_STATE_IMAGE 0x04 -#define FILE_STATE_READ 0x08 - -#define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) -#define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) - -typedef struct GifFilePrivateType { - GifWord FileState, FileHandle, /* Where all this data goes to! */ - BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ - ClearCode, /* The CLEAR LZ code. */ - EOFCode, /* The EOF LZ code. */ - RunningCode, /* The next code algorithm can generate. */ - RunningBits, /* The number of bits required to represent RunningCode. */ - MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ - LastCode, /* The code before the current code. */ - CrntCode, /* Current algorithm code. */ - StackPtr, /* For character stack (see below). */ - CrntShiftState; /* Number of bits in CrntShiftDWord. */ - unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ - unsigned long PixelCount; /* Number of pixels in image. */ - FILE *File; /* File as stream. */ - InputFunc Read; /* function to read gif input (TVT) */ - OutputFunc Write; /* function to write gif output (MRB) */ - GifByteType Buf[256]; /* Compressed input is buffered here. */ - GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */ - GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ - GifPrefixType Prefix[LZ_MAX_CODE + 1]; -} GifFilePrivateType; - -extern int _GifError; - -#endif /* _GIF_LIB_PRIVATE_H */ diff --git a/Engine/lib/lungif/gifalloc.c b/Engine/lib/lungif/gifalloc.c deleted file mode 100644 index 79d23325b..000000000 --- a/Engine/lib/lungif/gifalloc.c +++ /dev/null @@ -1,443 +0,0 @@ -/***************************************************************************** - * "Gif-Lib" - Yet another gif library. - * - * Written by: Gershon Elber Ver 0.1, Jun. 1989 - * Extensively hacked by: Eric S. Raymond Ver 1.?, Sep 1992 - ***************************************************************************** - * GIF construction tools - ***************************************************************************** - * History: - * 15 Sep 92 - Version 1.0 by Eric Raymond. - ****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include "gif_lib.h" - -#define MAX(x, y) (((x) > (y)) ? (x) : (y)) - -/****************************************************************************** - * Miscellaneous utility functions - *****************************************************************************/ - -/* return smallest bitfield size n will fit in */ -int -BitSize(int n) { - - register int i; - - for (i = 1; i <= 8; i++) - if ((1 << i) >= n) - break; - return (i); -} - -/****************************************************************************** - * Color map object functions - *****************************************************************************/ - -/* - * Allocate a color map of given size; initialize with contents of - * ColorMap if that pointer is non-NULL. - */ -ColorMapObject * -MakeMapObject(int ColorCount, - const GifColorType * ColorMap) { - - ColorMapObject *Object; - - /*** FIXME: Our ColorCount has to be a power of two. Is it necessary to - * make the user know that or should we automatically round up instead? */ - if (ColorCount != (1 << BitSize(ColorCount))) { - return ((ColorMapObject *) NULL); - } - - Object = (ColorMapObject *)malloc(sizeof(ColorMapObject)); - if (Object == (ColorMapObject *) NULL) { - return ((ColorMapObject *) NULL); - } - - Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType)); - if (Object->Colors == (GifColorType *) NULL) { - return ((ColorMapObject *) NULL); - } - - Object->ColorCount = ColorCount; - Object->BitsPerPixel = BitSize(ColorCount); - - if (ColorMap) { - memcpy((char *)Object->Colors, - (char *)ColorMap, ColorCount * sizeof(GifColorType)); - } - - return (Object); -} - -/* - * Free a color map object - */ -void -FreeMapObject(ColorMapObject * Object) { - - if (Object != NULL) { - free(Object->Colors); - free(Object); - /*** FIXME: - * When we are willing to break API we need to make this function - * FreeMapObject(ColorMapObject **Object) - * and do this assignment to NULL here: - * *Object = NULL; - */ - } -} - -#ifdef DEBUG -void -DumpColorMap(ColorMapObject * Object, - FILE * fp) { - - if (Object) { - int i, j, Len = Object->ColorCount; - - for (i = 0; i < Len; i += 4) { - for (j = 0; j < 4 && j < Len; j++) { - fprintf(fp, "%3d: %02x %02x %02x ", i + j, - Object->Colors[i + j].Red, - Object->Colors[i + j].Green, - Object->Colors[i + j].Blue); - } - fprintf(fp, "\n"); - } - } -} -#endif /* DEBUG */ - -/* - * Compute the union of two given color maps and return it. If result can't - * fit into 256 colors, NULL is returned, the allocated union otherwise. - * ColorIn1 is copied as is to ColorUnion, while colors from ColorIn2 are - * copied iff they didn't exist before. ColorTransIn2 maps the old - * ColorIn2 into ColorUnion color map table. - */ -ColorMapObject * -UnionColorMap(const ColorMapObject * ColorIn1, - const ColorMapObject * ColorIn2, - GifPixelType ColorTransIn2[]) { - - int i, j, CrntSlot, RoundUpTo, NewBitSize; - ColorMapObject *ColorUnion; - - /* - * Allocate table which will hold the result for sure. - */ - ColorUnion = MakeMapObject(MAX(ColorIn1->ColorCount, - ColorIn2->ColorCount) * 2, NULL); - - if (ColorUnion == NULL) - return (NULL); - - /* Copy ColorIn1 to ColorUnionSize; */ - /*** FIXME: What if there are duplicate entries into the colormap to begin - * with? */ - for (i = 0; i < ColorIn1->ColorCount; i++) - ColorUnion->Colors[i] = ColorIn1->Colors[i]; - CrntSlot = ColorIn1->ColorCount; - - /* - * Potentially obnoxious hack: - * - * Back CrntSlot down past all contiguous {0, 0, 0} slots at the end - * of table 1. This is very useful if your display is limited to - * 16 colors. - */ - while (ColorIn1->Colors[CrntSlot - 1].Red == 0 - && ColorIn1->Colors[CrntSlot - 1].Green == 0 - && ColorIn1->Colors[CrntSlot - 1].Blue == 0) - CrntSlot--; - - /* Copy ColorIn2 to ColorUnionSize (use old colors if they exist): */ - for (i = 0; i < ColorIn2->ColorCount && CrntSlot <= 256; i++) { - /* Let's see if this color already exists: */ - /*** FIXME: Will it ever occur that ColorIn2 will contain duplicate - * entries? So we should search from 0 to CrntSlot rather than - * ColorIn1->ColorCount? - */ - for (j = 0; j < ColorIn1->ColorCount; j++) - if (memcmp (&ColorIn1->Colors[j], &ColorIn2->Colors[i], - sizeof(GifColorType)) == 0) - break; - - if (j < ColorIn1->ColorCount) - ColorTransIn2[i] = j; /* color exists in Color1 */ - else { - /* Color is new - copy it to a new slot: */ - ColorUnion->Colors[CrntSlot] = ColorIn2->Colors[i]; - ColorTransIn2[i] = CrntSlot++; - } - } - - if (CrntSlot > 256) { - FreeMapObject(ColorUnion); - return ((ColorMapObject *) NULL); - } - - NewBitSize = BitSize(CrntSlot); - RoundUpTo = (1 << NewBitSize); - - if (RoundUpTo != ColorUnion->ColorCount) { - register GifColorType *Map = ColorUnion->Colors; - - /* - * Zero out slots up to next power of 2. - * We know these slots exist because of the way ColorUnion's - * start dimension was computed. - */ - for (j = CrntSlot; j < RoundUpTo; j++) - Map[j].Red = Map[j].Green = Map[j].Blue = 0; - - /* perhaps we can shrink the map? */ - if (RoundUpTo < ColorUnion->ColorCount) - ColorUnion->Colors = (GifColorType *)realloc(Map, - sizeof(GifColorType) * RoundUpTo); - } - - ColorUnion->ColorCount = RoundUpTo; - ColorUnion->BitsPerPixel = NewBitSize; - - return (ColorUnion); -} - -/* - * Apply a given color translation to the raster bits of an image - */ -void -ApplyTranslation(SavedImage * Image, - GifPixelType Translation[]) { - - register int i; - register int RasterSize = Image->ImageDesc.Height * Image->ImageDesc.Width; - - for (i = 0; i < RasterSize; i++) - Image->RasterBits[i] = Translation[Image->RasterBits[i]]; -} - -/****************************************************************************** - * Extension record functions - *****************************************************************************/ - -void -MakeExtension(SavedImage * New, - int Function) { - - New->Function = Function; - /*** FIXME: - * Someday we might have to deal with multiple extensions. - * ??? Was this a note from Gershon or from me? Does the multiple - * extension blocks solve this or do we need multiple Functions? Or is - * this an obsolete function? (People should use AddExtensionBlock - * instead?) - * Looks like AddExtensionBlock needs to take the int Function argument - * then it can take the place of this function. Right now people have to - * use both. Fix AddExtensionBlock and add this to the deprecation list. - */ -} - -int -AddExtensionBlock(SavedImage * New, - int Len, - unsigned char ExtData[]) { - - ExtensionBlock *ep; - - if (New->ExtensionBlocks == NULL) - New->ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock)); - else - New->ExtensionBlocks = (ExtensionBlock *)realloc(New->ExtensionBlocks, - sizeof(ExtensionBlock) * - (New->ExtensionBlockCount + 1)); - - if (New->ExtensionBlocks == NULL) - return (GIF_ERROR); - - ep = &New->ExtensionBlocks[New->ExtensionBlockCount++]; - - ep->ByteCount=Len; - ep->Bytes = (char *)malloc(ep->ByteCount); - if (ep->Bytes == NULL) - return (GIF_ERROR); - - if (ExtData) { - memcpy(ep->Bytes, ExtData, Len); - ep->Function = New->Function; - } - - return (GIF_OK); -} - -void -FreeExtension(SavedImage * Image) -{ - ExtensionBlock *ep; - - if ((Image == NULL) || (Image->ExtensionBlocks == NULL)) { - return; - } - for (ep = Image->ExtensionBlocks; - ep < (Image->ExtensionBlocks + Image->ExtensionBlockCount); ep++) - (void)free((char *)ep->Bytes); - free((char *)Image->ExtensionBlocks); - Image->ExtensionBlocks = NULL; -} - -/****************************************************************************** - * Image block allocation functions -******************************************************************************/ - -/* Private Function: - * Frees the last image in the GifFile->SavedImages array - */ -void -FreeLastSavedImage(GifFileType *GifFile) { - - SavedImage *sp; - - if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) - return; - - /* Remove one SavedImage from the GifFile */ - GifFile->ImageCount--; - sp = &GifFile->SavedImages[GifFile->ImageCount]; - - /* Deallocate its Colormap */ - if (sp->ImageDesc.ColorMap) { - FreeMapObject(sp->ImageDesc.ColorMap); - sp->ImageDesc.ColorMap = NULL; - } - - /* Deallocate the image data */ - if (sp->RasterBits) - free((char *)sp->RasterBits); - - /* Deallocate any extensions */ - if (sp->ExtensionBlocks) - FreeExtension(sp); - - /*** FIXME: We could realloc the GifFile->SavedImages structure but is - * there a point to it? Saves some memory but we'd have to do it every - * time. If this is used in FreeSavedImages then it would be inefficient - * (The whole array is going to be deallocated.) If we just use it when - * we want to free the last Image it's convenient to do it here. - */ -} - -/* - * Append an image block to the SavedImages array - */ -SavedImage * -MakeSavedImage(GifFileType * GifFile, - const SavedImage * CopyFrom) { - - SavedImage *sp; - - if (GifFile->SavedImages == NULL) - GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage)); - else - GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * (GifFile->ImageCount + 1)); - - if (GifFile->SavedImages == NULL) - return ((SavedImage *)NULL); - else { - sp = &GifFile->SavedImages[GifFile->ImageCount++]; - memset((char *)sp, '\0', sizeof(SavedImage)); - - if (CopyFrom) { - memcpy((char *)sp, CopyFrom, sizeof(SavedImage)); - - /* - * Make our own allocated copies of the heap fields in the - * copied record. This guards against potential aliasing - * problems. - */ - - /* first, the local color map */ - if (sp->ImageDesc.ColorMap) { - sp->ImageDesc.ColorMap = MakeMapObject( - CopyFrom->ImageDesc.ColorMap->ColorCount, - CopyFrom->ImageDesc.ColorMap->Colors); - if (sp->ImageDesc.ColorMap == NULL) { - FreeLastSavedImage(GifFile); - return (SavedImage *)(NULL); - } - } - - /* next, the raster */ - sp->RasterBits = (unsigned char *)malloc(sizeof(GifPixelType) * - CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width); - if (sp->RasterBits == NULL) { - FreeLastSavedImage(GifFile); - return (SavedImage *)(NULL); - } - memcpy(sp->RasterBits, CopyFrom->RasterBits, - sizeof(GifPixelType) * CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width); - - /* finally, the extension blocks */ - if (sp->ExtensionBlocks) { - sp->ExtensionBlocks = (ExtensionBlock *)malloc( - sizeof(ExtensionBlock) * - CopyFrom->ExtensionBlockCount); - if (sp->ExtensionBlocks == NULL) { - FreeLastSavedImage(GifFile); - return (SavedImage *)(NULL); - } - memcpy(sp->ExtensionBlocks, CopyFrom->ExtensionBlocks, - sizeof(ExtensionBlock) * CopyFrom->ExtensionBlockCount); - - /* - * For the moment, the actual blocks can take their - * chances with free(). We'll fix this later. - *** FIXME: [Better check this out... Toshio] - * 2004 May 27: Looks like this was an ESR note. - * It means the blocks are shallow copied from InFile to - * OutFile. However, I don't see that in this code.... - * Did ESR fix it but never remove this note (And other notes - * in gifspnge?) - */ - } - } - - return (sp); - } -} - -void -FreeSavedImages(GifFileType * GifFile) { - - SavedImage *sp; - - if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) { - return; - } - for (sp = GifFile->SavedImages; - sp < GifFile->SavedImages + GifFile->ImageCount; sp++) { - if (sp->ImageDesc.ColorMap) { - FreeMapObject(sp->ImageDesc.ColorMap); - sp->ImageDesc.ColorMap = NULL; - } - - if (sp->RasterBits) - free((char *)sp->RasterBits); - - if (sp->ExtensionBlocks) - FreeExtension(sp); - } - free((char *)GifFile->SavedImages); - GifFile->SavedImages=NULL; -} diff --git a/Engine/lib/nativeFileDialogs/SConstruct b/Engine/lib/nativeFileDialogs/SConstruct index 342fa1a3a..b1a9e4881 100644 --- a/Engine/lib/nativeFileDialogs/SConstruct +++ b/Engine/lib/nativeFileDialogs/SConstruct @@ -3,7 +3,8 @@ # # Scons build script -- GCC, Clang, Visual Studio # Does not build test - +# +# SCons builds are deprecated -- see README.md for details. import os @@ -97,3 +98,5 @@ set_warnings(nfd_env) nfd_env.Append( CPPPATH=['.','./include'] ) nfd_env.StaticLibrary( get_lib_name('nfd', debug), nfd_files ) + +print "*** Scons builds are deprecated! See README.md for details." diff --git a/Engine/lib/nativeFileDialogs/common.h b/Engine/lib/nativeFileDialogs/common.h index 688b0b1fd..7745d323b 100644 --- a/Engine/lib/nativeFileDialogs/common.h +++ b/Engine/lib/nativeFileDialogs/common.h @@ -11,7 +11,7 @@ #define _NFD_COMMON_H #define NFD_MAX_STRLEN 256 -#define _NFD_UNUSED(x) ((void)x) +#define _NFD_UNUSED(x) ((void)x) void *NFDi_Malloc( size_t bytes ); void NFDi_Free( void *ptr ); diff --git a/Engine/lib/nativeFileDialogs/include/nfd.h b/Engine/lib/nativeFileDialogs/include/nfd.h index 03fe53206..74c92743f 100644 --- a/Engine/lib/nativeFileDialogs/include/nfd.h +++ b/Engine/lib/nativeFileDialogs/include/nfd.h @@ -50,6 +50,11 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, const nfdchar_t *defaultPath, nfdchar_t **outPath ); + +/* select folder dialog */ +nfdresult_t NFD_PickFolder( const nfdchar_t *defaultPath, + nfdchar_t **outPath); + /* nfd_common.c */ /* get last error -- set when nfdresult_t returns NFD_ERROR */ diff --git a/Engine/lib/nativeFileDialogs/nfd_cocoa.m b/Engine/lib/nativeFileDialogs/nfd_cocoa.m index a73e15714..d3fb48347 100644 --- a/Engine/lib/nativeFileDialogs/nfd_cocoa.m +++ b/Engine/lib/nativeFileDialogs/nfd_cocoa.m @@ -122,7 +122,8 @@ nfdresult_t NFD_OpenDialog( const char *filterList, nfdchar_t **outPath ) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + + NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; NSOpenPanel *dialog = [NSOpenPanel openPanel]; [dialog setAllowsMultipleSelection:NO]; @@ -152,6 +153,7 @@ nfdresult_t NFD_OpenDialog( const char *filterList, } [pool release]; + [keyWindow makeKeyAndOrderFront:nil]; return nfdResult; } @@ -233,3 +235,42 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, return nfdResult; } + +nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, + nfdchar_t **outPath) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; + NSOpenPanel *dialog = [NSOpenPanel openPanel]; + [dialog setAllowsMultipleSelection:NO]; + [dialog setCanChooseDirectories:YES]; + [dialog setCanCreateDirectories:YES]; + [dialog setCanChooseFiles:NO]; + + // Set the starting directory + SetDefaultPath(dialog, defaultPath); + + nfdresult_t nfdResult = NFD_CANCEL; + if ( [dialog runModal] == NSModalResponseOK ) + { + NSURL *url = [dialog URL]; + const char *utf8Path = [[url path] UTF8String]; + + // byte count, not char count + size_t len = strlen(utf8Path);//NFDi_UTF8_Strlen(utf8Path); + + *outPath = NFDi_Malloc( len+1 ); + if ( !*outPath ) + { + [pool release]; + return NFD_ERROR; + } + memcpy( *outPath, utf8Path, len+1 ); /* copy null term */ + nfdResult = NFD_OKAY; + } + [pool release]; + + [keyWindow makeKeyAndOrderFront:nil]; + return nfdResult; +} diff --git a/Engine/lib/nativeFileDialogs/nfd_gtk.c b/Engine/lib/nativeFileDialogs/nfd_gtk.c index fd15a86dd..65bc41dad 100644 --- a/Engine/lib/nativeFileDialogs/nfd_gtk.c +++ b/Engine/lib/nativeFileDialogs/nfd_gtk.c @@ -47,14 +47,10 @@ static void AddFiltersToDialog( GtkWidget *dialog, const char *filterList ) if ( NFDi_IsFilterSegmentChar(*p_filterList) ) { char typebufWildcard[NFD_MAX_STRLEN]; - /* add another type to the filter */ - if (strlen(typebuf) <= 0 || strlen(typebuf) > NFD_MAX_STRLEN-1) - { - p_filterList++; - continue; - } - + assert( strlen(typebuf) > 0 ); + assert( strlen(typebuf) < NFD_MAX_STRLEN-1 ); + snprintf( typebufWildcard, NFD_MAX_STRLEN, "*.%s", typebuf ); AddTypeToFilterName( typebuf, filterName, NFD_MAX_STRLEN ); @@ -297,6 +293,59 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, /* Build the filter list */ AddFiltersToDialog(dialog, filterList); + /* Set the default path */ + SetDefaultPath(dialog, defaultPath); + + result = NFD_CANCEL; + if ( gtk_dialog_run( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) + { + char *filename; + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(dialog) ); + + { + size_t len = strlen(filename); + *outPath = NFDi_Malloc( len + 1 ); + memcpy( *outPath, filename, len + 1 ); + if ( !*outPath ) + { + g_free( filename ); + gtk_widget_destroy(dialog); + return NFD_ERROR; + } + } + g_free(filename); + + result = NFD_OKAY; + } + + WaitForCleanup(); + gtk_widget_destroy(dialog); + WaitForCleanup(); + + return result; +} + +nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, + nfdchar_t **outPath) +{ + GtkWidget *dialog; + nfdresult_t result; + + if (!gtk_init_check(NULL, NULL)) + { + NFDi_SetError(INIT_FAIL_MSG); + return NFD_ERROR; + } + + dialog = gtk_file_chooser_dialog_new( "Select folder", + NULL, + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + "_Cancel", GTK_RESPONSE_CANCEL, + "_Select", GTK_RESPONSE_ACCEPT, + NULL ); + gtk_file_chooser_set_do_overwrite_confirmation( GTK_FILE_CHOOSER(dialog), TRUE ); + + /* Set the default path */ SetDefaultPath(dialog, defaultPath); diff --git a/Engine/lib/nativeFileDialogs/nfd_win.cpp b/Engine/lib/nativeFileDialogs/nfd_win.cpp index 45878824a..a73fd8a46 100644 --- a/Engine/lib/nativeFileDialogs/nfd_win.cpp +++ b/Engine/lib/nativeFileDialogs/nfd_win.cpp @@ -9,13 +9,17 @@ #define UNICODE #endif +#ifdef __MINGW32__ +// Explicitly setting NTDDI version, this is necessary for the MinGW compiler +#define NTDDI_VERSION NTDDI_VISTA +#define _WIN32_WINNT _WIN32_WINNT_VISTA +#endif #include #include #include #include #include - #include "nfd_common.h" @@ -359,14 +363,15 @@ nfdresult_t NFD_OpenDialog( const char *filterList, HRESULT result = ::CoInitializeEx(NULL, ::COINIT_APARTMENTTHREADED | ::COINIT_DISABLE_OLE1DDE ); + + ::IFileOpenDialog *fileOpenDialog(NULL); + if ( !SUCCEEDED(result)) { NFDi_SetError("Could not initialize COM."); goto end; } - ::IFileOpenDialog *fileOpenDialog(NULL); - // Create dialog result = ::CoCreateInstance(::CLSID_FileOpenDialog, NULL, CLSCTX_ALL, ::IID_IFileOpenDialog, @@ -616,3 +621,133 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, return nfdResult; } + +class AutoCoInit +{ +public: + AutoCoInit() + { + mResult = ::CoInitializeEx(NULL, + ::COINIT_APARTMENTTHREADED | + ::COINIT_DISABLE_OLE1DDE); + } + + ~AutoCoInit() + { + if (SUCCEEDED(mResult)) + { + ::CoUninitialize(); + } + } + + HRESULT Result() const { return mResult; } +private: + HRESULT mResult; +}; + +// VS2010 hasn't got a copy of CComPtr - this was first added in the 2003 SDK, so we make our own small CComPtr instead +template +class ComPtr +{ +public: + ComPtr() : mPtr(NULL) { } + ~ComPtr() + { + if (mPtr) + { + mPtr->Release(); + } + } + + T* Ptr() const { return mPtr; } + T** operator&() { return &mPtr; } + T* operator->() const { return mPtr; } +private: + // Don't allow copy or assignment + ComPtr(const ComPtr&); + ComPtr& operator = (const ComPtr&) const; + T* mPtr; +}; + +nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, + nfdchar_t **outPath) +{ + // Init COM + AutoCoInit autoCoInit; + if (!SUCCEEDED(autoCoInit.Result())) + { + NFDi_SetError("CoInitializeEx failed."); + return NFD_ERROR; + } + + // Create the file dialog COM object + ComPtr pFileDialog; + if (!SUCCEEDED(CoCreateInstance(CLSID_FileOpenDialog, + NULL, + CLSCTX_ALL, + IID_PPV_ARGS(&pFileDialog)))) + { + NFDi_SetError("CoCreateInstance for CLSID_FileOpenDialog failed."); + return NFD_ERROR; + } + + // Set the default path + if (SetDefaultPath(pFileDialog.Ptr(), defaultPath) != NFD_OKAY) + { + NFDi_SetError("SetDefaultPath failed."); + return NFD_ERROR; + } + + // Get the dialogs options + DWORD dwOptions = 0; + if (!SUCCEEDED(pFileDialog->GetOptions(&dwOptions))) + { + NFDi_SetError("GetOptions for IFileDialog failed."); + return NFD_ERROR; + } + + // Add in FOS_PICKFOLDERS which hides files and only allows selection of folders + if (!SUCCEEDED(pFileDialog->SetOptions(dwOptions | FOS_PICKFOLDERS))) + { + NFDi_SetError("SetOptions for IFileDialog failed."); + return NFD_ERROR; + } + + // Show the dialog to the user + const HRESULT result = pFileDialog->Show(NULL); + if (result == HRESULT_FROM_WIN32(ERROR_CANCELLED)) + { + return NFD_CANCEL; + } + else if (!SUCCEEDED(result)) + { + NFDi_SetError("Show for IFileDialog failed."); + return NFD_ERROR; + } + + // Get the shell item result + ComPtr pShellItem; + if (!SUCCEEDED(pFileDialog->GetResult(&pShellItem))) + { + return NFD_OKAY; + } + + // Finally get the path + wchar_t *path = NULL; + if (!SUCCEEDED(pShellItem->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, &path))) + { + NFDi_SetError("GetDisplayName for IShellItem failed."); + return NFD_ERROR; + } + + // Convert string + CopyWCharToNFDChar(path, outPath); + CoTaskMemFree(path); + if (!*outPath) + { + // error is malloc-based, error message would be redundant + return NFD_ERROR; + } + + return NFD_OKAY; +} diff --git a/Engine/lib/sdl/CMakeLists.txt b/Engine/lib/sdl/CMakeLists.txt index 54a23f0c7..ef82e73a0 100644 --- a/Engine/lib/sdl/CMakeLists.txt +++ b/Engine/lib/sdl/CMakeLists.txt @@ -1166,11 +1166,6 @@ elseif(WINDOWS) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) list(APPEND EXTRA_LIBS dinput8) - if(CMAKE_COMPILER_IS_MINGW) - list(APPEND EXTRA_LIBS dxerr8) - elseif (NOT USE_WINSDK_DIRECTX) - list(APPEND EXTRA_LIBS dxerr) - endif() endif() if(HAVE_XINPUT_H) set(SDL_JOYSTICK_XINPUT 1) diff --git a/Engine/lib/sdl/configure.in b/Engine/lib/sdl/configure.in index 37c57e288..f38f02e34 100644 --- a/Engine/lib/sdl/configure.in +++ b/Engine/lib/sdl/configure.in @@ -3144,7 +3144,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau fi if test x$have_dinput = xyes; then AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ]) - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid" fi else AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) diff --git a/Engine/source/T3D/assets/ComponentAsset.cpp b/Engine/source/T3D/assets/ComponentAsset.cpp index b329d391f..83045832e 100644 --- a/Engine/source/T3D/assets/ComponentAsset.cpp +++ b/Engine/source/T3D/assets/ComponentAsset.cpp @@ -74,7 +74,7 @@ ConsoleSetType(TypeComponentAssetPtr) if (pAssetPtr == NULL) { // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + //Con::warnf("(TypeComponentAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); return; } @@ -85,24 +85,20 @@ ConsoleSetType(TypeComponentAssetPtr) } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeComponentAssetPtr) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -ComponentAsset::ComponentAsset() : - mpOwningAssetManager(NULL), - mAssetInitialized(false), - mAcquireReferenceCount(0) +ComponentAsset::ComponentAsset() { - // Generate an asset definition. - mpAssetDefinition = new AssetDefinition(); + mComponentName = StringTable->EmptyString(); + mComponentClass = StringTable->EmptyString(); + mFriendlyName = StringTable->EmptyString(); + mComponentType = StringTable->EmptyString(); + mDescription = StringTable->EmptyString(); - mComponentName = StringTable->lookup(""); - mComponentClass = StringTable->lookup(""); - mFriendlyName = StringTable->lookup(""); - mComponentType = StringTable->lookup(""); - mDescription = StringTable->lookup(""); + mScriptFile = StringTable->EmptyString(); } //----------------------------------------------------------------------------- @@ -127,6 +123,8 @@ void ComponentAsset::initPersistFields() addField("friendlyName", TypeString, Offset(mFriendlyName, ComponentAsset), "The human-readble name for the component."); addField("componentType", TypeString, Offset(mComponentType, ComponentAsset), "The category of the component for organizing in the editor."); addField("description", TypeString, Offset(mDescription, ComponentAsset), "Simple description of the component."); + + addField("scriptFile", TypeString, Offset(mScriptFile, ComponentAsset), "A script file with additional scripted functionality for this component."); } //------------------------------------------------------------------------------ @@ -135,4 +133,16 @@ void ComponentAsset::copyTo(SimObject* object) { // Call to parent. Parent::copyTo(object); +} + +void ComponentAsset::initializeAsset() +{ + if(Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); +} + +void ComponentAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); } \ No newline at end of file diff --git a/Engine/source/T3D/assets/ComponentAsset.h b/Engine/source/T3D/assets/ComponentAsset.h index 1db53b8c8..9d803970b 100644 --- a/Engine/source/T3D/assets/ComponentAsset.h +++ b/Engine/source/T3D/assets/ComponentAsset.h @@ -44,17 +44,14 @@ class ComponentAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - StringTableEntry mComponentName; StringTableEntry mComponentClass; StringTableEntry mFriendlyName; StringTableEntry mComponentType; StringTableEntry mDescription; + StringTableEntry mScriptFile; + public: ComponentAsset(); virtual ~ComponentAsset(); @@ -69,12 +66,20 @@ public: StringTableEntry getComponentName() { return mComponentName; } StringTableEntry getComponentClass() { return mComponentClass; } StringTableEntry getFriendlyName() { return mFriendlyName; } - StringTableEntry getFriendlyType() { return mComponentType; } + StringTableEntry getComponentType() { return mComponentType; } StringTableEntry getDescription() { return mDescription; } + void setComponentName(StringTableEntry name) { mComponentName = name; } + void setComponentClass(StringTableEntry name) { mComponentClass = name; } + void setFriendlyName(StringTableEntry name) { mFriendlyName = name; } + void setComponentType(StringTableEntry typeName) { mComponentType = typeName; } + void setDescription(StringTableEntry description) { mDescription = description; } + + AssetDefinition* getAssetDefinition() { return mpAssetDefinition; } + protected: - virtual void initializeAsset(void) {} - virtual void onAssetRefresh(void) {} + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); }; DefineConsoleType(TypeComponentAssetPtr, ComponentAsset) diff --git a/Engine/source/T3D/assets/ExampleAsset.cpp b/Engine/source/T3D/assets/ExampleAsset.cpp index eed7a4d19..b8c43ac07 100644 --- a/Engine/source/T3D/assets/ExampleAsset.cpp +++ b/Engine/source/T3D/assets/ExampleAsset.cpp @@ -74,7 +74,7 @@ ConsoleSetType(TypeExampleAssetPtr) if (pAssetPtr == NULL) { // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + //Con::warnf("(TypeExampleAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); return; } @@ -85,18 +85,13 @@ ConsoleSetType(TypeExampleAssetPtr) } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeExampleAssetPtr) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -ExampleAsset::ExampleAsset() : -mpOwningAssetManager(NULL), -mAssetInitialized(false), -mAcquireReferenceCount(0) +ExampleAsset::ExampleAsset() { - // Generate an asset definition. - mpAssetDefinition = new AssetDefinition(); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/assets/ExampleAsset.h b/Engine/source/T3D/assets/ExampleAsset.h index 43532a6e5..b3a5a7695 100644 --- a/Engine/source/T3D/assets/ExampleAsset.h +++ b/Engine/source/T3D/assets/ExampleAsset.h @@ -43,11 +43,6 @@ class ExampleAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - public: ExampleAsset(); virtual ~ExampleAsset(); diff --git a/Engine/source/T3D/assets/GUIAsset.cpp b/Engine/source/T3D/assets/GUIAsset.cpp new file mode 100644 index 000000000..a011b56e3 --- /dev/null +++ b/Engine/source/T3D/assets/GUIAsset.cpp @@ -0,0 +1,222 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef GUI_ASSET_H +#include "GUIAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GUIAsset); + +ConsoleType(GUIAssetPtr, TypeGUIAssetPtr, GUIAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeGUIAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeGUIAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeGUIAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeGUIAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +GUIAsset::GUIAsset() +{ + mScriptFilePath = StringTable->EmptyString(); + mGUIFilePath = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +GUIAsset::~GUIAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void GUIAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFilePath", TypeString, Offset(mScriptFilePath, GUIAsset), "Path to the script file for the gui"); + addField("GUIFilePath", TypeString, Offset(mGUIFilePath, GUIAsset), "Path to the gui file"); +} + +//------------------------------------------------------------------------------ + +void GUIAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void GUIAsset::initializeAsset() +{ + if (Platform::isFile(mGUIFilePath)) + Con::executeFile(mGUIFilePath, false, false); + + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +void GUIAsset::onAssetRefresh() +{ + if (Platform::isFile(mGUIFilePath)) + Con::executeFile(mGUIFilePath, false, false); + + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeGUIAssetPtr); + +ConsoleDocClass(GuiInspectorTypeGUIAssetPtr, + "@brief Inspector field type for GUI Asset Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeGUIAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeGUIAssetPtr)->setInspectorFieldType("GuiInspectorTypeGUIAssetPtr"); +} + +GuiControl* GuiInspectorTypeGUIAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"GUIAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeGUIAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/GUIAsset.h b/Engine/source/T3D/assets/GUIAsset.h new file mode 100644 index 000000000..5668f9afd --- /dev/null +++ b/Engine/source/T3D/assets/GUIAsset.h @@ -0,0 +1,89 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef GUI_ASSET_H +#define GUI_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" + +//----------------------------------------------------------------------------- +class GUIAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mScriptFilePath; + StringTableEntry mGUIFilePath; + +public: + GUIAsset(); + virtual ~GUIAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(GUIAsset); + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); +}; + +DefineConsoleType(TypeGUIAssetPtr, GUIAsset) + + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeGUIAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeGUIAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/GameObjectAsset.cpp b/Engine/source/T3D/assets/GameObjectAsset.cpp index 6659504bd..45b33b086 100644 --- a/Engine/source/T3D/assets/GameObjectAsset.cpp +++ b/Engine/source/T3D/assets/GameObjectAsset.cpp @@ -74,7 +74,7 @@ ConsoleSetType(TypeGameObjectAssetPtr) if (pAssetPtr == NULL) { // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + //Con::warnf("(TypeGameObjectAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); return; } @@ -85,19 +85,13 @@ ConsoleSetType(TypeGameObjectAssetPtr) } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeGameObjectAssetPtr) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -GameObjectAsset::GameObjectAsset() : - mpOwningAssetManager(NULL), - mAssetInitialized(false), - mAcquireReferenceCount(0) +GameObjectAsset::GameObjectAsset() { - // Generate an asset definition. - mpAssetDefinition = new AssetDefinition(); - mGameObjectName = StringTable->lookup(""); mScriptFilePath = StringTable->lookup(""); mTAMLFilePath = StringTable->lookup(""); @@ -131,4 +125,94 @@ void GameObjectAsset::copyTo(SimObject* object) { // Call to parent. Parent::copyTo(object); +} + +void GameObjectAsset::initializeAsset() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +void GameObjectAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeGameObjectAssetPtr); + +ConsoleDocClass(GuiInspectorTypeGameObjectAssetPtr, + "@brief Inspector field type for Game Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeGameObjectAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeGameObjectAssetPtr)->setInspectorFieldType("GuiInspectorTypeGameObjectAssetPtr"); +} + +GuiControl* GuiInspectorTypeGameObjectAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"GameObjectAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeGameObjectAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; } \ No newline at end of file diff --git a/Engine/source/T3D/assets/GameObjectAsset.h b/Engine/source/T3D/assets/GameObjectAsset.h index 82230cd5c..954a11300 100644 --- a/Engine/source/T3D/assets/GameObjectAsset.h +++ b/Engine/source/T3D/assets/GameObjectAsset.h @@ -38,17 +38,15 @@ #ifndef _ASSET_FIELD_TYPES_H_ #include "assets/assetFieldTypes.h" #endif +#ifndef _GUI_INSPECTOR_TYPES_H_ +#include "gui/editor/guiInspectorTypes.h" +#endif //----------------------------------------------------------------------------- class GameObjectAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - StringTableEntry mGameObjectName; StringTableEntry mScriptFilePath; StringTableEntry mTAMLFilePath; @@ -65,11 +63,29 @@ public: DECLARE_CONOBJECT(GameObjectAsset); protected: - virtual void initializeAsset(void) {} - virtual void onAssetRefresh(void) {} + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); }; DefineConsoleType(TypeGameObjectAssetPtr, GameObjectAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeGameObjectAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeGameObjectAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + #endif // _ASSET_BASE_H_ diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp new file mode 100644 index 000000000..3e29b0bdf --- /dev/null +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -0,0 +1,161 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef IMAGE_ASSET_H +#include "ImageAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ImageAsset); + +ConsoleType(ImageAssetPtr, TypeImageAssetPtr, ImageAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeImageAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeImageAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeImageAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeImageAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ImageAsset::ImageAsset() +{ + mImageFileName = StringTable->EmptyString(); + + mImage = NULL; + mUseMips = true; + mIsHDRImage = false; + mIsValidImage = false; +} + +//----------------------------------------------------------------------------- + +ImageAsset::~ImageAsset() +{ +} + +//----------------------------------------------------------------------------- + +void ImageAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("imageFile", TypeString, Offset(mImageFileName, ImageAsset), "Path to the image file."); + addField("useMips", TypeBool, Offset(mUseMips, ImageAsset), "Should the image use mips? (Currently unused)."); + addField("isHDRImage", TypeBool, Offset(mIsHDRImage, ImageAsset), "Is the image in an HDR format? (Currently unused)"); +} + +//------------------------------------------------------------------------------ + +void ImageAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void ImageAsset::loadImage() +{ + SAFE_DELETE(mImage); + + if (mImageFileName) + { + if (!Platform::isFile(mImageFileName)) + { + Con::errorf("ImageAsset::initializeAsset: Attempted to load file %s but it was not valid!", mImageFileName); + return; + } + + mImage.set(mImageFileName, &GFXStaticTextureSRGBProfile, avar("%s() - mImage (line %d)", __FUNCTION__, __LINE__)); + + if (mImage) + { + mIsValidImage = true; + return; + } + } + + mIsValidImage = false; +} + +void ImageAsset::initializeAsset() +{ + loadImage(); +} + +void ImageAsset::onAssetRefresh() +{ + loadImage(); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h new file mode 100644 index 000000000..d289ac195 --- /dev/null +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -0,0 +1,90 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef IMAGE_ASSET_H +#define IMAGE_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gfx/bitmap/gBitmap.h" +#include "gfx/gfxTextureHandle.h" + +//----------------------------------------------------------------------------- +class ImageAsset : public AssetBase +{ + typedef AssetBase Parent; + + AssetManager* mpOwningAssetManager; + bool mAssetInitialized; + AssetDefinition* mpAssetDefinition; + U32 mAcquireReferenceCount; + + StringTableEntry mImageFileName; + + GFXTexHandle mImage; + + bool mIsValidImage; + bool mUseMips; + bool mIsHDRImage; + +public: + ImageAsset(); + virtual ~ImageAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ImageAsset); + + StringTableEntry getImageFileName() { return mImageFileName; } + + bool isValid() { return mIsValidImage; } + + GFXTexHandle* getImage() { return &mImage; } + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); + + void loadImage(); +}; + +DefineConsoleType(TypeImageAssetPtr, ImageAsset) + +#endif + diff --git a/Engine/source/T3D/assets/LevelAsset.cpp b/Engine/source/T3D/assets/LevelAsset.cpp new file mode 100644 index 000000000..849cdc8d7 --- /dev/null +++ b/Engine/source/T3D/assets/LevelAsset.cpp @@ -0,0 +1,126 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef LEVEL_ASSET_H +#include "LevelAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(LevelAsset); + +ConsoleType(LevelAssetPtr, TypeLevelAssetPtr, LevelAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeLevelAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeLevelAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeLevelAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeLevelAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +LevelAsset::LevelAsset() +{ + mLevelFile = StringTable->EmptyString(); + mPreviewImage = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +LevelAsset::~LevelAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void LevelAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("LevelFile", TypeString, Offset(mLevelFile, LevelAsset), "Path to the actual level file."); + addField("PreviewImage", TypeString, Offset(mPreviewImage, LevelAsset), "Path to the image used for selection preview."); +} + +//------------------------------------------------------------------------------ + +void LevelAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/LevelAsset.h b/Engine/source/T3D/assets/LevelAsset.h new file mode 100644 index 000000000..3fc58c183 --- /dev/null +++ b/Engine/source/T3D/assets/LevelAsset.h @@ -0,0 +1,72 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef LEVEL_ASSET_H +#define LEVEL_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +//----------------------------------------------------------------------------- +class LevelAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mLevelFile; + StringTableEntry mPreviewImage; + + bool mIsSubLevel; + StringTableEntry mMainLevelAsset; + +public: + LevelAsset(); + virtual ~LevelAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(LevelAsset); + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} +}; + +DefineConsoleType(TypeLevelAssetPtr, LevelAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp new file mode 100644 index 000000000..697f21e37 --- /dev/null +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -0,0 +1,241 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef MATERIALASSET_H +#include "MaterialAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(MaterialAsset); + +ConsoleType(MaterialAssetPtr, TypeMaterialAssetPtr, MaterialAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeMaterialAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeMaterialAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeMaterialAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeMaterialAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +MaterialAsset::MaterialAsset() +{ + mShaderGraphFile = ""; + mScriptFile = ""; + mMatDefinitionName = ""; +} + +//----------------------------------------------------------------------------- + +MaterialAsset::~MaterialAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void MaterialAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + //addField("shaderGraph", TypeRealString, Offset(mShaderGraphFile, MaterialAsset), ""); + addField("scriptFile", TypeRealString, Offset(mScriptFile, MaterialAsset), "Path to the file containing the material definition."); + addField("materialDefinitionName", TypeRealString, Offset(mMatDefinitionName, MaterialAsset), "Name of the material definition this asset is for."); +} + +void MaterialAsset::initializeAsset() +{ + // Call parent. + Parent::initializeAsset(); + + compileShader(); + + if (Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); +} + +void MaterialAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); + + if (!mMatDefinitionName.isEmpty()) + { + Material* matDef; + if (!Sim::findObject(mMatDefinitionName.c_str(), matDef)) + { + Con::errorf("MaterialAsset: Unable to find the Material %s", mMatDefinitionName.c_str()); + return; + } + + matDef->reload(); + } +} + +//------------------------------------------------------------------------------ + +void MaterialAsset::compileShader() +{ +} + +void MaterialAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +ConsoleMethod(MaterialAsset, compileShader, void, 2, 2, "() - Compiles the material's generated shader, if any. Not yet implemented\n") +{ + object->compileShader(); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeMaterialAssetPtr); + +ConsoleDocClass(GuiInspectorTypeMaterialAssetPtr, + "@brief Inspector field type for Material Asset Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeMaterialAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeMaterialAssetPtr)->setInspectorFieldType("GuiInspectorTypeMaterialAssetPtr"); +} + +GuiControl* GuiInspectorTypeMaterialAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Material Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeMaterialAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h new file mode 100644 index 000000000..2cb9f15b1 --- /dev/null +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef MATERIALASSET_H +#define MATERIALASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#ifndef _GFXDEVICE_H_ +#include "gfx/gfxDevice.h" +#endif + +#ifndef _GUI_INSPECTOR_TYPES_H_ +#include "gui/editor/guiInspectorTypes.h" +#endif + +#include "materials/matTextureTarget.h" +#include "materials/materialDefinition.h" +#include "materials/customMaterialDefinition.h" + +//----------------------------------------------------------------------------- +class MaterialAsset : public AssetBase +{ + typedef AssetBase Parent; + + String mShaderGraphFile; + String mScriptFile; + String mMatDefinitionName; + +public: + MaterialAsset(); + virtual ~MaterialAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + virtual void initializeAsset(); + virtual void onAssetRefresh(void); + + void compileShader(); + + String getMaterialDefinitionName() { return mMatDefinitionName; } + + /// Declare Console Object. + DECLARE_CONOBJECT(MaterialAsset); +}; + +DefineConsoleType(TypeMaterialAssetPtr, MaterialAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeMaterialAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeMaterialAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ParticleAsset.cpp b/Engine/source/T3D/assets/ParticleAsset.cpp new file mode 100644 index 000000000..bcefd2dfa --- /dev/null +++ b/Engine/source/T3D/assets/ParticleAsset.cpp @@ -0,0 +1,205 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef PARTICLE_ASSET_H +#include "ParticleAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ParticleAsset); + +ConsoleType(ParticleAssetPtr, TypeParticleAssetPtr, ParticleAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeParticleAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeParticleAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeParticleAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeParticleAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ParticleAsset::ParticleAsset() +{ + mScriptFilePath = StringTable->EmptyString(); + mDatablockFilePath = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +ParticleAsset::~ParticleAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void ParticleAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFilePath", TypeString, Offset(mScriptFilePath, ParticleAsset), "Path to the script file for the particle effect"); + addField("DatablockFilePath", TypeString, Offset(mDatablockFilePath, ParticleAsset), "Path to the datablock file"); +} + +//------------------------------------------------------------------------------ + +void ParticleAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeParticleAssetPtr); + +ConsoleDocClass(GuiInspectorTypeParticleAssetPtr, + "@brief Inspector field type for Partial Asset Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeParticleAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeParticleAssetPtr)->setInspectorFieldType("GuiInspectorTypeParticleAssetPtr"); +} + +GuiControl* GuiInspectorTypeParticleAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ParticleAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeParticleAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ParticleAsset.h b/Engine/source/T3D/assets/ParticleAsset.h new file mode 100644 index 000000000..b446c2cf0 --- /dev/null +++ b/Engine/source/T3D/assets/ParticleAsset.h @@ -0,0 +1,89 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef PARTICLE_ASSET_H +#define PARTICLE_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" + +//----------------------------------------------------------------------------- +class ParticleAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mScriptFilePath; + StringTableEntry mDatablockFilePath; + +public: + ParticleAsset(); + virtual ~ParticleAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ParticleAsset); + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} +}; + +DefineConsoleType(TypeParticleAssetPtr, ParticleAsset) + + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeParticleAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeParticleAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/PostEffectAsset.cpp b/Engine/source/T3D/assets/PostEffectAsset.cpp new file mode 100644 index 000000000..4eb67a6a3 --- /dev/null +++ b/Engine/source/T3D/assets/PostEffectAsset.cpp @@ -0,0 +1,129 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef POSTEFFECT_ASSET_H +#include "PostEffectAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(PostEffectAsset); + +ConsoleType(PostEffectAssetPtr, TypePostEffectAssetPtr, PostEffectAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypePostEffectAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypePostEffectAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypePostEffectAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypePostEffectAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +PostEffectAsset::PostEffectAsset() +{ + mScriptFile = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +PostEffectAsset::~PostEffectAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void PostEffectAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFile", TypeString, Offset(mScriptFile, PostEffectAsset), "Path to the script file."); +} + +//------------------------------------------------------------------------------ + +void PostEffectAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void PostEffectAsset::initializeAsset() +{ + //mPostEffect = new PostEffect(); +} \ No newline at end of file diff --git a/Engine/source/platform/menus/menuBar.h b/Engine/source/T3D/assets/PostEffectAsset.h similarity index 50% rename from Engine/source/platform/menus/menuBar.h rename to Engine/source/T3D/assets/PostEffectAsset.h index 0e0e64602..381fa1576 100644 --- a/Engine/source/platform/menus/menuBar.h +++ b/Engine/source/T3D/assets/PostEffectAsset.h @@ -1,5 +1,6 @@ +#pragma once //----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC +// Copyright (c) 2013 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to @@ -19,53 +20,52 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- +#ifndef POSTEFFECT_ASSET_H +#define POSTEFFECT_ASSET_H -#include "console/simBase.h" +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif -#ifndef _MENUBAR_H_ -#define _MENUBAR_H_ +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif -// Forward Refs -class PlatformMenuBarData; -class PopupMenu; -class GuiCanvas; +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif -class MenuBar : public SimSet +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "postFx/postEffect.h" + +//----------------------------------------------------------------------------- +class PostEffectAsset : public AssetBase { - typedef SimSet Parent; + typedef AssetBase Parent; -protected: - PlatformMenuBarData *mData; - GuiCanvas *mCanvas; - - /// Update the native menu bar to ensure consistency with the set - void updateMenuBar(PopupMenu *menu = NULL); - - void createPlatformPopupMenuData(); - void deletePlatformPopupMenuData(); + StringTableEntry mScriptFile; public: - MenuBar(); - virtual ~MenuBar(); - DECLARE_CONOBJECT(MenuBar); + PostEffectAsset(); + virtual ~PostEffectAsset(); - /// Attach this menu bar to the native menu bar - void attachToCanvas(GuiCanvas *owner, S32 pos); - /// Remove this menu bar from the native menu bar - void removeFromCanvas(); + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); - /// Returns true if this menu is attached to the menu bar - bool isAttachedToCanvas() { return mCanvas != NULL; } + virtual void initializeAsset(); - virtual void insertObject(SimObject *obj, S32 pos); + /// Declare Console Object. + DECLARE_CONOBJECT(PostEffectAsset); - // Overridden SimSet methods to ensure menu bar consistency when attached - virtual void addObject(SimObject *obj); - virtual void removeObject(SimObject *obj); - virtual void pushObject(SimObject *obj); - virtual void popObject(); - - virtual bool reOrder(SimObject *obj, SimObject *target = 0); +protected: + virtual void onAssetRefresh(void) {} }; -#endif // _MENUBAR_H_ +DefineConsoleType(TypePostEffectAssetPtr, PostEffectAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ScriptAsset.cpp b/Engine/source/T3D/assets/ScriptAsset.cpp new file mode 100644 index 000000000..dbc5e7a2e --- /dev/null +++ b/Engine/source/T3D/assets/ScriptAsset.cpp @@ -0,0 +1,137 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SCRIPT_ASSET_H +#include "ScriptAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ScriptAsset); + +ConsoleType(ScriptAssetPtr, TypeScriptAssetPtr, ScriptAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeScriptAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeScriptAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeScriptAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeScriptAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ScriptAsset::ScriptAsset() +{ + mScriptFilePath = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +ScriptAsset::~ScriptAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void ScriptAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFilePath", TypeString, Offset(mScriptFilePath, ScriptAsset), "Path to the script file."); + addField("isServerSide", TypeBool, Offset(mIsServerSide, ScriptAsset), "Is this script file to be run on the server side?"); + +} + +//------------------------------------------------------------------------------ + +void ScriptAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void ScriptAsset::initializeAsset() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +void ScriptAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ScriptAsset.h b/Engine/source/T3D/assets/ScriptAsset.h new file mode 100644 index 000000000..8c12f2b88 --- /dev/null +++ b/Engine/source/T3D/assets/ScriptAsset.h @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SCRIPT_ASSET_H +#define SCRIPT_ASSET_H +#pragma once + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +//----------------------------------------------------------------------------- +class ScriptAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mScriptFilePath; + bool mIsServerSide; + +public: + ScriptAsset(); + virtual ~ScriptAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ScriptAsset); + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); +}; + +DefineConsoleType(TypeScriptAssetPtr, ScriptAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp new file mode 100644 index 000000000..ee10bbe40 --- /dev/null +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp @@ -0,0 +1,131 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef SHAPE_ANIMATION_ASSET_H +#include "ShapeAnimationAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +#include "core/resourceManager.h" + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ShapeAnimationAsset); + +ConsoleType(ShapeAnimationAssetPtr, TypeShapeAnimationAssetPtr, ShapeAnimationAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeShapeAnimationAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeShapeAnimationAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeShapeAnimationAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeShapeAnimationAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ShapeAnimationAsset::ShapeAnimationAsset() +{ +} + +//----------------------------------------------------------------------------- + +ShapeAnimationAsset::~ShapeAnimationAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void ShapeAnimationAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("animationFile", TypeFilename, Offset(mFileName, ShapeAnimationAsset), "Path to the file name containing the animation"); + addField("animationName", TypeString, Offset(mAnimationName, ShapeAnimationAsset), "Name of the animation"); + + addField("startFrame", TypeS32, Offset(mStartFrame, ShapeAnimationAsset), "What frame does this animation clip start on"); + addField("endFrame", TypeS32, Offset(mEndFrame, ShapeAnimationAsset), "What fram does this animation clip end on"); + addField("padRotation", TypeBool, Offset(mPadRotation, ShapeAnimationAsset), "Are the rotation values padded"); + addField("padTransforms", TypeBool, Offset(mPadTransforms, ShapeAnimationAsset), "Are the transform values padded"); +} + +//------------------------------------------------------------------------------ + +void ShapeAnimationAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.h b/Engine/source/T3D/assets/ShapeAnimationAsset.h new file mode 100644 index 000000000..673607d53 --- /dev/null +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.h @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SHAPE_ANIMATION_ASSET_H +#define SHAPE_ANIMATION_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +//----------------------------------------------------------------------------- +class ShapeAnimationAsset : public AssetBase +{ + typedef AssetBase Parent; + +protected: + StringTableEntry mFileName; + + // + StringTableEntry mAnimationName; + S32 mStartFrame; + S32 mEndFrame; + bool mPadRotation; + bool mPadTransforms; + +public: + ShapeAnimationAsset(); + virtual ~ShapeAnimationAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ShapeAnimationAsset); + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} + +public: + StringTableEntry getAnimationFilename() { return mFileName; } + StringTableEntry getAnimationName() { return mAnimationName; } + + S32 getStartFrame() { return mStartFrame; } + S32 getEndFrame() { return mEndFrame; } + + bool getPadRotation() { return mPadRotation; } + bool getPadTransforms() { return mPadTransforms; } +}; + +DefineConsoleType(TypeShapeAnimationAssetPtr, ShapeAnimationAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +/*class GuiInspectorTypeShapeAnimationAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mShapeEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeShapeAnimationAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +};*/ + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index d8cbce453..099c3c117 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -49,14 +49,14 @@ IMPLEMENT_CONOBJECT(ShapeAsset); -ConsoleType(TestAssetPtr, TypeShapeAssetPtr, ShapeAsset, ASSET_ID_FIELD_PREFIX) +ConsoleType(assetIdString, TypeShapeAssetPtr, String, ASSET_ID_FIELD_PREFIX) //----------------------------------------------------------------------------- ConsoleGetType(TypeShapeAssetPtr) { // Fetch asset Id. - return (*((AssetPtr*)dptr)).getAssetId(); + return *((StringTableEntry*)dptr); } //----------------------------------------------------------------------------- @@ -69,33 +69,22 @@ ConsoleSetType(TypeShapeAssetPtr) // Yes, so fetch field value. const char* pFieldValue = argv[0]; - // Fetch asset pointer. - AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + // Fetch asset Id. + StringTableEntry* assetId = (StringTableEntry*)(dptr); - // Is the asset pointer the correct type? - if (pAssetPtr == NULL) - { - // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); - return; - } - - // Set asset. - pAssetPtr->setAssetId(pFieldValue); + // Update asset value. + *assetId = StringTable->insert(pFieldValue); return; } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeAssetId) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -ShapeAsset::ShapeAsset() : -mpOwningAssetManager(NULL), -mAssetInitialized(false), -mAcquireReferenceCount(0) +ShapeAsset::ShapeAsset() { } @@ -116,7 +105,21 @@ void ShapeAsset::initPersistFields() // Call parent. Parent::initPersistFields(); - addField("fileName", TypeFilename, Offset(mFileName, ShapeAsset), "Path to the script file we want to execute"); + addField("fileName", TypeFilename, Offset(mFileName, ShapeAsset), "Path to the shape file we want to render"); +} + +void ShapeAsset::setDataField(StringTableEntry slotName, const char *array, const char *value) +{ + Parent::setDataField(slotName, array, value); + + //Now, if it's a material slot of some fashion, set it up + StringTableEntry matSlotName = StringTable->insert("materialAsset"); + if (String(slotName).startsWith(matSlotName)) + { + StringTableEntry matId = StringTable->insert(value); + + mMaterialAssetIds.push_back(matId); + } } void ShapeAsset::initializeAsset() @@ -132,6 +135,45 @@ void ShapeAsset::initializeAsset() bool ShapeAsset::loadShape() { + mMaterialAssets.clear(); + mMaterialAssetIds.clear(); + + //First, load any material, animation, etc assets we may be referencing in our asset + // Find any asset dependencies. + AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId); + + // Does the asset have any dependencies? + if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end()) + { + // Iterate all dependencies. + while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId) + { + StringTableEntry assetType = mpOwningAssetManager->getAssetType(assetDependenciesItr->value); + + if (assetType == StringTable->insert("MaterialAsset")) + { + mMaterialAssetIds.push_back(assetDependenciesItr->value); + + //Force the asset to become initialized if it hasn't been already + AssetPtr matAsset = assetDependenciesItr->value; + + mMaterialAssets.push_back(matAsset); + } + else if (assetType == StringTable->insert("ShapeAnimationAsset")) + { + mAnimationAssetIds.push_back(assetDependenciesItr->value); + + //Force the asset to become initialized if it hasn't been already + AssetPtr animAsset = assetDependenciesItr->value; + + mAnimationAssets.push_back(animAsset); + } + + // Next dependency. + assetDependenciesItr++; + } + } + mShape = ResourceManager::get().load(mFileName); if (!mShape) @@ -140,6 +182,19 @@ bool ShapeAsset::loadShape() return false; //if it failed to load, bail out } + //Now that we've successfully loaded our shape and have any materials and animations loaded + //we need to set up the animations we're using on our shape + for (U32 i = 0; i < mAnimationAssets.size(); i++) + { + String srcName; + String srcPath(mAnimationAssets[i]->getAnimationFilename()); + SplitSequencePathAndName(srcPath, srcName); + + if (!mShape->addSequence(srcPath, srcName, mAnimationAssets[i]->getAnimationName(), + mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms())) + return false; + } + return true; } @@ -153,4 +208,141 @@ void ShapeAsset::copyTo(SimObject* object) void ShapeAsset::onAssetRefresh(void) { + if (dStrcmp(mFileName, "") == 0) + return; + + loadShape(); +} + +void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName) +{ + srcName = ""; + + // Determine if there is a sequence name at the end of the source string, and + // if so, split the filename from the sequence name + S32 split = srcPath.find(' ', 0, String::Right); + S32 split2 = srcPath.find('\t', 0, String::Right); + if ((split == String::NPos) || (split2 > split)) + split = split2; + if (split != String::NPos) + { + split2 = split + 1; + while ((srcPath[split2] != '\0') && dIsspace(srcPath[split2])) + split2++; + + // now 'split' is at the end of the path, and 'split2' is at the start of the sequence name + srcName = srcPath.substr(split2); + srcPath = srcPath.erase(split, srcPath.length() - split); + } +} + +ShapeAnimationAsset* ShapeAsset::getAnimation(S32 index) +{ + if (index < mAnimationAssets.size()) + { + return mAnimationAssets[index]; + } + + return nullptr; +} + +DefineEngineMethod(ShapeAsset, getMaterialCount, S32, (), , + "Gets the number of materials for this shape asset.\n" + "@return Material count.\n") +{ + return object->getMaterialCount(); +} + +DefineEngineMethod(ShapeAsset, getAnimationCount, S32, (), , + "Gets the number of animations for this shape asset.\n" + "@return Animation count.\n") +{ + return object->getAnimationCount(); +} + +DefineEngineMethod(ShapeAsset, getAnimation, ShapeAnimationAsset*, (S32 index), (0), + "Gets a particular shape animation asset for this shape.\n" + "@param animation asset index.\n" + "@return Shape Animation Asset.\n") +{ + return object->getAnimation(index); +} +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeShapeAssetPtr); + +ConsoleDocClass(GuiInspectorTypeShapeAssetPtr, + "@brief Inspector field type for Shapes\n\n" + "Editor use only.\n\n" + "@internal" + ); + +void GuiInspectorTypeShapeAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeShapeAssetPtr)->setInspectorFieldType("GuiInspectorTypeShapeAssetPtr"); +} + +GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + setDataField(StringTable->insert("ComponentOwner"), NULL, String::ToString(mInspector->getComponentGroupTargetId()).c_str()); + + // Create "Open in ShapeEditor" button + mShapeEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.openShapeAsset(%d.getText());", retCtrl->getId()); + mShapeEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mShapeEdButton->setBitmap(bitmapName); + + mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mShapeEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mShapeEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor"); + + mShapeEdButton->registerObject(); + addObject(mShapeEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeShapeAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mShapeEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mShapeEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; } \ No newline at end of file diff --git a/Engine/source/T3D/assets/ShapeAsset.h b/Engine/source/T3D/assets/ShapeAsset.h index d727d0a1c..45fca7e86 100644 --- a/Engine/source/T3D/assets/ShapeAsset.h +++ b/Engine/source/T3D/assets/ShapeAsset.h @@ -44,21 +44,35 @@ #ifndef __RESOURCE_H__ #include "core/resource.h" #endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif +#ifndef MATERIALASSET_H +#include "MaterialAsset.h" +#endif +#ifndef SHAPE_ANIMATION_ASSET_H +#include "ShapeAnimationAsset.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" //----------------------------------------------------------------------------- class ShapeAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - protected: StringTableEntry mFileName; Resource mShape; + //Material assets we're dependent on and use + Vector mMaterialAssetIds; + Vector> mMaterialAssets; + + //Animation assets we're dependent on and use + Vector mAnimationAssetIds; + Vector> mAnimationAssets; + public: ShapeAsset(); virtual ~ShapeAsset(); @@ -67,6 +81,8 @@ public: static void initPersistFields(); virtual void copyTo(SimObject* object); + virtual void setDataField(StringTableEntry slotName, const char *array, const char *value); + virtual void initializeAsset(); /// Declare Console Object. @@ -78,11 +94,37 @@ public: Resource getShapeResource() { return mShape; } + void SplitSequencePathAndName(String& srcPath, String& srcName); + String getShapeFilename() { return mFileName; } + + U32 getShapeFilenameHash() { return _StringTable::hashString(mFileName); } + + S32 getMaterialCount() { return mMaterialAssets.size(); } + S32 getAnimationCount() { return mAnimationAssets.size(); } + ShapeAnimationAsset* getAnimation(S32 index); + protected: virtual void onAssetRefresh(void); }; -DefineConsoleType(TypeShapeAssetPtr, ShapeAsset) +DefineConsoleType(TypeShapeAssetPtr, S32) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeShapeAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mShapeEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeShapeAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; #endif diff --git a/Engine/source/T3D/assets/SoundAsset.cpp b/Engine/source/T3D/assets/SoundAsset.cpp new file mode 100644 index 000000000..f2978aa38 --- /dev/null +++ b/Engine/source/T3D/assets/SoundAsset.cpp @@ -0,0 +1,141 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef SOUND_ASSET_H +#include "SoundAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(SoundAsset); + +ConsoleType(SoundAssetPtr, TypeSoundAssetPtr, SoundAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeSoundAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeSoundAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeSoundAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeSoundAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +SoundAsset::SoundAsset() +{ + mSoundFilePath = StringTable->EmptyString(); + + mPitchAdjust = 0; + mVolumeAdjust = 0; + + //mSound = nullptr; +} + +//----------------------------------------------------------------------------- + +SoundAsset::~SoundAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void SoundAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("soundFilePath", TypeFilename, Offset(mSoundFilePath, SoundAsset), "Path to the sound file."); + + addField("pitchAdjust", TypeF32, Offset(mPitchAdjust, SoundAsset), "Adjustment of the pitch value"); + addField("volumeAdjust", TypeF32, Offset(mVolumeAdjust, SoundAsset), "Adjustment to the volume."); +} + +//------------------------------------------------------------------------------ + +void SoundAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void SoundAsset::initializeAsset(void) +{ +} + +void SoundAsset::onAssetRefresh(void) +{ + +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/SoundAsset.h b/Engine/source/T3D/assets/SoundAsset.h new file mode 100644 index 000000000..bfe582823 --- /dev/null +++ b/Engine/source/T3D/assets/SoundAsset.h @@ -0,0 +1,75 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SOUND_ASSET_H +#define SOUND_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +class SFXTrack; + +//----------------------------------------------------------------------------- +class SoundAsset : public AssetBase +{ + typedef AssetBase Parent; + +protected: + StringTableEntry mSoundFilePath; + F32 mPitchAdjust; + F32 mVolumeAdjust; + +public: + SoundAsset(); + virtual ~SoundAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(SoundAsset); + + StringTableEntry getSoundFilePath() { return mSoundFilePath; } + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); +}; + +DefineConsoleType(TypeSoundAssetPtr, SoundAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/stateMachineAsset.cpp b/Engine/source/T3D/assets/stateMachineAsset.cpp new file mode 100644 index 000000000..99ba956a4 --- /dev/null +++ b/Engine/source/T3D/assets/stateMachineAsset.cpp @@ -0,0 +1,207 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef STATE_MACHINE_ASSET_H +#include "stateMachineAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(StateMachineAsset); + +ConsoleType(StateMachineAssetPtr, TypeStateMachineAssetPtr, StateMachineAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeStateMachineAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeStateMachineAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeStateMachineAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeStateMachineAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +StateMachineAsset::StateMachineAsset() +{ + mStateMachineFileName = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +StateMachineAsset::~StateMachineAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void StateMachineAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("stateMachineFile", TypeString, Offset(mStateMachineFileName, StateMachineAsset), "Path to the state machine file."); +} + +//------------------------------------------------------------------------------ + +void StateMachineAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +DefineEngineMethod(StateMachineAsset, notifyAssetChanged, void, (),,"") +{ + ResourceManager::get().getChangedSignal().trigger(object->getStateMachineFileName()); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeStateMachineAssetPtr); + +ConsoleDocClass(GuiInspectorTypeStateMachineAssetPtr, + "@brief Inspector field type for State Machines\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeStateMachineAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeStateMachineAssetPtr)->setInspectorFieldType("GuiInspectorTypeStateMachineAssetPtr"); +} + +GuiControl* GuiInspectorTypeStateMachineAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"StateMachineAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "StateMachineEditor.loadStateMachineAsset(%d.getText()); Canvas.pushDialog(StateMachineEditor);", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeStateMachineAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/stateMachineAsset.h b/Engine/source/T3D/assets/stateMachineAsset.h new file mode 100644 index 000000000..6452a6e6f --- /dev/null +++ b/Engine/source/T3D/assets/stateMachineAsset.h @@ -0,0 +1,89 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef STATE_MACHINE_ASSET_H +#define STATE_MACHINE_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" + +//----------------------------------------------------------------------------- +class StateMachineAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mStateMachineFileName; + +public: + StateMachineAsset(); + virtual ~StateMachineAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(StateMachineAsset); + + StringTableEntry getStateMachineFileName() { return mStateMachineFileName; } + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} +}; + +DefineConsoleType(TypeStateMachineAssetPtr, StateMachineAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeStateMachineAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeStateMachineAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif + diff --git a/Engine/source/T3D/components/animation/animationComponent.cpp b/Engine/source/T3D/components/animation/animationComponent.cpp index e1a71511c..c8fd645d0 100644 --- a/Engine/source/T3D/components/animation/animationComponent.cpp +++ b/Engine/source/T3D/components/animation/animationComponent.cpp @@ -72,7 +72,6 @@ IMPLEMENT_CALLBACK(AnimationComponent, onAnimationTrigger, void, (Component* obj AnimationComponent::AnimationComponent() : Component() { mNetworked = true; - mNetFlags.set(Ghostable | ScopeAlways); mFriendlyName = "Animation(Component)"; mComponentType = "Render"; @@ -223,31 +222,19 @@ U32 AnimationComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stre { U32 retMask = Parent::packUpdate(con, mask, stream); - //early test if we lack an owner, ghost-wise - //no point in trying, just re-queue the mask and go - if (!mOwner || con->getGhostIndex(mOwner) == -1) + /*for (int i = 0; i < MaxScriptThreads; i++) { - stream->writeFlag(false); - return retMask |= ThreadMask; - } - else - { - stream->writeFlag(true); - - for (int i = 0; i < MaxScriptThreads; i++) + Thread& st = mAnimationThreads[i]; + if (stream->writeFlag((st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)))) { - Thread& st = mAnimationThreads[i]; - if (stream->writeFlag( (st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)) ) ) - { - stream->writeInt(st.sequence,ThreadSequenceBits); - stream->writeInt(st.state,2); - stream->write(st.timescale); - stream->write(st.position); - stream->writeFlag(st.atEnd); - stream->writeFlag(st.transition); - } + stream->writeInt(st.sequence, ThreadSequenceBits); + stream->writeInt(st.state, 2); + stream->write(st.timescale); + stream->write(st.position); + stream->writeFlag(st.atEnd); + stream->writeFlag(st.transition); } - } + }*/ return retMask; } @@ -256,29 +243,26 @@ void AnimationComponent::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con, stream); - if (stream->readFlag()) + /*for (S32 i = 0; i < MaxScriptThreads; i++) { - for (S32 i = 0; i < MaxScriptThreads; i++) + if (stream->readFlag()) { - if (stream->readFlag()) - { - Thread& st = mAnimationThreads[i]; - U32 seq = stream->readInt(ThreadSequenceBits); - st.state = stream->readInt(2); - stream->read( &st.timescale ); - stream->read( &st.position ); - st.atEnd = stream->readFlag(); - bool transition = stream->readFlag(); + Thread& st = mAnimationThreads[i]; + U32 seq = stream->readInt(ThreadSequenceBits); + st.state = stream->readInt(2); + stream->read( &st.timescale ); + stream->read( &st.position ); + st.atEnd = stream->readFlag(); + bool transition = stream->readFlag(); - if (!st.thread || st.sequence != seq && st.state != Thread::Destroy) - setThreadSequence(i, seq, false, transition); - else - updateThread(st); - - } + if (!st.thread || st.sequence != seq && st.state != Thread::Destroy) + setThreadSequence(i, seq, false, transition); + else + updateThread(st); } - } + }*/ } + void AnimationComponent::processTick() { Parent::processTick(); @@ -327,9 +311,6 @@ const char *AnimationComponent::getThreadSequenceName(U32 slot) bool AnimationComponent::setThreadSequence(U32 slot, S32 seq, bool reset, bool transition, F32 transTime) { - if (!mOwnerShapeInstance) - return false; - Thread& st = mAnimationThreads[slot]; if (st.thread && st.sequence == seq && st.state == Thread::Play && !reset) return true; @@ -340,7 +321,6 @@ bool AnimationComponent::setThreadSequence(U32 slot, S32 seq, bool reset, bool t if (seq < MaxSequenceIndex) { - setMaskBits(-1); setMaskBits(ThreadMaskN << slot); st.sequence = seq; st.transition = transition; @@ -647,7 +627,7 @@ void AnimationComponent::advanceThreads(F32 dt) st.atEnd = true; updateThread(st); - if (!isGhost()) + if (!isClientObject()) { Con::executef(this, "onAnimationEnd", st.thread->getSequenceName()); } @@ -660,7 +640,7 @@ void AnimationComponent::advanceThreads(F32 dt) mOwnerShapeInstance->advanceTime(dt, st.thread); } - if (mOwnerShapeInstance && !isGhost()) + if (mOwnerShapeInstance && !isClientObject()) { for (U32 i = 1; i < 32; i++) { @@ -672,8 +652,16 @@ void AnimationComponent::advanceThreads(F32 dt) } } - if (isGhost()) + if (isClientObject()) + { mOwnerShapeInstance->animate(); + /*mOwnerShapeInstance->animateGround(); + MatrixF groundTransform = mOwnerShapeInstance->getGroundTransform(); + if (groundTransform != MatrixF::Identity) + { + mOwner->setPosition(groundTransform.getPosition()); + }*/ + } } } } diff --git a/Engine/source/T3D/components/audio/SoundComponent.cpp b/Engine/source/T3D/components/audio/SoundComponent.cpp new file mode 100644 index 000000000..9552c2d67 --- /dev/null +++ b/Engine/source/T3D/components/audio/SoundComponent.cpp @@ -0,0 +1,422 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "T3D/components/audio/SoundComponent.h" +#include "core/stream/bitStream.h" +#include "sim/netConnection.h" + +#include "sfx/sfxSystem.h" +#include "sfx/sfxSource.h" +#include "sfx/sfxTrack.h" +#include "sfx/sfxDescription.h" +#include "T3D/sfx/sfx3DWorld.h" + +#include "sfx/sfxTrack.h" +#include "sfx/sfxTypes.h" + +#include "renderInstance/renderPassManager.h" +#include "gfx/gfxDrawUtil.h" + +// Timeout for non-looping sounds on a channel +static SimTime sAudioTimeout = 500; + +extern bool gEditingMission; + +////////////////////////////////////////////////////////////////////////// +// Constructor/Destructor +////////////////////////////////////////////////////////////////////////// +SoundComponent::SoundComponent() : Component() +{ + //These flags inform that, in this particular component, we network down to the client, which enables the pack/unpackData functions to operate + mNetworked = true; + + mFriendlyName = "Sound(Component)"; + mComponentType = "Sound"; + mDescription = getDescriptionText("Stores up to 4 sounds for playback."); + + for (U32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) { + mSoundThread[slotNum].play = false; + mSoundThread[slotNum].profile = 0; + mSoundThread[slotNum].sound = 0; + + mSoundFile[slotNum] = NULL; + mPreviewSound[slotNum] = false; + mPlay[slotNum] = false; + } +} + +SoundComponent::~SoundComponent() +{ +} + +IMPLEMENT_CO_NETOBJECT_V1(SoundComponent); + +//Standard onAdd function, for when the component is created +bool SoundComponent::onAdd() +{ + if (!Parent::onAdd()) + return false; + + for (U32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + mPreviewSound[slotNum] = false; + + return true; +} + +//Standard onRemove function, when the component object is deleted +void SoundComponent::onRemove() +{ + Parent::onRemove(); +} + +//This is called when the component has been added to an entity +void SoundComponent::onComponentAdd() +{ + Parent::onComponentAdd(); + + Con::printf("We were added to an entity! SoundComponent reporting in for owner entity %i", mOwner->getId()); +} + +//This is called when the component has been removed from an entity +void SoundComponent::onComponentRemove() +{ + Con::printf("We were removed from our entity! SoundComponent signing off for owner entity %i", mOwner->getId()); + Parent::onComponentRemove(); +} + +//This is called any time a component is added to an entity. Every component currently owned by the entity is informed of the event. +//This allows you to do dependency behavior, like collisions being aware of a mesh component, etc +void SoundComponent::componentAddedToOwner(Component *comp) +{ + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + if (mPlay[slotNum]) + { + playAudio(slotNum, mSoundFile[slotNum]); + } + } + Con::printf("Our owner entity has a new component being added! SoundComponent welcomes component %i of type %s", comp->getId(), comp->getClassRep()->getNameSpace()); +} + +//This is called any time a component is removed from an entity. Every component current owned by the entity is informed of the event. +//This allows cleanup and dependency management. +void SoundComponent::componentRemovedFromOwner(Component *comp) +{ + Con::printf("Our owner entity has a removed a component! SoundComponent waves farewell to component %i of type %s", comp->getId(), comp->getClassRep()->getNameSpace()); +} + +//Regular init persist fields function to set up static fields. +void SoundComponent::initPersistFields() +{ + //addArray("Sounds", MaxSoundThreads); + addField("mSoundFile", TypeSFXTrackName, Offset(mSoundFile, SoundComponent), MaxSoundThreads, "If the text will not fit in the control, the deniedSound is played."); + addProtectedField("mPreviewSound", TypeBool, Offset(mPreviewSound, SoundComponent), + &_previewSound, &defaultProtectedGetFn, MaxSoundThreads, "Preview Sound", AbstractClassRep::FieldFlags::FIELD_ComponentInspectors); + addProtectedField("play", TypeBool, Offset(mPlay, SoundComponent), + &_autoplay, &defaultProtectedGetFn, MaxSoundThreads, "Whether playback of the emitter's sound should start as soon as the emitter object is added to the level.\n" + "If this is true, the emitter will immediately start to play when the level is loaded."); + //endArray("Sounds"); + Parent::initPersistFields(); +} + +bool SoundComponent::_previewSound(void *object, const char *index, const char *data) +{ + U32 slotNum = (index != NULL) ? dAtoui(index) : 0; + SoundComponent* component = reinterpret_cast< SoundComponent* >(object); + if (!component->mPreviewSound[slotNum]) + component->playAudio(slotNum, component->mSoundFile[slotNum]); + else + component->stopAudio(slotNum); + component->mPreviewSound[slotNum] = !component->mPreviewSound[slotNum]; + + return false; +} + +bool SoundComponent::_autoplay(void *object, const char *index, const char *data) +{ + U32 slotNum = (index != NULL) ? dAtoui(index) : 0; + SoundComponent* component = reinterpret_cast< SoundComponent* >(object); + component->mPlay[slotNum] = dAtoui(data); + if (component->mPlay[slotNum]) + component->playAudio(slotNum, component->mSoundFile[slotNum]); + else + component->stopAudio(slotNum); + + return false; +} + +U32 SoundComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) +{ + U32 retMask = Parent::packUpdate(con, mask, stream); + + if (mask & InitialUpdateMask) + { + // mask off sounds that aren't playing + S32 slotNum; + for (slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + if (!mSoundThread[slotNum].play) + mask &= ~(SoundMaskN << slotNum); + } + + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + stream->writeFlag(mPreviewSound[slotNum]); + + if (stream->writeFlag(mask & SoundMask)) + { + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + Sound& st = mSoundThread[slotNum]; + + if (stream->writeFlag(mask & (SoundMaskN << slotNum))) + { + if (stream->writeFlag(st.play)) + //stream->writeRangedU32(st.profile->getId(), DataBlockObjectIdFirst, + // DataBlockObjectIdLast); + stream->writeString(st.profile->getName()); + + } + } + } + + return retMask; +} + +void SoundComponent::unpackUpdate(NetConnection *con, BitStream *stream) +{ + Parent::unpackUpdate(con, stream); + + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + mPreviewSound[slotNum] = stream->readFlag(); + + if (stream->readFlag()) + { + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + if (stream->readFlag()) + { + Sound& st = mSoundThread[slotNum]; + st.play = stream->readFlag(); + if (st.play) + { + //st.profile = (SFXTrack*)stream->readRangedU32(DataBlockObjectIdFirst, + // DataBlockObjectIdLast); + char profileName[255]; + stream->readString(profileName); + + if (!Sim::findObject(profileName, st.profile)) + Con::errorf("Could not find SFXTrack"); + } + + //if (isProperlyAdded()) + updateAudioState(st); + } + } + } +} + +//This allows custom behavior in the event the owner is being edited +void SoundComponent::onInspect() +{ +} + +//This allows cleanup of the custom editor behavior if our owner stopped being edited +void SoundComponent::onEndInspect() +{ +} + +//Process tick update function, natch +void SoundComponent::processTick() +{ + Parent::processTick(); +} + +//Client-side advance function +void SoundComponent::advanceTime(F32 dt) +{ + +} + +//Client-side interpolation function +void SoundComponent::interpolateTick(F32 delta) +{ + +} + +void SoundComponent::prepRenderImage(SceneRenderState *state) +{ + if (!mEnabled || !mOwner || !gEditingMission) + return; + ObjectRenderInst* ri = state->getRenderPass()->allocInst< ObjectRenderInst >(); + + ri->renderDelegate.bind(this, &SoundComponent::_renderObject); + ri->type = RenderPassManager::RIT_Editor; + ri->defaultKey = 0; + ri->defaultKey2 = 0; + + state->getRenderPass()->addInst(ri); +} + +void SoundComponent::_renderObject(ObjectRenderInst *ri, + SceneRenderState *state, + BaseMatInstance *overrideMat) +{ + if (overrideMat) + return; + + GFXStateBlockDesc desc; + desc.setBlend(true); + + MatrixF camera = GFX->getWorldMatrix(); + camera.inverse(); + Point3F pos = mOwner->getPosition(); + + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + if (mPreviewSound[slotNum]) + { + Sound& st = mSoundThread[slotNum]; + if (st.sound && st.sound->getDescription()) + { + F32 minRad = st.sound->getDescription()->mMinDistance; + F32 falloffRad = st.sound->getDescription()->mMaxDistance; + SphereF sphere(pos, falloffRad); + if (sphere.isContained(camera.getPosition())) + desc.setCullMode(GFXCullNone); + + GFX->getDrawUtil()->drawSphere(desc, minRad, pos, ColorI(255, 0, 255, 64)); + GFX->getDrawUtil()->drawSphere(desc, falloffRad, pos, ColorI(128, 0, 128, 64)); + } + } + } +} + +void SoundComponent::playAudio(U32 slotNum, SFXTrack* _profile) +{ + AssertFatal(slotNum < MaxSoundThreads, "ShapeBase::playAudio() bad slot index"); + SFXTrack* profile = (_profile != NULL) ? _profile : mSoundFile[slotNum]; + Sound& st = mSoundThread[slotNum]; + if (profile && (!st.play || st.profile != profile)) + { + setMaskBits(SoundMaskN << slotNum); + st.play = true; + st.profile = profile; + updateAudioState(st); + } +} + +void SoundComponent::stopAudio(U32 slotNum) +{ + AssertFatal(slotNum < MaxSoundThreads, "ShapeBase::stopAudio() bad slot index"); + + Sound& st = mSoundThread[slotNum]; + if (st.play) + { + st.play = false; + setMaskBits(SoundMaskN << slotNum); + updateAudioState(st); + } +} + +void SoundComponent::updateServerAudio() +{ + // Timeout non-looping sounds + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + Sound& st = mSoundThread[slotNum]; + if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) + { + //clearMaskBits(SoundMaskN << slotNum); + st.play = false; + } + } +} + +void SoundComponent::updateAudioState(Sound& st) +{ + SFX_DELETE(st.sound); + + if (st.play && st.profile) + { + if (isClientObject()) + { + //if (Sim::findObject(SimObjectId((uintptr_t)st.profile), st.profile)) + // { + MatrixF transform = mOwner->getTransform(); + st.sound = SFX->createSource(st.profile, &transform); + if (st.sound) + st.sound->play(); + //} + else + st.play = false; + } + else + { + // Non-looping sounds timeout on the server + st.timeout = 0; + if (!st.profile->getDescription()->mIsLooping) + st.timeout = Sim::getCurrentTime() + sAudioTimeout; + } + } + else + st.play = false; +} + +void SoundComponent::updateAudioPos() +{ + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + SFXSource* source = mSoundThread[slotNum].sound; + if (source) + source->setTransform(mOwner->getTransform()); + } +} + +//---------------------------------------------------------------------------- +DefineEngineMethod(SoundComponent, playAudio, bool, (S32 slot, SFXTrack* track), (0, nullAsType()), + "@brief Attach a sound to this shape and start playing it.\n\n" + + "@param slot Audio slot index for the sound (valid range is 0 - 3)\n" // 3 = ShapeBase::MaxSoundThreads-1 + "@param track SFXTrack to play\n" + "@return true if the sound was attached successfully, false if failed\n\n" + + "@see stopAudio()\n") +{ + if (track && slot >= 0 && slot < SoundComponent::MaxSoundThreads) { + object->playAudio(slot, track); + return true; + } + return false; +} + +DefineEngineMethod(SoundComponent, stopAudio, bool, (S32 slot), , + "@brief Stop a sound started with playAudio.\n\n" + + "@param slot audio slot index (started with playAudio)\n" + "@return true if the sound was stopped successfully, false if failed\n\n" + + "@see playAudio()\n") +{ + if (slot >= 0 && slot < SoundComponent::MaxSoundThreads) { + object->stopAudio(slot); + return true; + } + return false; +} \ No newline at end of file diff --git a/Engine/source/T3D/components/audio/SoundComponent.h b/Engine/source/T3D/components/audio/SoundComponent.h new file mode 100644 index 000000000..a56bc600e --- /dev/null +++ b/Engine/source/T3D/components/audio/SoundComponent.h @@ -0,0 +1,129 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef EXAMPLE_COMPONENT_H +#define EXAMPLE_COMPONENT_H +#pragma once + +#ifndef COMPONENT_H +#include "T3D/components/component.h" +#endif +#ifndef RENDER_COMPONENT_INTERFACE_H +#include "T3D/components/render/renderComponentInterface.h" +#endif + +class SFXSource; + +//SoundComponent +//A basic example of the various functions you can utilize to make your own component! +//This example doesn't really DO anything, persay, but you can readily copy it as a base +//and use it as a starting point for your own. +class SoundComponent : public Component, public RenderComponentInterface, public EditorInspectInterface +{ + typedef Component Parent; + +public: + enum PublicConstants + { + MaxSoundThreads = 4, ///< Should be a power of 2 + }; + + /// @name Network state masks + /// @{ + + /// + enum SoundComponentMasks + { + SoundMaskN = Parent::NextFreeMask << 6, ///< Extends + MaxSoundThreads bits + }; + + enum BaseMaskConstants + { + SoundMask = (SoundMaskN << MaxSoundThreads) - SoundMaskN, + }; + /// @name Scripted Sound + /// @{ + struct Sound { + bool play; ///< Are we playing this sound? + SimTime timeout; ///< Time until we stop playing this sound. + SFXTrack* profile; ///< Profile on server + SFXSource* sound; ///< Sound on client + Sound() + { + play = false; + timeout = 0; + profile = NULL; + sound = NULL; + } + }; + Sound mSoundThread[MaxSoundThreads]; + SFXTrack* mSoundFile[MaxSoundThreads]; + bool mPreviewSound[MaxSoundThreads]; + bool mPlay[MaxSoundThreads]; + /// @} + + SoundComponent(); + virtual ~SoundComponent(); + DECLARE_CONOBJECT(SoundComponent); + + virtual bool onAdd(); + virtual void onRemove(); + static void initPersistFields(); + static bool _previewSound(void *object, const char *index, const char *data); + static bool _autoplay(void *object, const char *index, const char *data); + + virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream); + virtual void unpackUpdate(NetConnection *con, BitStream *stream); + + virtual void onComponentRemove(); + virtual void onComponentAdd(); + + virtual void componentAddedToOwner(Component *comp); + virtual void componentRemovedFromOwner(Component *comp); + + virtual void onInspect(); + virtual void onEndInspect(); + + virtual void processTick(); + virtual void advanceTime(F32 dt); + virtual void interpolateTick(F32 delta); + + void prepRenderImage(SceneRenderState* state); + void _renderObject(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat); + + virtual void playAudio(U32 slotNum, SFXTrack* profile = NULL); + virtual void stopAudio(U32 slot); + virtual void updateServerAudio(); + virtual void updateAudioState(Sound& st); + virtual void updateAudioPos(); + + //why god why + virtual TSShape* getShape() { return NULL; }; + Signal< void(RenderComponentInterface*) > onShapeChanged; + virtual TSShapeInstance* getShapeInstance() { return NULL; }; + Signal< void(RenderComponentInterface*) > onShapeInstanceChanged; + virtual MatrixF getNodeTransform(S32 nodeIdx) { return MatrixF::Identity; }; + virtual Vector getNodeTransforms() { return NULL; }; + virtual void setNodeTransforms(Vector transforms) {}; +}; + +#endif \ No newline at end of file diff --git a/Engine/source/T3D/components/camera/cameraComponent.cpp b/Engine/source/T3D/components/camera/cameraComponent.cpp index 60c62fb3a..2cd1b7d08 100644 --- a/Engine/source/T3D/components/camera/cameraComponent.cpp +++ b/Engine/source/T3D/components/camera/cameraComponent.cpp @@ -79,6 +79,7 @@ CameraComponent::CameraComponent() : Component() mTargetNode = ""; mUseParentTransform = true; + mNetworked = true; mFriendlyName = "Camera(Component)"; } @@ -202,7 +203,7 @@ void CameraComponent::setCameraFov(F32 fov) void CameraComponent::onCameraScopeQuery(NetConnection *cr, CameraScopeQuery * query) { // update the camera query - query->camera = this; + query->camera = mOwner;//this; if(GameConnection * con = dynamic_cast(cr)) { @@ -357,7 +358,8 @@ U32 CameraComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) mTargetNodeIdx = nodeIndex; } - stream->writeInt(mTargetNodeIdx, 32); + if(stream->writeFlag(mTargetNodeIdx > -1)) + stream->writeInt(mTargetNodeIdx, 32); //send offsets here stream->writeCompressedPoint(mPosOffset); @@ -382,7 +384,10 @@ void CameraComponent::unpackUpdate(NetConnection *con, BitStream *stream) if(stream->readFlag()) { - mTargetNodeIdx = stream->readInt(32); + if (stream->readFlag()) + mTargetNodeIdx = stream->readInt(32); + else + mTargetNodeIdx = -1; stream->readCompressedPoint(&mPosOffset); diff --git a/Engine/source/T3D/components/collision/collisionComponent.cpp b/Engine/source/T3D/components/collision/collisionComponent.cpp index e680665dc..ccdf818f1 100644 --- a/Engine/source/T3D/components/collision/collisionComponent.cpp +++ b/Engine/source/T3D/components/collision/collisionComponent.cpp @@ -125,8 +125,6 @@ EndImplementEnumType; // CollisionComponent::CollisionComponent() : Component() { - mNetFlags.set(Ghostable | ScopeAlways); - mFriendlyName = "Collision(Component)"; mOwnerRenderInterface = NULL; diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index 47784d4b2..ff207d2c1 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -31,6 +31,7 @@ #include "console/engineAPI.h" #include "sim/netConnection.h" #include "console/consoleInternal.h" +#include "T3D/assets/MaterialAsset.h" #define DECLARE_NATIVE_COMPONENT( ComponentType ) \ Component* staticComponentTemplate = new ComponentType; \ @@ -42,17 +43,16 @@ Component::Component() { - mFriendlyName = StringTable->lookup(""); - mFromResource = StringTable->lookup(""); - mComponentType = StringTable->lookup(""); - mComponentGroup = StringTable->lookup(""); - mNetworkType = StringTable->lookup(""); - mTemplateName = StringTable->lookup(""); - //mDependency = StringTable->lookup(""); + mFriendlyName = StringTable->EmptyString(); + mFromResource = StringTable->EmptyString(); + mComponentType = StringTable->EmptyString(); + mComponentGroup = StringTable->EmptyString(); + mNetworkType = StringTable->EmptyString(); + mTemplateName = StringTable->EmptyString(); + //mDependency = StringTable->EmptyString(); mNetworked = false; - // [tom, 1/12/2007] We manage the memory for the description since it // could be loaded from a file and thus massive. This is accomplished with // protected fields, but since they still call Con::getData() the field @@ -64,7 +64,9 @@ Component::Component() mCanSaveFieldDictionary = false; - mNetFlags.set(Ghostable); + mOriginatingAssetId = StringTable->EmptyString(); + + mIsServerObject = true; } Component::~Component() @@ -97,6 +99,10 @@ void Component::initPersistFields() //addField("hidden", TypeBool, Offset(mHidden, Component), "Flags if this behavior is shown in the editor or not", AbstractClassRep::FieldFlags::FIELD_HideInInspectors); addProtectedField("enabled", TypeBool, Offset(mEnabled, Component), &_setEnabled, &defaultProtectedGetFn, ""); + + addField("originatingAsset", TypeComponentAssetPtr, Offset(mOriginatingAsset, Component), + "Asset that spawned this component, used for tracking/housekeeping", AbstractClassRep::FieldFlags::FIELD_HideInInspectors); + endGroup("Component"); Parent::initPersistFields(); @@ -149,6 +155,7 @@ bool Component::onAdd() return false; setMaskBits(UpdateMask); + setMaskBits(NamespaceMask); return true; } @@ -191,7 +198,6 @@ void Component::onComponentRemove() { mOwner->onComponentAdded.remove(this, &Component::componentAddedToOwner); mOwner->onComponentRemoved.remove(this, &Component::componentRemovedFromOwner); - mOwner->onTransformSet.remove(this, &Component::ownerTransformSet); } mOwner = NULL; @@ -205,7 +211,6 @@ void Component::setOwner(Entity* owner) { mOwner->onComponentAdded.remove(this, &Component::componentAddedToOwner); mOwner->onComponentRemoved.remove(this, &Component::componentRemovedFromOwner); - mOwner->onTransformSet.remove(this, &Component::ownerTransformSet); mOwner->removeComponent(this, false); } @@ -216,11 +221,18 @@ void Component::setOwner(Entity* owner) { mOwner->onComponentAdded.notify(this, &Component::componentAddedToOwner); mOwner->onComponentRemoved.notify(this, &Component::componentRemovedFromOwner); - mOwner->onTransformSet.notify(this, &Component::ownerTransformSet); } if (isServerObject()) + { setMaskBits(OwnerMask); + + //if we have any outstanding maskbits, push them along to have the network update happen on the entity + if (mDirtyMaskBits != 0 && mOwner) + { + mOwner->setMaskBits(Entity::ComponentsUpdateMask); + } + } } void Component::componentAddedToOwner(Component *comp) @@ -233,16 +245,19 @@ void Component::componentRemovedFromOwner(Component *comp) return; } -void Component::ownerTransformSet(MatrixF *mat) +void Component::setMaskBits(U32 orMask) { - return; + AssertFatal(orMask != 0, "Invalid net mask bits set."); + + if (mOwner) + mOwner->setComponentNetMask(this, orMask); } U32 Component::packUpdate(NetConnection *con, U32 mask, BitStream *stream) { - U32 retMask = Parent::packUpdate(con, mask, stream); + U32 retMask = 0; - if (mask & OwnerMask) + /*if (mask & OwnerMask) { if (mOwner != NULL) { @@ -267,21 +282,32 @@ U32 Component::packUpdate(NetConnection *con, U32 mask, BitStream *stream) } } else - stream->writeFlag(false); + stream->writeFlag(false);*/ if (stream->writeFlag(mask & EnableMask)) { stream->writeFlag(mEnabled); } + /*if (stream->writeFlag(mask & NamespaceMask)) + { + const char* name = getName(); + if (stream->writeFlag(name && name[0])) + stream->writeString(String(name)); + + if (stream->writeFlag(mSuperClassName && mSuperClassName[0])) + stream->writeString(String(mSuperClassName)); + + if (stream->writeFlag(mClassName && mClassName[0])) + stream->writeString(String(mClassName)); + }*/ + return retMask; } void Component::unpackUpdate(NetConnection *con, BitStream *stream) { - Parent::unpackUpdate(con, stream); - - if (stream->readFlag()) + /*if (stream->readFlag()) { if (stream->readFlag()) { @@ -297,12 +323,38 @@ void Component::unpackUpdate(NetConnection *con, BitStream *stream) //it's being nulled out setOwner(NULL); } - } + }*/ if (stream->readFlag()) { mEnabled = stream->readFlag(); } + + /*if (stream->readFlag()) + { + if (stream->readFlag()) + { + char name[256]; + stream->readString(name); + assignName(name); + } + + if (stream->readFlag()) + { + char superClassname[256]; + stream->readString(superClassname); + mSuperClassName = superClassname; + } + + if (stream->readFlag()) + { + char classname[256]; + stream->readString(classname); + mClassName = classname; + } + + linkNamespaces(); + }*/ } void Component::packToStream(Stream &stream, U32 tabStop, S32 behaviorID, U32 flags /* = 0 */) @@ -346,6 +398,10 @@ void Component::setDataField(StringTableEntry slotName, const char *array, const onDataSet.trigger(this, slotName, value); } +StringTableEntry Component::getComponentName() +{ + return getNamespace()->getName(); +} //catch any behavior field updates void Component::onStaticModified(const char* slotName, const char* newValue) @@ -417,7 +473,7 @@ void Component::addComponentField(const char *fieldName, const char *desc, const else if (fieldType == StringTable->insert("vector")) fieldTypeMask = TypePoint3F; else if (fieldType == StringTable->insert("material")) - fieldTypeMask = TypeMaterialName; + fieldTypeMask = TypeMaterialAssetPtr; else if (fieldType == StringTable->insert("image")) fieldTypeMask = TypeImageFilename; else if (fieldType == StringTable->insert("shape")) @@ -426,8 +482,19 @@ void Component::addComponentField(const char *fieldName, const char *desc, const fieldTypeMask = TypeBool; else if (fieldType == StringTable->insert("object")) fieldTypeMask = TypeSimObjectPtr; + else if (fieldType == StringTable->insert("string")) + fieldTypeMask = TypeString; + else if (fieldType == StringTable->insert("colorI")) + fieldTypeMask = TypeColorI; + else if (fieldType == StringTable->insert("colorF")) + fieldTypeMask = TypeColorF; + else if (fieldType == StringTable->insert("ease")) + fieldTypeMask = TypeEaseF; + else if (fieldType == StringTable->insert("gameObject")) + fieldTypeMask = TypeGameObjectAssetPtr; else fieldTypeMask = TypeString; + field.mFieldTypeName = fieldType; field.mFieldType = fieldTypeMask; @@ -603,6 +670,17 @@ ConsoleMethod(Component, setComponentield, const char *, 3, 3, "(int index) - Ge return buf; } +DefineConsoleMethod(Component, getComponentFieldType, const char *, (String fieldName), , + "Get the number of static fields on the object.\n" + "@return The number of static fields defined on the object.") +{ + ComponentField *field = object->getComponentField(fieldName); + if (field == NULL) + return ""; + + return field->mFieldTypeName;; +} + ConsoleMethod(Component, getBehaviorFieldUserData, const char *, 3, 3, "(int index) - Gets the UserData associated with a field by index in the field list\n" "@param index The index of the behavior\n" "@return Returns a string representing the user data of this field\n") diff --git a/Engine/source/T3D/components/component.h b/Engine/source/T3D/components/component.h index 0259bacd0..b585a30b0 100644 --- a/Engine/source/T3D/components/component.h +++ b/Engine/source/T3D/components/component.h @@ -32,14 +32,22 @@ #ifndef CORE_INTERFACES_H #include "T3D/components/coreInterfaces.h" #endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif +#ifndef COMPONENT_ASSET_H +#include "T3D/assets/ComponentAsset.h" +#endif class Entity; +class Namespace; struct ComponentField { StringTableEntry mFieldName; StringTableEntry mFieldDescription; + StringTableEntry mFieldTypeName; S32 mFieldType; StringTableEntry mUserData; @@ -56,9 +64,9 @@ struct ComponentField /// /// ////////////////////////////////////////////////////////////////////////// -class Component : public NetObject, public UpdateInterface +class Component : public SimObject, public UpdateInterface { - typedef NetObject Parent; + typedef SimObject Parent; protected: StringTableEntry mFriendlyName; @@ -81,6 +89,13 @@ protected: bool mHidden; bool mEnabled; + StringTableEntry mOriginatingAssetId; + AssetPtr mOriginatingAsset; + + U32 mDirtyMaskBits; + + bool mIsServerObject; + public: Component(); virtual ~Component(); @@ -102,7 +117,8 @@ public: //This is called when a different component is removed from our owner entity virtual void componentRemovedFromOwner(Component *comp); - virtual void ownerTransformSet(MatrixF *mat); + //Overridden by components that actually care + virtual void ownerTransformSet(MatrixF *mat) {} void setOwner(Entity* pOwner); inline Entity *getOwner() { return mOwner ? mOwner : NULL; } @@ -175,9 +191,20 @@ public: OwnerMask = BIT(1), UpdateMask = BIT(2), EnableMask = BIT(3), - NextFreeMask = BIT(4) + NamespaceMask = BIT(4), + NextFreeMask = BIT(5) }; + virtual void setMaskBits(U32 orMask); + virtual void clearMaskBits() { + mDirtyMaskBits = 0; + } + + bool isServerObject() { return mIsServerObject; } + bool isClientObject() { return !mIsServerObject; } + + void setIsServerObject(bool isServerObj) { mIsServerObject = isServerObj; } + virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream); virtual void unpackUpdate(NetConnection *con, BitStream *stream); /// @} @@ -192,6 +219,8 @@ public: void checkComponentFieldModified(const char* slotName, const char* newValue); virtual void checkDependencies(){} + + StringTableEntry getComponentName(); }; #endif // COMPONENT_H diff --git a/Engine/source/T3D/components/game/stateMachineComponent.cpp b/Engine/source/T3D/components/game/stateMachineComponent.cpp index 991d41ce1..d4e9a7d73 100644 --- a/Engine/source/T3D/components/game/stateMachineComponent.cpp +++ b/Engine/source/T3D/components/game/stateMachineComponent.cpp @@ -57,7 +57,6 @@ StateMachineComponent::StateMachineComponent() : Component() //doesn't need to be networked mNetworked = false; - mNetFlags.clear(); } StateMachineComponent::~StateMachineComponent() diff --git a/Engine/source/T3D/components/physics/playerControllerComponent.cpp b/Engine/source/T3D/components/physics/playerControllerComponent.cpp index 60945f68e..2c6cea6e9 100644 --- a/Engine/source/T3D/components/physics/playerControllerComponent.cpp +++ b/Engine/source/T3D/components/physics/playerControllerComponent.cpp @@ -330,93 +330,6 @@ void PlayerControllerComponent::updateMove() bool doStandardMove = true; GameConnection* con = mOwner->getControllingClient(); -#ifdef TORQUE_EXTENDED_MOVE - // Work with an absolute rotation from the ExtendedMove class? - if (con && con->getControlSchemeAbsoluteRotation()) - { - doStandardMove = false; - const ExtendedMove* emove = dynamic_cast(move); - U32 emoveIndex = smExtendedMoveHeadPosRotIndex; - if (emoveIndex >= ExtendedMove::MaxPositionsRotations) - emoveIndex = 0; - - if (emove->EulerBasedRotation[emoveIndex]) - { - // Head pitch - mHead.x += (emove->rotX[emoveIndex] - mLastAbsolutePitch); - - // Do we also include the relative yaw value? - if (con->getControlSchemeAddPitchToAbsRot()) - { - F32 x = move->pitch; - if (x > M_PI_F) - x -= M_2PI_F; - - mHead.x += x; - } - - // Constrain the range of mHead.x - while (mHead.x < -M_PI_F) - mHead.x += M_2PI_F; - while (mHead.x > M_PI_F) - mHead.x -= M_2PI_F; - - // Rotate (heading) head or body? - if (move->freeLook && ((isMounted() && getMountNode() == 0) || (con && !con->isFirstPerson()))) - { - // Rotate head - mHead.z += (emove->rotZ[emoveIndex] - mLastAbsoluteYaw); - - // Do we also include the relative yaw value? - if (con->getControlSchemeAddYawToAbsRot()) - { - F32 z = move->yaw; - if (z > M_PI_F) - z -= M_2PI_F; - - mHead.z += z; - } - - // Constrain the range of mHead.z - while (mHead.z < 0.0f) - mHead.z += M_2PI_F; - while (mHead.z > M_2PI_F) - mHead.z -= M_2PI_F; - } - else - { - // Rotate body - mRot.z += (emove->rotZ[emoveIndex] - mLastAbsoluteYaw); - - // Do we also include the relative yaw value? - if (con->getControlSchemeAddYawToAbsRot()) - { - F32 z = move->yaw; - if (z > M_PI_F) - z -= M_2PI_F; - - mRot.z += z; - } - - // Constrain the range of mRot.z - while (mRot.z < 0.0f) - mRot.z += M_2PI_F; - while (mRot.z > M_2PI_F) - mRot.z -= M_2PI_F; - } - mLastAbsoluteYaw = emove->rotZ[emoveIndex]; - mLastAbsolutePitch = emove->rotX[emoveIndex]; - - // Head bank - mHead.y = emove->rotY[emoveIndex]; - - // Constrain the range of mHead.y - while (mHead.y > M_PI_F) - mHead.y -= M_2PI_F; - } - } -#endif - MatrixF zRot; zRot.set(EulerF(0.0f, 0.0f, mOwner->getRotation().asEulerF().z)); diff --git a/Engine/source/T3D/components/physics/rigidBodyComponent.cpp b/Engine/source/T3D/components/physics/rigidBodyComponent.cpp index 21e9ecdbe..200e0d65e 100644 --- a/Engine/source/T3D/components/physics/rigidBodyComponent.cpp +++ b/Engine/source/T3D/components/physics/rigidBodyComponent.cpp @@ -288,7 +288,7 @@ void RigidBodyComponent::processTick() return; // SINGLE PLAYER HACK!!!! - if (PHYSICSMGR->isSinglePlayer() && isClientObject() && getServerObject()) + /*if (PHYSICSMGR->isSinglePlayer() && isClientObject() && getServerObject()) { RigidBodyComponent *servObj = (RigidBodyComponent*)getServerObject(); mOwner->setTransform(servObj->mState.getTransform()); @@ -296,7 +296,7 @@ void RigidBodyComponent::processTick() mRenderState[1] = servObj->mRenderState[1]; return; - } + }*/ // Store the last render state. mRenderState[0] = mRenderState[1]; diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index 708a48ae1..10186c873 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -34,7 +34,6 @@ #include "lighting/lightQuery.h" #include "scene/sceneManager.h" #include "gfx/bitmap/ddsFile.h" -#include "gfx/bitmap/ddsUtils.h" #include "gfx/gfxTextureManager.h" #include "materials/materialFeatureTypes.h" #include "renderInstance/renderImposterMgr.h" @@ -46,52 +45,49 @@ #include "core/strings/findMatch.h" #include "T3D/components/render/meshComponent_ScriptBinding.h" +ImplementEnumType(BatchingMode, + "Type of mesh data available in a shape.\n" + "@ingroup gameObjects") +{ + MeshComponent::Individual, "Individual", "This mesh is rendered indivudally, wthout batching or instancing." +}, + { MeshComponent::StaticBatch, "Static Batching", "Statically batches this mesh together with others to reduce drawcalls." }, + //{ MeshComponent::DynamicBatch, "Dynamic Batching", "Dynamical batches this mesh together with others to reduce drawcalls each frame." }, + // { MeshComponent::Instanced, "Instanced", "This mesh is rendered as an instance, reducing draw overhead with others that share the same mesh and material." }, + EndImplementEnumType; + ////////////////////////////////////////////////////////////////////////// // Constructor/Destructor ////////////////////////////////////////////////////////////////////////// MeshComponent::MeshComponent() : Component() { - mShapeName = StringTable->insert(""); - mShapeAsset = StringTable->insert(""); - mShapeInstance = NULL; - - mChangingMaterials.clear(); - - mMaterials.clear(); - mFriendlyName = "Mesh Component"; mComponentType = "Render"; mDescription = getDescriptionText("Causes the object to render a non-animating 3d shape using the file provided."); mNetworked = true; - mNetFlags.set(Ghostable | ScopeAlways); + + mShapeName = StringTable->EmptyString(); + mShapeAsset = StringTable->EmptyString(); + + mMeshAsset = StringTable->EmptyString(); + mMeshAssetId = StringTable->EmptyString(); + + mInterfaceData = new MeshRenderSystemInterface(); + + mRenderMode = Individual; } -MeshComponent::~MeshComponent(){} +MeshComponent::~MeshComponent() +{ + if (mInterfaceData) + SAFE_DELETE(mInterfaceData); +} IMPLEMENT_CO_NETOBJECT_V1(MeshComponent); //========================================================================================== -void MeshComponent::boneObject::addObject(SimObject* object) -{ - SceneObject* sc = dynamic_cast(object); - - if(sc && mOwner) - { - if(TSShape* shape = mOwner->getShape()) - { - S32 nodeID = shape->findNode(mBoneName); - - //we may have a offset on the shape's center - //so make sure we accomodate for that when setting up the mount offsets - MatrixF mat = mOwner->getNodeTransform(nodeID); - - mOwner->getOwner()->mountObject(sc, nodeID, mat); - } - } -} - bool MeshComponent::onAdd() { if(! Parent::onAdd()) @@ -107,6 +103,12 @@ void MeshComponent::onComponentAdd() { Parent::onComponentAdd(); + if (isClientObject()) + mInterfaceData->mIsClient = true; + + // if (mInterfaceData != nullptr) + // mInterfaceData->mIsClient = isClientObject(); + //get the default shape, if any updateShape(); } @@ -114,10 +116,6 @@ void MeshComponent::onComponentAdd() void MeshComponent::onRemove() { Parent::onRemove(); - - mMeshAsset.clear(); - - SAFE_DELETE(mShapeInstance); } void MeshComponent::onComponentRemove() @@ -136,9 +134,14 @@ void MeshComponent::initPersistFields() { Parent::initPersistFields(); + addGroup("Rendering"); + addField("BatchingMode", TypeBatchingMode, Offset(mRenderMode, MeshComponent), + "The mode of batching this shape should be rendered with."); + endGroup("Rendering"); + //create a hook to our internal variables addGroup("Model"); - addProtectedField("MeshAsset", TypeAssetId, Offset(mShapeAsset, MeshComponent), &_setMesh, &defaultProtectedGetFn, + addProtectedField("MeshAsset", TypeShapeAssetPtr, Offset(mShapeAsset, MeshComponent), &_setMesh, &defaultProtectedGetFn, "The asset Id used for the mesh.", AbstractClassRep::FieldFlags::FIELD_ComponentInspectors); endGroup("Model"); } @@ -166,6 +169,9 @@ bool MeshComponent::_setShape( void *object, const char *index, const char *data bool MeshComponent::setMeshAsset(const char* assetName) { // Fetch the asset Id. + if (mInterfaceData == nullptr) + return false; + mMeshAssetId = StringTable->insert(assetName); mMeshAsset = mMeshAssetId; @@ -184,9 +190,129 @@ bool MeshComponent::setMeshAsset(const char* assetName) return true; } +void MeshComponent::updateShape() +{ + if (mInterfaceData == nullptr) + return; + + //if ((mShapeName && mShapeName[0] != '\0') || (mShapeAsset && mShapeAsset[0] != '\0')) + if ((mShapeName && mShapeName[0] != '\0') || (mMeshAssetId && mMeshAssetId[0] != '\0')) + + { + if (mMeshAsset == NULL) + return; + + mShape = mMeshAsset->getShape(); + + if (!mMeshAsset->getShape()) + return; + + setupShape(); + + //Do this on both the server and client + S32 materialCount = mMeshAsset->getShape()->materialList->getMaterialNameList().size(); + + if (isServerObject()) + { + //we need to update the editor + for (U32 i = 0; i < mFields.size(); i++) + { + //find any with the materialslot title and clear them out + if (FindMatch::isMatch("MaterialSlot*", mFields[i].mFieldName, false)) + { + setDataField(mFields[i].mFieldName, NULL, ""); + mFields.erase(i); + continue; + } + } + + //next, get a listing of our materials in the shape, and build our field list for them + char matFieldName[128]; + + if (materialCount > 0) + mComponentGroup = StringTable->insert("Materials"); + + for (U32 i = 0; i < materialCount; i++) + { + String materialname = mMeshAsset->getShape()->materialList->getMaterialName(i); + if (materialname == String("ShapeBounds")) + continue; + + dSprintf(matFieldName, 128, "MaterialSlot%d", i); + + addComponentField(matFieldName, "A material used in the shape file", "Material", materialname, ""); + } + + if (materialCount > 0) + mComponentGroup = ""; + } + + if (mOwner != NULL) + { + Point3F min, max, pos; + pos = mOwner->getPosition(); + + mOwner->getWorldToObj().mulP(pos); + + min = mMeshAsset->getShape()->bounds.minExtents; + max = mMeshAsset->getShape()->bounds.maxExtents; + + if (mInterfaceData) + { + mInterfaceData->mBounds.set(min, max); + mInterfaceData->mScale = mOwner->getScale(); + mInterfaceData->mTransform = mOwner->getRenderTransform(); + } + + mOwner->setObjectBox(Box3F(min, max)); + + mOwner->resetWorldBox(); + + if (mOwner->getSceneManager() != NULL) + mOwner->getSceneManager()->notifyObjectDirty(mOwner); + } + + if (isClientObject() && mInterfaceData) + { + if (mRenderMode == StaticBatch) + { + mInterfaceData->mStatic = true; + + OptimizedPolyList geom; + MatrixF transform = mInterfaceData->mTransform; + mInterfaceData->mGeometry.setTransform(&transform, mInterfaceData->mScale); + mInterfaceData->mGeometry.setObject(mOwner); + + mInterfaceData->mShapeInstance->buildPolyList(&mInterfaceData->mGeometry, 0); + } + else + { + mInterfaceData->mStatic = false; + } + + MeshRenderSystem::rebuildBuffers(); + } + + //finally, notify that our shape was changed + onShapeInstanceChanged.trigger(this); + } +} + +void MeshComponent::setupShape() +{ + mInterfaceData->mShapeInstance = new TSShapeInstance(mMeshAsset->getShape(), true); +} + void MeshComponent::_onResourceChanged( const Torque::Path &path ) { - if ( path != Torque::Path( mShapeName ) ) + if (mInterfaceData == nullptr) + return; + + String filePath; + if (mMeshAsset) + filePath = Torque::Path(mMeshAsset->getShapeFilename()); + + if (!mMeshAsset || path != Torque::Path(mMeshAsset->getShapeFilename()) ) return; updateShape(); @@ -217,6 +343,8 @@ U32 MeshComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) if (stream->writeFlag(mask & ShapeMask)) { stream->writeString(mShapeName); + + stream->writeInt(mRenderMode, 8); } if (stream->writeFlag( mask & MaterialMask )) @@ -227,7 +355,7 @@ U32 MeshComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) { stream->writeInt(mChangingMaterials[i].slot, 16); - NetStringHandle matNameStr = mChangingMaterials[i].matName.c_str(); + NetStringHandle matNameStr = mChangingMaterials[i].assetId.c_str(); con->packNetStringHandleU(stream, matNameStr); } @@ -244,6 +372,8 @@ void MeshComponent::unpackUpdate(NetConnection *con, BitStream *stream) if(stream->readFlag()) { mShapeName = stream->readSTString(); + + mRenderMode = (RenderMode)stream->readInt(8); setMeshAsset(mShapeName); updateShape(); } @@ -257,7 +387,10 @@ void MeshComponent::unpackUpdate(NetConnection *con, BitStream *stream) { matMap newMatMap; newMatMap.slot = stream->readInt(16); - newMatMap.matName = String(con->unpackNetStringHandleU(stream).getString()); + newMatMap.assetId = String(con->unpackNetStringHandleU(stream).getString()); + + //do the lookup, now + newMatMap.matAsset = AssetDatabase.acquireAsset(newMatMap.assetId); mChangingMaterials.push_back(newMatMap); } @@ -268,7 +401,7 @@ void MeshComponent::unpackUpdate(NetConnection *con, BitStream *stream) void MeshComponent::prepRenderImage( SceneRenderState *state ) { - if (!mEnabled || !mOwner || !mShapeInstance) + /*if (!mEnabled || !mOwner || !mShapeInstance) return; Point3F cameraOffset; @@ -301,114 +434,41 @@ void MeshComponent::prepRenderImage( SceneRenderState *state ) rdata.setLightQuery(&query); MatrixF mat = mOwner->getRenderTransform(); - Point3F renderPos = mat.getPosition(); - EulerF renderRot = mat.toEuler(); + + if (mOwner->isMounted()) + { + MatrixF wrldPos = mOwner->getWorldTransform(); + Point3F wrldPosPos = wrldPos.getPosition(); + + Point3F mntPs = mat.getPosition(); + EulerF mntRt = RotationF(mat).asEulerF(); + + bool tr = true; + } + mat.scale(objScale); GFX->setWorldMatrix(mat); - mShapeInstance->render(rdata); -} - -void MeshComponent::updateShape() -{ - bool isServer = isServerObject(); - - if ((mShapeName && mShapeName[0] != '\0') || (mShapeAsset && mShapeAsset[0] != '\0')) - { - if (mMeshAsset == NULL) - return; - - mShape = mMeshAsset->getShape(); - - if (!mShape) - return; - - setupShape(); - - //Do this on both the server and client - S32 materialCount = mShape->materialList->getMaterialNameList().size(); - - if(isServerObject()) - { - //we need to update the editor - for (U32 i = 0; i < mFields.size(); i++) - { - //find any with the materialslot title and clear them out - if (FindMatch::isMatch("MaterialSlot*", mFields[i].mFieldName, false)) - { - setDataField(mFields[i].mFieldName, NULL, ""); - mFields.erase(i); - continue; - } - } - - //next, get a listing of our materials in the shape, and build our field list for them - char matFieldName[128]; - - if(materialCount > 0) - mComponentGroup = StringTable->insert("Materials"); - - for(U32 i=0; i < materialCount; i++) - { - String materialname = mShape->materialList->getMaterialName(i); - if(materialname == String("ShapeBounds")) - continue; - - dSprintf(matFieldName, 128, "MaterialSlot%d", i); - - addComponentField(matFieldName, "A material used in the shape file", "TypeAssetId", materialname, ""); - } - - if(materialCount > 0) - mComponentGroup = ""; - } - - if(mOwner != NULL) - { - Point3F min, max, pos; - pos = mOwner->getPosition(); - - mOwner->getWorldToObj().mulP(pos); - - min = mShape->bounds.minExtents; - max = mShape->bounds.maxExtents; - - mShapeBounds.set(min, max); - - mOwner->setObjectBox(Box3F(min, max)); - - if( mOwner->getSceneManager() != NULL ) - mOwner->getSceneManager()->notifyObjectDirty( mOwner ); - } - - //finally, notify that our shape was changed - onShapeInstanceChanged.trigger(this); - } -} - -void MeshComponent::setupShape() -{ - mShapeInstance = new TSShapeInstance(mShape, true); + mShapeInstance->render(rdata);*/ } void MeshComponent::updateMaterials() { - if (mChangingMaterials.empty() || !mShape) + if (mChangingMaterials.empty() || !mMeshAsset->getShape()) return; - TSMaterialList* pMatList = mShapeInstance->getMaterialList(); + TSMaterialList* pMatList = mInterfaceData->mShapeInstance->getMaterialList(); pMatList->setTextureLookupPath(getShapeResource().getPath().getPath()); const Vector &materialNames = pMatList->getMaterialNameList(); for ( S32 i = 0; i < materialNames.size(); i++ ) { - const String &pName = materialNames[i]; - for(U32 m=0; m < mChangingMaterials.size(); m++) { if(mChangingMaterials[m].slot == i) { - pMatList->renameMaterial( i, mChangingMaterials[m].matName ); + //Fetch the actual material asset + pMatList->renameMaterial( i, mChangingMaterials[m].matAsset->getMaterialDefinitionName()); } } @@ -416,22 +476,31 @@ void MeshComponent::updateMaterials() } // Initialize the material instances - mShapeInstance->initMaterialList(); + mInterfaceData->mShapeInstance->initMaterialList(); } MatrixF MeshComponent::getNodeTransform(S32 nodeIdx) { - if (mShape) + if (mInterfaceData != nullptr && mMeshAsset->getShape()) { S32 nodeCount = getShape()->nodes.size(); if(nodeIdx >= 0 && nodeIdx < nodeCount) { //animate(); - MatrixF mountTransform = mShapeInstance->mNodeTransforms[nodeIdx]; - mountTransform.mul(mOwner->getRenderTransform()); + MatrixF nodeTransform = mInterfaceData->mShapeInstance->mNodeTransforms[nodeIdx]; + const Point3F& scale = mOwner->getScale(); - return mountTransform; + // The position of the node needs to be scaled. + Point3F position = nodeTransform.getPosition(); + position.convolve(scale); + nodeTransform.setPosition(position); + + MatrixF finalTransform = MatrixF::Identity; + + finalTransform.mul(mOwner->getRenderTransform(), nodeTransform); + + return finalTransform; } } @@ -440,7 +509,7 @@ MatrixF MeshComponent::getNodeTransform(S32 nodeIdx) S32 MeshComponent::getNodeByName(String nodeName) { - if (mShape) + if (mMeshAsset->getShape()) { S32 nodeIdx = getShape()->findNode(nodeName); @@ -486,12 +555,18 @@ void MeshComponent::onDynamicModified(const char* slotName, const char* newValue if(slot == -1) return; + //Safe to assume the inbound value for the material will be a MaterialAsset, so lets do a lookup on the name + MaterialAsset* matAsset = AssetDatabase.acquireAsset(newValue); + if (!matAsset) + return; + bool found = false; for(U32 i=0; i < mChangingMaterials.size(); i++) { if(mChangingMaterials[i].slot == slot) { - mChangingMaterials[i].matName = String(newValue); + mChangingMaterials[i].matAsset = matAsset; + mChangingMaterials[i].assetId = newValue; found = true; } } @@ -500,7 +575,8 @@ void MeshComponent::onDynamicModified(const char* slotName, const char* newValue { matMap newMatMap; newMatMap.slot = slot; - newMatMap.matName = String(newValue); + newMatMap.matAsset = matAsset; + newMatMap.assetId = newValue; mChangingMaterials.push_back(newMatMap); } @@ -511,14 +587,31 @@ void MeshComponent::onDynamicModified(const char* slotName, const char* newValue Parent::onDynamicModified(slotName, newValue); } -void MeshComponent::changeMaterial(U32 slot, const char* newMat) +void MeshComponent::changeMaterial(U32 slot, MaterialAsset* newMat) { char fieldName[512]; //update our respective field dSprintf(fieldName, 512, "materialSlot%d", slot); - setDataField(fieldName, NULL, newMat); + setDataField(fieldName, NULL, newMat->getAssetId()); +} + +bool MeshComponent::setMatInstField(U32 slot, const char* field, const char* value) +{ + TSMaterialList* pMatList = mInterfaceData->mShapeInstance->getMaterialList(); + pMatList->setTextureLookupPath(getShapeResource().getPath().getPath()); + + MaterialParameters* params = pMatList->getMaterialInst(slot)->getMaterialParameters(); + + if (pMatList->getMaterialInst(slot)->getFeatures().hasFeature(MFT_DiffuseColor)) + { + MaterialParameterHandle* handle = pMatList->getMaterialInst(slot)->getMaterialParameterHandle("DiffuseColor"); + + params->set(handle, LinearColorF(0, 0, 0)); + } + + return true; } void MeshComponent::onInspect() @@ -527,4 +620,13 @@ void MeshComponent::onInspect() void MeshComponent::onEndInspect() { +} + +void MeshComponent::ownerTransformSet(MatrixF *mat) +{ + if (mInterfaceData != nullptr) + { + MatrixF newTransform = *mat; + mInterfaceData->mTransform = newTransform; + } } \ No newline at end of file diff --git a/Engine/source/T3D/components/render/meshComponent.h b/Engine/source/T3D/components/render/meshComponent.h index 6adc2633e..587038d63 100644 --- a/Engine/source/T3D/components/render/meshComponent.h +++ b/Engine/source/T3D/components/render/meshComponent.h @@ -60,6 +60,8 @@ #include "gfx/gfxVertexFormat.h" #endif +#include "T3D/systems/render/meshRenderSystem.h" + class TSShapeInstance; class SceneRenderState; ////////////////////////////////////////////////////////////////////////// @@ -84,37 +86,38 @@ protected: StringTableEntry mShapeName; StringTableEntry mShapeAsset; TSShape* mShape; - Box3F mShapeBounds; + //Box3F mShapeBounds; Point3F mCenterOffset; + MeshRenderSystemInterface* mInterfaceData; + struct matMap { - String matName; + MaterialAsset* matAsset; + String assetId; U32 slot; }; Vector mChangingMaterials; Vector mMaterials; - class boneObject : public SimGroup +public: + enum RenderMode { - MeshComponent *mOwner; - public: - boneObject(MeshComponent *owner){ mOwner = owner; } - - StringTableEntry mBoneName; - S32 mItemID; - - virtual void addObject(SimObject *obj); + Individual = 0, + DynamicBatch, + StaticBatch, + Instanced }; - Vector mNodesList; +protected: + RenderMode mRenderMode; public: StringTableEntry mMeshAssetId; AssetPtr mMeshAsset; - TSShapeInstance* mShapeInstance; + //TSShapeInstance* mShapeInstance; public: MeshComponent(); @@ -132,7 +135,7 @@ public: virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream); virtual void unpackUpdate(NetConnection *con, BitStream *stream); - Box3F getShapeBounds() { return mShapeBounds; } + Box3F getShapeBounds() { return mInterfaceData->mBounds; } virtual MatrixF getNodeTransform(S32 nodeIdx); S32 getNodeByName(String nodeName); @@ -144,6 +147,8 @@ public: virtual void onComponentRemove(); virtual void onComponentAdd(); + virtual void ownerTransformSet(MatrixF *mat); + static bool _setMesh(void *object, const char *index, const char *data); static bool _setShape(void *object, const char *index, const char *data); const char* _getShape(void *object, const char *data); @@ -151,7 +156,7 @@ public: bool setMeshAsset(const char* assetName); virtual TSShape* getShape() { if (mMeshAsset) return mMeshAsset->getShape(); else return NULL; } - virtual TSShapeInstance* getShapeInstance() { return mShapeInstance; } + virtual TSShapeInstance* getShapeInstance() { return mInterfaceData->mShapeInstance; } Resource getShapeResource() { return mMeshAsset->getShapeResource(); } @@ -163,7 +168,8 @@ public: virtual void onDynamicModified(const char* slotName, const char* newValue); - void changeMaterial(U32 slot, const char* newMat); + void changeMaterial(U32 slot, MaterialAsset* newMat); + bool setMatInstField(U32 slot, const char* field, const char* value); virtual void onInspect(); virtual void onEndInspect(); @@ -180,4 +186,7 @@ public: } }; +typedef MeshComponent::RenderMode BatchingMode; +DefineEnumType(BatchingMode); + #endif diff --git a/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h b/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h index 5a19b8f08..396166def 100644 --- a/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h +++ b/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h @@ -126,6 +126,28 @@ DefineEngineMethod(MeshComponent, getNodePosition, Point3F, return Point3F(0, 0, 0); } +DefineEngineMethod(MeshComponent, getNodeRotation, EulerF, + (S32 node), (-1), + "@brief Mount objB to this object at the desired slot with optional transform.\n\n" + + "@param objB Object to mount onto us\n" + "@param slot Mount slot ID\n" + "@param txfm (optional) mount offset transform\n" + "@return true if successful, false if failed (objB is not valid)") +{ + if (node != -1) + { + //BUG: Unsure how it broke, but atm the default transform passed in here is rotated 180 degrees. This doesn't happen + //for the SceneObject mountobject method. Hackish, but for now, just default to a clean MatrixF::Identity + //object->mountObjectToNode( objB, node, /*MatrixF::Identity*/txfm.getMatrix() ); + RotationF mat = object->getNodeTransform(node); + + return mat.asEulerF(RotationF::Degrees); + } + + return EulerF(0, 0, 0); +} + DefineEngineMethod(MeshComponent, getNodeByName, S32, (String nodeName), , "@brief Mount objB to this object at the desired slot with optional transform.\n\n" @@ -148,8 +170,14 @@ DefineEngineMethod(MeshComponent, getNodeByName, S32, return -1; } -DefineEngineMethod(MeshComponent, changeMaterial, void, (U32 slot, const char* newMat), (0, ""), +DefineEngineMethod(MeshComponent, changeMaterial, void, (U32 slot, MaterialAsset* newMat), (0, nullAsType()), "@brief Change one of the materials on the shape.\n\n") { object->changeMaterial(slot, newMat); +} + +DefineEngineMethod(MeshComponent, setMatInstField, bool, (U32 slot, const char* field, const char* value), (0, "", ""), + "@brief Change one of the materials on the shape.\n\n") +{ + return object->setMatInstField(slot, field, value); } \ No newline at end of file diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index 00ecedad0..a7af19b33 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -47,10 +47,13 @@ #include "T3D/gameBase/std/stdMoveList.h" #include "T3D/prefab.h" +#include "T3D/gameBase/gameConnection.h" +#include // #include "gfx/sim/debugDraw.h" // +#include "T3D/sfx/sfx3DWorld.h" extern bool gEditingMission; @@ -117,6 +120,10 @@ Entity::Entity() mInitialized = false; + mLifetimeMS = 0; + + mGameObjectAssetId = StringTable->insert(""); + } Entity::~Entity() @@ -143,6 +150,15 @@ void Entity::initPersistFields() addField("LocalRotation", TypeMatrixRotation, Offset(mMount.xfm, Entity), "Rotation we are mounted at ( object space of our mount object )."); endGroup("Transform"); + + addGroup("Misc"); + addField("LifetimeMS", TypeS32, Offset(mLifetimeMS, Entity), "Object world orientation."); + endGroup("Misc"); + + addGroup("GameObject"); + addProtectedField("gameObjectName", TypeGameObjectAssetPtr, Offset(mGameObjectAsset, Entity), &_setGameObject, &defaultProtectedGetFn, + "The asset Id used for the game object this entity is based on."); + endGroup("GameObject"); } // @@ -215,15 +231,27 @@ bool Entity::onAdd() if (!Parent::onAdd()) return false; - mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); - + mObjBox = Box3F(Point3F(-0.5, -0.5, -0.5), Point3F(0.5, 0.5, 0.5)); + resetWorldBox(); setObjectBox(mObjBox); addToScene(); //Make sure we get positioned - setMaskBits(TransformMask); + if (isServerObject()) + { + setMaskBits(TransformMask); + setMaskBits(NamespaceMask); + } + else + { + //We can shortcut the initialization here because stuff generally ghosts down in order, and onPostAdd isn't called on ghosts. + onPostAdd(); + } + + if (mLifetimeMS != 0) + mStartTimeMS = Platform::getRealMilliseconds(); return true; } @@ -236,6 +264,8 @@ void Entity::onRemove() onDataSet.removeAll(); + mGameObjectAsset.clear(); + Parent::onRemove(); } @@ -249,10 +279,41 @@ void Entity::onPostAdd() mComponents[i]->onComponentAdd(); } + //Set up the networked components + mNetworkedComponents.clear(); + for (U32 i = 0; i < mComponents.size(); i++) + { + if (mComponents[i]->isNetworked()) + { + NetworkedComponent netComp; + netComp.componentIndex = i; + netComp.updateState = NetworkedComponent::Adding; + netComp.updateMaskBits = -1; + + mNetworkedComponents.push_back(netComp); + } + } + + if (!mNetworkedComponents.empty()) + { + setMaskBits(AddComponentsMask); + setMaskBits(ComponentsUpdateMask); + } + if (isMethod("onAdd")) Con::executef(this, "onAdd"); } +bool Entity::_setGameObject(void *object, const char *index, const char *data) +{ + Entity *e = static_cast(object); + + // Sanity! + AssertFatal(data != NULL, "Cannot use a NULL asset Id."); + + return true; //rbI->setMeshAsset(data); +} + void Entity::setDataField(StringTableEntry slotName, const char *array, const char *value) { Parent::setDataField(slotName, array, value); @@ -363,8 +424,28 @@ void Entity::processTick(const Move* move) } } - if (isMethod("processTick")) + // Save current rigid state interpolation + mDelta.posVec = getPosition(); + mDelta.rot[0] = mRot.asQuatF(); + + //Handle any script updates, which can include physics stuff + if (isServerObject() && isMethod("processTick")) Con::executef(this, "processTick"); + + // Wrap up interpolation info + mDelta.pos = getPosition(); + mDelta.posVec -= getPosition(); + mDelta.rot[1] = mRot.asQuatF(); + + setTransform(getPosition(), mRot); + + //Lifetime test + if (mLifetimeMS != 0) + { + S32 currentTime = Platform::getRealMilliseconds(); + if (currentTime - mStartTimeMS >= mLifetimeMS) + deleteObject(); + } } } @@ -402,11 +483,6 @@ U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream) if (stream->writeFlag(mask & TransformMask)) { - //mathWrite( *stream, getScale() ); - //stream->writeAffineTransform(mObjToWorld); - //mathWrite(*stream, getPosition()); - //mathWrite(*stream, mPos); - stream->writeCompressedPoint(mPos); mathWrite(*stream, getRotation()); @@ -415,73 +491,125 @@ U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->writeFlag(!(mask & NoWarpMask)); } - /*if (stream->writeFlag(mask & MountedMask)) - { - mathWrite(*stream, mMount.xfm.getPosition()); - mathWrite(*stream, mMount.xfm.toEuler()); - }*/ - if (stream->writeFlag(mask & BoundsMask)) { mathWrite(*stream, mObjBox); } - //pass our behaviors around - if (mask & ComponentsMask || mask & InitialUpdateMask) + if (stream->writeFlag(mask & AddComponentsMask)) { - stream->writeFlag(true); - //now, we run through a list of our to-be-sent behaviors and begin sending them - //if any fail, we keep our list and re-queue the mask - S32 componentCount = mToLoadComponents.size(); + U32 toAddComponentCount = 0; - //build our 'ready' list - //This requires both the instance and the instances' template to be prepped(if the template hasn't been ghosted, - //then we know we shouldn't be passing the instance's ghosts around yet) - U32 ghostedCompCnt = 0; - for (U32 i = 0; i < componentCount; i++) + for (U32 i = 0; i < mNetworkedComponents.size(); i++) { - if (con->getGhostIndex(mToLoadComponents[i]) != -1) - ghostedCompCnt++; - } - - if (ghostedCompCnt != 0) - { - stream->writeFlag(true); - - stream->writeFlag(mStartComponentUpdate); - - //if not all the behaviors have been ghosted, we'll need another pass - if (ghostedCompCnt != componentCount) - retMask |= ComponentsMask; - - //write the currently ghosted behavior count - stream->writeInt(ghostedCompCnt, 16); - - for (U32 i = 0; i < mToLoadComponents.size(); i++) + if (mNetworkedComponents[i].updateState == NetworkedComponent::Adding) { - //now fetch them and pass the ghost - S32 ghostIndex = con->getGhostIndex(mToLoadComponents[i]); - if (ghostIndex != -1) - { - stream->writeInt(ghostIndex, NetConnection::GhostIdBitSize); - mToLoadComponents.erase(i); - i--; - - mStartComponentUpdate = false; - } + toAddComponentCount++; } } - else if (componentCount) + + //you reaaaaally shouldn't have >255 networked components on a single entity + stream->writeInt(toAddComponentCount, 8); + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) { - //on the odd chance we have behaviors to ghost, but NONE of them have been yet, just set the flag now - stream->writeFlag(false); - retMask |= ComponentsMask; + NetworkedComponent::UpdateState state = mNetworkedComponents[i].updateState; + + if (mNetworkedComponents[i].updateState == NetworkedComponent::Adding) + { + const char* className = mComponents[mNetworkedComponents[i].componentIndex]->getClassName(); + stream->writeString(className, strlen(className)); + + mNetworkedComponents[i].updateState = NetworkedComponent::Updating; + } } - else - stream->writeFlag(false); } - else - stream->writeFlag(false); + + if (stream->writeFlag(mask & RemoveComponentsMask)) + { + /*U32 toRemoveComponentCount = 0; + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Adding) + { + toRemoveComponentCount++; + } + } + + //you reaaaaally shouldn't have >255 networked components on a single entity + stream->writeInt(toRemoveComponentCount, 8); + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Removing) + { + stream->writeInt(i, 16); + } + }*/ + + /*for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::UpdateState::Removing) + { + removeComponent(mComponents[mNetworkedComponents[i].componentIndex], true); + mNetworkedComponents.erase(i); + i--; + + } + }*/ + } + + //Update our components + if (stream->writeFlag(mask & ComponentsUpdateMask)) + { + U32 toUpdateComponentCount = 0; + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Updating) + { + toUpdateComponentCount++; + } + } + + //you reaaaaally shouldn't have >255 networked components on a single entity + stream->writeInt(toUpdateComponentCount, 8); + + bool forceUpdate = false; + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Updating) + { + stream->writeInt(i, 8); + + mNetworkedComponents[i].updateMaskBits = mComponents[mNetworkedComponents[i].componentIndex]->packUpdate(con, mNetworkedComponents[i].updateMaskBits, stream); + + if (mNetworkedComponents[i].updateMaskBits != 0) + forceUpdate = true; + else + mNetworkedComponents[i].updateState = NetworkedComponent::None; + } + } + + //If we have leftover, we need to re-iterate our packing + if (forceUpdate) + setMaskBits(ComponentsUpdateMask); + } + + /*if (stream->writeFlag(mask & NamespaceMask)) + { + const char* name = getName(); + if (stream->writeFlag(name && name[0])) + stream->writeString(String(name)); + + if (stream->writeFlag(mSuperClassName && mSuperClassName[0])) + stream->writeString(String(mSuperClassName)); + + if (stream->writeFlag(mClassName && mClassName[0])) + stream->writeString(String(mClassName)); + }*/ return retMask; } @@ -492,20 +620,10 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) if (stream->readFlag()) { - /*Point3F scale; - mathRead( *stream, &scale ); - setScale( scale);*/ - - //MatrixF objToWorld; - //stream->readAffineTransform(&objToWorld); - Point3F pos; - stream->readCompressedPoint(&pos); - //mathRead(*stream, &pos); RotationF rot; - mathRead(*stream, &rot); mDelta.move.unpack(stream); @@ -514,72 +632,6 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) { // Determine number of ticks to warp based on the average // of the client and server velocities. - /*mDelta.warpOffset = pos - mDelta.pos; - - F32 dt = mDelta.warpOffset.len() / (0.5f * TickSec); - - mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - - //F32 as = (speed + mVelocity.len()) * 0.5f * TickSec; - //F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as : sMaxWarpTicks; - //mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - - //mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - - //mDelta.warpTicks = sMaxWarpTicks; - - mDelta.warpTicks = 0; - - if (mDelta.warpTicks) - { - // Setup the warp to start on the next tick. - if (mDelta.warpTicks > sMaxWarpTicks) - mDelta.warpTicks = sMaxWarpTicks; - mDelta.warpOffset /= (F32)mDelta.warpTicks; - - mDelta.rot[0] = rot.asQuatF(); - mDelta.rot[1] = rot.asQuatF(); - - mDelta.rotOffset = rot.asEulerF() - mDelta.rot.asEulerF(); - - // Ignore small rotation differences - if (mFabs(mDelta.rotOffset.x) < 0.001f) - mDelta.rotOffset.x = 0; - - if (mFabs(mDelta.rotOffset.y) < 0.001f) - mDelta.rotOffset.y = 0; - - if (mFabs(mDelta.rotOffset.z) < 0.001f) - mDelta.rotOffset.z = 0; - - mDelta.rotOffset /= (F32)mDelta.warpTicks; - } - else - { - // Going to skip the warp, server and client are real close. - // Adjust the frame interpolation to move smoothly to the - // new position within the current tick. - Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; - if (mDelta.dt == 0) - { - mDelta.posVec.set(0.0f, 0.0f, 0.0f); - mDelta.rotVec.set(0.0f, 0.0f, 0.0f); - } - else - { - F32 dti = 1.0f / mDelta.dt; - mDelta.posVec = (cp - pos) * dti; - mDelta.rotVec.z = mRot.z - rot.z; - - mDelta.rotVec.z *= dti; - } - - mDelta.pos = pos; - mDelta.rot = rot; - - setTransform(pos, rot); - }*/ - Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; mDelta.warpOffset = pos - cp; @@ -631,42 +683,101 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) } } - /*if (stream->readFlag()) - { - Point3F mountOffset; - EulerF mountRot; - mathRead(*stream, &mountOffset); - mathRead(*stream, &mountRot); - - RotationF rot = RotationF(mountRot); - mountRot = rot.asEulerF(RotationF::Degrees); - - setMountOffset(mountOffset); - setMountRotation(mountRot); - }*/ - if (stream->readFlag()) { mathRead(*stream, &mObjBox); resetWorldBox(); } + //AddComponentMask if (stream->readFlag()) { - //are we passing any behaviors currently? + U32 addedComponentCount = stream->readInt(8); + + for (U32 i = 0; i < addedComponentCount; i++) + { + char className[256] = ""; + stream->readString(className); + + //Change to components, so iterate our list and create any new components + // Well, looks like we have to create a new object. + const char* componentType = className; + + ConsoleObject *object = ConsoleObject::create(componentType); + + // Finally, set currentNewObject to point to the new one. + Component* newComponent = dynamic_cast(object); + + if (newComponent) + { + addComponent(newComponent); + } + } + } + + //RemoveComponentMask + if (stream->readFlag()) + { + + } + + //ComponentUpdateMask + if (stream->readFlag()) + { + U32 updatingComponents = stream->readInt(8); + + for (U32 i = 0; i < updatingComponents; i++) + { + U32 updateComponentIndex = stream->readInt(8); + + Component* comp = mComponents[updateComponentIndex]; + comp->unpackUpdate(con, stream); + } + } + + /*if (stream->readFlag()) + { if (stream->readFlag()) { - //if we've just started the update, clear our behaviors - if (stream->readFlag()) - clearComponents(false); + char name[256]; + stream->readString(name); + assignName(name); + } - S32 componentCount = stream->readInt(16); + if (stream->readFlag()) + { + char superClassname[256]; + stream->readString(superClassname); + mSuperClassName = superClassname; + } - for (U32 i = 0; i < componentCount; i++) - { - S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize); - addComponent(dynamic_cast(con->resolveGhost(gIndex))); - } + if (stream->readFlag()) + { + char classname[256]; + stream->readString(classname); + mClassName = classname; + } + + linkNamespaces(); + }*/ +} + +void Entity::setComponentNetMask(Component* comp, U32 mask) +{ + setMaskBits(Entity::ComponentsUpdateMask); + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + U32 netCompId = mComponents[mNetworkedComponents[i].componentIndex]->getId(); + U32 compId = comp->getId(); + + if (netCompId == compId && + (mNetworkedComponents[i].updateState == NetworkedComponent::None || mNetworkedComponents[i].updateState == NetworkedComponent::Updating)) + { + mNetworkedComponents[i].updateState = NetworkedComponent::Updating; + mNetworkedComponents[i].updateMaskBits |= mask; + + break; } } } @@ -674,8 +785,7 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) //Manipulation void Entity::setTransform(const MatrixF &mat) { - //setMaskBits(TransformMask); - setMaskBits(TransformMask | NoWarpMask); + MatrixF oldTransform = getTransform(); if (isMounted()) { @@ -687,25 +797,20 @@ void Entity::setTransform(const MatrixF &mat) if (!newOffset.isZero()) { - //setMountOffset(newOffset); mPos = newOffset; } Point3F matEul = mat.toEuler(); - //mRot = Point3F(mRadToDeg(matEul.x), mRadToDeg(matEul.y), mRadToDeg(matEul.z)); - if (matEul != Point3F(0, 0, 0)) { Point3F mountEul = mMount.object->getTransform().toEuler(); Point3F diff = matEul - mountEul; - //setMountRotation(Point3F(mRadToDeg(diff.x), mRadToDeg(diff.y), mRadToDeg(diff.z))); mRot = diff; } else { - //setMountRotation(Point3F(0, 0, 0)); mRot = Point3F(0, 0, 0); } @@ -714,6 +819,9 @@ void Entity::setTransform(const MatrixF &mat) transf.setPosition(mPos + mMount.object->getPosition()); Parent::setTransform(transf); + + if (transf != oldTransform) + setMaskBits(TransformMask); } else { @@ -744,6 +852,8 @@ void Entity::setTransform(const MatrixF &mat) void Entity::setTransform(Point3F position, RotationF rotation) { + MatrixF oldTransform = getTransform(); + if (isMounted()) { mPos = position; @@ -755,7 +865,8 @@ void Entity::setTransform(Point3F position, RotationF rotation) Parent::setTransform(transf); - setMaskBits(TransformMask); + if (transf != oldTransform) + setMaskBits(TransformMask); } else { @@ -774,7 +885,6 @@ void Entity::setTransform(Point3F position, RotationF rotation) mPos = position; mRot = rotation; - setMaskBits(TransformMask); //if (isServerObject()) // setMaskBits(TransformMask); @@ -788,19 +898,22 @@ void Entity::setTransform(Point3F position, RotationF rotation) //PROFILE_SCOPE(Entity_setTransform); // Update the transforms. - Parent::setTransform(newMat); - onTransformSet.trigger(&newMat); + U32 compCount = mComponents.size(); + for (U32 i = 0; i < compCount; ++i) + { + mComponents[i]->ownerTransformSet(&newMat); + } - /*mObjToWorld = mWorldToObj = newMat; - mWorldToObj.affineInverse(); - // Update the world-space AABB. - resetWorldBox(); - // If we're in a SceneManager, sync our scene state. - if (mSceneManager != NULL) - mSceneManager->notifyObjectDirty(this); - setRenderTransform(newMat);*/ + Point3F newPos = newMat.getPosition(); + RotationF newRot = newMat; + + Point3F oldPos = oldTransform.getPosition(); + RotationF oldRot = oldTransform; + + if (newPos != oldPos || newRot != oldRot) + setMaskBits(TransformMask); } } @@ -833,7 +946,11 @@ void Entity::setRenderTransform(Point3F position, RotationF rotation) Parent::setRenderTransform(newMat); - onTransformSet.trigger(&newMat); + U32 compCount = mComponents.size(); + for (U32 i = 0; i < compCount; ++i) + { + mComponents[i]->ownerTransformSet(&newMat); + } } } @@ -887,7 +1004,7 @@ void Entity::setMountRotation(EulerF rotOffset) temp.setColumn(3, mMount.xfm.getPosition()); mMount.xfm = temp; - //mRot = RotationF(temp); + setMaskBits(MountedMask); } } @@ -964,63 +1081,6 @@ void Entity::getRenderMountTransform(F32 delta, S32 index, const MatrixF &xfm, M Parent::getMountTransform(index, xfm, outMat); } -void Entity::setForwardVector(VectorF newForward, VectorF upVector) -{ - MatrixF mat = getTransform(); - - VectorF up(0.0f, 0.0f, 1.0f); - VectorF axisX; - VectorF axisY = newForward; - VectorF axisZ; - - if (upVector != VectorF::Zero) - up = upVector; - - // Validate and normalize input: - F32 lenSq; - lenSq = axisY.lenSquared(); - if (lenSq < 0.000001f) - { - axisY.set(0.0f, 1.0f, 0.0f); - Con::errorf("Entity::setForwardVector() - degenerate forward vector"); - } - else - { - axisY /= mSqrt(lenSq); - } - - - lenSq = up.lenSquared(); - if (lenSq < 0.000001f) - { - up.set(0.0f, 0.0f, 1.0f); - Con::errorf("SceneObject::setForwardVector() - degenerate up vector - too small"); - } - else - { - up /= mSqrt(lenSq); - } - - if (fabsf(mDot(up, axisY)) > 0.9999f) - { - Con::errorf("SceneObject::setForwardVector() - degenerate up vector - same as forward"); - // i haven't really tested this, but i think it generates something which should be not parallel to the previous vector: - F32 tmp = up.x; - up.x = -up.y; - up.y = up.z; - up.z = tmp; - } - - // construct the remaining axes: - mCross(axisY, up, &axisX); - mCross(axisX, axisY, &axisZ); - - mat.setColumn(0, axisX); - mat.setColumn(1, axisY); - mat.setColumn(2, axisZ); - - setTransform(mat); -} // //These basically just redirect to any collision behaviors we have bool Entity::castRay(const Point3F &start, const Point3F &end, RayInfo* info) @@ -1117,6 +1177,28 @@ void Entity::onUnmount(SceneObject *obj, S32 node) } } +void Entity::setControllingClient(GameConnection* client) +{ + if (isGhost() && gSFX3DWorld) + { + if (gSFX3DWorld->getListener() == this && !client && getControllingClient() && getControllingClient()->isConnectionToServer()) + { + // We are the current listener and are no longer a controller object on the + // connection, so clear our listener status. + + gSFX3DWorld->setListener(NULL); + } + else if (client && client->isConnectionToServer() && !getControllingObject()) + { + // We're on the local client and not controlled by another object, so make + // us the current SFX listener. + + gSFX3DWorld->setListener(this); + } + } + Parent::setControllingClient(client); +} + //Heirarchy stuff void Entity::addObject(SimObject* object) { @@ -1223,11 +1305,28 @@ bool Entity::addComponent(Component *comp) // Register the component with this owner. comp->setOwner(this); + comp->setIsServerObject(isServerObject()); + //if we've already been added and this is being added after the fact(at runtime), //then just go ahead and call it's onComponentAdd so it can get to work - if (mInitialized) + //if (mInitialized) + { comp->onComponentAdd(); + if (comp->isNetworked()) + { + NetworkedComponent netComp; + netComp.componentIndex = mComponents.size() - 1; + netComp.updateState = NetworkedComponent::Adding; + netComp.updateMaskBits = -1; + + mNetworkedComponents.push_back(netComp); + + setMaskBits(AddComponentsMask); + setMaskBits(ComponentsUpdateMask); + } + } + onComponentAdded.trigger(comp); return true; @@ -1261,9 +1360,8 @@ bool Entity::removeComponent(Component *comp, bool deleteComponent) onComponentRemoved.trigger(comp); - comp->setOwner(NULL); - comp->onComponentRemove(); //in case the behavior needs to do cleanup on the owner + comp->setOwner(NULL); if (deleteComponent) comp->safeDeleteObject(); @@ -1338,7 +1436,7 @@ Component *Entity::getComponent(String componentType) Namespace *NS = comp->getNamespace(); //we shouldn't ever go past Component into net object, as we're no longer dealing with component classes - while (dStrcmp(NS->getName(), "NetObject")) + while (dStrcmp(NS->getName(), "SimObject")) { String namespaceName = NS->getName(); @@ -1364,72 +1462,6 @@ void Entity::onInspect() { (*it)->onInspect(); } - - GuiTreeViewCtrl *editorTree = dynamic_cast(Sim::findObject("EditorTree")); - if (!editorTree) - return; - - GuiTreeViewCtrl::Item *newItem, *parentItem; - - parentItem = editorTree->getItem(editorTree->findItemByObjectId(getId())); - - S32 componentID = editorTree->insertItem(parentItem->getID(), "Components"); - - newItem = editorTree->getItem(componentID); - newItem->mState.set(GuiTreeViewCtrl::Item::VirtualParent); - newItem->mState.set(GuiTreeViewCtrl::Item::DenyDrag); - //newItem->mState.set(GuiTreeViewCtrl::Item::InspectorData); - newItem->mState.set(GuiTreeViewCtrl::Item::ForceItemName); - //newItem->mInspectorInfo.mObject = this; - - AssetManager *assetDB = dynamic_cast(Sim::findObject("AssetDatabase")); - if (!assetDB) - return; - - //This is used in the event of script-created assets, which likely only have - //the name and other 'friendly' properties stored in a ComponentAsset. - //So we'll do a query for those assets and find the asset based on the component's - //class name - AssetQuery* qry = new AssetQuery(); - qry->registerObject(); - - assetDB->findAssetType(qry, "ComponentAsset"); - - for (U32 i = 0; i < mComponents.size(); ++i) - { - String compName = mComponents[i]->getFriendlyName(); - - if (compName == String("")) - { - String componentClass = mComponents[i]->getClassNamespace(); - - //Means that it's a script-derived component and we should consult the asset to try - //to get the info for it - S32 compAssetCount = qry->mAssetList.size(); - for (U32 c = 0; c < compAssetCount; ++c) - { - StringTableEntry assetID = qry->mAssetList[c]; - - ComponentAsset* compAsset = assetDB->acquireAsset(assetID); - - String compAssetClass = compAsset->getComponentName(); - if (componentClass == compAssetClass) - { - compName = compAsset->getFriendlyName(); - break; - } - } - } - - S32 compID = editorTree->insertItem(componentID, compName); - newItem = editorTree->getItem(compID); - newItem->mInspectorInfo.mObject = mComponents[i]; - newItem->mState.set(GuiTreeViewCtrl::Item::ForceItemName); - newItem->mState.set(GuiTreeViewCtrl::Item::DenyDrag); - newItem->mState.set(GuiTreeViewCtrl::Item::InspectorData); - } - - editorTree->buildVisibleTree(true); } void Entity::onEndInspect() @@ -1615,9 +1647,25 @@ void Entity::updateContainer() } // +void Entity::notifyComponents(String signalFunction, String argA, String argB, String argC, String argD, String argE) +{ + for (U32 i = 0; i < mComponents.size(); i++) + { + // We can do this because both are in the string table + Component *comp = mComponents[i]; + + if (comp->isActive()) + { + if (comp->isMethod(signalFunction)) + Con::executef(comp, signalFunction, argA, argB, argC, argD, argE); + } + } +} + void Entity::setComponentsDirty() { - if (mToLoadComponents.empty()) + bool tmp = true; + /*if (mToLoadComponents.empty()) mStartComponentUpdate = true; //we need to build a list of behaviors that need to be pushed across the network @@ -1642,7 +1690,7 @@ void Entity::setComponentsDirty() } } - setMaskBits(ComponentsMask); + setMaskBits(ComponentsMask);*/ } void Entity::setComponentDirty(Component *comp, bool forceUpdate) @@ -1833,7 +1881,6 @@ DefineConsoleMethod(Entity, getComponent, S32, (String componentName), (""), Component *comp = object->getComponent(componentName); return (comp != NULL) ? comp->getId() : 0; - return 0; } /*ConsoleMethod(Entity, getBehaviorByType, S32, 3, 3, "(string BehaviorTemplateName) - gets a behavior\n" @@ -1917,6 +1964,15 @@ DefineConsoleMethod(Entity, getMoveTrigger, bool, (S32 triggerNum), (0), return false; } +DefineEngineMethod(Entity, getForwardVector, VectorF, (), , + "Get the direction this object is facing.\n" + "@return a vector indicating the direction this object is facing.\n" + "@note This is the object's y axis.") +{ + VectorF forVec = object->getTransform().getForwardVector(); + return forVec; +} + DefineConsoleMethod(Entity, setForwardVector, void, (VectorF newForward), (VectorF(0,0,0)), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") @@ -1936,4 +1992,53 @@ DefineConsoleMethod(Entity, rotateTo, void, (Point3F lookPosition, F32 degreePer "@return The number of static fields defined on the object.") { //object->setForwardVector(newForward); +} + +DefineConsoleMethod(Entity, notify, void, (String signalFunction, String argA, String argB, String argC, String argD, String argE), +("", "", "", "", "", ""), +"Triggers a signal call to all components for a certain function.") +{ + if (signalFunction == String("")) + return; + + object->notifyComponents(signalFunction, argA, argB, argC, argD, argE); +} + +DefineConsoleFunction(findEntitiesByTag, const char*, (SimGroup* searchingGroup, String tags), (nullAsType(), ""), +"Finds all entities that have the provided tags.\n" +"@param searchingGroup The SimGroup to search inside. If null, we'll search the entire dictionary(this can be slow!).\n" +"@param tags Word delimited list of tags to search for. If multiple tags are included, the list is eclusively parsed, requiring all tags provided to be found on an entity for a match.\n" +"@return A word list of IDs of entities that match the tag search terms.") +{ + //if (tags.isEmpty()) + return ""; + + /*if (searchingGroup == nullptr) + { + searchingGroup = Sim::getRootGroup(); + } + + StringTableEntry entityStr = StringTable->insert("Entity"); + + std::thread threadBob; + + std::thread::id a = threadBob.get_id(); + std::thread::id b = std::this_thread::get_id().; + + if (a == b) + { + //do + } + + for (SimGroup::iterator itr = searchingGroup->begin(); itr != searchingGroup->end(); itr++) + { + Entity* ent = dynamic_cast((*itr)); + + if (ent != nullptr) + { + ent->mTags. + } + } + + object->notifyComponents(signalFunction, argA, argB, argC, argD, argE);*/ } \ No newline at end of file diff --git a/Engine/source/T3D/entity.h b/Engine/source/T3D/entity.h index 52818f6f9..db65f2866 100644 --- a/Engine/source/T3D/entity.h +++ b/Engine/source/T3D/entity.h @@ -35,6 +35,12 @@ #ifndef _CONTAINERQUERY_H_ #include "T3D/containerQuery.h" #endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif +#ifndef GAME_OBJECT_ASSET_H +#include "T3D/assets/GameObjectAsset.h" +#endif class Component; @@ -52,18 +58,43 @@ private: Vector mComponents; - Vector mToLoadComponents; + //Bit of helper data to let us track and manage the adding, removal and updating of networked components + struct NetworkedComponent + { + U32 componentIndex; + + enum UpdateState + { + None, + Adding, + Removing, + Updating + }; + + UpdateState updateState; + + U32 updateMaskBits; + }; + + Vector mNetworkedComponents; + + U32 mComponentNetMask; bool mStartComponentUpdate; + StringTableEntry mGameObjectAssetId; + AssetPtr mGameObjectAsset; + ContainerQueryInfo containerInfo; bool mInitialized; + String mTags; + Signal< void(Component*) > onComponentAdded; Signal< void(Component*) > onComponentRemoved; - Signal< void(MatrixF*) > onTransformSet; + S32 mLifetimeMS; protected: @@ -96,9 +127,12 @@ public: { TransformMask = Parent::NextFreeMask << 0, BoundsMask = Parent::NextFreeMask << 1, - ComponentsMask = Parent::NextFreeMask << 2, - NoWarpMask = Parent::NextFreeMask << 3, - NextFreeMask = Parent::NextFreeMask << 4 + ComponentsUpdateMask = Parent::NextFreeMask << 2, + AddComponentsMask = Parent::NextFreeMask << 3, + RemoveComponentsMask = Parent::NextFreeMask << 4, + NoWarpMask = Parent::NextFreeMask << 5, + NamespaceMask = Parent::NextFreeMask << 6, + NextFreeMask = Parent::NextFreeMask << 7 }; StateDelta mDelta; @@ -106,6 +140,8 @@ public: Move lastMove; + S32 mStartTimeMS; + // Entity(); ~Entity(); @@ -123,16 +159,14 @@ public: virtual MatrixF getTransform(); virtual Point3F getPosition() const { return mPos; } - //void setTransform(Point3F position, RotationF rot); - - //void setRotation(RotationF rotation); - void setRotation(RotationF rotation) { mRot = rotation; setMaskBits(TransformMask); }; RotationF getRotation() { return mRot; } + static bool _setGameObject(void *object, const char *index, const char *data); + void setMountOffset(Point3F posOffset); void setMountRotation(EulerF rotOffset); @@ -146,13 +180,18 @@ public: virtual void getMountTransform(S32 index, const MatrixF &xfm, MatrixF *outMat); virtual void getRenderMountTransform(F32 delta, S32 index, const MatrixF &xfm, MatrixF *outMat); - void setForwardVector(VectorF newForward, VectorF upVector = VectorF::Zero); - virtual void mountObject(SceneObject *obj, S32 node, const MatrixF &xfm = MatrixF::Identity); void mountObject(SceneObject* objB, MatrixF txfm); void onMount(SceneObject *obj, S32 node); void onUnmount(SceneObject *obj, S32 node); + /// Sets the client controlling this object + /// @param client Client that is now controlling this object + virtual void setControllingClient(GameConnection *client); + + // + //Networking + // // NetObject U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); void unpackUpdate(NetConnection *conn, BitStream *stream); @@ -160,9 +199,13 @@ public: void setComponentsDirty(); void setComponentDirty(Component *comp, bool forceUpdate = false); + void setComponentNetMask(Component* comp, U32 mask); + //Components virtual bool deferAddingComponents() const { return true; } + void notifyComponents(String signalFunction, String argA, String argB, String argC, String argD, String argE); + template T* getComponent(); template diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index 03f9e6202..cfe87de6d 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -44,10 +44,8 @@ #include "console/engineAPI.h" #include "math/mTransform.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/entity.h" #include "T3D/components/coreInterfaces.h" -#endif #ifdef TORQUE_HIFI_NET #include "T3D/gameBase/hifi/hifiMoveList.h" @@ -789,7 +787,6 @@ bool GameConnection::getControlCameraFov(F32 * fov) } if (cObj) { -#ifdef TORQUE_EXPERIMENTAL_EC if (Entity* ent = dynamic_cast(cObj)) { if (CameraInterface* camInterface = ent->getComponent()) @@ -799,11 +796,9 @@ bool GameConnection::getControlCameraFov(F32 * fov) } else { - *fov = cObj->getCameraFov(); + *fov = cObj->getCameraFov(); } -#else - *fov = cObj->getCameraFov(); -#endif + return(true); } @@ -823,7 +818,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov) if (cObj) { -#ifdef TORQUE_EXPERIMENTAL_EC if (Entity* ent = dynamic_cast(cObj)) { if (CameraInterface* camInterface = ent->getComponent()) @@ -835,9 +829,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov) { return cObj->isValidCameraFov(fov); } -#else - return cObj->isValidCameraFov(fov); -#endif } return NULL; @@ -855,8 +846,6 @@ bool GameConnection::setControlCameraFov(F32 fov) } if (cObj) { - -#ifdef TORQUE_EXPERIMENTAL_EC F32 newFov = 90.f; if (Entity* ent = dynamic_cast(cObj)) { @@ -876,11 +865,6 @@ bool GameConnection::setControlCameraFov(F32 fov) cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov)); newFov = cObj->getCameraFov(); } -#else - // allow shapebase to clamp fov to its datablock values - cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov)); - F32 newFov = cObj->getCameraFov(); -#endif // server fov of client has 1degree resolution if( S32(newFov) != S32(mCameraFov) || newFov != fov ) diff --git a/Engine/source/T3D/gameBase/processList.cpp b/Engine/source/T3D/gameBase/processList.cpp index 1fef84fc2..13285caa1 100644 --- a/Engine/source/T3D/gameBase/processList.cpp +++ b/Engine/source/T3D/gameBase/processList.cpp @@ -32,10 +32,8 @@ #include "platform/profiler.h" #include "console/consoleTypes.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/coreInterfaces.h" #include "T3D/components/component.h" -#endif //---------------------------------------------------------------------------- ProcessObject::ProcessObject() @@ -277,12 +275,10 @@ void ProcessList::advanceObjects() onTickObject(pobj); } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { UpdateInterface::all[i]->processTick(); } -#endif mTotalTicks++; diff --git a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp index b9c3a27f1..1e9166316 100644 --- a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp +++ b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp @@ -37,10 +37,8 @@ #include "T3D/gameBase/std/stdMoveList.h" #include "T3D/fx/cameraFXMgr.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/coreInterfaces.h" #include "T3D/components/component.h" -#endif MODULE_BEGIN( ProcessList ) @@ -137,7 +135,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast(UpdateInterface::all[i]); @@ -147,7 +144,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) UpdateInterface::all[i]->interpolateTick(mLastDelta); } -#endif // Inform objects of total elapsed delta so they can advance // client side animations. @@ -163,7 +159,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast(UpdateInterface::all[i]); @@ -176,7 +171,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) UpdateInterface::all[i]->advanceTime(dt); } -#endif return ret; } diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index 8970e3e3c..e6d21b93a 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -1209,7 +1209,7 @@ DefineEngineMethod( Item, isRotating, bool, (),, return object->isRotating(); } -DefineEngineMethod( Item, setCollisionTimeout, bool, (S32 ignoreColObj),(NULL), +DefineEngineMethod( Item, setCollisionTimeout, bool, (S32 ignoreColObj),, "@brief Temporarily disable collisions against a specific ShapeBase object.\n\n" "This is useful to prevent a player from immediately picking up an Item they have " diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 5f71a7eb9..643a5955d 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -4405,7 +4405,7 @@ DefineEngineMethod( ShapeBase, getEyeTransform, TransformF, (),, return mat; } -DefineEngineMethod( ShapeBase, getLookAtPoint, const char*, ( F32 distance, S32 typeMask ), ( 2000, 0xFFFFFFFF ), +DefineEngineMethod( ShapeBase, getLookAtPoint, const char*, ( F32 distance, U32 typeMask ), ( 2000, 0xFFFFFFFF ), "@brief Get the world position this object is looking at.\n\n" "Casts a ray from the eye and returns information about what the ray hits.\n" diff --git a/Engine/source/T3D/systems/componentSystem.h b/Engine/source/T3D/systems/componentSystem.h new file mode 100644 index 000000000..fc106a6a2 --- /dev/null +++ b/Engine/source/T3D/systems/componentSystem.h @@ -0,0 +1,30 @@ +#pragma once +#include "console/engineAPI.h" + +template +class SystemInterface +{ +public: + bool mIsEnabled; + bool mIsServer; + + static Vector all; + + SystemInterface() + { + all.push_back((T*)this); + } + + virtual ~SystemInterface() + { + for (U32 i = 0; i < all.size(); i++) + { + if (all[i] == (T*)this) + { + all.erase(i); + return; + } + } + } +}; +template Vector SystemInterface::all(0); \ No newline at end of file diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.cpp b/Engine/source/T3D/systems/render/meshRenderSystem.cpp new file mode 100644 index 000000000..214a63dfe --- /dev/null +++ b/Engine/source/T3D/systems/render/meshRenderSystem.cpp @@ -0,0 +1,375 @@ +#include "T3D/systems/render/meshRenderSystem.h" +#include "gfx/gfxTransformSaver.h" +#include "lighting/lightQuery.h" + +#include "renderInstance/renderPassManager.h" +#include "materials/materialManager.h" +#include "materials/baseMatInstance.h" + +Vector MeshRenderSystem::mBufferMaterials(0); +Vector MeshRenderSystem::mStaticBuffers(0); + +void MeshRenderSystem::render(SceneManager *sceneManager, SceneRenderState* state) +{ + Frustum viewFrustum = state->getCullingFrustum(); + MatrixF camTransform = state->getCameraTransform(); + + U32 count = MeshRenderSystemInterface::all.size(); + for (U32 i = 0; i < count; i++) + { + //Server side items exist for data, but we don't actually render them + bool isClient = MeshRenderSystemInterface::all[i]->mIsClient; + if (!MeshRenderSystemInterface::all[i]->mIsClient) + continue; + + bool isStatic = MeshRenderSystemInterface::all[i]->mStatic; + if (MeshRenderSystemInterface::all[i]->mStatic) + continue; + + //First, do frustum culling + if (viewFrustum.isCulled(MeshRenderSystemInterface::all[i]->mBounds)) + continue; + + // Set the query box for the container query. Never + // make it larger than the frustum's AABB. In the editor, + // always query the full frustum as that gives objects + // the opportunity to render editor visualizations even if + // they are otherwise not in view. + if (!state->getCullingFrustum().getBounds().isOverlapped(state->getRenderArea())) + { + // This handles fringe cases like flying backwards into a zone where you + // end up pretty much standing on a zone border and looking directly into + // its "walls". In that case the traversal area will be behind the frustum + // (remember that the camera isn't where visibility starts, it's the near + // distance). + + continue; + } + + //We can then sort our objects by range since we have it already, so we can do occlusion culling be rendering front-to-back + + //if we've made it this far, call down to the render function to actually display our stuff + renderInterface(i, state); + } + + //Static Batch rendering + if ( /*!mMaterialInst ||*/ !state) + return; + + BaseMatInstance *matInst = MATMGR->getWarningMatInstance(); + + // Get a handy pointer to our RenderPassmanager + RenderPassManager *renderPass = state->getRenderPass(); + + for (U32 i = 0; i < mStaticBuffers.size(); i++) + { + for (U32 b = 0; b < mStaticBuffers[i].buffers.size(); b++) + { + if (mStaticBuffers[i].buffers[b].vertData.empty()) + continue; + + MeshRenderInst *ri = renderPass->allocInst(); + + // Set our RenderInst as a standard mesh render + ri->type = RenderPassManager::RIT_Mesh; + + //If our material has transparency set on this will redirect it to proper render bin + if (matInst->getMaterial()->isTranslucent()) + { + ri->type = RenderPassManager::RIT_Translucent; + ri->translucentSort = true; + } + + // Calculate our sorting point + if (state) + { + // Calculate our sort point manually. + const Box3F& rBox = Box3F(1000);// getRenderWorldBox(); + ri->sortDistSq = rBox.getSqDistanceToPoint(state->getCameraPosition()); + } + else + ri->sortDistSq = 0.0f; + + // Set up our transforms + MatrixF objectToWorld = MatrixF::Identity;//getRenderTransform(); + //objectToWorld.scale(getScale()); + + ri->objectToWorld = renderPass->allocUniqueXform(objectToWorld); + ri->worldToCamera = renderPass->allocSharedXform(RenderPassManager::View); + ri->projection = renderPass->allocSharedXform(RenderPassManager::Projection); + + // If our material needs lights then fill the RIs + // light vector with the best lights. + /*if (matInst->isForwardLit()) + { + LightQuery query; + query.init(getWorldSphere()); + query.getLights(ri->lights, 8); + }*/ + + // Make sure we have an up-to-date backbuffer in case + // our Material would like to make use of it + // NOTICE: SFXBB is removed and refraction is disabled! + //ri->backBuffTex = GFX->getSfxBackBuffer(); + + // Set our Material + ri->matInst = matInst; + + // Set up our vertex buffer and primitive buffer + ri->vertBuff = &mStaticBuffers[i].buffers[b].vertexBuffer; + ri->primBuff = &mStaticBuffers[i].buffers[b].primitiveBuffer; + + ri->prim = renderPass->allocPrim(); + ri->prim->type = GFXTriangleList; + ri->prim->minIndex = 0; + ri->prim->startIndex = 0; + ri->prim->numPrimitives = mStaticBuffers[i].buffers[b].primData.size(); + ri->prim->startVertex = 0; + ri->prim->numVertices = mStaticBuffers[i].buffers[b].vertData.size(); + + // We sort by the material then vertex buffer + ri->defaultKey = matInst->getStateHint(); + ri->defaultKey2 = (uintptr_t)ri->vertBuff; // Not 64bit safe! + + // Submit our RenderInst to the RenderPassManager + state->getRenderPass()->addInst(ri); + } + } +} + +void MeshRenderSystem::renderInterface(U32 interfaceIndex, SceneRenderState* state) +{ + //Fetch + MeshRenderSystemInterface* interface = MeshRenderSystemInterface::all[interfaceIndex]; + + if (interface->mShapeInstance == nullptr) + return; + + Point3F cameraOffset; + interface->mTransform.getColumn(3, &cameraOffset); + cameraOffset -= state->getDiffuseCameraPosition(); + F32 dist = cameraOffset.len(); + if (dist < 0.01f) + dist = 0.01f; + + Point3F objScale = interface->mScale; + F32 invScale = (1.0f / getMax(getMax(objScale.x, objScale.y), objScale.z)); + + interface->mShapeInstance->setDetailFromDistance(state, dist * invScale); + + if (interface->mShapeInstance->getCurrentDetail() < 0) + return; + + GFXTransformSaver saver; + + // Set up our TS render state. + TSRenderState rdata; + rdata.setSceneState(state); + rdata.setFadeOverride(1.0f); + rdata.setOriginSort(false); + + // We might have some forward lit materials + // so pass down a query to gather lights. + LightQuery query; + query.init(interface->mSphere); + rdata.setLightQuery(&query); + + MatrixF mat = interface->mTransform; + + mat.scale(objScale); + GFX->setWorldMatrix(mat); + + interface->mShapeInstance->render(rdata); +} + +void MeshRenderSystem::rebuildBuffers() +{ + U32 BUFFER_SIZE = 65000; + Vector tempIndices; + tempIndices.reserve(4); + + Box3F newBounds = Box3F::Zero; + + mStaticBuffers.clear(); + + for (U32 i = 0; i < MeshRenderSystemInterface::all.size(); i++) + { + if (!MeshRenderSystemInterface::all[i]->mIsEnabled) + continue; + + if (!MeshRenderSystemInterface::all[i]->mIsClient || !MeshRenderSystemInterface::all[i]->mStatic) + continue; + + //TODO: Properly re-implement StaticElements to container owner interfaces and buffer sets + for (U32 j = 0; j < MeshRenderSystemInterface::all[i]->mGeometry.mPolyList.size(); j++) + { + const OptimizedPolyList::Poly& poly = MeshRenderSystemInterface::all[i]->mGeometry.mPolyList[j]; + + if (poly.vertexCount < 3) + continue; + + tempIndices.setSize(poly.vertexCount); + dMemset(tempIndices.address(), 0, poly.vertexCount); + + if (poly.type == OptimizedPolyList::TriangleStrip || + poly.type == OptimizedPolyList::TriangleFan) + { + tempIndices[0] = 0; + U32 idx = 1; + + for (U32 k = 1; k < poly.vertexCount; k += 2) + tempIndices[idx++] = k; + + for (U32 k = ((poly.vertexCount - 1) & (~0x1)); k > 0; k -= 2) + tempIndices[idx++] = k; + } + else if (poly.type == OptimizedPolyList::TriangleList) + { + for (U32 k = 0; k < poly.vertexCount; k++) + tempIndices[k] = k; + } + else + continue; + + //got our data, now insert it into the correct buffer! + S32 bufferId = findBufferSetByMaterial(poly.material); + + if (bufferId == -1) + { + //add a new buffer set if we didn't get a match! + BufferSet newSet; + newSet.surfaceMaterialId = poly.material; + + mStaticBuffers.push_back(newSet); + + bufferId = mStaticBuffers.size() - 1; + } + + //see if this would push us over our buffer size limit, if it is, make a new buffer for this set + if (mStaticBuffers[bufferId].buffers.last().vertData.size() + 3 > BUFFER_SIZE + || mStaticBuffers[bufferId].buffers.last().primData.size() + 1 > BUFFER_SIZE) + { + //yep, we'll overstep with this, so spool up a new buffer in this set + BufferSet::Buffers newBuffer = BufferSet::Buffers(); + mStaticBuffers[bufferId].buffers.push_back(newBuffer); + } + + const U32& firstIdx = MeshRenderSystemInterface::all[i]->mGeometry.mIndexList[poly.vertexStart]; + const OptimizedPolyList::VertIndex& firstVertIdx = MeshRenderSystemInterface::all[i]->mGeometry.mVertexList[firstIdx]; + + //Vector geomPoints = MeshRenderSystemInterface::all[i]->mGeometry.mPoints; + //Vector geomNormals = MeshRenderSystemInterface::all[i]->mGeometry.mNormals; + //Vector geoUVs = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s; + + for (U32 k = 1; k < poly.vertexCount - 1; k++) + { + const U32& secondIdx = MeshRenderSystemInterface::all[i]->mGeometry.mIndexList[poly.vertexStart + tempIndices[k]]; + const U32& thirdIdx = MeshRenderSystemInterface::all[i]->mGeometry.mIndexList[poly.vertexStart + tempIndices[k + 1]]; + + const OptimizedPolyList::VertIndex& secondVertIdx = MeshRenderSystemInterface::all[i]->mGeometry.mVertexList[secondIdx]; + const OptimizedPolyList::VertIndex& thirdVertIdx = MeshRenderSystemInterface::all[i]->mGeometry.mVertexList[thirdIdx]; + + Point3F points[3]; + points[0] = MeshRenderSystemInterface::all[i]->mGeometry.mPoints[firstVertIdx.vertIdx]; + points[1] = MeshRenderSystemInterface::all[i]->mGeometry.mPoints[secondVertIdx.vertIdx]; + points[2] = MeshRenderSystemInterface::all[i]->mGeometry.mPoints[thirdVertIdx.vertIdx]; + + Point3F normals[3]; + normals[0] = MeshRenderSystemInterface::all[i]->mGeometry.mNormals[firstVertIdx.normalIdx]; + normals[1] = MeshRenderSystemInterface::all[i]->mGeometry.mNormals[secondVertIdx.normalIdx]; + normals[2] = MeshRenderSystemInterface::all[i]->mGeometry.mNormals[thirdVertIdx.normalIdx]; + + Point3F tangents[3]; + tangents[0] = mCross(points[1] - points[0], normals[0]); + tangents[1] = mCross(points[2] - points[1], normals[1]); + tangents[2] = mCross(points[0] - points[2], normals[2]); + + Point2F uvs[3]; + uvs[0] = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s[firstVertIdx.uv0Idx]; + uvs[1] = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s[secondVertIdx.uv0Idx]; + uvs[2] = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s[thirdVertIdx.uv0Idx]; + + mStaticBuffers[bufferId].vertCount += 3; + mStaticBuffers[bufferId].primCount += 1; + + for (U32 v = 0; v < 3; ++v) + { + //Build the vert and store it to the buffers! + GFXVertexPNTT bufVert; + bufVert.point = points[v]; + bufVert.normal = normals[v]; + bufVert.tangent = tangents[v]; + bufVert.texCoord = uvs[v]; + + newBounds.extend(points[v]); + + mStaticBuffers[bufferId].buffers.last().vertData.push_back(bufVert); + + U32 vertPrimId = mStaticBuffers[bufferId].buffers.last().vertData.size() - 1; + mStaticBuffers[bufferId].buffers.last().primData.push_back(vertPrimId); + + mStaticBuffers[bufferId].center += points[v]; + } + } + } + } + + //Now, iterate through the organized data and turn them into renderable buffers + for (U32 i = 0; i < mStaticBuffers.size(); i++) + { + for (U32 b = 0; b < mStaticBuffers[i].buffers.size(); b++) + { + BufferSet::Buffers& buffers = mStaticBuffers[i].buffers[b]; + + //if there's no data to be had in this buffer, just skip it + if (buffers.vertData.empty()) + continue; + + buffers.vertexBuffer.set(GFX, buffers.vertData.size(), GFXBufferTypeStatic); + GFXVertexPNTT *pVert = buffers.vertexBuffer.lock(); + + for (U32 v = 0; v < buffers.vertData.size(); v++) + { + pVert->normal = buffers.vertData[v].normal; + pVert->tangent = buffers.vertData[v].tangent; + //pVert->color = buffers.vertData[v].color; + pVert->point = buffers.vertData[v].point; + pVert->texCoord = buffers.vertData[v].texCoord; + + pVert++; + } + + buffers.vertexBuffer.unlock(); + + // Allocate PB + buffers.primitiveBuffer.set(GFX, buffers.primData.size(), buffers.primData.size() / 3, GFXBufferTypeStatic); + + U16 *pIndex; + buffers.primitiveBuffer.lock(&pIndex); + + for (U16 i = 0; i < buffers.primData.size(); i++) + { + *pIndex = i; + pIndex++; + } + + buffers.primitiveBuffer.unlock(); + } + + mStaticBuffers[i].center /= mStaticBuffers[i].vertCount; + } + + //mObjBox = newBounds; + //resetWorldBox(); +} + +U32 MeshRenderSystem::findBufferSetByMaterial(U32 matId) +{ + for (U32 i = 0; i < mStaticBuffers.size(); i++) + { + if (mStaticBuffers[i].surfaceMaterialId == matId) + return i; + } + + return -1; +} \ No newline at end of file diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.h b/Engine/source/T3D/systems/render/meshRenderSystem.h new file mode 100644 index 000000000..4bc2269db --- /dev/null +++ b/Engine/source/T3D/systems/render/meshRenderSystem.h @@ -0,0 +1,207 @@ +#pragma once +#include "scene/sceneRenderState.h" +#include "T3D/systems/componentSystem.h" +#include "ts/tsShape.h" +#include "ts/tsShapeInstance.h" +#include "T3D/assets/ShapeAsset.h" +#include "T3D/assets/MaterialAsset.h" + +#ifndef _GFXVERTEXBUFFER_H_ +#include "gfx/gfxVertexBuffer.h" +#endif +#ifndef _GFXPRIMITIVEBUFFER_H_ +#include "gfx/gfxPrimitiveBuffer.h" +#endif +#ifndef _OPTIMIZEDPOLYLIST_H_ +#include "collision/optimizedPolyList.h" +#endif + +class MeshRenderSystemInterface : public SystemInterface +{ +public: + TSShapeInstance * mShapeInstance; + + MatrixF mTransform; + Point3F mScale; + Box3F mBounds; + SphereF mSphere; + + bool mIsClient; + + struct matMap + { + //MaterialAsset* matAsset; + String assetId; + U32 slot; + }; + + Vector mChangingMaterials; + Vector mMaterials; + + //Static geometry stuff + bool mStatic; + + OptimizedPolyList mGeometry; + + MeshRenderSystemInterface() : SystemInterface(), mShapeInstance(nullptr), mTransform(MatrixF::Identity), mScale(Point3F::One), mIsClient(false), mStatic(false) + { + mBounds = Box3F(1); + mSphere = SphereF(); + } + + ~MeshRenderSystemInterface() + { + //SAFE_DELETE(mShape); + SAFE_DELETE(mShapeInstance); + } +}; + +class MeshRenderSystem +{ +protected: + /*struct StaticBatchElement + { + SimObject* owner; + OptimizedPolyList geometry; + String batchName; + }; + + static Vector mStaticElements;*/ + + //We retain the pushed geometry data for rendering here. It's static(unless forced to change through editing or whatnot) + //so rendering the batches is real fast + struct BufferMaterials + { + // The name of the Material we will use for rendering + String mMaterialName; + // The actual Material instance + BaseMatInstance* mMaterialInst; + + BufferMaterials() + { + mMaterialName = ""; + mMaterialInst = NULL; + } + }; + + static Vector mBufferMaterials; + + struct BufferSet + { + U32 surfaceMaterialId; + + U32 vertCount; + U32 primCount; + + Point3F center; + + struct Buffers + { + U32 vertStart; + U32 primStart; + U32 vertCount; + U32 primCount; + + Vector vertData; + Vector primData; + + GFXVertexBufferHandle< GFXVertexPNTT > vertexBuffer; + GFXPrimitiveBufferHandle primitiveBuffer; + + Buffers() + { + vertStart = 0; + primStart = 0; + vertCount = 0; + primCount = 0; + + vertexBuffer = NULL; + primitiveBuffer = NULL; + } + }; + + Vector buffers; + + BufferSet() + { + Buffers newBuffer; + buffers.push_back(newBuffer); + + surfaceMaterialId = 0; + + vertCount = 0; + primCount = 0; + + center = Point3F::Zero; + } + }; + + static Vector mStaticBuffers; + +public: + /*virtual void prepRenderImage(SceneRenderState *state); + + bool setMeshAsset(const char* assetName); + + virtual TSShape* getShape() { if (mMeshAsset) return mMeshAsset->getShape(); else return NULL; } + virtual TSShapeInstance* getShapeInstance() { return mShapeInstance; } + + Resource getShapeResource() { return mMeshAsset->getShapeResource(); } + + void _onResourceChanged(const Torque::Path &path); + + virtual bool castRayRendered(const Point3F &start, const Point3F &end, RayInfo *info); + + void mountObjectToNode(SceneObject* objB, String node, MatrixF txfm); + + virtual void onDynamicModified(const char* slotName, const char* newValue); + + void changeMaterial(U32 slot, MaterialAsset* newMat); + bool setMatInstField(U32 slot, const char* field, const char* value); + + virtual void onInspect(); + virtual void onEndInspect(); + + virtual Vector getNodeTransforms() + { + Vector bob; + return bob; + } + + virtual void setNodeTransforms(Vector transforms) + { + return; + }*/ + + /*MeshRenderSystem() + { + + } + virtual ~MeshRenderSystem() + { + smInterfaceList.clear(); + } + + static MeshComponentInterface* GetNewInterface() + { + smInterfaceList.increment(); + + return &smInterfaceList.last(); + } + + static void RemoveInterface(T* q) + { + smInterfaceList.erase(q); + }*/ + + //Core render function, which does all the real work + static void render(SceneManager *sceneManager, SceneRenderState* state); + + //Render our particular interface's data + static void renderInterface(U32 interfaceIndex, SceneRenderState* state); + + //Static Batch rendering + static void rebuildBuffers(); + + static U32 findBufferSetByMaterial(U32 matId); +}; \ No newline at end of file diff --git a/Engine/source/T3D/systems/updateSystem.cpp b/Engine/source/T3D/systems/updateSystem.cpp new file mode 100644 index 000000000..128329365 --- /dev/null +++ b/Engine/source/T3D/systems/updateSystem.cpp @@ -0,0 +1,34 @@ +#include "T3D/systems/updateSystem.h" + +void UpdateSystem::processTick() +{ + for (U32 i = 0; i < UpdateSystemInterface::all.size(); i++) + { + if (UpdateSystemInterface::all[i]->mIsEnabled) + { + //do work + } + } +} + +void UpdateSystem::advanceTime(U32 _tickMS) +{ + for (U32 i = 0; i < UpdateSystemInterface::all.size(); i++) + { + if (UpdateSystemInterface::all[i]->mIsEnabled) + { + //do work + } + } +} + +void UpdateSystem::interpolateTick(U32 _deltaMS) +{ + for (U32 i = 0; i < UpdateSystemInterface::all.size(); i++) + { + if (UpdateSystemInterface::all[i]->mIsEnabled) + { + //do work + } + } +} \ No newline at end of file diff --git a/Engine/source/T3D/systems/updateSystem.h b/Engine/source/T3D/systems/updateSystem.h new file mode 100644 index 000000000..b7d24eb88 --- /dev/null +++ b/Engine/source/T3D/systems/updateSystem.h @@ -0,0 +1,16 @@ +#pragma once +#include "componentSystem.h" + +class UpdateSystemInterface : public SystemInterface +{ +public: + bool mIsEnabled; +}; + +class UpdateSystem +{ +public: + static void processTick(); + static void advanceTime(U32 _tickMS); + static void interpolateTick(U32 _deltaMS); +}; \ No newline at end of file diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index 0a914ad11..63ad635ac 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -453,7 +453,7 @@ const char* afxCamera::getMode() static char buffer[100]; ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8, - "(GameBase orbitObject, transform mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" + "(GameBase orbitObject, TransformF mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" "Set the camera to orbit around some given object.\n\n" "@param orbitObject Object we want to orbit.\n" "@param mat A set of fields: posX posY posZ aaX aaY aaZ aaTheta\n" @@ -541,7 +541,7 @@ ConsoleMethod(afxCamera, getThirdPersonAngle, F32, 2, 2, "") return object->getThirdPersonAngle(); } -ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, Point3f coi_offset])") +ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, Point3F coi_offset])") { Point3F offset; dSscanf(argv[2], "%f %f %f", &offset.x, &offset.y, &offset.z); diff --git a/Engine/source/afx/afxChoreographer.cpp b/Engine/source/afx/afxChoreographer.cpp index 581ba42ba..5473552f5 100644 --- a/Engine/source/afx/afxChoreographer.cpp +++ b/Engine/source/afx/afxChoreographer.cpp @@ -848,13 +848,13 @@ void afxChoreographer::unregisterParticlePool(afxParticlePool* pool) //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// -DefineEngineMethod( afxChoreographer, setRanking, void, ( unsigned int ranking ),, +DefineEngineMethod( afxChoreographer, setRanking, void, ( U32 ranking ),, "Set a ranking value (0-255) for the choreographer.\n" ) { object->setRanking((U8)ranking); } -DefineEngineMethod( afxChoreographer, setLevelOfDetail, void, ( unsigned int lod ),, +DefineEngineMethod( afxChoreographer, setLevelOfDetail, void, ( U32 lod ),, "Set a level-of-detail value (0-255) for the choreographer.\n" ) { object->setLevelOfDetail((U8)lod); diff --git a/Engine/source/afx/ui/afxSpellButton.cpp b/Engine/source/afx/ui/afxSpellButton.cpp index 149423dd0..2ca1e4473 100644 --- a/Engine/source/afx/ui/afxSpellButton.cpp +++ b/Engine/source/afx/ui/afxSpellButton.cpp @@ -343,13 +343,13 @@ afxRPGMagicSpellData* afxSpellButton::getSpellRPGDataBlock() const //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// -DefineEngineMethod( afxSpellButton, onSpellbookChange, void, ( afxSpellBook* spellbook, unsigned int page ),, +DefineEngineMethod( afxSpellButton, onSpellbookChange, void, ( afxSpellBook* spellbook, U32 page ),, "Notify an afxSpellButton when its associated spellbook has changed.\n" ) { object->setSpellBook(spellbook, (U8)page); } -DefineEngineMethod( afxSpellButton, onTurnPage, void, ( unsigned int page ),, +DefineEngineMethod( afxSpellButton, onTurnPage, void, (U32 page ),, "Notify an afxSpellButton when the spellbook turns to a new page.\n" ) { object->setPage((U8)page); diff --git a/Engine/source/afx/ui/afxTSCtrl.cpp b/Engine/source/afx/ui/afxTSCtrl.cpp index 5766b43a4..5a308601c 100644 --- a/Engine/source/afx/ui/afxTSCtrl.cpp +++ b/Engine/source/afx/ui/afxTSCtrl.cpp @@ -329,7 +329,7 @@ DefineEngineMethod(afxTSCtrl, setSpellBook, void, (afxSpellBook* spellbook),, object->setSpellBook(spellbook); } -DefineEngineMethod(afxTSCtrl, pushTargetingMode, void, (unsigned int mode, unsigned int checkMethod), ((U32)arcaneFX::TARGETING_OFF, (U32)arcaneFX::TARGET_CHECK_POLL), +DefineEngineMethod(afxTSCtrl, pushTargetingMode, void, (U32 mode, U32 checkMethod), ((U32)arcaneFX::TARGETING_OFF, (U32)arcaneFX::TARGET_CHECK_POLL), "Push a new targeting-mode onto a statck of modes.\n\n" "@ingroup AFX") { diff --git a/Engine/source/afx/util/afxParticlePool.cpp b/Engine/source/afx/util/afxParticlePool.cpp index 37647f294..e6dbb172f 100644 --- a/Engine/source/afx/util/afxParticlePool.cpp +++ b/Engine/source/afx/util/afxParticlePool.cpp @@ -60,6 +60,8 @@ afxParticlePoolData::afxParticlePoolData(const afxParticlePoolData& other, bool ImplementEnumType( afxParticlePool_PoolType, "Possible particle pool types.\n" "@ingroup afxParticlePool\n\n" ) { afxParticlePoolData::POOL_NORMAL, "normal", "..." }, { afxParticlePoolData::POOL_TWOPASS, "two-pass", "..." }, +// Alias... + { afxParticlePoolData::POOL_TWOPASS, "twopass", "..." }, EndImplementEnumType; afxParticlePoolData::~afxParticlePoolData() diff --git a/Engine/source/afx/util/afxParticlePool_T3D.cpp b/Engine/source/afx/util/afxParticlePool_T3D.cpp index 6689326cd..d6c4847f9 100644 --- a/Engine/source/afx/util/afxParticlePool_T3D.cpp +++ b/Engine/source/afx/util/afxParticlePool_T3D.cpp @@ -28,7 +28,7 @@ #include "scene/sceneRenderState.h" #include "T3D/fx/particleEmitter.h" #include "renderInstance/renderPassManager.h" -#include "lighting/lightinfo.h" +#include "lighting/lightInfo.h" #include "lighting/lightManager.h" #include "afx/util/afxParticlePool.h" diff --git a/Engine/source/app/mainLoop.cpp b/Engine/source/app/mainLoop.cpp index c77c33552..5fc4aa8c0 100644 --- a/Engine/source/app/mainLoop.cpp +++ b/Engine/source/app/mainLoop.cpp @@ -45,6 +45,7 @@ #include "console/debugOutputConsumer.h" #include "console/consoleTypes.h" #include "console/engineAPI.h" +#include "console/codeInterpreter.h" #include "gfx/bitmap/gBitmap.h" #include "gfx/gFont.h" @@ -227,6 +228,9 @@ void StandardMainLoop::init() ManagedSingleton< ThreadManager >::createSingleton(); FrameAllocator::init(TORQUE_FRAME_SIZE); // See comments in torqueConfig.h + // Initialize the TorqueScript interpreter. + CodeInterpreter::init(); + // Yell if we can't initialize the network. if(!Net::init()) { diff --git a/Engine/source/assets/assetBase.cpp b/Engine/source/assets/assetBase.cpp index 85ec18834..39cd4115f 100644 --- a/Engine/source/assets/assetBase.cpp +++ b/Engine/source/assets/assetBase.cpp @@ -69,7 +69,7 @@ AssetBase::~AssetBase() // If the asset manager does not own the asset then we own the // asset definition so delete it. if (!getOwned()) - delete mpAssetDefinition; + SAFE_DELETE(mpAssetDefinition); } //----------------------------------------------------------------------------- diff --git a/Engine/source/assets/assetBase.h b/Engine/source/assets/assetBase.h index 8709c5474..73c6df1c0 100644 --- a/Engine/source/assets/assetBase.h +++ b/Engine/source/assets/assetBase.h @@ -62,6 +62,7 @@ class AssetBase : public SimObject typedef SimObject Parent; +protected: AssetManager* mpOwningAssetManager; bool mAssetInitialized; AssetDefinition* mpAssetDefinition; diff --git a/Engine/source/assets/assetManager.cpp b/Engine/source/assets/assetManager.cpp index 2ed7b19ae..da610a895 100644 --- a/Engine/source/assets/assetManager.cpp +++ b/Engine/source/assets/assetManager.cpp @@ -54,6 +54,23 @@ #include "console/consoleTypes.h" #endif +#ifndef _AUTOLOAD_ASSETS_H_ +#include "assets/autoloadAssets.h" +#endif + +#ifndef COMPONENTASSET_H +#include "T3D/assets/ComponentAsset.h" +#endif +#ifndef GUI_ASSET_H +#include "T3D/assets/GUIAsset.h" +#endif +#ifndef SCRIPT_ASSET_H +#include "T3D/assets/ScriptAsset.h" +#endif +#ifndef MATERIALASSET_H +#include "T3D/assets/MaterialAsset.h" +#endif + // Script bindings. #include "assetManager_ScriptBinding.h" @@ -202,6 +219,69 @@ bool AssetManager::addModuleDeclaredAssets( ModuleDefinition* pModuleDefinition return true; } +bool AssetManager::loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition) +{ + // Debug Profiling. + PROFILE_SCOPE(AssetManager_loadModuleAutoLoadAssets); + + // Sanity! + AssertFatal(pModuleDefinition != NULL, "Cannot auto load assets using a NULL module definition"); + + // Does the module have any assets associated with it? + if (pModuleDefinition->getModuleAssets().empty()) + { + // Yes, so warn. + Con::warnf("Asset Manager: Cannot auto load assets to module '%s' as it has no existing assets.", pModuleDefinition->getSignature()); + return false; + } + + U32 assetCount = pModuleDefinition->getModuleAssets().size(); + + // Iterate the module definition children. + for (SimSet::iterator itr = pModuleDefinition->begin(); itr != pModuleDefinition->end(); ++itr) + { + // Fetch the declared assets. + AutoloadAssets* pAutoloadAssets = dynamic_cast(*itr); + + // Skip if it's not a declared assets location. + if (pAutoloadAssets == NULL) + continue; + + for (U32 i = 0; i < assetCount; ++i) + { + AssetDefinition* assetDef = pModuleDefinition->getModuleAssets()[i]; + + if (assetDef->mAssetType == pAutoloadAssets->getAssetType()) + { + //TODO: this is stupid and ugly, need to properly automagically parse the class for registration + AssetBase* assetBase = nullptr; + + if (assetDef->mAssetType == StringTable->insert("ComponentAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } + else if (assetDef->mAssetType == StringTable->insert("GUIAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } + else if (assetDef->mAssetType == StringTable->insert("ScriptAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } + else if (assetDef->mAssetType == StringTable->insert("MaterialAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } + + //load the asset now if valid + if (assetBase) + addPrivateAsset(assetBase); + } + } + } + + return true; +} //----------------------------------------------------------------------------- bool AssetManager::addDeclaredAsset( ModuleDefinition* pModuleDefinition, const char* pAssetFilePath ) @@ -2310,6 +2390,13 @@ S32 AssetManager::findAssetLooseFile( AssetQuery* pAssetQuery, const char* pLoos //----------------------------------------------------------------------------- +AssetManager::typeAssetDependsOnHash* AssetManager::getDependedOnAssets() +{ + // Find any asset dependencies. + return &mAssetDependsOn; +} +//----------------------------------------------------------------------------- + bool AssetManager::scanDeclaredAssets( const char* pPath, const char* pExtension, const bool recurse, ModuleDefinition* pModuleDefinition ) { // Debug Profiling. @@ -2974,6 +3061,9 @@ void AssetManager::onModulePreLoad( ModuleDefinition* pModuleDefinition ) // Add module declared assets. addModuleDeclaredAssets( pModuleDefinition ); + // Load any auto-loaded asset types + loadModuleAutoLoadAssets(pModuleDefinition); + // Is an asset tags manifest specified? if ( pModuleDefinition->getAssetTagsManifest() != StringTable->EmptyString() ) { diff --git a/Engine/source/assets/assetManager.h b/Engine/source/assets/assetManager.h index fbf1522f3..9271ea534 100644 --- a/Engine/source/assets/assetManager.h +++ b/Engine/source/assets/assetManager.h @@ -73,15 +73,18 @@ class AssetManager : public SimObject, public ModuleCallbacks { private: typedef SimObject Parent; - typedef StringTableEntry typeAssetId; - typedef StringTableEntry typeAssetName; - typedef StringTableEntry typeReferenceFilePath; - typedef HashMap typeDeclaredAssetsHash; - typedef HashTable typeReferencedAssetsHash; - typedef HashTable typeAssetDependsOnHash; - typedef HashTable typeAssetIsDependedOnHash; - typedef HashMap typeAssetPtrRefreshHash; +public: + typedef StringTableEntry typeAssetId; + typedef StringTableEntry typeAssetName; + typedef StringTableEntry typeReferenceFilePath; + typedef HashMap typeDeclaredAssetsHash; + typedef HashTable typeReferencedAssetsHash; + typedef HashTable typeAssetDependsOnHash; + typedef HashTable typeAssetIsDependedOnHash; + typedef HashMap typeAssetPtrRefreshHash; + +private: /// Declared assets. typeDeclaredAssetsHash mDeclaredAssets; @@ -127,6 +130,7 @@ public: bool removeDeclaredAssets( ModuleDefinition* pModuleDefinition ); bool removeDeclaredAsset( const char* pAssetId ); bool renameDeclaredAsset( const char* pAssetIdFrom, const char* pAssetIdTo ); + bool loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition); StringTableEntry getAssetName( const char* pAssetId ); StringTableEntry getAssetDescription( const char* pAssetId ); StringTableEntry getAssetCategory( const char* pAssetId ); @@ -367,6 +371,8 @@ public: S32 findTaggedAssets( AssetQuery* pAssetQuery, const char* pAssetTagNames, const bool assetQueryAsSource = false ); S32 findAssetLooseFile( AssetQuery* pAssetQuery, const char* pLooseFile, const bool assetQueryAsSource = false ); + typeAssetDependsOnHash* getDependedOnAssets(); + /// Declare Console Object. DECLARE_CONOBJECT( AssetManager ); diff --git a/Engine/source/platformSDL/menus/guiPlatformGenericMenuBar.h b/Engine/source/assets/autoloadAssets.cpp similarity index 63% rename from Engine/source/platformSDL/menus/guiPlatformGenericMenuBar.h rename to Engine/source/assets/autoloadAssets.cpp index b2129a8b1..e5b3ca53f 100644 --- a/Engine/source/platformSDL/menus/guiPlatformGenericMenuBar.h +++ b/Engine/source/assets/autoloadAssets.cpp @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC +// Copyright (c) 2013 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to @@ -20,32 +20,26 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#pragma once +#ifndef _AUTOLOAD_ASSETS_H_ +#include "assets/autoloadAssets.h" +#endif -#include "gui/editor/guiMenuBar.h" -#include "platformSDL/menus/PlatformSDLPopupMenuData.h" -#include "platform/menus/popupMenu.h" +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif -class GuiPlatformGenericMenuBar : public GuiMenuBar +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(AutoloadAssets); + +//----------------------------------------------------------------------------- + +void AutoloadAssets::initPersistFields() { - typedef GuiMenuBar Parent; -public: - DECLARE_CONOBJECT(GuiPlatformGenericMenuBar); + // Call Parent. + Parent::initPersistFields(); - virtual void menuItemSelected(Menu *menu, MenuItem *item) - { - AssertFatal(menu && item, ""); - - PopupMenu *popupMenu = PlatformPopupMenuData::mMenuMap[menu]; - AssertFatal(popupMenu, ""); - - popupMenu->handleSelect(item->id); - - Parent::menuItemSelected(menu, item); - } - -protected: - /// menu id / item id - Map, String> mCmds; - -}; \ No newline at end of file + addField("Path", TypeString, Offset(mPath, AutoloadAssets), ""); + addField("AssetType", TypeString, Offset(mAssetType, AutoloadAssets), ""); + addField("Recurse", TypeBool, Offset(mRecurse, AutoloadAssets), ""); +} diff --git a/Engine/source/assets/autoloadAssets.h b/Engine/source/assets/autoloadAssets.h new file mode 100644 index 000000000..5a33e57c1 --- /dev/null +++ b/Engine/source/assets/autoloadAssets.h @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _AUTOLOAD_ASSETS_H_ +#define _AUTOLOAD_ASSETS_H_ + +#ifndef _SIM_H_ +#include "console/sim.h" +#endif + +#ifndef _SIMOBJECT_H_ +#include "console/simObject.h" +#endif + +#ifndef _CONSOLEOBJECT_H_ +#include "console/consoleObject.h" +#endif + +//----------------------------------------------------------------------------- + +class AutoloadAssets : public SimObject +{ + friend class AssetManager; + +private: + typedef SimObject Parent; + + StringTableEntry mPath; + StringTableEntry mAssetType; + bool mRecurse; + +public: + AutoloadAssets() : + mPath(StringTable->EmptyString()), + mAssetType(StringTable->EmptyString()), + mRecurse(false) + {} + virtual ~AutoloadAssets() {} + + static void initPersistFields(); + + inline void setPath(const char* pPath) { mPath = StringTable->insert(pPath); } + inline StringTableEntry getPath(void) const { return mPath; } + inline void setAssetType(const char* pPath) { mAssetType = StringTable->insert(pPath); } + inline StringTableEntry getAssetType(void) const { return mAssetType; } + inline void setRecurse(const bool recurse) { mRecurse = recurse; } + inline bool getRecurse(void) const { return mRecurse; } + + /// Declare Console Object. + DECLARE_CONOBJECT(AutoloadAssets); +}; + +#endif // _DECLARED_ASSETS_H_ + +#pragma once diff --git a/Engine/source/console/CMDgram.y b/Engine/source/console/CMDgram.y index 5ebd9492b..6cfbf3311 100644 --- a/Engine/source/console/CMDgram.y +++ b/Engine/source/console/CMDgram.y @@ -496,9 +496,9 @@ class_name_expr assign_op_struct : opPLUSPLUS - { $$.lineNumber = $1.lineNumber; $$.token = '+'; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } + { $$.lineNumber = $1.lineNumber; $$.token = opPLUSPLUS; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } | opMINUSMINUS - { $$.lineNumber = $1.lineNumber; $$.token = '-'; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } + { $$.lineNumber = $1.lineNumber; $$.token = opMINUSMINUS; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } | opPLASN expr { $$.lineNumber = $1.lineNumber; $$.token = '+'; $$.expr = $2; } | opMIASN expr @@ -551,6 +551,8 @@ funcall_expr { $$ = FuncCallExprNode::alloc( $1.lineNumber, $3.value, $1.value, $5, false); } | expr '.' IDENT '(' expr_list_decl ')' { $1->append($5); $$ = FuncCallExprNode::alloc( $1->dbgLineNumber, $3.value, NULL, $1, true); } + | expr '(' expr_list_decl ')' + { $$ = FuncPointerCallExprNode::alloc( $1->dbgLineNumber, $1, $3); } ; assert_expr diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 4a1c132b9..733460b09 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -20,8 +20,8 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $ - */ +* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $ +*/ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 @@ -49,19 +49,19 @@ /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use +#pragma warn -rch +#pragma warn -use #include #include #define YY_USE_CONST @@ -85,22 +85,22 @@ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ +* integer for use as an array index. If the signed char is negative, +* we want to instead treat it as an 8-bit unsigned char, hence the +* double cast. +*/ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ +* but we do it the disgusting crufty way forced on us by the ()-less +* definition of BEGIN. +*/ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ +* to BEGIN to return to the state. The YYSTATE alias is for lex +* compatibility. +*/ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START @@ -125,419 +125,419 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ +* int a single C statement (which needs a semi-colon terminator). This +* avoids problems with code like: +* +* if ( condition_holds ) +* yyless( 5 ); +* else +* do_something_else(); +* +* Prior to using the do-while the compiler would get upset at the +* "else" because it interpreted the "if" statement as being all +* done when it reached the ';' after the yyless() call. +*/ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ +* (without autoconf's help, which isn't available because we want +* flex-generated scanners to compile on their own). +*/ typedef unsigned int yy_size_t; struct yy_buffer_state - { +{ FILE *yy_input_file; - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ + * characters. + */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ + * and can realloc() it to grow it, and should free() it to + * delete it. + */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ + * If so, '^' rules will be active on the next match, otherwise + * not. + */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the - * end of it. - */ + * end of it. + */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; +}; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ +* future we want to put the buffer states in a more general +* "scanner state". +*/ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static char *yy_c_buf_p = (char *)0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ + /* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void yyrestart YY_PROTO((FILE *input_file)); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_switch_to_buffer YY_PROTO((YY_BUFFER_STATE new_buffer)); +void yy_load_buffer_state YY_PROTO((void)); +YY_BUFFER_STATE yy_create_buffer YY_PROTO((FILE *file, int size)); +void yy_delete_buffer YY_PROTO((YY_BUFFER_STATE b)); +void yy_init_buffer YY_PROTO((YY_BUFFER_STATE b, FILE *file)); +void yy_flush_buffer YY_PROTO((YY_BUFFER_STATE b)); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +YY_BUFFER_STATE yy_scan_buffer YY_PROTO((char *base, yy_size_t size)); +YY_BUFFER_STATE yy_scan_string YY_PROTO((yyconst char *str)); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO((yyconst char *bytes, int len)); -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +static void *yy_flex_alloc YY_PROTO((yy_size_t)); +static void *yy_flex_realloc YY_PROTO((void *, yy_size_t)); +static void yy_flex_free YY_PROTO((void *)); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +FILE *yyin = (FILE *)0, *yyout = (FILE *)0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +static yy_state_type yy_get_previous_state YY_PROTO((void)); +static yy_state_type yy_try_NUL_trans YY_PROTO((yy_state_type current_state)); +static int yy_get_next_buffer YY_PROTO((void)); +static void yy_fatal_error YY_PROTO((yyconst char msg[])); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ +* corresponding action - sets up yytext. +*/ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define YY_NUM_RULES 94 #define YY_END_OF_BUFFER 95 static yyconst short int yy_accept[224] = - { 0, - 0, 0, 95, 93, 1, 5, 4, 51, 93, 93, - 58, 57, 93, 41, 42, 45, 43, 56, 44, 50, - 46, 90, 90, 52, 53, 47, 61, 48, 38, 36, - 88, 88, 88, 88, 39, 40, 59, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, - 88, 54, 49, 55, 60, 1, 0, 9, 0, 6, - 0, 0, 17, 87, 25, 12, 26, 0, 7, 0, - 23, 16, 21, 15, 22, 31, 91, 37, 3, 24, - 0, 90, 0, 0, 14, 19, 11, 8, 10, 20, - 88, 33, 88, 88, 27, 88, 88, 88, 88, 88, +{ 0, +0, 0, 95, 93, 1, 5, 4, 51, 93, 93, +58, 57, 93, 41, 42, 45, 43, 56, 44, 50, +46, 90, 90, 52, 53, 47, 61, 48, 38, 36, +88, 88, 88, 88, 39, 40, 59, 88, 88, 88, +88, 88, 88, 88, 88, 88, 88, 88, 88, 88, +88, 54, 49, 55, 60, 1, 0, 9, 0, 6, +0, 0, 17, 87, 25, 12, 26, 0, 7, 0, +23, 16, 21, 15, 22, 31, 91, 37, 3, 24, +0, 90, 0, 0, 14, 19, 11, 8, 10, 20, +88, 33, 88, 88, 27, 88, 88, 88, 88, 88, - 88, 69, 88, 88, 88, 88, 70, 62, 88, 88, - 63, 88, 88, 88, 88, 88, 88, 28, 13, 18, - 92, 87, 0, 32, 3, 3, 91, 0, 91, 89, - 29, 30, 35, 34, 88, 88, 88, 88, 88, 88, - 88, 88, 73, 88, 88, 76, 88, 88, 88, 88, - 88, 88, 92, 0, 3, 2, 88, 88, 79, 88, - 88, 88, 66, 88, 88, 88, 88, 88, 88, 88, - 88, 85, 88, 3, 0, 88, 64, 88, 88, 88, - 86, 88, 88, 88, 88, 88, 88, 88, 68, 0, - 67, 88, 88, 88, 88, 88, 88, 88, 65, 88, +88, 69, 88, 88, 88, 88, 70, 62, 88, 88, +63, 88, 88, 88, 88, 88, 88, 28, 13, 18, +92, 87, 0, 32, 3, 3, 91, 0, 91, 89, +29, 30, 35, 34, 88, 88, 88, 88, 88, 88, +88, 88, 73, 88, 88, 76, 88, 88, 88, 88, +88, 88, 92, 0, 3, 2, 88, 88, 79, 88, +88, 88, 66, 88, 88, 88, 88, 88, 88, 88, +88, 85, 88, 3, 0, 88, 64, 88, 88, 88, +86, 88, 88, 88, 88, 88, 88, 88, 68, 0, +67, 88, 88, 88, 88, 88, 88, 88, 65, 88, - 81, 0, 88, 88, 82, 72, 88, 88, 83, 88, - 80, 0, 74, 88, 71, 75, 88, 88, 0, 78, - 84, 77, 0 - } ; +81, 0, 88, 88, 82, 72, 88, 88, 83, 88, +80, 0, 74, 88, 71, 75, 88, 88, 0, 78, +84, 77, 0 +}; static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 5, 6, 1, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, - 33, 33, 33, 33, 33, 34, 33, 35, 33, 36, - 33, 33, 37, 38, 33, 33, 33, 39, 33, 33, - 40, 41, 42, 43, 33, 1, 44, 45, 46, 47, +{ 0, +1, 1, 1, 1, 1, 1, 1, 1, 2, 3, +2, 2, 4, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 2, 5, 6, 1, 7, 8, 9, 10, 11, +12, 13, 14, 15, 16, 17, 18, 19, 20, 20, +20, 20, 20, 20, 20, 20, 20, 21, 22, 23, +24, 25, 26, 27, 28, 29, 30, 31, 32, 31, +33, 33, 33, 33, 33, 34, 33, 35, 33, 36, +33, 33, 37, 38, 33, 33, 33, 39, 33, 33, +40, 41, 42, 43, 33, 1, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 33, 53, 54, 55, 56, - 57, 58, 33, 59, 60, 61, 62, 33, 63, 39, - 33, 33, 64, 65, 66, 67, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +48, 49, 50, 51, 52, 33, 53, 54, 55, 56, +57, 58, 33, 59, 60, 61, 62, 33, 63, 39, +33, 33, 64, 65, 66, 67, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1 +}; static yyconst int yy_meta[68] = - { 0, - 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 4, 4, - 5, 1, 1, 6, 1, 1, 1, 4, 4, 4, - 4, 4, 7, 7, 7, 7, 7, 7, 7, 1, - 1, 1, 1, 4, 4, 4, 4, 4, 4, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 1, 1, 1, 1 - } ; +{ 0, +1, 1, 2, 2, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 3, 4, 4, +5, 1, 1, 6, 1, 1, 1, 4, 4, 4, +4, 4, 7, 7, 7, 7, 7, 7, 7, 1, +1, 1, 1, 4, 4, 4, 4, 4, 4, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +7, 7, 7, 1, 1, 1, 1 +}; static yyconst short int yy_base[237] = - { 0, - 0, 0, 337, 338, 334, 338, 338, 61, 63, 51, - 53, 65, 66, 338, 338, 311, 64, 338, 66, 60, - 68, 76, 80, 313, 338, 60, 309, 77, 338, 338, - 0, 298, 295, 302, 338, 338, 305, 268, 268, 54, - 61, 272, 59, 38, 62, 266, 280, 275, 62, 263, - 270, 338, 89, 338, 338, 318, 295, 338, 111, 338, - 314, 100, 338, 296, 338, 338, 338, 112, 338, 312, - 338, 338, 338, 290, 338, 338, 107, 338, 296, 338, - 110, 114, 121, 0, 338, 289, 338, 338, 338, 288, - 0, 0, 281, 281, 338, 249, 260, 247, 250, 244, +{ 0, +0, 0, 337, 338, 334, 338, 338, 61, 63, 51, +53, 65, 66, 338, 338, 311, 64, 338, 66, 60, +68, 76, 80, 313, 338, 60, 309, 77, 338, 338, +0, 298, 295, 302, 338, 338, 305, 268, 268, 54, +61, 272, 59, 38, 62, 266, 280, 275, 62, 263, +270, 338, 89, 338, 338, 318, 295, 338, 111, 338, +314, 100, 338, 296, 338, 338, 338, 112, 338, 312, +338, 338, 338, 290, 338, 338, 107, 338, 296, 338, +110, 114, 121, 0, 338, 289, 338, 338, 338, 288, +0, 0, 281, 281, 338, 249, 260, 247, 250, 244, - 255, 0, 243, 248, 242, 244, 0, 0, 244, 235, - 0, 251, 235, 239, 242, 231, 240, 338, 338, 338, - 270, 269, 268, 338, 0, 139, 119, 125, 128, 0, - 338, 338, 0, 0, 240, 243, 238, 224, 240, 239, - 234, 221, 232, 233, 230, 0, 224, 214, 225, 213, - 225, 218, 250, 249, 146, 152, 210, 215, 0, 215, - 221, 203, 0, 216, 219, 201, 201, 216, 200, 204, - 211, 0, 208, 155, 237, 193, 0, 197, 198, 197, - 0, 204, 197, 190, 197, 190, 197, 193, 0, 225, - 0, 180, 184, 179, 177, 153, 158, 151, 0, 134, +255, 0, 243, 248, 242, 244, 0, 0, 244, 235, +0, 251, 235, 239, 242, 231, 240, 338, 338, 338, +270, 269, 268, 338, 0, 139, 119, 125, 128, 0, +338, 338, 0, 0, 240, 243, 238, 224, 240, 239, +234, 221, 232, 233, 230, 0, 224, 214, 225, 213, +225, 218, 250, 249, 146, 152, 210, 215, 0, 215, +221, 203, 0, 216, 219, 201, 201, 216, 200, 204, +211, 0, 208, 155, 237, 193, 0, 197, 198, 197, +0, 204, 197, 190, 197, 190, 197, 193, 0, 225, +0, 180, 184, 179, 177, 153, 158, 151, 0, 134, - 187, 157, 143, 144, 0, 176, 123, 126, 0, 112, - 338, 160, 0, 115, 338, 0, 88, 76, 162, 0, - 0, 0, 338, 170, 174, 181, 185, 189, 193, 200, - 119, 204, 211, 218, 225, 232 - } ; +187, 157, 143, 144, 0, 176, 123, 126, 0, 112, +338, 160, 0, 115, 338, 0, 88, 76, 162, 0, +0, 0, 338, 170, 174, 181, 185, 189, 193, 200, +119, 204, 211, 218, 225, 232 +}; static yyconst short int yy_def[237] = - { 0, - 223, 1, 223, 223, 223, 223, 223, 223, 224, 225, - 225, 223, 226, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 227, 227, 227, 227, 223, 223, 223, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 223, 223, 223, 223, 223, 223, 223, 224, 223, - 224, 228, 223, 229, 223, 223, 223, 226, 223, 226, - 223, 223, 223, 223, 223, 223, 223, 223, 230, 223, - 223, 223, 223, 231, 223, 223, 223, 223, 223, 223, - 227, 227, 227, 227, 223, 227, 227, 227, 227, 227, +{ 0, +223, 1, 223, 223, 223, 223, 223, 223, 224, 225, +225, 223, 226, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +227, 227, 227, 227, 223, 223, 223, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 223, 223, 223, 223, 223, 223, 223, 224, 223, +224, 228, 223, 229, 223, 223, 223, 226, 223, 226, +223, 223, 223, 223, 223, 223, 223, 223, 230, 223, +223, 223, 223, 231, 223, 223, 223, 223, 223, 223, +227, 227, 227, 227, 223, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 223, 223, 223, - 232, 229, 229, 223, 230, 233, 223, 223, 223, 231, - 223, 223, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 232, 232, 234, 223, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 234, 223, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 223, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 223, 223, 223, +232, 229, 229, 223, 230, 233, 223, 223, 223, 231, +223, 223, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 232, 232, 234, 223, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 234, 223, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 223, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 235, 227, 227, 227, 227, 227, 227, 227, 227, - 223, 236, 227, 227, 223, 227, 227, 227, 236, 227, - 227, 227, 0, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223 - } ; +227, 235, 227, 227, 227, 227, 227, 227, 227, 227, +223, 236, 227, 227, 223, 227, 227, 227, 236, 227, +227, 227, 0, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223 +}; static yyconst short int yy_nxt[406] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 31, 31, - 31, 31, 31, 31, 32, 31, 33, 34, 31, 35, - 4, 36, 37, 38, 39, 40, 41, 42, 43, 31, - 31, 44, 31, 31, 31, 45, 46, 47, 48, 49, - 50, 31, 51, 52, 53, 54, 55, 57, 60, 62, - 62, 62, 62, 66, 63, 69, 65, 72, 77, 77, - 78, 74, 86, 87, 58, 79, 107, 73, 67, 75, - 76, 80, 81, 108, 82, 82, 81, 98, 82, 82, +{ 0, +4, 5, 6, 7, 8, 9, 10, 11, 12, 13, +14, 15, 16, 17, 18, 19, 20, 21, 22, 23, +24, 25, 26, 27, 28, 29, 30, 31, 31, 31, +31, 31, 31, 31, 32, 31, 33, 34, 31, 35, +4, 36, 37, 38, 39, 40, 41, 42, 43, 31, +31, 44, 31, 31, 31, 45, 46, 47, 48, 49, +50, 31, 51, 52, 53, 54, 55, 57, 60, 62, +62, 62, 62, 66, 63, 69, 65, 72, 77, 77, +78, 74, 86, 87, 58, 79, 107, 73, 67, 75, +76, 80, 81, 108, 82, 82, 81, 98, 82, 82, - 89, 90, 104, 61, 100, 109, 70, 83, 101, 110, - 99, 83, 118, 114, 84, 105, 60, 102, 62, 62, - 106, 69, 130, 83, 115, 77, 77, 83, 127, 127, - 81, 222, 82, 82, 128, 221, 128, 127, 127, 129, - 129, 156, 156, 129, 129, 83, 129, 129, 156, 156, - 83, 61, 70, 119, 156, 156, 125, 156, 156, 156, - 156, 83, 156, 156, 156, 156, 83, 220, 218, 175, - 59, 217, 59, 59, 59, 59, 59, 64, 216, 64, - 64, 68, 215, 68, 68, 68, 68, 68, 91, 214, - 213, 91, 121, 211, 210, 121, 122, 122, 209, 122, +89, 90, 104, 61, 100, 109, 70, 83, 101, 110, +99, 83, 118, 114, 84, 105, 60, 102, 62, 62, +106, 69, 130, 83, 115, 77, 77, 83, 127, 127, +81, 222, 82, 82, 128, 221, 128, 127, 127, 129, +129, 156, 156, 129, 129, 83, 129, 129, 156, 156, +83, 61, 70, 119, 156, 156, 125, 156, 156, 156, +156, 83, 156, 156, 156, 156, 83, 220, 218, 175, +59, 217, 59, 59, 59, 59, 59, 64, 216, 64, +64, 68, 215, 68, 68, 68, 68, 68, 91, 214, +213, 91, 121, 211, 210, 121, 122, 122, 209, 122, - 125, 208, 125, 125, 125, 125, 125, 153, 153, 207, - 153, 155, 155, 155, 155, 155, 155, 155, 174, 174, - 174, 174, 174, 174, 174, 212, 212, 206, 212, 212, - 212, 212, 219, 219, 219, 219, 219, 219, 219, 205, - 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, - 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, - 184, 183, 182, 181, 180, 179, 178, 177, 176, 154, - 154, 173, 172, 171, 170, 169, 168, 167, 166, 165, - 164, 163, 162, 161, 160, 159, 158, 157, 123, 123, - 154, 152, 151, 150, 149, 148, 147, 146, 145, 144, +125, 208, 125, 125, 125, 125, 125, 153, 153, 207, +153, 155, 155, 155, 155, 155, 155, 155, 174, 174, +174, 174, 174, 174, 174, 212, 212, 206, 212, 212, +212, 212, 219, 219, 219, 219, 219, 219, 219, 205, +204, 203, 202, 201, 200, 199, 198, 197, 196, 195, +194, 193, 192, 191, 190, 189, 188, 187, 186, 185, +184, 183, 182, 181, 180, 179, 178, 177, 176, 154, +154, 173, 172, 171, 170, 169, 168, 167, 166, 165, +164, 163, 162, 161, 160, 159, 158, 157, 123, 123, +154, 152, 151, 150, 149, 148, 147, 146, 145, 144, - 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, - 133, 132, 131, 126, 124, 68, 123, 59, 120, 56, - 117, 116, 113, 112, 111, 103, 97, 96, 95, 94, - 93, 92, 88, 85, 71, 56, 223, 3, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +143, 142, 141, 140, 139, 138, 137, 136, 135, 134, +133, 132, 131, 126, 124, 68, 123, 59, 120, 56, +117, 116, 113, 112, 111, 103, 97, 96, 95, 94, +93, 92, 88, 85, 71, 56, 223, 3, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223 - } ; +223, 223, 223, 223, 223 +}; static yyconst short int yy_chk[406] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 8, 9, 10, - 10, 11, 11, 12, 10, 13, 11, 17, 20, 20, - 21, 19, 26, 26, 8, 21, 44, 17, 12, 19, - 19, 21, 22, 44, 22, 22, 23, 40, 23, 23, +{ 0, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 8, 9, 10, +10, 11, 11, 12, 10, 13, 11, 17, 20, 20, +21, 19, 26, 26, 8, 21, 44, 17, 12, 19, +19, 21, 22, 44, 22, 22, 23, 40, 23, 23, - 28, 28, 43, 9, 41, 45, 13, 22, 41, 45, - 40, 23, 53, 49, 22, 43, 59, 41, 62, 62, - 43, 68, 231, 22, 49, 77, 77, 23, 81, 81, - 82, 218, 82, 82, 83, 217, 83, 127, 127, 83, - 83, 126, 126, 128, 128, 82, 129, 129, 155, 155, - 127, 59, 68, 53, 156, 156, 126, 174, 174, 202, - 202, 82, 212, 212, 219, 219, 127, 214, 210, 156, - 224, 208, 224, 224, 224, 224, 224, 225, 207, 225, - 225, 226, 206, 226, 226, 226, 226, 226, 227, 204, - 203, 227, 228, 201, 200, 228, 229, 229, 198, 229, +28, 28, 43, 9, 41, 45, 13, 22, 41, 45, +40, 23, 53, 49, 22, 43, 59, 41, 62, 62, +43, 68, 231, 22, 49, 77, 77, 23, 81, 81, +82, 218, 82, 82, 83, 217, 83, 127, 127, 83, +83, 126, 126, 128, 128, 82, 129, 129, 155, 155, +127, 59, 68, 53, 156, 156, 126, 174, 174, 202, +202, 82, 212, 212, 219, 219, 127, 214, 210, 156, +224, 208, 224, 224, 224, 224, 224, 225, 207, 225, +225, 226, 206, 226, 226, 226, 226, 226, 227, 204, +203, 227, 228, 201, 200, 228, 229, 229, 198, 229, - 230, 197, 230, 230, 230, 230, 230, 232, 232, 196, - 232, 233, 233, 233, 233, 233, 233, 233, 234, 234, - 234, 234, 234, 234, 234, 235, 235, 195, 235, 235, - 235, 235, 236, 236, 236, 236, 236, 236, 236, 194, - 193, 192, 190, 188, 187, 186, 185, 184, 183, 182, - 180, 179, 178, 176, 175, 173, 171, 170, 169, 168, - 167, 166, 165, 164, 162, 161, 160, 158, 157, 154, - 153, 152, 151, 150, 149, 148, 147, 145, 144, 143, - 142, 141, 140, 139, 138, 137, 136, 135, 123, 122, - 121, 117, 116, 115, 114, 113, 112, 110, 109, 106, +230, 197, 230, 230, 230, 230, 230, 232, 232, 196, +232, 233, 233, 233, 233, 233, 233, 233, 234, 234, +234, 234, 234, 234, 234, 235, 235, 195, 235, 235, +235, 235, 236, 236, 236, 236, 236, 236, 236, 194, +193, 192, 190, 188, 187, 186, 185, 184, 183, 182, +180, 179, 178, 176, 175, 173, 171, 170, 169, 168, +167, 166, 165, 164, 162, 161, 160, 158, 157, 154, +153, 152, 151, 150, 149, 148, 147, 145, 144, 143, +142, 141, 140, 139, 138, 137, 136, 135, 123, 122, +121, 117, 116, 115, 114, 113, 112, 110, 109, 106, - 105, 104, 103, 101, 100, 99, 98, 97, 96, 94, - 93, 90, 86, 79, 74, 70, 64, 61, 57, 56, - 51, 50, 48, 47, 46, 42, 39, 38, 37, 34, - 33, 32, 27, 24, 16, 5, 3, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +105, 104, 103, 101, 100, 99, 98, 97, 96, 94, +93, 90, 86, 79, 74, 70, 64, 61, 57, 56, +51, 50, 48, 47, 46, 42, 39, 38, 37, 34, +33, 32, 27, 24, 16, 5, 3, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223 - } ; +223, 223, 223, 223, 223 +}; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ +* any uses of REJECT which flex missed. +*/ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 @@ -568,7 +568,7 @@ struct Token // Can't have ctors in structs used in unions, so we have this. template< typename T > -inline Token< T > MakeToken( T value, U32 lineNumber ) +inline Token< T > MakeToken(T value, U32 lineNumber) { Token< T > result; result.value = value; @@ -617,7 +617,7 @@ inline int isatty(int) { return 0; } buf[n++] = (char) c; \ result = n; \ } - + // General helper stuff. static int lineIndex; @@ -634,30 +634,30 @@ void CMDrestart(FILE *in); #line 635 "CMDscan.cpp" /* Macros after this point can all be overridden by user definitions in - * section 1. - */ +* section 1. +*/ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int yywrap YY_PROTO((void)); #else -extern int yywrap YY_PROTO(( void )); +extern int yywrap YY_PROTO((void)); #endif #endif #ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); +static void yyunput YY_PROTO((int c, char *buf_ptr)); #endif #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy YY_PROTO((char *, yyconst char *, int)); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput YY_PROTO((void)); #else -static int input YY_PROTO(( void )); +static int input YY_PROTO((void)); #endif #endif @@ -666,13 +666,13 @@ static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); +static void yy_push_state YY_PROTO((int new_state)); #endif #ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); +static void yy_pop_state YY_PROTO((void)); #endif #ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); +static int yy_top_state YY_PROTO((void)); #endif #else @@ -690,9 +690,9 @@ YY_MALLOC_DECL #endif #else /* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ +* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) +* or sizeof(void*) != sizeof(int). +*/ #endif #endif @@ -705,37 +705,37 @@ YY_MALLOC_DECL #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ +* we now use fwrite(). +*/ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ +* is returned in "result". +*/ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ +* we don't want an extra ';' after the "return" because that will cause +* some compilers to complain about unreachable statements. +*/ #ifndef yyterminate #define yyterminate() return YY_NULL #endif @@ -751,15 +751,15 @@ YY_MALLOC_DECL #endif /* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ +* easily add parameters. +*/ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ +* have been set up. +*/ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif @@ -770,778 +770,777 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION YY_DECL - { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; +{ + register yy_state_type yy_current_state; +register char *yy_cp, *yy_bp; +register int yy_act; #line 105 "CMDscan.l" - ; +; #line 785 "CMDscan.cpp" - if ( yy_init ) - { - yy_init = 0; +if (yy_init) +{ + yy_init = 0; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if (!yy_start) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if (!yyin) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if (!yyout) + yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if (!yy_current_buffer) + yy_current_buffer = + yy_create_buffer(yyin, YY_BUF_SIZE); - yy_load_buffer_state(); - } + yy_load_buffer_state(); +} - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; +while (1) /* loops until end-of-file is reached */ +{ + yy_cp = yy_c_buf_p; - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of yytext. */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 338 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if (yy_accept[yy_current_state]) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) + { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 224) + yy_c = yy_meta[(unsigned int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; + ++yy_cp; + } while (yy_base[yy_current_state] != 338); yy_find_action: + yy_act = yy_accept[yy_current_state]; + if (yy_act == 0) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; -do_action: /* This label is used only to access EOF actions. */ +do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) + switch (yy_act) { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; -case 1: -YY_RULE_SETUP + case 1: + YY_RULE_SETUP #line 107 "CMDscan.l" -{ } - YY_BREAK -case 2: -YY_RULE_SETUP + {} + YY_BREAK + case 2: + YY_RULE_SETUP #line 108 "CMDscan.l" -{ return(Sc_ScanDocBlock()); } - YY_BREAK -case 3: -YY_RULE_SETUP + { return(Sc_ScanDocBlock()); } + YY_BREAK + case 3: + YY_RULE_SETUP #line 109 "CMDscan.l" -; - YY_BREAK -case 4: -YY_RULE_SETUP + ; + YY_BREAK + case 4: + YY_RULE_SETUP #line 110 "CMDscan.l" -; - YY_BREAK -case 5: -YY_RULE_SETUP + ; + YY_BREAK + case 5: + YY_RULE_SETUP #line 111 "CMDscan.l" -{lineIndex++;} - YY_BREAK -case 6: -YY_RULE_SETUP + { lineIndex++; } + YY_BREAK + case 6: + YY_RULE_SETUP #line 112 "CMDscan.l" -{ return(Sc_ScanString(STRATOM)); } - YY_BREAK -case 7: -YY_RULE_SETUP + { return(Sc_ScanString(STRATOM)); } + YY_BREAK + case 7: + YY_RULE_SETUP #line 113 "CMDscan.l" -{ return(Sc_ScanString(TAGATOM)); } - YY_BREAK -case 8: -YY_RULE_SETUP + { return(Sc_ScanString(TAGATOM)); } + YY_BREAK + case 8: + YY_RULE_SETUP #line 114 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opEQ, lineIndex ); return opEQ; } - YY_BREAK -case 9: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opEQ, lineIndex); return opEQ; } + YY_BREAK + case 9: + YY_RULE_SETUP #line 115 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opNE, lineIndex ); return opNE; } - YY_BREAK -case 10: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opNE, lineIndex); return opNE; } + YY_BREAK + case 10: + YY_RULE_SETUP #line 116 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opGE, lineIndex ); return opGE; } - YY_BREAK -case 11: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opGE, lineIndex); return opGE; } + YY_BREAK + case 11: + YY_RULE_SETUP #line 117 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opLE, lineIndex ); return opLE; } - YY_BREAK -case 12: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opLE, lineIndex); return opLE; } + YY_BREAK + case 12: + YY_RULE_SETUP #line 118 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opAND, lineIndex ); return opAND; } - YY_BREAK -case 13: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opAND, lineIndex); return opAND; } + YY_BREAK + case 13: + YY_RULE_SETUP #line 119 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opOR, lineIndex ); return opOR; } - YY_BREAK -case 14: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opOR, lineIndex); return opOR; } + YY_BREAK + case 14: + YY_RULE_SETUP #line 120 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opCOLONCOLON, lineIndex ); return opCOLONCOLON; } - YY_BREAK -case 15: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opCOLONCOLON, lineIndex); return opCOLONCOLON; } + YY_BREAK + case 15: + YY_RULE_SETUP #line 121 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMINUSMINUS, lineIndex ); return opMINUSMINUS; } - YY_BREAK -case 16: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMINUSMINUS, lineIndex); return opMINUSMINUS; } + YY_BREAK + case 16: + YY_RULE_SETUP #line 122 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opPLUSPLUS, lineIndex ); return opPLUSPLUS; } - YY_BREAK -case 17: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opPLUSPLUS, lineIndex); return opPLUSPLUS; } + YY_BREAK + case 17: + YY_RULE_SETUP #line 123 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSTREQ, lineIndex ); return opSTREQ; } - YY_BREAK -case 18: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSTREQ, lineIndex); return opSTREQ; } + YY_BREAK + case 18: + YY_RULE_SETUP #line 124 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSTRNE, lineIndex ); return opSTRNE; } - YY_BREAK -case 19: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSTRNE, lineIndex); return opSTRNE; } + YY_BREAK + case 19: + YY_RULE_SETUP #line 125 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSHL, lineIndex ); return opSHL; } - YY_BREAK -case 20: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSHL, lineIndex); return opSHL; } + YY_BREAK + case 20: + YY_RULE_SETUP #line 126 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSHR, lineIndex ); return opSHR; } - YY_BREAK -case 21: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSHR, lineIndex); return opSHR; } + YY_BREAK + case 21: + YY_RULE_SETUP #line 127 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opPLASN, lineIndex ); return opPLASN; } - YY_BREAK -case 22: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opPLASN, lineIndex); return opPLASN; } + YY_BREAK + case 22: + YY_RULE_SETUP #line 128 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMIASN, lineIndex ); return opMIASN; } - YY_BREAK -case 23: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMIASN, lineIndex); return opMIASN; } + YY_BREAK + case 23: + YY_RULE_SETUP #line 129 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMLASN, lineIndex ); return opMLASN; } - YY_BREAK -case 24: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMLASN, lineIndex); return opMLASN; } + YY_BREAK + case 24: + YY_RULE_SETUP #line 130 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opDVASN, lineIndex ); return opDVASN; } - YY_BREAK -case 25: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opDVASN, lineIndex); return opDVASN; } + YY_BREAK + case 25: + YY_RULE_SETUP #line 131 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMODASN, lineIndex ); return opMODASN; } - YY_BREAK -case 26: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMODASN, lineIndex); return opMODASN; } + YY_BREAK + case 26: + YY_RULE_SETUP #line 132 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opANDASN, lineIndex ); return opANDASN; } - YY_BREAK -case 27: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opANDASN, lineIndex); return opANDASN; } + YY_BREAK + case 27: + YY_RULE_SETUP #line 133 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opXORASN, lineIndex ); return opXORASN; } - YY_BREAK -case 28: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opXORASN, lineIndex); return opXORASN; } + YY_BREAK + case 28: + YY_RULE_SETUP #line 134 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opORASN, lineIndex ); return opORASN; } - YY_BREAK -case 29: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opORASN, lineIndex); return opORASN; } + YY_BREAK + case 29: + YY_RULE_SETUP #line 135 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSLASN, lineIndex ); return opSLASN; } - YY_BREAK -case 30: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSLASN, lineIndex); return opSLASN; } + YY_BREAK + case 30: + YY_RULE_SETUP #line 136 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSRASN, lineIndex ); return opSRASN; } - YY_BREAK -case 31: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSRASN, lineIndex); return opSRASN; } + YY_BREAK + case 31: + YY_RULE_SETUP #line 137 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opINTNAME, lineIndex ); return opINTNAME; } - YY_BREAK -case 32: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opINTNAME, lineIndex); return opINTNAME; } + YY_BREAK + case 32: + YY_RULE_SETUP #line 138 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opINTNAMER, lineIndex ); return opINTNAMER; } - YY_BREAK -case 33: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opINTNAMER, lineIndex); return opINTNAMER; } + YY_BREAK + case 33: + YY_RULE_SETUP #line 139 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( '\n', lineIndex ); return '@'; } - YY_BREAK -case 34: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >('\n', lineIndex); return '@'; } + YY_BREAK + case 34: + YY_RULE_SETUP #line 140 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( '\t', lineIndex ); return '@'; } - YY_BREAK -case 35: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >('\t', lineIndex); return '@'; } + YY_BREAK + case 35: + YY_RULE_SETUP #line 141 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( ' ', lineIndex ); return '@'; } - YY_BREAK -case 36: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(' ', lineIndex); return '@'; } + YY_BREAK + case 36: + YY_RULE_SETUP #line 142 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( 0, lineIndex ); return '@'; } - YY_BREAK -case 37: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(0, lineIndex); return '@'; } + YY_BREAK + case 37: + YY_RULE_SETUP #line 143 "CMDscan.l" -{ /* this comment stops syntax highlighting from getting messed up when editing the lexer in TextPad */ - int c = 0, l; - for ( ; ; ) + { /* this comment stops syntax highlighting from getting messed up when editing the lexer in TextPad */ + int c = 0, l; + for (; ; ) { l = c; c = yyinput(); // Is this an open comment? - if ( c == EOF ) + if (c == EOF) { - CMDerror( "unexpected end of file found in comment" ); + CMDerror("unexpected end of file found in comment"); break; } // Increment line numbers. - else if ( c == '\n' ) + else if (c == '\n') lineIndex++; // Did we find the end of the comment? - else if ( l == '*' && c == '/' ) + else if (l == '*' && c == '/') break; } - } - YY_BREAK -case 38: + } + YY_BREAK + case 38: #line 167 "CMDscan.l" -case 39: + case 39: #line 168 "CMDscan.l" -case 40: + case 40: #line 169 "CMDscan.l" -case 41: + case 41: #line 170 "CMDscan.l" -case 42: + case 42: #line 171 "CMDscan.l" -case 43: + case 43: #line 172 "CMDscan.l" -case 44: + case 44: #line 173 "CMDscan.l" -case 45: + case 45: #line 174 "CMDscan.l" -case 46: + case 46: #line 175 "CMDscan.l" -case 47: + case 47: #line 176 "CMDscan.l" -case 48: + case 48: #line 177 "CMDscan.l" -case 49: + case 49: #line 178 "CMDscan.l" -case 50: + case 50: #line 179 "CMDscan.l" -case 51: + case 51: #line 180 "CMDscan.l" -case 52: + case 52: #line 181 "CMDscan.l" -case 53: + case 53: #line 182 "CMDscan.l" -case 54: + case 54: #line 183 "CMDscan.l" -case 55: + case 55: #line 184 "CMDscan.l" -case 56: + case 56: #line 185 "CMDscan.l" -case 57: + case 57: #line 186 "CMDscan.l" -case 58: + case 58: #line 187 "CMDscan.l" -case 59: + case 59: #line 188 "CMDscan.l" -case 60: + case 60: #line 189 "CMDscan.l" -case 61: -YY_RULE_SETUP + case 61: + YY_RULE_SETUP #line 189 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( CMDtext[ 0 ], lineIndex ); return CMDtext[ 0 ]; } - YY_BREAK -case 62: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(CMDtext[0], lineIndex); return CMDtext[0]; } + YY_BREAK + case 62: + YY_RULE_SETUP #line 190 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwIN, lineIndex ); return(rwIN); } - YY_BREAK -case 63: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwIN, lineIndex); return(rwIN); } + YY_BREAK + case 63: + YY_RULE_SETUP #line 191 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwCASEOR, lineIndex ); return(rwCASEOR); } - YY_BREAK -case 64: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwCASEOR, lineIndex); return(rwCASEOR); } + YY_BREAK + case 64: + YY_RULE_SETUP #line 192 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwBREAK, lineIndex ); return(rwBREAK); } - YY_BREAK -case 65: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwBREAK, lineIndex); return(rwBREAK); } + YY_BREAK + case 65: + YY_RULE_SETUP #line 193 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwRETURN, lineIndex ); return(rwRETURN); } - YY_BREAK -case 66: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwRETURN, lineIndex); return(rwRETURN); } + YY_BREAK + case 66: + YY_RULE_SETUP #line 194 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwELSE, lineIndex ); return(rwELSE); } - YY_BREAK -case 67: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwELSE, lineIndex); return(rwELSE); } + YY_BREAK + case 67: + YY_RULE_SETUP #line 195 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwASSERT, lineIndex ); return(rwASSERT); } - YY_BREAK -case 68: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwASSERT, lineIndex); return(rwASSERT); } + YY_BREAK + case 68: + YY_RULE_SETUP #line 196 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwWHILE, lineIndex ); return(rwWHILE); } - YY_BREAK -case 69: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwWHILE, lineIndex); return(rwWHILE); } + YY_BREAK + case 69: + YY_RULE_SETUP #line 197 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDO, lineIndex ); return(rwDO); } - YY_BREAK -case 70: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDO, lineIndex); return(rwDO); } + YY_BREAK + case 70: + YY_RULE_SETUP #line 198 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwIF, lineIndex ); return(rwIF); } - YY_BREAK -case 71: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwIF, lineIndex); return(rwIF); } + YY_BREAK + case 71: + YY_RULE_SETUP #line 199 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwFOREACHSTR, lineIndex ); return(rwFOREACHSTR); } - YY_BREAK -case 72: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwFOREACHSTR, lineIndex); return(rwFOREACHSTR); } + YY_BREAK + case 72: + YY_RULE_SETUP #line 200 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwFOREACH, lineIndex ); return(rwFOREACH); } - YY_BREAK -case 73: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwFOREACH, lineIndex); return(rwFOREACH); } + YY_BREAK + case 73: + YY_RULE_SETUP #line 201 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwFOR, lineIndex ); return(rwFOR); } - YY_BREAK -case 74: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwFOR, lineIndex); return(rwFOR); } + YY_BREAK + case 74: + YY_RULE_SETUP #line 202 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwCONTINUE, lineIndex ); return(rwCONTINUE); } - YY_BREAK -case 75: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwCONTINUE, lineIndex); return(rwCONTINUE); } + YY_BREAK + case 75: + YY_RULE_SETUP #line 203 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDEFINE, lineIndex ); return(rwDEFINE); } - YY_BREAK -case 76: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDEFINE, lineIndex); return(rwDEFINE); } + YY_BREAK + case 76: + YY_RULE_SETUP #line 204 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDECLARE, lineIndex ); return(rwDECLARE); } - YY_BREAK -case 77: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDECLARE, lineIndex); return(rwDECLARE); } + YY_BREAK + case 77: + YY_RULE_SETUP #line 205 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDECLARESINGLETON, lineIndex ); return(rwDECLARESINGLETON); } - YY_BREAK -case 78: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDECLARESINGLETON, lineIndex); return(rwDECLARESINGLETON); } + YY_BREAK + case 78: + YY_RULE_SETUP #line 206 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDATABLOCK, lineIndex ); return(rwDATABLOCK); } - YY_BREAK -case 79: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDATABLOCK, lineIndex); return(rwDATABLOCK); } + YY_BREAK + case 79: + YY_RULE_SETUP #line 207 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwCASE, lineIndex ); return(rwCASE); } - YY_BREAK -case 80: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwCASE, lineIndex); return(rwCASE); } + YY_BREAK + case 80: + YY_RULE_SETUP #line 208 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwSWITCHSTR, lineIndex ); return(rwSWITCHSTR); } - YY_BREAK -case 81: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwSWITCHSTR, lineIndex); return(rwSWITCHSTR); } + YY_BREAK + case 81: + YY_RULE_SETUP #line 209 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwSWITCH, lineIndex ); return(rwSWITCH); } - YY_BREAK -case 82: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwSWITCH, lineIndex); return(rwSWITCH); } + YY_BREAK + case 82: + YY_RULE_SETUP #line 210 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDEFAULT, lineIndex ); return(rwDEFAULT); } - YY_BREAK -case 83: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDEFAULT, lineIndex); return(rwDEFAULT); } + YY_BREAK + case 83: + YY_RULE_SETUP #line 211 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwPACKAGE, lineIndex ); return(rwPACKAGE); } - YY_BREAK -case 84: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwPACKAGE, lineIndex); return(rwPACKAGE); } + YY_BREAK + case 84: + YY_RULE_SETUP #line 212 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwNAMESPACE, lineIndex ); return(rwNAMESPACE); } - YY_BREAK -case 85: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwNAMESPACE, lineIndex); return(rwNAMESPACE); } + YY_BREAK + case 85: + YY_RULE_SETUP #line 213 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( 1, lineIndex ); return INTCONST; } - YY_BREAK -case 86: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(1, lineIndex); return INTCONST; } + YY_BREAK + case 86: + YY_RULE_SETUP #line 214 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( 0, lineIndex ); return INTCONST; } - YY_BREAK -case 87: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(0, lineIndex); return INTCONST; } + YY_BREAK + case 87: + YY_RULE_SETUP #line 215 "CMDscan.l" -{ return(Sc_ScanVar()); } - YY_BREAK -case 88: -YY_RULE_SETUP + { return(Sc_ScanVar()); } + YY_BREAK + case 88: + YY_RULE_SETUP #line 216 "CMDscan.l" -{ return Sc_ScanIdent(); } - YY_BREAK -case 89: -YY_RULE_SETUP + { return Sc_ScanIdent(); } + YY_BREAK + case 89: + YY_RULE_SETUP #line 217 "CMDscan.l" -return(Sc_ScanHex()); - YY_BREAK -case 90: -YY_RULE_SETUP + return(Sc_ScanHex()); + YY_BREAK + case 90: + YY_RULE_SETUP #line 218 "CMDscan.l" -{ CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >( dAtoi(CMDtext), lineIndex ); return INTCONST; } - YY_BREAK -case 91: -YY_RULE_SETUP + { CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >(dAtoi(CMDtext), lineIndex); return INTCONST; } + YY_BREAK + case 91: + YY_RULE_SETUP #line 219 "CMDscan.l" -return Sc_ScanNum(); - YY_BREAK -case 92: -YY_RULE_SETUP + return Sc_ScanNum(); + YY_BREAK + case 92: + YY_RULE_SETUP #line 220 "CMDscan.l" -return(ILLEGAL_TOKEN); - YY_BREAK -case 93: -YY_RULE_SETUP + return(ILLEGAL_TOKEN); + YY_BREAK + case 93: + YY_RULE_SETUP #line 221 "CMDscan.l" -return(ILLEGAL_TOKEN); - YY_BREAK -case 94: -YY_RULE_SETUP + return(ILLEGAL_TOKEN); + YY_BREAK + case 94: + YY_RULE_SETUP #line 222 "CMDscan.l" -ECHO; - YY_BREAK + ECHO; + YY_BREAK #line 1291 "CMDscan.cpp" -case YY_STATE_EOF(INITIAL): - yyterminate(); + case YY_STATE_EOF(INITIAL): + yyterminate(); - case YY_END_OF_BUFFER: + case YY_END_OF_BUFFER: { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if (yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW) { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if (yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars]) { /* This was really a NUL. */ - yy_state_type yy_next_state; + yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans(yy_current_state); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = yytext_ptr + YY_MORE_ADJ; - if ( yy_next_state ) + if (yy_next_state) { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; } - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch (yy_get_next_buffer()) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if (yywrap()) { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; } - break; + + else + { + if (!yy_did_buffer_switch_on_eof) + YY_NEW_FILE; + } + break; } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; } - break; + break; } - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found"); } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ +} /* end of scanning one token */ +} /* end of yylex */ -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ + /* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ -static int yy_get_next_buffer() - { - char *dest = yy_current_buffer->yy_ch_buf; - char *source = yytext_ptr; - int number_to_move, i; + static int yy_get_next_buffer() +{ + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if (yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1]) YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + "fatal flex scanner internal error--end of buffer missed"); - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { + if (yy_current_buffer->yy_fill_buffer == 0) + { /* Don't try to fill the buffer, so this is an EOF. */ + if (yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1) + { /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ + * treat this as a final EOF. + */ return EOB_ACT_END_OF_FILE; - } + } else - { + { /* We matched some text prior to the EOB, first - * process it. - */ + * process it. + */ return EOB_ACT_LAST_MATCH; - } } + } /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int)(yy_c_buf_p - yytext_ptr) - 1; - for ( i = 0; i < number_to_move; ++i ) + for (i = 0; i < number_to_move; ++i) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if (yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING) /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ + * just force an EOF + */ yy_n_chars = 0; else - { + { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + while (num_to_read <= 0) + { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + "input buffer overflow, can't enlarge buffer because scanner uses REJECT"); #else - /* just a shorter name for the current buffer */ + /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int)(yy_c_buf_p - b->yy_ch_buf); - if ( b->yy_is_our_buffer ) - { + if (b->yy_is_our_buffer) + { int new_size = b->yy_buf_size * 2; - if ( new_size <= 0 ) + if (new_size <= 0) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } + yy_flex_realloc((void *)b->yy_ch_buf, + b->yy_buf_size + 2); + } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; - if ( ! b->yy_ch_buf ) + if (!b->yy_ch_buf) YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + "fatal error - scanner input buffer overflow"); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; + number_to_move - 1; #endif - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) + if (num_to_read > YY_READ_BUF_SIZE) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT((&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read); + } + + if (yy_n_chars == 0) + { + if (number_to_move == YY_MORE_ADJ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin); } - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - else - { + { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } } + } else ret_val = EOB_ACT_CONTINUE_SCAN; @@ -1553,116 +1552,116 @@ static int yy_get_next_buffer() yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; - } +} /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() - { - yy_state_type yy_current_state; - char *yy_cp; +{ + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = yy_start; - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for (yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if (yy_accept[yy_current_state]) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) + { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 224) + yy_c = yy_meta[(unsigned int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; + } return yy_current_state; - } +} /* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ +* +* synopsis +* next_state = yy_try_NUL_trans( current_state ); +*/ #ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state) #else -static yy_state_type yy_try_NUL_trans( yy_current_state ) +static yy_state_type yy_try_NUL_trans(yy_current_state) yy_state_type yy_current_state; #endif - { - int yy_is_jam; - char *yy_cp = yy_c_buf_p; +{ + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { + register YY_CHAR yy_c = 1; + if (yy_accept[yy_current_state]) + { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) + { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 224) + yy_c = yy_meta[(unsigned int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; yy_is_jam = (yy_current_state == 223); return yy_is_jam ? 0 : yy_current_state; - } +} #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS -static void yyunput( int c, char *yy_bp ) +static void yyunput(int c, register char *yy_bp) #else -static void yyunput( c, yy_bp ) +static void yyunput(c, yy_bp) int c; -char *yy_bp; +register char *yy_bp; #endif - { - char *yy_cp = yy_c_buf_p; +{ + register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = yy_n_chars + 2; - char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + if (yy_cp < yy_current_buffer->yy_ch_buf + 2) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) + while (source > yy_current_buffer->yy_ch_buf) *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); + yy_cp += (int)(dest - source); + yy_bp += (int)(dest - source); yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if (yy_cp < yy_current_buffer->yy_ch_buf + 2) + YY_FATAL_ERROR("flex scanner push-back overflow"); + } - *--yy_cp = (char) c; + *--yy_cp = (char)c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ +} +#endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus @@ -1670,45 +1669,45 @@ static int yyinput() #else static int input() #endif - { +{ int c; *yy_c_buf_p = yy_hold_char; - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { + if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR) + { /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if (yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars]) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else - { /* need more input */ + { /* need more input */ yytext_ptr = yy_c_buf_p; ++yy_c_buf_p; - switch ( yy_get_next_buffer() ) - { + switch (yy_get_next_buffer()) + { case EOB_ACT_END_OF_FILE: + { + if (yywrap()) { - if ( yywrap() ) - { yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; + yytext_ptr + YY_MORE_ADJ; return EOF; - } + } - if ( ! yy_did_buffer_switch_on_eof ) + if (!yy_did_buffer_switch_on_eof) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif - } + } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; @@ -1717,150 +1716,150 @@ static int input() case EOB_ACT_LAST_MATCH: #ifdef __cplusplus YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); + "unexpected last match in yyinput()"); #else YY_FATAL_ERROR( - "unexpected last match in input()" ); + "unexpected last match in input()"); #endif - } } } + } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ + c = *(unsigned char *)yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; - } +} #ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) +void yyrestart(FILE *input_file) #else -void yyrestart( input_file ) +void yyrestart(input_file) FILE *input_file; #endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +{ + if (!yy_current_buffer) + yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); - yy_init_buffer( yy_current_buffer, input_file ); + yy_init_buffer(yy_current_buffer, input_file); yy_load_buffer_state(); - } +} #ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer) #else -void yy_switch_to_buffer( new_buffer ) +void yy_switch_to_buffer(new_buffer) YY_BUFFER_STATE new_buffer; #endif - { - if ( yy_current_buffer == new_buffer ) +{ + if (yy_current_buffer == new_buffer) return; - if ( yy_current_buffer ) - { + if (yy_current_buffer) + { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; - } + } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ yy_did_buffer_switch_on_eof = 1; - } +} #ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) +void yy_load_buffer_state(void) #else void yy_load_buffer_state() #endif - { +{ yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; - } +} #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +YY_BUFFER_STATE yy_create_buffer(FILE *file, int size) #else -YY_BUFFER_STATE yy_create_buffer( file, size ) +YY_BUFFER_STATE yy_create_buffer(file, size) FILE *file; int size; #endif - { +{ YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state)); + if (!b) + YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *)yy_flex_alloc(b->yy_buf_size + 2); + if (!b->yy_ch_buf) + YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b, file); return b; - } +} #ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) +void yy_delete_buffer(YY_BUFFER_STATE b) #else -void yy_delete_buffer( b ) +void yy_delete_buffer(b) YY_BUFFER_STATE b; #endif - { - if ( ! b ) +{ + if (!b) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if (b == yy_current_buffer) + yy_current_buffer = (YY_BUFFER_STATE)0; - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + if (b->yy_is_our_buffer) + yy_flex_free((void *)b->yy_ch_buf); - yy_flex_free( (void *) b ); - } + yy_flex_free((void *)b); +} #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); +extern int isatty YY_PROTO((int)); #endif #endif #ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +void yy_init_buffer(YY_BUFFER_STATE b, FILE *file) #else -void yy_init_buffer( b, file ) +void yy_init_buffer(b, file) YY_BUFFER_STATE b; FILE *file; #endif - { - yy_flush_buffer( b ); +{ + yy_flush_buffer(b); b->yy_input_file = file; b->yy_fill_buffer = 1; @@ -1871,26 +1870,26 @@ FILE *file; #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; #endif #endif - } +} #ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) +void yy_flush_buffer(YY_BUFFER_STATE b) #else -void yy_flush_buffer( b ) +void yy_flush_buffer(b) YY_BUFFER_STATE b; #endif - { +{ b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; @@ -1899,33 +1898,33 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) + if (b == yy_current_buffer) yy_load_buffer_state(); - } +} #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size) #else -YY_BUFFER_STATE yy_scan_buffer( base, size ) +YY_BUFFER_STATE yy_scan_buffer(base, size) char *base; yy_size_t size; #endif - { +{ YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) + if (size < 2 || + base[size - 2] != YY_END_OF_BUFFER_CHAR || + base[size - 1] != YY_END_OF_BUFFER_CHAR) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state)); + if (!b) + YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()"); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; @@ -1935,39 +1934,39 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b); return b; - } +} #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *str ) +YY_BUFFER_STATE yy_scan_string(yyconst char *str) #else -YY_BUFFER_STATE yy_scan_string( str ) +YY_BUFFER_STATE yy_scan_string(str) yyconst char *str; #endif - { +{ int len; - for ( len = 0; str[len]; ++len ) + for (len = 0; str[len]; ++len) ; - return yy_scan_bytes( str, len ); - } + return yy_scan_bytes(str, len); +} #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +YY_BUFFER_STATE yy_scan_bytes(yyconst char *bytes, int len) #else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +YY_BUFFER_STATE yy_scan_bytes(bytes, len) yyconst char *bytes; int len; #endif - { +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; @@ -1975,79 +1974,79 @@ int len; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + buf = (char *)yy_flex_alloc(n); + if (!buf) + YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); - for ( i = 0; i < len; ++i ) + for (i = 0; i < len; ++i) buf[i] = bytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len + 1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + b = yy_scan_buffer(buf, n); + if (!b) + YY_FATAL_ERROR("bad buffer in yy_scan_bytes()"); /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ + * away when we're done. + */ b->yy_is_our_buffer = 1; return b; - } +} #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) +static void yy_push_state(int new_state) #else -static void yy_push_state( new_state ) +static void yy_push_state(new_state) int new_state; #endif +{ + if (yy_start_stack_ptr >= yy_start_stack_depth) { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + new_size = yy_start_stack_depth * sizeof(int); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if (!yy_start_stack) + yy_start_stack = (int *)yy_flex_alloc(new_size); else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + yy_start_stack = (int *)yy_flex_realloc( + (void *)yy_start_stack, new_size); - if ( ! yy_start_stack ) + if (!yy_start_stack) YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } + "out of memory expanding start-condition stack"); + } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); - } +} #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); +{ + if (--yy_start_stack_ptr < 0) + YY_FATAL_ERROR("start-condition stack underflow"); BEGIN(yy_start_stack[yy_start_stack_ptr]); - } +} #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() - { +{ return yy_start_stack[yy_start_stack_ptr - 1]; - } +} #endif #ifndef YY_EXIT_FAILURE @@ -2055,15 +2054,15 @@ static int yy_top_state() #endif #ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) +static void yy_fatal_error(yyconst char msg[]) #else -static void yy_fatal_error( msg ) +static void yy_fatal_error(msg) char msg[]; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } +{ + (void)fprintf(stderr, "%s\n", msg); + exit(YY_EXIT_FAILURE); +} @@ -2071,81 +2070,81 @@ char msg[]; #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +static void yy_flex_strncpy(char *s1, yyconst char *s2, int n) #else -static void yy_flex_strncpy( s1, s2, n ) +static void yy_flex_strncpy(s1, s2, n) char *s1; yyconst char *s2; int n; #endif - { - int i; - for ( i = 0; i < n; ++i ) +{ + register int i; + for (i = 0; i < n; ++i) s1[i] = s2[i]; - } +} #endif #ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) +static void *yy_flex_alloc(yy_size_t size) #else -static void *yy_flex_alloc( size ) +static void *yy_flex_alloc(size) yy_size_t size; #endif - { - return (void *) malloc( size ); - } +{ + return (void *)malloc(size); +} #ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) +static void *yy_flex_realloc(void *ptr, yy_size_t size) #else -static void *yy_flex_realloc( ptr, size ) +static void *yy_flex_realloc(ptr, size) void *ptr; yy_size_t size; #endif - { +{ /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *)realloc((char *)ptr, size); +} #ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) +static void yy_flex_free(void *ptr) #else -static void yy_flex_free( ptr ) +static void yy_flex_free(ptr) void *ptr; #endif - { - free( ptr ); - } +{ + free(ptr); +} #if YY_MAIN int main() - { +{ yylex(); return 0; - } +} #endif #line 222 "CMDscan.l" @@ -2173,59 +2172,59 @@ void CMDerror(char *format, ...) const int BUFMAX = 1024; char tempBuf[BUFMAX]; va_list args; - va_start( args, format ); + va_start(args, format); #ifdef TORQUE_OS_WIN - _vsnprintf( tempBuf, BUFMAX, format, args ); + _vsnprintf(tempBuf, BUFMAX, format, args); #else - vsnprintf( tempBuf, BUFMAX, format, args ); + vsnprintf(tempBuf, BUFMAX, format, args); #endif - va_end(args); + va_end(args); - if(fileName) + if (fileName) { Con::errorf(ConsoleLogEntry::Script, "%s Line: %d - %s", fileName, lineIndex, tempBuf); #ifndef NO_ADVANCED_ERROR_REPORT // dhc - lineIndex is bogus. let's try to add some sanity back in. - int i,j,n; + int i, j, n; char c; int linediv = 1; // first, walk the buffer, trying to detect line ending type. // this is imperfect, if inconsistant line endings exist... - for (i=0; iBUFMAX>>2) break; // at least get a little data + c = scanBuffer[scanIndex - i]; + if ((c == '\r' || c == '\n') && i>BUFMAX >> 2) break; // at least get a little data n++; i++; } // find next lineending - while (n>1) // cap at half-buf-size forward + while (n>1) // cap at half-buf-size forward { - c = scanBuffer[scanIndex+j]; - if (c==0) break; - if ((c=='\r' || c=='\n') && j>BUFMAX>>2) break; // at least get a little data + c = scanBuffer[scanIndex + j]; + if (c == 0) break; + if ((c == '\r' || c == '\n') && j>BUFMAX >> 2) break; // at least get a little data n++; j++; } if (i) i--; // chop off extra linefeed. if (j) j--; // chop off extra linefeed. - // build our little text block - if (i) dStrncpy(tempBuf,scanBuffer+scanIndex-i,i); - dStrncpy(tempBuf+i,"##", 2); // bracketing. - tempBuf[i+2] = scanBuffer[scanIndex]; // copy the halt character. - dStrncpy(tempBuf+i+3,"##", 2); // bracketing. - if (j) dStrncpy(tempBuf+i+5,scanBuffer+scanIndex+1,j); // +1 to go past current char. - tempBuf[i+j+5] = 0; // null terminate - for(n=0; n>> Advanced script error report. Line %d.", lineIndex); Con::warnf(ConsoleLogEntry::Script, ">>> Some error context, with ## on sides of error halt:"); @@ -2242,7 +2241,7 @@ void CMDerror(char *format, ...) Con::setVariable("$ScriptError", tempBuf); // We also need to mark that we came up with a new error. - static S32 sScriptErrorHash=1000; + static S32 sScriptErrorHash = 1000; Con::setIntVariable("$ScriptErrorHash", sScriptErrorHash++); } else @@ -2260,7 +2259,7 @@ void CMDSetScanBuffer(const char *sb, const char *fn) int CMDgetc() { int ret = scanBuffer[scanIndex]; - if(ret) + if (ret) scanIndex++; else ret = -1; @@ -2278,13 +2277,13 @@ static int Sc_ScanVar() CMDtext[CMDleng] = 0; // Make it a stringtable string! - CMDlval.s = MakeToken< StringTableEntry >( StringTable->insert(CMDtext), lineIndex ); + CMDlval.s = MakeToken< StringTableEntry >(StringTable->insert(CMDtext), lineIndex); return(VAR); } static int charConv(int in) { - switch(in) + switch (in) { case 'r': return '\r'; @@ -2299,11 +2298,11 @@ static int charConv(int in) static int getHexDigit(char c) { - if(c >= '0' && c <= '9') + if (c >= '0' && c <= '9') return c - '0'; - if(c >= 'A' && c <= 'F') + if (c >= 'A' && c <= 'F') return c - 'A' + 10; - if(c >= 'a' && c <= 'f') + if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1; } @@ -2311,40 +2310,40 @@ static int getHexDigit(char c) static int Sc_ScanDocBlock() { S32 len = dStrlen(CMDtext); - char* text = (char *) consoleAlloc(len + 1); + char* text = (char *)consoleAlloc(len + 1); S32 line = lineIndex; - for( S32 i = 0, j = 0; j <= len; j++ ) + for (S32 i = 0, j = 0; j <= len; j++) { - if( ( j <= (len - 2) ) && ( CMDtext[j] == '/' ) && ( CMDtext[j + 1] == '/' ) && ( CMDtext[j + 2] == '/' ) ) + if ((j <= (len - 2)) && (CMDtext[j] == '/') && (CMDtext[j + 1] == '/') && (CMDtext[j + 2] == '/')) { j += 2; continue; } - if( CMDtext[j] == '\r' ) + if (CMDtext[j] == '\r') continue; - if( CMDtext[j] == '\n' ) + if (CMDtext[j] == '\n') lineIndex++; text[i++] = CMDtext[j]; } - CMDlval.str = MakeToken< char* >( text, line ); + CMDlval.str = MakeToken< char* >(text, line); return(DOCBLOCK); } static int Sc_ScanString(int ret) { CMDtext[CMDleng - 1] = 0; - if(!collapseEscape(CMDtext+1)) + if (!collapseEscape(CMDtext + 1)) return -1; - - char* buffer = ( char* ) consoleAlloc( dStrlen( CMDtext ) ); - dStrcpy( buffer, CMDtext + 1 ); - - CMDlval.str = MakeToken< char* >( buffer, lineIndex ); + + char* buffer = (char*)consoleAlloc(dStrlen(CMDtext)); + dStrcpy(buffer, CMDtext + 1); + + CMDlval.str = MakeToken< char* >(buffer, lineIndex); return ret; } @@ -2354,96 +2353,96 @@ static int Sc_ScanIdent() CMDtext[CMDleng] = 0; - if((type = ConsoleBaseType::getTypeByName(CMDtext)) != NULL) + if ((type = ConsoleBaseType::getTypeByName(CMDtext)) != NULL) { /* It's a type */ - CMDlval.i = MakeToken< int >( type->getTypeID(), lineIndex ); + CMDlval.i = MakeToken< int >(type->getTypeID(), lineIndex); return TYPEIDENT; } /* It's an identifier */ - CMDlval.s = MakeToken< StringTableEntry >( StringTable->insert(CMDtext), lineIndex ); + CMDlval.s = MakeToken< StringTableEntry >(StringTable->insert(CMDtext), lineIndex); return IDENT; } void expandEscape(char *dest, const char *src) { U8 c; - while((c = (U8) *src++) != 0) + while ((c = (U8)*src++) != 0) { - if(c == '\"') + if (c == '\"') { *dest++ = '\\'; *dest++ = '\"'; } - else if(c == '\\') + else if (c == '\\') { *dest++ = '\\'; *dest++ = '\\'; } - else if(c == '\r') + else if (c == '\r') { *dest++ = '\\'; *dest++ = 'r'; } - else if(c == '\n') + else if (c == '\n') { *dest++ = '\\'; *dest++ = 'n'; } - else if(c == '\t') + else if (c == '\t') { *dest++ = '\\'; *dest++ = 't'; } - else if(c == '\'') + else if (c == '\'') { *dest++ = '\\'; *dest++ = '\''; } - else if((c >= 1 && c <= 7) || - (c >= 11 && c <= 12) || - (c >= 14 && c <= 15)) + else if ((c >= 1 && c <= 7) || + (c >= 11 && c <= 12) || + (c >= 14 && c <= 15)) { - /* Remap around: \b = 0x8, \t = 0x9, \n = 0xa, \r = 0xd */ - static U8 expandRemap[15] = { 0x0, - 0x0, - 0x1, - 0x2, - 0x3, - 0x4, - 0x5, - 0x6, - 0x0, - 0x0, - 0x0, - 0x7, - 0x8, - 0x0, - 0x9 }; + /* Remap around: \b = 0x8, \t = 0x9, \n = 0xa, \r = 0xd */ + static U8 expandRemap[15] = { 0x0, + 0x0, + 0x1, + 0x2, + 0x3, + 0x4, + 0x5, + 0x6, + 0x0, + 0x0, + 0x0, + 0x7, + 0x8, + 0x0, + 0x9 }; *dest++ = '\\'; *dest++ = 'c'; - if(c == 15) + if (c == 15) *dest++ = 'r'; - else if(c == 16) + else if (c == 16) *dest++ = 'p'; - else if(c == 17) + else if (c == 17) *dest++ = 'o'; else *dest++ = expandRemap[c] + '0'; } - else if(c < 32) + else if (c < 32) { *dest++ = '\\'; *dest++ = 'x'; S32 dig1 = c >> 4; S32 dig2 = c & 0xf; - if(dig1 < 10) + if (dig1 < 10) dig1 += '0'; else dig1 += 'A' - 10; - if(dig2 < 10) + if (dig2 < 10) dig2 += '0'; else dig2 += 'A' - 10; @@ -2459,56 +2458,56 @@ void expandEscape(char *dest, const char *src) bool collapseEscape(char *buf) { S32 len = dStrlen(buf) + 1; - for(S32 i = 0; i < len;) + for (S32 i = 0; i < len;) { - if(buf[i] == '\\') + if (buf[i] == '\\') { - if(buf[i+1] == 'x') + if (buf[i + 1] == 'x') { - S32 dig1 = getHexDigit(buf[i+2]); - if(dig1 == -1) + S32 dig1 = getHexDigit(buf[i + 2]); + if (dig1 == -1) return false; - S32 dig2 = getHexDigit(buf[i+3]); - if(dig2 == -1) + S32 dig2 = getHexDigit(buf[i + 3]); + if (dig2 == -1) return false; buf[i] = dig1 * 16 + dig2; dMemmove(buf + i + 1, buf + i + 4, len - i - 3); len -= 3; i++; } - else if(buf[i+1] == 'c') + else if (buf[i + 1] == 'c') { /* Remap around: \b = 0x8, \t = 0x9, \n = 0xa, \r = 0xd */ static U8 collapseRemap[10] = { 0x1, - 0x2, - 0x3, - 0x4, - 0x5, - 0x6, - 0x7, - 0xb, - 0xc, - 0xe }; + 0x2, + 0x3, + 0x4, + 0x5, + 0x6, + 0x7, + 0xb, + 0xc, + 0xe }; - if(buf[i+2] == 'r') - buf[i] = 15; - else if(buf[i+2] == 'p') + if (buf[i + 2] == 'r') + buf[i] = 15; + else if (buf[i + 2] == 'p') buf[i] = 16; - else if(buf[i+2] == 'o') + else if (buf[i + 2] == 'o') buf[i] = 17; else { - int dig1 = buf[i+2] - '0'; - if(dig1 < 0 || dig1 > 9) - return false; - buf[i] = collapseRemap[dig1]; + int dig1 = buf[i + 2] - '0'; + if (dig1 < 0 || dig1 > 9) + return false; + buf[i] = collapseRemap[dig1]; } // Make sure we don't put 0x1 at the beginning of the string. if ((buf[i] == 0x1) && (i == 0)) { buf[i] = 0x2; - buf[i+1] = 0x1; + buf[i + 1] = 0x1; dMemmove(buf + i + 2, buf + i + 3, len - i - 1); len -= 1; } @@ -2521,7 +2520,7 @@ bool collapseEscape(char *buf) } else { - buf[i] = charConv(buf[i+1]); + buf[i] = charConv(buf[i + 1]); dMemmove(buf + i + 1, buf + i + 2, len - i - 1); len--; i++; @@ -2536,7 +2535,7 @@ bool collapseEscape(char *buf) static int Sc_ScanNum() { CMDtext[CMDleng] = 0; - CMDlval.f = MakeToken< double >( dAtof(CMDtext), lineIndex ); + CMDlval.f = MakeToken< double >(dAtof(CMDtext), lineIndex); return(FLTCONST); } @@ -2544,7 +2543,7 @@ static int Sc_ScanHex() { S32 val = 0; dSscanf(CMDtext, "%x", &val); - CMDlval.i = MakeToken< int >( val, lineIndex ); + CMDlval.i = MakeToken< int >(val, lineIndex); return INTCONST; } diff --git a/Engine/source/console/ast.h b/Engine/source/console/ast.h index f1327a75a..65b20a926 100644 --- a/Engine/source/console/ast.h +++ b/Engine/source/console/ast.h @@ -56,7 +56,7 @@ struct StmtNode StmtNode(); virtual ~StmtNode() {} - + /// @name next Accessors /// @{ @@ -99,17 +99,17 @@ struct StmtNode struct BreakStmtNode : StmtNode { - static BreakStmtNode *alloc( S32 lineNumber ); + static BreakStmtNode *alloc(S32 lineNumber); + - U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(BreakStmtNode); }; struct ContinueStmtNode : StmtNode { - static ContinueStmtNode *alloc( S32 lineNumber ); - + static ContinueStmtNode *alloc(S32 lineNumber); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(ContinueStmtNode); }; @@ -117,7 +117,7 @@ struct ContinueStmtNode : StmtNode /// A mathematical expression. struct ExprNode : StmtNode { - + U32 compileStmt(CodeStream &codeStream, U32 ip); virtual U32 compile(CodeStream &codeStream, U32 ip, TypeReq type) = 0; @@ -128,8 +128,8 @@ struct ReturnStmtNode : StmtNode { ExprNode *expr; - static ReturnStmtNode *alloc( S32 lineNumber, ExprNode *expr ); - + static ReturnStmtNode *alloc(S32 lineNumber, ExprNode *expr); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(ReturnStmtNode); }; @@ -143,10 +143,10 @@ struct IfStmtNode : StmtNode bool integer; bool propagate; - static IfStmtNode *alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagateThrough ); + static IfStmtNode *alloc(S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagateThrough); void propagateSwitchExpr(ExprNode *left, bool string); ExprNode *getSwitchOR(ExprNode *left, ExprNode *list, bool string); - + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(IfStmtNode); }; @@ -163,8 +163,8 @@ struct LoopStmtNode : StmtNode U32 loopBlockStartOffset; bool integer; - static LoopStmtNode *alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *initExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop ); - + static LoopStmtNode *alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *initExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(LoopStmtNode); }; @@ -174,22 +174,22 @@ struct IterStmtNode : StmtNode { /// Local variable name to use for the container element. StringTableEntry varName; - + /// Expression evaluating to a SimSet object. ExprNode* containerExpr; - + /// The statement body. StmtNode* body; - + /// If true, this is a 'foreach$'. bool isStringIter; - + /// Bytecode size of body statement. Set by precompileStmt. U32 bodySize; - - static IterStmtNode* alloc( S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter ); - - U32 compileStmt( CodeStream &codeStream, U32 ip ); + + static IterStmtNode* alloc(S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter); + + U32 compileStmt(CodeStream &codeStream, U32 ip); }; /// A binary mathematical expression (ie, left op right). @@ -202,8 +202,8 @@ struct BinaryExprNode : ExprNode struct FloatBinaryExprNode : BinaryExprNode { - static FloatBinaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ); - + static FloatBinaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FloatBinaryExprNode); @@ -215,8 +215,8 @@ struct ConditionalExprNode : ExprNode ExprNode *trueExpr; ExprNode *falseExpr; bool integer; - static ConditionalExprNode *alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr ); - + static ConditionalExprNode *alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr); + virtual U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); virtual TypeReq getPreferredType(); DBG_STMT_TYPE(ConditionalExprNode); @@ -227,10 +227,10 @@ struct IntBinaryExprNode : BinaryExprNode TypeReq subType; U32 operand; - static IntBinaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ); + static IntBinaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right); void getSubTypeOperand(); - + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(IntBinaryExprNode); @@ -239,8 +239,8 @@ struct IntBinaryExprNode : BinaryExprNode struct StreqExprNode : BinaryExprNode { bool eq; - static StreqExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, bool eq ); - + static StreqExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right, bool eq); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(StreqExprNode); @@ -249,8 +249,8 @@ struct StreqExprNode : BinaryExprNode struct StrcatExprNode : BinaryExprNode { S32 appendChar; - static StrcatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar ); - + static StrcatExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(StrcatExprNode); @@ -258,9 +258,9 @@ struct StrcatExprNode : BinaryExprNode struct CommaCatExprNode : BinaryExprNode { - static CommaCatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right ); + static CommaCatExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right); + - U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(CommaCatExprNode); @@ -272,8 +272,8 @@ struct IntUnaryExprNode : ExprNode ExprNode *expr; bool integer; - static IntUnaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *expr ); - + static IntUnaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(IntUnaryExprNode); @@ -284,8 +284,8 @@ struct FloatUnaryExprNode : ExprNode S32 op; ExprNode *expr; - static FloatUnaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *expr ); - + static FloatUnaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FloatUnaryExprNode); @@ -296,8 +296,8 @@ struct VarNode : ExprNode StringTableEntry varName; ExprNode *arrayIndex; - static VarNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex ); - + static VarNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(VarNode); @@ -308,8 +308,8 @@ struct IntNode : ExprNode S32 value; U32 index; // if it's converted to float/string - static IntNode *alloc( S32 lineNumber, S32 value ); - + static IntNode *alloc(S32 lineNumber, S32 value); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(IntNode); @@ -320,8 +320,8 @@ struct FloatNode : ExprNode F64 value; U32 index; - static FloatNode *alloc( S32 lineNumber, F64 value ); - + static FloatNode *alloc(S32 lineNumber, F64 value); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FloatNode); @@ -335,8 +335,8 @@ struct StrConstNode : ExprNode bool tag; bool doc; // Specifies that this string is a documentation block. - static StrConstNode *alloc( S32 lineNumber, char *str, bool tag, bool doc = false ); - + static StrConstNode *alloc(S32 lineNumber, char *str, bool tag, bool doc = false); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(StrConstNode); @@ -348,8 +348,8 @@ struct ConstantNode : ExprNode F64 fVal; U32 index; - static ConstantNode *alloc( S32 lineNumber, StringTableEntry value ); - + static ConstantNode *alloc(S32 lineNumber, StringTableEntry value); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(ConstantNode); @@ -362,8 +362,8 @@ struct AssignExprNode : ExprNode ExprNode *arrayIndex; TypeReq subType; - static AssignExprNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr ); - + static AssignExprNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(AssignExprNode); @@ -386,8 +386,8 @@ struct AssignOpExprNode : ExprNode U32 operand; TypeReq subType; - static AssignOpExprNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op ); - + static AssignOpExprNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(AssignOpExprNode); @@ -399,8 +399,8 @@ struct TTagSetStmtNode : StmtNode ExprNode *valueExpr; ExprNode *stringExpr; - static TTagSetStmtNode *alloc( S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr ); - + static TTagSetStmtNode *alloc(S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(TTagSetStmtNode); }; @@ -409,8 +409,8 @@ struct TTagDerefNode : ExprNode { ExprNode *expr; - static TTagDerefNode *alloc( S32 lineNumber, ExprNode *expr ); - + static TTagDerefNode *alloc(S32 lineNumber, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(TTagDerefNode); @@ -420,8 +420,8 @@ struct TTagExprNode : ExprNode { StringTableEntry tag; - static TTagExprNode *alloc( S32 lineNumber, StringTableEntry tag ); - + static TTagExprNode *alloc(S32 lineNumber, StringTableEntry tag); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(TTagExprNode); @@ -439,21 +439,33 @@ struct FuncCallExprNode : ExprNode ParentCall }; - static FuncCallExprNode *alloc( S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot ); - + static FuncCallExprNode *alloc(S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FuncCallExprNode); }; +struct FuncPointerCallExprNode : ExprNode +{ + ExprNode *funcPointer; + ExprNode *args; + + static FuncPointerCallExprNode *alloc(S32 lineNumber, ExprNode *stmt, ExprNode *args); + + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); + TypeReq getPreferredType(); + DBG_STMT_TYPE(FuncPointerCallExprNode); +}; + struct AssertCallExprNode : ExprNode { ExprNode *testExpr; const char *message; U32 messageIndex; - static AssertCallExprNode *alloc( S32 lineNumber, ExprNode *testExpr, const char *message ); - + static AssertCallExprNode *alloc(S32 lineNumber, ExprNode *testExpr, const char *message); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(AssertCallExprNode); @@ -472,8 +484,8 @@ struct SlotAccessNode : ExprNode ExprNode *objectExpr, *arrayExpr; StringTableEntry slotName; - static SlotAccessNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName ); - + static SlotAccessNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(SlotAccessNode); @@ -492,8 +504,8 @@ struct InternalSlotAccessNode : ExprNode ExprNode *objectExpr, *slotExpr; bool recurse; - static InternalSlotAccessNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse ); - + static InternalSlotAccessNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(InternalSlotAccessNode); @@ -506,8 +518,8 @@ struct SlotAssignNode : ExprNode ExprNode *valueExpr; U32 typeID; - static SlotAssignNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID = -1 ); - + static SlotAssignNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID = -1); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(SlotAssignNode); @@ -522,8 +534,8 @@ struct SlotAssignOpNode : ExprNode U32 operand; TypeReq subType; - static SlotAssignOpNode *alloc( S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr ); - + static SlotAssignOpNode *alloc(S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(SlotAssignOpNode); @@ -542,8 +554,8 @@ struct ObjectDeclNode : ExprNode bool isClassNameInternal; bool isSingleton; - static ObjectDeclNode *alloc( S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton ); - + static ObjectDeclNode *alloc(S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton); + U32 precompileSubObject(bool); U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); U32 compileSubObject(CodeStream &codeStream, U32 ip, bool); @@ -567,8 +579,8 @@ struct FunctionDeclStmtNode : StmtNode U32 endOffset; U32 argc; - static FunctionDeclStmtNode *alloc( S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts ); - + static FunctionDeclStmtNode *alloc(S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts); + U32 compileStmt(CodeStream &codeStream, U32 ip); void setPackage(StringTableEntry packageName); DBG_STMT_TYPE(FunctionDeclStmtNode); diff --git a/Engine/source/console/astAlloc.cpp b/Engine/source/console/astAlloc.cpp index fb69f49d5..75fbe151c 100644 --- a/Engine/source/console/astAlloc.cpp +++ b/Engine/source/console/astAlloc.cpp @@ -38,25 +38,25 @@ using namespace Compiler; //------------------------------------------------------------ -BreakStmtNode *BreakStmtNode::alloc( S32 lineNumber ) +BreakStmtNode *BreakStmtNode::alloc(S32 lineNumber) { - BreakStmtNode *ret = (BreakStmtNode *) consoleAlloc(sizeof(BreakStmtNode)); + BreakStmtNode *ret = (BreakStmtNode *)consoleAlloc(sizeof(BreakStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; return ret; } -ContinueStmtNode *ContinueStmtNode::alloc( S32 lineNumber ) +ContinueStmtNode *ContinueStmtNode::alloc(S32 lineNumber) { - ContinueStmtNode *ret = (ContinueStmtNode *) consoleAlloc(sizeof(ContinueStmtNode)); + ContinueStmtNode *ret = (ContinueStmtNode *)consoleAlloc(sizeof(ContinueStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; return ret; } -ReturnStmtNode *ReturnStmtNode::alloc( S32 lineNumber, ExprNode *expr) +ReturnStmtNode *ReturnStmtNode::alloc(S32 lineNumber, ExprNode *expr) { - ReturnStmtNode *ret = (ReturnStmtNode *) consoleAlloc(sizeof(ReturnStmtNode)); + ReturnStmtNode *ret = (ReturnStmtNode *)consoleAlloc(sizeof(ReturnStmtNode)); constructInPlace(ret); ret->expr = expr; ret->dbgLineNumber = lineNumber; @@ -64,9 +64,9 @@ ReturnStmtNode *ReturnStmtNode::alloc( S32 lineNumber, ExprNode *expr) return ret; } -IfStmtNode *IfStmtNode::alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagate ) +IfStmtNode *IfStmtNode::alloc(S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagate) { - IfStmtNode *ret = (IfStmtNode *) consoleAlloc(sizeof(IfStmtNode)); + IfStmtNode *ret = (IfStmtNode *)consoleAlloc(sizeof(IfStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; @@ -78,9 +78,9 @@ IfStmtNode *IfStmtNode::alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifB return ret; } -LoopStmtNode *LoopStmtNode::alloc( S32 lineNumber, ExprNode *initExpr, ExprNode *testExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop ) +LoopStmtNode *LoopStmtNode::alloc(S32 lineNumber, ExprNode *initExpr, ExprNode *testExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop) { - LoopStmtNode *ret = (LoopStmtNode *) consoleAlloc(sizeof(LoopStmtNode)); + LoopStmtNode *ret = (LoopStmtNode *)consoleAlloc(sizeof(LoopStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->testExpr = testExpr; @@ -92,28 +92,28 @@ LoopStmtNode *LoopStmtNode::alloc( S32 lineNumber, ExprNode *initExpr, ExprNode // Deal with setting some dummy constant nodes if we weren't provided with // info... This allows us to play nice with missing parts of for(;;) for // instance. - if(!ret->testExpr) ret->testExpr = IntNode::alloc( lineNumber, 1 ); + if (!ret->testExpr) ret->testExpr = IntNode::alloc(lineNumber, 1); return ret; } -IterStmtNode* IterStmtNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter ) +IterStmtNode* IterStmtNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter) { - IterStmtNode* ret = ( IterStmtNode* ) consoleAlloc( sizeof( IterStmtNode ) ); - constructInPlace( ret ); - + IterStmtNode* ret = (IterStmtNode*)consoleAlloc(sizeof(IterStmtNode)); + constructInPlace(ret); + ret->dbgLineNumber = lineNumber; ret->varName = varName; ret->containerExpr = containerExpr; ret->body = body; ret->isStringIter = isStringIter; - + return ret; } -FloatBinaryExprNode *FloatBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ) +FloatBinaryExprNode *FloatBinaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right) { - FloatBinaryExprNode *ret = (FloatBinaryExprNode *) consoleAlloc(sizeof(FloatBinaryExprNode)); + FloatBinaryExprNode *ret = (FloatBinaryExprNode *)consoleAlloc(sizeof(FloatBinaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; @@ -124,9 +124,9 @@ FloatBinaryExprNode *FloatBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNod return ret; } -IntBinaryExprNode *IntBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ) +IntBinaryExprNode *IntBinaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right) { - IntBinaryExprNode *ret = (IntBinaryExprNode *) consoleAlloc(sizeof(IntBinaryExprNode)); + IntBinaryExprNode *ret = (IntBinaryExprNode *)consoleAlloc(sizeof(IntBinaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; @@ -137,9 +137,9 @@ IntBinaryExprNode *IntBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *l return ret; } -StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, bool eq ) +StreqExprNode *StreqExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right, bool eq) { - StreqExprNode *ret = (StreqExprNode *) consoleAlloc(sizeof(StreqExprNode)); + StreqExprNode *ret = (StreqExprNode *)consoleAlloc(sizeof(StreqExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->left = left; @@ -149,9 +149,9 @@ StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *r return ret; } -StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar ) +StrcatExprNode *StrcatExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar) { - StrcatExprNode *ret = (StrcatExprNode *) consoleAlloc(sizeof(StrcatExprNode)); + StrcatExprNode *ret = (StrcatExprNode *)consoleAlloc(sizeof(StrcatExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->left = left; @@ -161,9 +161,9 @@ StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode return ret; } -CommaCatExprNode *CommaCatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right ) +CommaCatExprNode *CommaCatExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right) { - CommaCatExprNode *ret = (CommaCatExprNode *) consoleAlloc(sizeof(CommaCatExprNode)); + CommaCatExprNode *ret = (CommaCatExprNode *)consoleAlloc(sizeof(CommaCatExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->left = left; @@ -172,9 +172,9 @@ CommaCatExprNode *CommaCatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprN return ret; } -IntUnaryExprNode *IntUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *expr ) +IntUnaryExprNode *IntUnaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *expr) { - IntUnaryExprNode *ret = (IntUnaryExprNode *) consoleAlloc(sizeof(IntUnaryExprNode)); + IntUnaryExprNode *ret = (IntUnaryExprNode *)consoleAlloc(sizeof(IntUnaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->op = op; @@ -182,9 +182,9 @@ IntUnaryExprNode *IntUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *exp return ret; } -FloatUnaryExprNode *FloatUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *expr ) +FloatUnaryExprNode *FloatUnaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *expr) { - FloatUnaryExprNode *ret = (FloatUnaryExprNode *) consoleAlloc(sizeof(FloatUnaryExprNode)); + FloatUnaryExprNode *ret = (FloatUnaryExprNode *)consoleAlloc(sizeof(FloatUnaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->op = op; @@ -192,9 +192,9 @@ FloatUnaryExprNode *FloatUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode return ret; } -VarNode *VarNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex ) +VarNode *VarNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex) { - VarNode *ret = (VarNode *) consoleAlloc(sizeof(VarNode)); + VarNode *ret = (VarNode *)consoleAlloc(sizeof(VarNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->varName = varName; @@ -202,18 +202,18 @@ VarNode *VarNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arr return ret; } -IntNode *IntNode::alloc( S32 lineNumber, S32 value ) +IntNode *IntNode::alloc(S32 lineNumber, S32 value) { - IntNode *ret = (IntNode *) consoleAlloc(sizeof(IntNode)); + IntNode *ret = (IntNode *)consoleAlloc(sizeof(IntNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->value = value; return ret; } -ConditionalExprNode *ConditionalExprNode::alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr ) +ConditionalExprNode *ConditionalExprNode::alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr) { - ConditionalExprNode *ret = (ConditionalExprNode *) consoleAlloc(sizeof(ConditionalExprNode)); + ConditionalExprNode *ret = (ConditionalExprNode *)consoleAlloc(sizeof(ConditionalExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->testExpr = testExpr; @@ -223,22 +223,22 @@ ConditionalExprNode *ConditionalExprNode::alloc( S32 lineNumber, ExprNode *testE return ret; } -FloatNode *FloatNode::alloc( S32 lineNumber, F64 value ) +FloatNode *FloatNode::alloc(S32 lineNumber, F64 value) { - FloatNode *ret = (FloatNode *) consoleAlloc(sizeof(FloatNode)); + FloatNode *ret = (FloatNode *)consoleAlloc(sizeof(FloatNode)); constructInPlace(ret); - + ret->dbgLineNumber = lineNumber; ret->value = value; return ret; } -StrConstNode *StrConstNode::alloc( S32 lineNumber, char *str, bool tag, bool doc ) +StrConstNode *StrConstNode::alloc(S32 lineNumber, char *str, bool tag, bool doc) { - StrConstNode *ret = (StrConstNode *) consoleAlloc(sizeof(StrConstNode)); + StrConstNode *ret = (StrConstNode *)consoleAlloc(sizeof(StrConstNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; - ret->str = (char *) consoleAlloc(dStrlen(str) + 1); + ret->str = (char *)consoleAlloc(dStrlen(str) + 1); ret->tag = tag; ret->doc = doc; dStrcpy(ret->str, str); @@ -246,18 +246,18 @@ StrConstNode *StrConstNode::alloc( S32 lineNumber, char *str, bool tag, bool doc return ret; } -ConstantNode *ConstantNode::alloc( S32 lineNumber, StringTableEntry value ) +ConstantNode *ConstantNode::alloc(S32 lineNumber, StringTableEntry value) { - ConstantNode *ret = (ConstantNode *) consoleAlloc(sizeof(ConstantNode)); + ConstantNode *ret = (ConstantNode *)consoleAlloc(sizeof(ConstantNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->value = value; return ret; } -AssignExprNode *AssignExprNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr ) +AssignExprNode *AssignExprNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr) { - AssignExprNode *ret = (AssignExprNode *) consoleAlloc(sizeof(AssignExprNode)); + AssignExprNode *ret = (AssignExprNode *)consoleAlloc(sizeof(AssignExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->varName = varName; @@ -267,9 +267,9 @@ AssignExprNode *AssignExprNode::alloc( S32 lineNumber, StringTableEntry varName, return ret; } -AssignOpExprNode *AssignOpExprNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op ) +AssignOpExprNode *AssignOpExprNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op) { - AssignOpExprNode *ret = (AssignOpExprNode *) consoleAlloc(sizeof(AssignOpExprNode)); + AssignOpExprNode *ret = (AssignOpExprNode *)consoleAlloc(sizeof(AssignOpExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->varName = varName; @@ -279,9 +279,9 @@ AssignOpExprNode *AssignOpExprNode::alloc( S32 lineNumber, StringTableEntry varN return ret; } -TTagSetStmtNode *TTagSetStmtNode::alloc( S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr ) +TTagSetStmtNode *TTagSetStmtNode::alloc(S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr) { - TTagSetStmtNode *ret = (TTagSetStmtNode *) consoleAlloc(sizeof(TTagSetStmtNode)); + TTagSetStmtNode *ret = (TTagSetStmtNode *)consoleAlloc(sizeof(TTagSetStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->tag = tag; @@ -290,37 +290,37 @@ TTagSetStmtNode *TTagSetStmtNode::alloc( S32 lineNumber, StringTableEntry tag, E return ret; } -TTagDerefNode *TTagDerefNode::alloc( S32 lineNumber, ExprNode *expr ) +TTagDerefNode *TTagDerefNode::alloc(S32 lineNumber, ExprNode *expr) { - TTagDerefNode *ret = (TTagDerefNode *) consoleAlloc(sizeof(TTagDerefNode)); + TTagDerefNode *ret = (TTagDerefNode *)consoleAlloc(sizeof(TTagDerefNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->expr = expr; return ret; } -TTagExprNode *TTagExprNode::alloc( S32 lineNumber, StringTableEntry tag ) +TTagExprNode *TTagExprNode::alloc(S32 lineNumber, StringTableEntry tag) { - TTagExprNode *ret = (TTagExprNode *) consoleAlloc(sizeof(TTagExprNode)); + TTagExprNode *ret = (TTagExprNode *)consoleAlloc(sizeof(TTagExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->tag = tag; return ret; } -FuncCallExprNode *FuncCallExprNode::alloc( S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot ) +FuncCallExprNode *FuncCallExprNode::alloc(S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot) { - FuncCallExprNode *ret = (FuncCallExprNode *) consoleAlloc(sizeof(FuncCallExprNode)); + FuncCallExprNode *ret = (FuncCallExprNode *)consoleAlloc(sizeof(FuncCallExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->funcName = funcName; ret->nameSpace = nameSpace; ret->args = args; - if(dot) + if (dot) ret->callType = MethodCall; else { - if(nameSpace && !dStricmp(nameSpace, "Parent")) + if (nameSpace && !dStricmp(nameSpace, "Parent")) ret->callType = ParentCall; else ret->callType = FunctionCall; @@ -328,27 +328,37 @@ FuncCallExprNode *FuncCallExprNode::alloc( S32 lineNumber, StringTableEntry func return ret; } -AssertCallExprNode *AssertCallExprNode::alloc( S32 lineNumber, ExprNode *testExpr, const char *message ) +FuncPointerCallExprNode *FuncPointerCallExprNode::alloc(S32 lineNumber, ExprNode *funcPointer, ExprNode *args) { - #ifdef TORQUE_ENABLE_SCRIPTASSERTS - - AssertCallExprNode *ret = (AssertCallExprNode *) consoleAlloc(sizeof(FuncCallExprNode)); - constructInPlace(ret); - ret->dbgLineNumber = lineNumber; - ret->testExpr = testExpr; - ret->message = message ? message : "TorqueScript assert!"; - return ret; - - #else - - return NULL; - - #endif + FuncPointerCallExprNode *ret = (FuncPointerCallExprNode *)consoleAlloc(sizeof(FuncPointerCallExprNode)); + constructInPlace(ret); + ret->dbgLineNumber = lineNumber; + ret->funcPointer = funcPointer; + ret->args = args; + return ret; } -SlotAccessNode *SlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName ) +AssertCallExprNode *AssertCallExprNode::alloc(S32 lineNumber, ExprNode *testExpr, const char *message) { - SlotAccessNode *ret = (SlotAccessNode *) consoleAlloc(sizeof(SlotAccessNode)); +#ifdef TORQUE_ENABLE_SCRIPTASSERTS + + AssertCallExprNode *ret = (AssertCallExprNode *)consoleAlloc(sizeof(FuncCallExprNode)); + constructInPlace(ret); + ret->dbgLineNumber = lineNumber; + ret->testExpr = testExpr; + ret->message = message ? message : "TorqueScript assert!"; + return ret; + +#else + + return NULL; + +#endif +} + +SlotAccessNode *SlotAccessNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName) +{ + SlotAccessNode *ret = (SlotAccessNode *)consoleAlloc(sizeof(SlotAccessNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -357,9 +367,9 @@ SlotAccessNode *SlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, Exp return ret; } -InternalSlotAccessNode *InternalSlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse ) +InternalSlotAccessNode *InternalSlotAccessNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse) { - InternalSlotAccessNode *ret = (InternalSlotAccessNode *) consoleAlloc(sizeof(InternalSlotAccessNode)); + InternalSlotAccessNode *ret = (InternalSlotAccessNode *)consoleAlloc(sizeof(InternalSlotAccessNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -368,9 +378,9 @@ InternalSlotAccessNode *InternalSlotAccessNode::alloc( S32 lineNumber, ExprNode return ret; } -SlotAssignNode *SlotAssignNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID /* = -1 */ ) +SlotAssignNode *SlotAssignNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID /* = -1 */) { - SlotAssignNode *ret = (SlotAssignNode *) consoleAlloc(sizeof(SlotAssignNode)); + SlotAssignNode *ret = (SlotAssignNode *)consoleAlloc(sizeof(SlotAssignNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -381,9 +391,9 @@ SlotAssignNode *SlotAssignNode::alloc( S32 lineNumber, ExprNode *objectExpr, Exp return ret; } -SlotAssignOpNode *SlotAssignOpNode::alloc( S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr ) +SlotAssignOpNode *SlotAssignOpNode::alloc(S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr) { - SlotAssignOpNode *ret = (SlotAssignOpNode *) consoleAlloc(sizeof(SlotAssignOpNode)); + SlotAssignOpNode *ret = (SlotAssignOpNode *)consoleAlloc(sizeof(SlotAssignOpNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -394,9 +404,9 @@ SlotAssignOpNode *SlotAssignOpNode::alloc( S32 lineNumber, ExprNode *objectExpr, return ret; } -ObjectDeclNode *ObjectDeclNode::alloc( S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton ) +ObjectDeclNode *ObjectDeclNode::alloc(S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton) { - ObjectDeclNode *ret = (ObjectDeclNode *) consoleAlloc(sizeof(ObjectDeclNode)); + ObjectDeclNode *ret = (ObjectDeclNode *)consoleAlloc(sizeof(ObjectDeclNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->classNameExpr = classNameExpr; @@ -408,16 +418,16 @@ ObjectDeclNode *ObjectDeclNode::alloc( S32 lineNumber, ExprNode *classNameExpr, ret->isClassNameInternal = classNameInternal; ret->isSingleton = isSingleton; ret->failOffset = 0; - if(parentObject) + if (parentObject) ret->parentObject = parentObject; else ret->parentObject = StringTable->EmptyString(); return ret; } -FunctionDeclStmtNode *FunctionDeclStmtNode::alloc( S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts ) +FunctionDeclStmtNode *FunctionDeclStmtNode::alloc(S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts) { - FunctionDeclStmtNode *ret = (FunctionDeclStmtNode *) consoleAlloc(sizeof(FunctionDeclStmtNode)); + FunctionDeclStmtNode *ret = (FunctionDeclStmtNode *)consoleAlloc(sizeof(FunctionDeclStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->fnName = fnName; diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index 3fc8c04c9..6ea557703 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -42,15 +42,89 @@ struct Token }; #include "console/cmdgram.h" - namespace Compiler { U32 compileBlock(StmtNode *block, CodeStream &codeStream, U32 ip) { - for(StmtNode *walk = block; walk; walk = walk->getNext()) + for (StmtNode *walk = block; walk; walk = walk->getNext()) ip = walk->compileStmt(codeStream, ip); return codeStream.tell(); } + + inline bool isSimpleVarLookup(ExprNode *arrayExpr, StringTableEntry &varName) + { + if (arrayExpr == nullptr) + { + varName = StringTable->insert(""); + return false; + } + + // No double arrays allowed for optimization. + VarNode *var = dynamic_cast(arrayExpr); + if (var && !var->arrayIndex) + { + StringTableEntry arrayVar = StringTable->insert(var->varName); + precompileIdent(arrayVar); + varName = arrayVar; + return true; + } + return false; + } + + // Do not allow 'recursive' %this optimizations. It can lead to weird bytecode + // generation since we can only optimize one expression at a time. + static bool OnlyOneThisOptimization = false; + + inline bool isThisVar(ExprNode *objectExpr) + { + // If we are currently optimizing a this var, don't allow extra optimization. + if (objectExpr == nullptr || OnlyOneThisOptimization) + return false; + + VarNode *thisVar = dynamic_cast(objectExpr); + if (thisVar && thisVar->varName == StringTable->insert("%this")) + return true; + return false; + } + + inline void optimizeThisPointer(CodeStream &codeStream, ExprNode *arrayExpr, U32 &ip, StringTableEntry slotName) + { + OnlyOneThisOptimization = true; + + // Is the array a simple variable? If so, we can optimize that. + StringTableEntry varName = nullptr; + bool simple = false; + + if (arrayExpr) + { + simple = isSimpleVarLookup(arrayExpr, varName); + if (!simple) + { + // Less optimized array setting. + codeStream.emit(OP_ADVANCE_STR); + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + } + } + + codeStream.emit(OP_SETCURFIELD_THIS); + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + if (simple) + { + codeStream.emit(OP_SETCURFIELD_ARRAY_VAR); + codeStream.emitSTE(varName); + } + else + { + codeStream.emit(OP_SETCURFIELD_ARRAY); + codeStream.emit(OP_TERMINATE_REWIND_STR); + } + } + + OnlyOneThisOptimization = false; + } } using namespace Compiler; @@ -77,7 +151,7 @@ void StmtNode::setPackage(StringTableEntry) void StmtNode::append(StmtNode *next) { StmtNode *walk = this; - while(walk->next) + while (walk->next) walk = walk->next; walk->next = next; } @@ -96,68 +170,68 @@ void FunctionDeclStmtNode::setPackage(StringTableEntry packageName) static U32 conversionOp(TypeReq src, TypeReq dst) { - if(src == TypeReqString) + if (src == TypeReqString) { - switch(dst) + switch (dst) { - case TypeReqUInt: - return OP_STR_TO_UINT; - case TypeReqFloat: - return OP_STR_TO_FLT; - case TypeReqNone: - return OP_STR_TO_NONE; - case TypeReqVar: - return OP_SAVEVAR_STR; - default: - break; + case TypeReqUInt: + return OP_STR_TO_UINT; + case TypeReqFloat: + return OP_STR_TO_FLT; + case TypeReqNone: + return OP_STR_TO_NONE; + case TypeReqVar: + return OP_SAVEVAR_STR; + default: + break; } } - else if(src == TypeReqFloat) + else if (src == TypeReqFloat) { - switch(dst) + switch (dst) { - case TypeReqUInt: - return OP_FLT_TO_UINT; - case TypeReqString: - return OP_FLT_TO_STR; - case TypeReqNone: - return OP_FLT_TO_NONE; - case TypeReqVar: - return OP_SAVEVAR_FLT; - default: - break; + case TypeReqUInt: + return OP_FLT_TO_UINT; + case TypeReqString: + return OP_FLT_TO_STR; + case TypeReqNone: + return OP_FLT_TO_NONE; + case TypeReqVar: + return OP_SAVEVAR_FLT; + default: + break; } } - else if(src == TypeReqUInt) + else if (src == TypeReqUInt) { - switch(dst) + switch (dst) { - case TypeReqFloat: - return OP_UINT_TO_FLT; - case TypeReqString: - return OP_UINT_TO_STR; - case TypeReqNone: - return OP_UINT_TO_NONE; - case TypeReqVar: - return OP_SAVEVAR_UINT; - default: - break; + case TypeReqFloat: + return OP_UINT_TO_FLT; + case TypeReqString: + return OP_UINT_TO_STR; + case TypeReqNone: + return OP_UINT_TO_NONE; + case TypeReqVar: + return OP_SAVEVAR_UINT; + default: + break; } } - else if(src == TypeReqVar) + else if (src == TypeReqVar) { - switch(dst) + switch (dst) { - case TypeReqUInt: - return OP_LOADVAR_UINT; - case TypeReqFloat: - return OP_LOADVAR_FLT; - case TypeReqString: - return OP_LOADVAR_STR; - case TypeReqNone: - return OP_COPYVAR_TO_NONE; - default: - break; + case TypeReqUInt: + return OP_LOADVAR_UINT; + case TypeReqFloat: + return OP_LOADVAR_FLT; + case TypeReqString: + return OP_LOADVAR_STR; + case TypeReqNone: + return OP_COPYVAR_TO_NONE; + default: + break; } } return OP_INVALID; @@ -167,7 +241,7 @@ static U32 conversionOp(TypeReq src, TypeReq dst) U32 BreakStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { - if(codeStream.inLoop()) + if (codeStream.inLoop()) { addBreakLine(codeStream); codeStream.emit(OP_JMP); @@ -184,7 +258,7 @@ U32 BreakStmtNode::compileStmt(CodeStream &codeStream, U32 ip) U32 ContinueStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { - if(codeStream.inLoop()) + if (codeStream.inLoop()) { addBreakLine(codeStream); codeStream.emit(OP_JMP); @@ -210,7 +284,7 @@ U32 ExprNode::compileStmt(CodeStream &codeStream, U32 ip) U32 ReturnStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { addBreakLine(codeStream); - if(!expr) + if (!expr) codeStream.emit(OP_RETURN_VOID); else { @@ -220,15 +294,15 @@ U32 ReturnStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // Return the correct type switch (walkType) { - case TypeReqUInt: - codeStream.emit(OP_RETURN_UINT); - break; - case TypeReqFloat: - codeStream.emit(OP_RETURN_FLT); - break; - default: - codeStream.emit(OP_RETURN); - break; + case TypeReqUInt: + codeStream.emit(OP_RETURN_UINT); + break; + case TypeReqFloat: + codeStream.emit(OP_RETURN_FLT); + break; + default: + codeStream.emit(OP_RETURN); + break; } } return codeStream.tell(); @@ -238,30 +312,30 @@ U32 ReturnStmtNode::compileStmt(CodeStream &codeStream, U32 ip) ExprNode *IfStmtNode::getSwitchOR(ExprNode *left, ExprNode *list, bool string) { - ExprNode *nextExpr = (ExprNode *) list->getNext(); + ExprNode *nextExpr = (ExprNode *)list->getNext(); ExprNode *test; - if(string) - test = StreqExprNode::alloc( left->dbgLineNumber, left, list, true ); + if (string) + test = StreqExprNode::alloc(left->dbgLineNumber, left, list, true); else - test = IntBinaryExprNode::alloc( left->dbgLineNumber, opEQ, left, list ); - if(!nextExpr) + test = IntBinaryExprNode::alloc(left->dbgLineNumber, opEQ, left, list); + if (!nextExpr) return test; - return IntBinaryExprNode::alloc( test->dbgLineNumber, opOR, test, getSwitchOR( left, nextExpr, string ) ); + return IntBinaryExprNode::alloc(test->dbgLineNumber, opOR, test, getSwitchOR(left, nextExpr, string)); } void IfStmtNode::propagateSwitchExpr(ExprNode *left, bool string) { testExpr = getSwitchOR(left, testExpr, string); - if(propagate && elseBlock) - ((IfStmtNode *) elseBlock)->propagateSwitchExpr(left, string); + if (propagate && elseBlock) + ((IfStmtNode *)elseBlock)->propagateSwitchExpr(left, string); } U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { U32 endifIp, elseIp; addBreakLine(codeStream); - - if(testExpr->getPreferredType() == TypeReqUInt) + + if (testExpr->getPreferredType() == TypeReqUInt) { integer = true; } @@ -273,14 +347,14 @@ U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT); - if(elseBlock) + if (elseBlock) { elseIp = codeStream.emit(0); elseOffset = compileBlock(ifBlock, codeStream, ip) + 2; codeStream.emit(OP_JMP); endifIp = codeStream.emit(0); endifOffset = compileBlock(elseBlock, codeStream, ip); - + codeStream.patch(endifIp, endifOffset); codeStream.patch(elseIp, elseOffset); } @@ -288,10 +362,10 @@ U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { endifIp = codeStream.emit(0); endifOffset = compileBlock(ifBlock, codeStream, ip); - + codeStream.patch(endifIp, endifOffset); } - + // Resolve fixes return codeStream.tell(); } @@ -300,7 +374,7 @@ U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { - if(testExpr->getPreferredType() == TypeReqUInt) + if (testExpr->getPreferredType() == TypeReqUInt) { integer = true; } @@ -308,7 +382,7 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { integer = false; } - + // if it's a for loop or a while loop it goes: // initExpr // testExpr @@ -320,7 +394,7 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // testExpr // OP_JMPIF loopStartPoint // breakPoint: - + // otherwise if it's a do ... while() it goes: // initExpr // loopStartPoint: @@ -330,19 +404,19 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // testExpr // OP_JMPIF loopStartPoint // breakPoint: - + // loopBlockStart == start of loop block // continue == skip to end // break == exit loop - - + + addBreakLine(codeStream); codeStream.pushFixScope(true); - - if(initExpr) + + if (initExpr) ip = initExpr->compile(codeStream, ip, TypeReqNone); - if(!isDoLoop) + if (!isDoLoop) { ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT); @@ -353,25 +427,25 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) loopBlockStartOffset = codeStream.tell(); continueOffset = compileBlock(loopBlock, codeStream, ip); - if(endLoopExpr) + if (endLoopExpr) ip = endLoopExpr->compile(codeStream, ip, TypeReqNone); ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIF : OP_JMPIFF); codeStream.emitFix(CodeStream::FIXTYPE_LOOPBLOCKSTART); - + breakOffset = codeStream.tell(); // exit loop - + codeStream.fixLoop(loopBlockStartOffset, breakOffset, continueOffset); codeStream.popFixScope(); - + return codeStream.tell(); } //------------------------------------------------------------ -U32 IterStmtNode::compileStmt( CodeStream &codeStream, U32 ip ) +U32 IterStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { // Instruction sequence: // @@ -384,33 +458,33 @@ U32 IterStmtNode::compileStmt( CodeStream &codeStream, U32 ip ) // .break: // OP_ITER_END // .fail: - + addBreakLine(codeStream); - + codeStream.pushFixScope(true); - + const U32 startIp = ip; - containerExpr->compile( codeStream, startIp, TypeReqString ); - + containerExpr->compile(codeStream, startIp, TypeReqString); + codeStream.emit(isStringIter ? OP_ITER_BEGIN_STR : OP_ITER_BEGIN); - codeStream.emitSTE( varName ); + codeStream.emitSTE(varName); const U32 finalFix = codeStream.emit(0); const U32 continueIp = codeStream.emit(OP_ITER); codeStream.emitFix(CodeStream::FIXTYPE_BREAK); const U32 bodyIp = codeStream.tell(); - - const U32 jmpIp = compileBlock( body, codeStream, bodyIp); + + const U32 jmpIp = compileBlock(body, codeStream, bodyIp); const U32 breakIp = jmpIp + 2; const U32 finalIp = breakIp + 1; - + codeStream.emit(OP_JMP); codeStream.emitFix(CodeStream::FIXTYPE_CONTINUE); codeStream.emit(OP_ITER_END); - + codeStream.patch(finalFix, finalIp); codeStream.fixLoop(bodyIp, breakIp, continueIp); codeStream.popFixScope(); - + return codeStream.tell(); } @@ -423,7 +497,7 @@ U32 ConditionalExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // trueExpr // JMP end // falseExpr - if(testExpr->getPreferredType() == TypeReqUInt) + if (testExpr->getPreferredType() == TypeReqUInt) { integer = true; } @@ -431,10 +505,10 @@ U32 ConditionalExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { integer = false; } - + ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT); - + U32 jumpElseIp = codeStream.emit(0); ip = trueExpr->compile(codeStream, ip, type); codeStream.emit(OP_JMP); @@ -442,7 +516,7 @@ U32 ConditionalExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) codeStream.patch(jumpElseIp, codeStream.tell()); ip = falseExpr->compile(codeStream, ip, type); codeStream.patch(jumpEndIp, codeStream.tell()); - + return codeStream.tell(); } @@ -458,23 +532,23 @@ U32 FloatBinaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) ip = right->compile(codeStream, ip, TypeReqFloat); ip = left->compile(codeStream, ip, TypeReqFloat); U32 operand = OP_INVALID; - switch(op) + switch (op) { - case '+': - operand = OP_ADD; - break; - case '-': - operand = OP_SUB; - break; - case '/': - operand = OP_DIV; - break; - case '*': - operand = OP_MUL; - break; + case '+': + operand = OP_ADD; + break; + case '-': + operand = OP_SUB; + break; + case '/': + operand = OP_DIV; + break; + case '*': + operand = OP_MUL; + break; } codeStream.emit(operand); - if(type != TypeReqFloat) + if (type != TypeReqFloat) codeStream.emit(conversionOp(TypeReqFloat, type)); return codeStream.tell(); } @@ -489,64 +563,64 @@ TypeReq FloatBinaryExprNode::getPreferredType() void IntBinaryExprNode::getSubTypeOperand() { subType = TypeReqUInt; - switch(op) + switch (op) { - case '^': - operand = OP_XOR; - break; - case '%': - operand = OP_MOD; - break; - case '&': - operand = OP_BITAND; - break; - case '|': - operand = OP_BITOR; - break; - case '<': - operand = OP_CMPLT; - subType = TypeReqFloat; - break; - case '>': - operand = OP_CMPGR; - subType = TypeReqFloat; - break; - case opGE: - operand = OP_CMPGE; - subType = TypeReqFloat; - break; - case opLE: - operand = OP_CMPLE; - subType = TypeReqFloat; - break; - case opEQ: - operand = OP_CMPEQ; - subType = TypeReqFloat; - break; - case opNE: - operand = OP_CMPNE; - subType = TypeReqFloat; - break; - case opOR: - operand = OP_OR; - break; - case opAND: - operand = OP_AND; - break; - case opSHR: - operand = OP_SHR; - break; - case opSHL: - operand = OP_SHL; - break; + case '^': + operand = OP_XOR; + break; + case '%': + operand = OP_MOD; + break; + case '&': + operand = OP_BITAND; + break; + case '|': + operand = OP_BITOR; + break; + case '<': + operand = OP_CMPLT; + subType = TypeReqFloat; + break; + case '>': + operand = OP_CMPGR; + subType = TypeReqFloat; + break; + case opGE: + operand = OP_CMPGE; + subType = TypeReqFloat; + break; + case opLE: + operand = OP_CMPLE; + subType = TypeReqFloat; + break; + case opEQ: + operand = OP_CMPEQ; + subType = TypeReqFloat; + break; + case opNE: + operand = OP_CMPNE; + subType = TypeReqFloat; + break; + case opOR: + operand = OP_OR; + break; + case opAND: + operand = OP_AND; + break; + case opSHR: + operand = OP_SHR; + break; + case opSHL: + operand = OP_SHL; + break; } } U32 IntBinaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { getSubTypeOperand(); - - if(operand == OP_OR || operand == OP_AND) + + if (operand == OP_OR || operand == OP_AND) { ip = left->compile(codeStream, ip, subType); codeStream.emit(operand == OP_OR ? OP_JMPIF_NP : OP_JMPIFNOT_NP); @@ -560,7 +634,7 @@ U32 IntBinaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) ip = left->compile(codeStream, ip, subType); codeStream.emit(operand); } - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -579,14 +653,14 @@ U32 StreqExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // eval str right // OP_COMPARE_STR // optional conversion - + ip = left->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_ADVANCE_STR_NUL); ip = right->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_COMPARE_STR); - if(!eq) + if (!eq) codeStream.emit(OP_NOT); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -601,7 +675,7 @@ TypeReq StreqExprNode::getPreferredType() U32 StrcatExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { ip = left->compile(codeStream, ip, TypeReqString); - if(!appendChar) + if (!appendChar) codeStream.emit(OP_ADVANCE_STR); else { @@ -610,9 +684,9 @@ U32 StrcatExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) } ip = right->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_REWIND_STR); - if(type == TypeReqUInt) + if (type == TypeReqUInt) codeStream.emit(OP_STR_TO_UINT); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) codeStream.emit(OP_STR_TO_FLT); return codeStream.tell(); } @@ -634,11 +708,11 @@ U32 CommaCatExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // At this point the stack has the concatenated string. // But we're paranoid, so accept (but whine) if we get an oddity... - if(type == TypeReqUInt || type == TypeReqFloat) + if (type == TypeReqUInt || type == TypeReqFloat) Con::warnf(ConsoleLogEntry::General, "%s (%d): converting comma string to a number... probably wrong.", dbgFileName, dbgLineNumber); - if(type == TypeReqUInt) + if (type == TypeReqUInt) codeStream.emit(OP_STR_TO_UINT); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) codeStream.emit(OP_STR_TO_FLT); return codeStream.tell(); } @@ -654,15 +728,15 @@ U32 IntUnaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { integer = true; TypeReq prefType = expr->getPreferredType(); - if(op == '!' && (prefType == TypeReqFloat || prefType == TypeReqString)) + if (op == '!' && (prefType == TypeReqFloat || prefType == TypeReqString)) integer = false; - + ip = expr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); - if(op == '!') + if (op == '!') codeStream.emit(integer ? OP_NOT : OP_NOTF); - else if(op == '~') + else if (op == '~') codeStream.emit(OP_ONESCOMPLEMENT); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -678,7 +752,7 @@ U32 FloatUnaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { ip = expr->compile(codeStream, ip, TypeReqFloat); codeStream.emit(OP_NEG); - if(type != TypeReqFloat) + if (type != TypeReqFloat) codeStream.emit(conversionOp(TypeReqFloat, type)); return codeStream.tell(); } @@ -692,53 +766,95 @@ TypeReq FloatUnaryExprNode::getPreferredType() U32 VarNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - // if this has an arrayIndex... - // OP_LOADIMMED_IDENT - // varName - // OP_ADVANCE_STR - // evaluate arrayIndex TypeReqString - // OP_REWIND_STR - // OP_SETCURVAR_ARRAY - // OP_LOADVAR (type) - + // if this has an arrayIndex and we are not short circuiting from a constant. + // if we are a var node + // OP_SETCURVAR_ARRAY_VARLOOKUP + // varName + // varNodeVarName + + // else + // OP_LOADIMMED_IDENT + // varName + // OP_ADVANCE_STR + // evaluate arrayIndex TypeReqString + // OP_REWIND_STR + // OP_SETCURVAR_ARRAY + // OP_LOADVAR (type) + // else // OP_SETCURVAR // varName // OP_LOADVAR (type) - - if(type == TypeReqNone) + + if (type == TypeReqNone) return codeStream.tell(); - + + bool shortCircuit = false; + if (arrayIndex) + { + // If we have a constant, shortcircuit the array logic. + + IntNode *intNode = dynamic_cast(arrayIndex); + StrConstNode *strNode = dynamic_cast(arrayIndex); + if (intNode) + { + varName = StringTable->insert(avar("%s%d", varName, intNode->value)); + shortCircuit = true; + } + else if (strNode) + { + varName = StringTable->insert(avar("%s%s", varName, strNode->str)); + shortCircuit = true; + } + } + precompileIdent(varName); - codeStream.emit(arrayIndex ? OP_LOADIMMED_IDENT : OP_SETCURVAR); - codeStream.emitSTE(varName); - - if(arrayIndex) + if (arrayIndex && !shortCircuit) { - codeStream.emit(OP_ADVANCE_STR); - ip = arrayIndex->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_REWIND_STR); - codeStream.emit(OP_SETCURVAR_ARRAY); + // Ok, lets try to optimize %var[%someothervar] as this is + // a common case for array usage. + StringTableEntry varNodeVarName; + if (isSimpleVarLookup(arrayIndex, varNodeVarName)) + { + codeStream.emit(OP_SETCURVAR_ARRAY_VARLOOKUP); + codeStream.emitSTE(varName); + codeStream.emitSTE(varNodeVarName); + } + else + { + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(varName); + codeStream.emit(OP_ADVANCE_STR); + ip = arrayIndex->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_REWIND_STR); + codeStream.emit(OP_SETCURVAR_ARRAY); + } } - switch(type) + else { - case TypeReqUInt: - codeStream.emit(OP_LOADVAR_UINT); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADVAR_FLT); - break; - case TypeReqString: - codeStream.emit(OP_LOADVAR_STR); - break; - case TypeReqVar: - codeStream.emit(OP_LOADVAR_VAR); - break; - case TypeReqNone: - break; - default: - break; + codeStream.emit(OP_SETCURVAR); + codeStream.emitSTE(varName); + } + + switch (type) + { + case TypeReqUInt: + codeStream.emit(OP_LOADVAR_UINT); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADVAR_FLT); + break; + case TypeReqString: + codeStream.emit(OP_LOADVAR_STR); + break; + case TypeReqVar: + codeStream.emit(OP_LOADVAR_VAR); + break; + case TypeReqNone: + break; + default: + break; } return codeStream.tell(); } @@ -752,27 +868,27 @@ TypeReq VarNode::getPreferredType() U32 IntNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqString) + if (type == TypeReqString) index = getCurrentStringTable()->addIntString(value); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) index = getCurrentFloatTable()->add(value); - - switch(type) + + switch (type) { - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(value); - break; - case TypeReqString: - codeStream.emit(OP_LOADIMMED_STR); - codeStream.emit(index); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(value); + break; + case TypeReqString: + codeStream.emit(OP_LOADIMMED_STR); + codeStream.emit(index); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return codeStream.tell(); } @@ -786,27 +902,27 @@ TypeReq IntNode::getPreferredType() U32 FloatNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqString) + if (type == TypeReqString) index = getCurrentStringTable()->addFloatString(value); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) index = getCurrentFloatTable()->add(value); - - switch(type) + + switch (type) { - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(U32(value)); - break; - case TypeReqString: - codeStream.emit(OP_LOADIMMED_STR); - codeStream.emit(index); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(U32(value)); + break; + case TypeReqString: + codeStream.emit(OP_LOADIMMED_STR); + codeStream.emit(index); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return codeStream.tell(); } @@ -821,25 +937,25 @@ TypeReq FloatNode::getPreferredType() U32 StrConstNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // Early out for documentation block. - if( doc ) + if (doc) { index = getCurrentStringTable()->add(str, true, tag); } - else if(type == TypeReqString) + else if (type == TypeReqString) { index = getCurrentStringTable()->add(str, true, tag); } else if (type != TypeReqNone) { fVal = consoleStringToNumber(str, dbgFileName, dbgLineNumber); - if(type == TypeReqFloat) + if (type == TypeReqFloat) { index = getCurrentFloatTable()->add(fVal); } } - + // If this is a DOCBLOCK, then process w/ appropriate op... - if( doc ) + if (doc) { codeStream.emit(OP_DOCBLOCK_STR); codeStream.emit(index); @@ -847,22 +963,22 @@ U32 StrConstNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) } // Otherwise, deal with it normally as a string literal case. - switch(type) + switch (type) { - case TypeReqString: - codeStream.emit(tag ? OP_TAG_TO_STR : OP_LOADIMMED_STR); - codeStream.emit(index); - break; - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(U32(fVal)); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqString: + codeStream.emit(tag ? OP_TAG_TO_STR : OP_LOADIMMED_STR); + codeStream.emit(index); + break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(U32(fVal)); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return codeStream.tell(); } @@ -876,33 +992,33 @@ TypeReq StrConstNode::getPreferredType() U32 ConstantNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqString) + if (type == TypeReqString) { precompileIdent(value); } else if (type != TypeReqNone) { fVal = consoleStringToNumber(value, dbgFileName, dbgLineNumber); - if(type == TypeReqFloat) + if (type == TypeReqFloat) index = getCurrentFloatTable()->add(fVal); } - - switch(type) + + switch (type) { - case TypeReqString: - codeStream.emit(OP_LOADIMMED_IDENT); - codeStream.emitSTE(value); - break; - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(U32(fVal)); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqString: + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(value); + break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(U32(fVal)); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return ip; } @@ -917,9 +1033,9 @@ TypeReq ConstantNode::getPreferredType() U32 AssignExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { subType = expr->getPreferredType(); - if(subType == TypeReqNone) + if (subType == TypeReqNone) subType = type; - if(subType == TypeReqNone) + if (subType == TypeReqNone) { // What we need to do in this case is turn it into a VarNode reference. // Unfortunately other nodes such as field access (SlotAccessNode) @@ -934,41 +1050,87 @@ U32 AssignExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) subType = TypeReqString; } } - // if it's an array expr, the formula is: + + //if we are an array index and we are gonna short circuit + // eval expr + // compute new varName + // OP_SETCURVAR_CREATE + // varName + // OP_SAVEVAR + + //else if it's an array expr and we don't short circuit, the formula is: // eval expr // (push and pop if it's TypeReqString) OP_ADVANCE_STR - // OP_LOADIMMED_IDENT - // varName - // OP_ADVANCE_STR - // eval array - // OP_REWIND_STR - // OP_SETCURVAR_ARRAY_CREATE + // if array lookup is varnode + // OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP + // varName + // varNodeVarName + // else + // OP_LOADIMMED_IDENT + // varName + // OP_ADVANCE_STR + // eval array + // OP_REWIND_STR + // OP_SETCURVAR_ARRAY_CREATE + // endif // OP_TERMINATE_REWIND_STR // OP_SAVEVAR - + //else // eval expr // OP_SETCURVAR_CREATE // varname // OP_SAVEVAR - - precompileIdent(varName); - + ip = expr->compile(codeStream, ip, subType); - if(arrayIndex) + bool shortCircuit = false; + if (arrayIndex) { - if(subType == TypeReqString) + // If we have a constant, shortcircuit the array logic. + + IntNode *intNode = dynamic_cast(arrayIndex); + StrConstNode *strNode = dynamic_cast(arrayIndex); + if (intNode) + { + varName = StringTable->insert(avar("%s%d", varName, intNode->value)); + shortCircuit = true; + } + else if (strNode) + { + varName = StringTable->insert(avar("%s%s", varName, strNode->str)); + shortCircuit = true; + } + } + + precompileIdent(varName); + + if (arrayIndex && !shortCircuit) + { + if (subType == TypeReqString) codeStream.emit(OP_ADVANCE_STR); - codeStream.emit(OP_LOADIMMED_IDENT); - codeStream.emitSTE(varName); - - codeStream.emit(OP_ADVANCE_STR); - ip = arrayIndex->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_REWIND_STR); - codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); - if(subType == TypeReqString) + // Ok, lets try to optimize %var[%someothervar] as this is + // a common case for array usage. + StringTableEntry varNodeVarName; + if (isSimpleVarLookup(arrayIndex, varNodeVarName)) + { + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP); + codeStream.emitSTE(varName); + codeStream.emitSTE(varNodeVarName); + } + else + { + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(varName); + + codeStream.emit(OP_ADVANCE_STR); + ip = arrayIndex->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_REWIND_STR); + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); + } + + if (subType == TypeReqString) codeStream.emit(OP_TERMINATE_REWIND_STR); } else @@ -976,24 +1138,24 @@ U32 AssignExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) codeStream.emit(OP_SETCURVAR_CREATE); codeStream.emitSTE(varName); } - switch(subType) + switch (subType) { - case TypeReqString: - codeStream.emit(OP_SAVEVAR_STR); - break; - case TypeReqUInt: - codeStream.emit(OP_SAVEVAR_UINT); - break; - case TypeReqFloat: - codeStream.emit(OP_SAVEVAR_FLT); - break; - case TypeReqVar: - codeStream.emit(OP_SAVEVAR_VAR); - break; - case TypeReqNone: - break; + case TypeReqString: + codeStream.emit(OP_SAVEVAR_STR); + break; + case TypeReqUInt: + codeStream.emit(OP_SAVEVAR_UINT); + break; + case TypeReqFloat: + codeStream.emit(OP_SAVEVAR_FLT); + break; + case TypeReqVar: + codeStream.emit(OP_SAVEVAR_VAR); + break; + case TypeReqNone: + break; } - if(type != subType) + if (type != subType) codeStream.emit(conversionOp(subType, type)); return ip; } @@ -1007,97 +1169,178 @@ TypeReq AssignExprNode::getPreferredType() static void getAssignOpTypeOp(S32 op, TypeReq &type, U32 &operand) { - switch(op) + switch (op) { - case '+': - type = TypeReqFloat; - operand = OP_ADD; - break; - case '-': - type = TypeReqFloat; - operand = OP_SUB; - break; - case '*': - type = TypeReqFloat; - operand = OP_MUL; - break; - case '/': - type = TypeReqFloat; - operand = OP_DIV; - break; - case '%': - type = TypeReqUInt; - operand = OP_MOD; - break; - case '&': - type = TypeReqUInt; - operand = OP_BITAND; - break; - case '^': - type = TypeReqUInt; - operand = OP_XOR; - break; - case '|': - type = TypeReqUInt; - operand = OP_BITOR; - break; - case opSHL: - type = TypeReqUInt; - operand = OP_SHL; - break; - case opSHR: - type = TypeReqUInt; - operand = OP_SHR; - break; - } + case '+': + case opPLUSPLUS: + type = TypeReqFloat; + operand = OP_ADD; + break; + case '-': + case opMINUSMINUS: + type = TypeReqFloat; + operand = OP_SUB; + break; + case '*': + type = TypeReqFloat; + operand = OP_MUL; + break; + case '/': + type = TypeReqFloat; + operand = OP_DIV; + break; + case '%': + type = TypeReqUInt; + operand = OP_MOD; + break; + case '&': + type = TypeReqUInt; + operand = OP_BITAND; + break; + case '^': + type = TypeReqUInt; + operand = OP_XOR; + break; + case '|': + type = TypeReqUInt; + operand = OP_BITOR; + break; + case opSHL: + type = TypeReqUInt; + operand = OP_SHL; + break; + case opSHR: + type = TypeReqUInt; + operand = OP_SHR; + break; + } } U32 AssignOpExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - + // goes like this... - // eval expr as float or int - // if there's an arrayIndex - - // OP_LOADIMMED_IDENT - // varName - // OP_ADVANCE_STR - // eval arrayIndex stringwise - // OP_REWIND_STR - // OP_SETCURVAR_ARRAY_CREATE - - // else - // OP_SETCURVAR_CREATE - // varName - - // OP_LOADVAR_FLT or UINT - // operand - // OP_SAVEVAR_FLT or UINT - + // + // IF no array index && (op == OPPLUSPLUS or op == OPMINUSMINUS) + // if op == OPPLUSPLUS + // OP_INC + // varName + // else if op == OPMINUSMINUS + // OP_DEC + // varName + // else + // OP_INVALID + // endif + // ELSE + // eval expr as float or int + // if there's an arrayIndex and we don't short circuit + // if arrayIndex is a var node + // OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP + // varName + // varNodeVarName + // else + // OP_LOADIMMED_IDENT + // varName + // OP_ADVANCE_STR + // eval arrayIndex stringwise + // OP_REWIND_STR + // OP_SETCURVAR_ARRAY_CREATE + // endif + // else + // OP_SETCURVAR_CREATE + // varName + // endif + // OP_LOADVAR_FLT or UINT + // operand + // OP_SAVEVAR_FLT or UINT + // ENDIF + // + // if subtype != type + // convert type + // endif + // conversion OP if necessary. getAssignOpTypeOp(op, subType, operand); - precompileIdent(varName); - - ip = expr->compile(codeStream, ip, subType); - if(!arrayIndex) + + // ++ or -- optimization support for non indexed variables. + if ((!arrayIndex) && (op == opPLUSPLUS || op == opMINUSMINUS)) { - codeStream.emit(OP_SETCURVAR_CREATE); - codeStream.emitSTE(varName); + precompileIdent(varName); + + if (op == opPLUSPLUS) + { + codeStream.emit(OP_INC); + codeStream.emitSTE(varName); + } + else if (op == opMINUSMINUS) + { + codeStream.emit(OP_DEC); + codeStream.emitSTE(varName); + } + else + { + // This should NEVER happen. This is just for sanity. + AssertISV(false, "Tried to use ++ or -- but something weird happened."); + codeStream.emit(OP_INVALID); + } } else { - codeStream.emit(OP_LOADIMMED_IDENT); - codeStream.emitSTE(varName); - - codeStream.emit(OP_ADVANCE_STR); - ip = arrayIndex->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_REWIND_STR); - codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); + ip = expr->compile(codeStream, ip, subType); + + bool shortCircuit = false; + if (arrayIndex) + { + // If we have a constant, shortcircuit the array logic. + + IntNode *intNode = dynamic_cast(arrayIndex); + StrConstNode *strNode = dynamic_cast(arrayIndex); + if (intNode) + { + varName = StringTable->insert(avar("%s%d", varName, intNode->value)); + shortCircuit = true; + } + else if (strNode) + { + varName = StringTable->insert(avar("%s%s", varName, strNode->str)); + shortCircuit = true; + } + } + + precompileIdent(varName); + + if (!arrayIndex || shortCircuit) + { + codeStream.emit(OP_SETCURVAR_CREATE); + codeStream.emitSTE(varName); + } + else + { + // Ok, lets try to optimize %var[%someothervar] as this is + // a common case for array usage. + StringTableEntry varNodeVarName; + if (isSimpleVarLookup(arrayIndex, varNodeVarName)) + { + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP); + codeStream.emitSTE(varName); + codeStream.emitSTE(varNodeVarName); + } + else + { + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(varName); + + codeStream.emit(OP_ADVANCE_STR); + ip = arrayIndex->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_REWIND_STR); + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); + } + } + codeStream.emit((subType == TypeReqFloat) ? OP_LOADVAR_FLT : OP_LOADVAR_UINT); + codeStream.emit(operand); + codeStream.emit((subType == TypeReqFloat) ? OP_SAVEVAR_FLT : OP_SAVEVAR_UINT); } - codeStream.emit((subType == TypeReqFloat) ? OP_LOADVAR_FLT : OP_LOADVAR_UINT); - codeStream.emit(operand); - codeStream.emit((subType == TypeReqFloat) ? OP_SAVEVAR_FLT : OP_SAVEVAR_UINT); - if(subType != type) + if (subType != type) codeStream.emit(conversionOp(subType, type)); return codeStream.tell(); } @@ -1146,17 +1389,44 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // OP_PUSH_FRAME // arg OP_PUSH arg OP_PUSH arg OP_PUSH // eval all the args, then call the function. - + // OP_CALLFUNC // function // namespace // isDot - + precompileIdent(funcName); precompileIdent(nameSpace); - + codeStream.emit(OP_PUSH_FRAME); - for(ExprNode *walk = args; walk; walk = (ExprNode *) walk->getNext()) + + bool isThisCall = false; + + ExprNode *walk = args; + + // Try to optimize the this pointer call if it is a variable + // that we are loading. + if (callType == MethodCall) + { + // We cannot optimize array indices because it can have quite + // a bit of code to figure out the array index. + VarNode *var = dynamic_cast(args); + if (var && !var->arrayIndex) + { + precompileIdent(var->varName); + + // Are we a %this call? + isThisCall = (var->varName == StringTable->insert("%this")); + + codeStream.emit(OP_PUSH_THIS); + codeStream.emitSTE(var->varName); + + // inc args since we took care of first arg. + walk = (ExprNode*)walk ->getNext(); + } + } + + for (; walk; walk = (ExprNode *)walk->getNext()) { TypeReq walkType = walk->getPreferredType(); if (walkType == TypeReqNone) walkType = TypeReqString; @@ -1174,16 +1444,25 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) break; } } - if(callType == MethodCall || callType == ParentCall) - codeStream.emit(OP_CALLFUNC); - else - codeStream.emit(OP_CALLFUNC_RESOLVE); - codeStream.emitSTE(funcName); - codeStream.emitSTE(nameSpace); - - codeStream.emit(callType); - if(type != TypeReqString) + if (isThisCall) + { + codeStream.emit(OP_CALLFUNC_THIS); + codeStream.emitSTE(funcName); + } + else + { + if (callType == MethodCall || callType == ParentCall) + codeStream.emit(OP_CALLFUNC); + else + codeStream.emit(OP_CALLFUNC_RESOLVE); + + codeStream.emitSTE(funcName); + codeStream.emitSTE(nameSpace); + codeStream.emit(callType); + } + + if (type != TypeReqString) codeStream.emit(conversionOp(TypeReqString, type)); return codeStream.tell(); } @@ -1193,20 +1472,63 @@ TypeReq FuncCallExprNode::getPreferredType() return TypeReqString; } +//------------------------------------------------------------ + +U32 FuncPointerCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) +{ + // OP_PUSH_FRAME + // arg OP_PUSH arg OP_PUSH arg OP_PUSH + // eval all the args, then call the function. + + // eval fn pointer + // OP_CALLFUNC_POINTER + + codeStream.emit(OP_PUSH_FRAME); + for (ExprNode *walk = args; walk; walk = (ExprNode *)walk->getNext()) + { + TypeReq walkType = walk->getPreferredType(); + if (walkType == TypeReqNone) walkType = TypeReqString; + ip = walk->compile(codeStream, ip, walkType); + switch (walk->getPreferredType()) + { + case TypeReqFloat: + codeStream.emit(OP_PUSH_FLT); + break; + case TypeReqUInt: + codeStream.emit(OP_PUSH_UINT); + break; + default: + codeStream.emit(OP_PUSH); + break; + } + } + + ip = funcPointer->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_CALLFUNC_POINTER); + + if (type != TypeReqString) + codeStream.emit(conversionOp(TypeReqString, type)); + return codeStream.tell(); +} + +TypeReq FuncPointerCallExprNode::getPreferredType() +{ + return TypeReqString; +} //------------------------------------------------------------ -U32 AssertCallExprNode::compile( CodeStream &codeStream, U32 ip, TypeReq type ) +U32 AssertCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - #ifdef TORQUE_ENABLE_SCRIPTASSERTS - - messageIndex = getCurrentStringTable()->add( message, true, false ); - - ip = testExpr->compile( codeStream, ip, TypeReqUInt ); - codeStream.emit(OP_ASSERT); - codeStream.emit(messageIndex); +#ifdef TORQUE_ENABLE_SCRIPTASSERTS - #endif + messageIndex = getCurrentStringTable()->add(message, true, false); + + ip = testExpr->compile(codeStream, ip, TypeReqUInt); + codeStream.emit(OP_ASSERT); + codeStream.emit(messageIndex); + +#endif return codeStream.tell(); } @@ -1220,37 +1542,45 @@ TypeReq AssertCallExprNode::getPreferredType() U32 SlotAccessNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqNone) + if (type == TypeReqNone) return ip; - + precompileIdent(slotName); - if(arrayExpr) + // check if object is %this. If we are, we can do additional optimizations. + if (isThisVar(objectExpr)) { - // eval array - // OP_ADVANCE_STR - // evaluate object expression sub (OP_SETCURFIELD) - // OP_TERMINATE_REWIND_STR - // OP_SETCURFIELDARRAY - // total add of 4 + array precomp - - ip = arrayExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); + optimizeThisPointer(codeStream, arrayExpr, ip, slotName); } - ip = objectExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_SETCUROBJECT); - - codeStream.emit(OP_SETCURFIELD); - - codeStream.emitSTE(slotName); + else + { + if (arrayExpr) + { + // eval array + // OP_ADVANCE_STR + // evaluate object expression sub (OP_SETCURFIELD) + // OP_TERMINATE_REWIND_STR + // OP_SETCURFIELDARRAY + // total add of 4 + array precomp - if(arrayExpr) - { - codeStream.emit(OP_TERMINATE_REWIND_STR); - codeStream.emit(OP_SETCURFIELD_ARRAY); + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_ADVANCE_STR); + } + ip = objectExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_SETCUROBJECT); + + codeStream.emit(OP_SETCURFIELD); + + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + codeStream.emit(OP_TERMINATE_REWIND_STR); + codeStream.emit(OP_SETCURFIELD_ARRAY); + } } - - switch(type) + + switch (type) { case TypeReqUInt: codeStream.emit(OP_LOADFIELD_UINT); @@ -1276,7 +1606,7 @@ TypeReq SlotAccessNode::getPreferredType() U32 InternalSlotAccessNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqNone) + if (type == TypeReqNone) return ip; ip = objectExpr->compile(codeStream, ip, TypeReqString); @@ -1286,7 +1616,7 @@ U32 InternalSlotAccessNode::compile(CodeStream &codeStream, U32 ip, TypeReq type codeStream.emit(OP_SETCUROBJECT_INTERNAL); codeStream.emit(recurse); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -1301,22 +1631,22 @@ TypeReq InternalSlotAccessNode::getPreferredType() U32 SlotAssignNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // first eval the expression TypeReqString - + // if it's an array: - + // if OP_ADVANCE_STR 1 // eval array - + // OP_ADVANCE_STR 1 // evaluate object expr // OP_SETCUROBJECT 1 // OP_SETCURFIELD 1 // fieldName 1 // OP_TERMINATE_REWIND_STR 1 - + // OP_SETCURFIELDARRAY 1 // OP_TERMINATE_REWIND_STR 1 - + // else // OP_ADVANCE_STR // evaluate object expr @@ -1324,45 +1654,54 @@ U32 SlotAssignNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // OP_SETCURFIELD // fieldName // OP_TERMINATE_REWIND_STR - + // OP_SAVEFIELD // convert to return type if necessary. - + precompileIdent(slotName); - + ip = valueExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); - if(arrayExpr) + + if (isThisVar(objectExpr)) { - ip = arrayExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); - } - if(objectExpr) - { - ip = objectExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_SETCUROBJECT); + optimizeThisPointer(codeStream, arrayExpr, ip, slotName); } else - codeStream.emit(OP_SETCUROBJECT_NEW); - codeStream.emit(OP_SETCURFIELD); - codeStream.emitSTE(slotName); - - if(arrayExpr) { + codeStream.emit(OP_ADVANCE_STR); + if (arrayExpr) + { + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_ADVANCE_STR); + } + if (objectExpr) + { + ip = objectExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_SETCUROBJECT); + } + else + codeStream.emit(OP_SETCUROBJECT_NEW); + codeStream.emit(OP_SETCURFIELD); + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + codeStream.emit(OP_TERMINATE_REWIND_STR); + codeStream.emit(OP_SETCURFIELD_ARRAY); + } + codeStream.emit(OP_TERMINATE_REWIND_STR); - codeStream.emit(OP_SETCURFIELD_ARRAY); } - codeStream.emit(OP_TERMINATE_REWIND_STR); codeStream.emit(OP_SAVEFIELD_STR); - if(typeID != -1) + if (typeID != -1) { codeStream.emit(OP_SETCURFIELD_TYPE); codeStream.emit(typeID); } - if(type != TypeReqString) + if (type != TypeReqString) codeStream.emit(conversionOp(TypeReqString, type)); return codeStream.tell(); } @@ -1377,7 +1716,7 @@ TypeReq SlotAssignNode::getPreferredType() U32 SlotAssignOpNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // first eval the expression as its type - + // if it's an array: // eval array // OP_ADVANCE_STR @@ -1387,41 +1726,49 @@ U32 SlotAssignOpNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // fieldName // OP_TERMINATE_REWIND_STR // OP_SETCURFIELDARRAY - + // else // evaluate object expr // OP_SETCUROBJECT // OP_SETCURFIELD // fieldName - + // OP_LOADFIELD of appropriate type // operand // OP_SAVEFIELD of appropriate type // convert to return type if necessary. - + getAssignOpTypeOp(op, subType, operand); precompileIdent(slotName); - + ip = valueExpr->compile(codeStream, ip, subType); - if(arrayExpr) + + if (isThisVar(objectExpr)) { - ip = arrayExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); + optimizeThisPointer(codeStream, arrayExpr, ip, slotName); } - ip = objectExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_SETCUROBJECT); - codeStream.emit(OP_SETCURFIELD); - codeStream.emitSTE(slotName); - - if(arrayExpr) + else { - codeStream.emit(OP_TERMINATE_REWIND_STR); - codeStream.emit(OP_SETCURFIELD_ARRAY); + if (arrayExpr) + { + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_ADVANCE_STR); + } + ip = objectExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_SETCUROBJECT); + codeStream.emit(OP_SETCURFIELD); + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + codeStream.emit(OP_TERMINATE_REWIND_STR); + codeStream.emit(OP_SETCURFIELD_ARRAY); + } } codeStream.emit((subType == TypeReqFloat) ? OP_LOADFIELD_FLT : OP_LOADFIELD_UINT); codeStream.emit(operand); codeStream.emit((subType == TypeReqFloat) ? OP_SAVEFIELD_FLT : OP_SAVEFIELD_UINT); - if(subType != type) + if (subType != type) codeStream.emit(conversionOp(subType, type)); return codeStream.tell(); } @@ -1437,7 +1784,7 @@ TypeReq SlotAssignOpNode::getPreferredType() U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) { // goes - + // OP_PUSHFRAME 1 // name expr // OP_PUSH 1 @@ -1449,17 +1796,17 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) // isSingleton 1 // lineNumber 1 // fail point 1 - + // for each field, eval // OP_ADD_OBJECT (to UINT[0]) 1 // root? 1 - + // add all the sub objects. // OP_END_OBJECT 1 // root? 1 // To fix the stack issue [7/9/2007 Black] // OP_FINISH_OBJECT <-- fail point jumps to this opcode - + codeStream.emit(OP_PUSH_FRAME); ip = classNameExpr->compile(codeStream, ip, TypeReqString); @@ -1467,7 +1814,7 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) ip = objectNameExpr->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_PUSH); - for(ExprNode *exprWalk = argList; exprWalk; exprWalk = (ExprNode *) exprWalk->getNext()) + for (ExprNode *exprWalk = argList; exprWalk; exprWalk = (ExprNode *)exprWalk->getNext()) { TypeReq walkType = exprWalk->getPreferredType(); if (walkType == TypeReqNone) walkType = TypeReqString; @@ -1482,7 +1829,7 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) break; default: codeStream.emit(OP_PUSH); - break; + break; } } codeStream.emit(OP_CREATE_OBJECT); @@ -1493,35 +1840,35 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) codeStream.emit(isSingleton); codeStream.emit(dbgLineNumber); const U32 failIp = codeStream.emit(0); - for(SlotAssignNode *slotWalk = slotDecls; slotWalk; slotWalk = (SlotAssignNode *) slotWalk->getNext()) + for (SlotAssignNode *slotWalk = slotDecls; slotWalk; slotWalk = (SlotAssignNode *)slotWalk->getNext()) ip = slotWalk->compile(codeStream, ip, TypeReqNone); codeStream.emit(OP_ADD_OBJECT); codeStream.emit(root); - for(ObjectDeclNode *objectWalk = subObjects; objectWalk; objectWalk = (ObjectDeclNode *) objectWalk->getNext()) + for (ObjectDeclNode *objectWalk = subObjects; objectWalk; objectWalk = (ObjectDeclNode *)objectWalk->getNext()) ip = objectWalk->compileSubObject(codeStream, ip, false); codeStream.emit(OP_END_OBJECT); codeStream.emit(root || isDatablock); // Added to fix the object creation issue [7/9/2007 Black] failOffset = codeStream.emit(OP_FINISH_OBJECT); - + codeStream.patch(failIp, failOffset); - + return codeStream.tell(); } U32 ObjectDeclNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // root object decl does: - + // push 0 onto the UINT stack OP_LOADIMMED_UINT // precompiles the subObject(true) // UINT stack now has object id // type conv to type - + codeStream.emit(OP_LOADIMMED_UINT); codeStream.emit(0); ip = compileSubObject(codeStream, ip, true); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -1547,31 +1894,31 @@ U32 FunctionDeclStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // OP_RETURN_VOID setCurrentStringTable(&getFunctionStringTable()); setCurrentFloatTable(&getFunctionFloatTable()); - + argc = 0; - for(VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) + for (VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) { precompileIdent(walk->varName); argc++; } - + CodeBlock::smInFunction = true; - + precompileIdent(fnName); precompileIdent(nameSpace); precompileIdent(package); - + CodeBlock::smInFunction = false; - + codeStream.emit(OP_FUNC_DECL); codeStream.emitSTE(fnName); codeStream.emitSTE(nameSpace); codeStream.emitSTE(package); - - codeStream.emit(U32( bool(stmts != NULL) ? 1 : 0 ) + U32( dbgLineNumber << 1 )); + + codeStream.emit(U32(bool(stmts != NULL) ? 1 : 0) + U32(dbgLineNumber << 1)); const U32 endIp = codeStream.emit(0); codeStream.emit(argc); - for(VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) + for (VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) { codeStream.emitSTE(walk->varName); } @@ -1584,11 +1931,11 @@ U32 FunctionDeclStmtNode::compileStmt(CodeStream &codeStream, U32 ip) CodeBlock::smInFunction = false; codeStream.emit(OP_RETURN_VOID); - + codeStream.patch(endIp, codeStream.tell()); - + setCurrentStringTable(&getGlobalStringTable()); setCurrentFloatTable(&getGlobalFloatTable()); - + return ip; } diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 39fe8d3c3..b5051786b 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -1,6 +1,6 @@ /* A Bison parser, made from cmdgram.y with Bison version GNU Bison version 1.24 - */ +*/ #define YYBISON 1 /* Identify Bison output. */ @@ -11,78 +11,78 @@ #define yychar CMDchar #define yydebug CMDdebug #define yynerrs CMDnerrs -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 #line 1 "cmdgram.y" @@ -129,13 +129,13 @@ struct Token #line 44 "cmdgram.y" - /* Reserved Word Definitions */ +/* Reserved Word Definitions */ #line 55 "cmdgram.y" - /* Constants and Identifier Definitions */ +/* Constants and Identifier Definitions */ #line 69 "cmdgram.y" - /* Operator Definitions */ +/* Operator Definitions */ #line 82 "cmdgram.y" typedef union { @@ -158,16 +158,16 @@ typedef union { #ifndef YYLTYPE typedef - struct yyltype - { - int timestamp; - int first_line; - int first_column; - int last_line; - int last_column; - char *text; - } - yyltype; +struct yyltype +{ + int timestamp; + int first_line; + int first_column; + int last_line; + int last_column; + char *text; +} +yyltype; #define YYLTYPE yyltype #endif @@ -182,165 +182,165 @@ typedef -#define YYFINAL 388 -#define YYFLAG -32768 -#define YYNTBASE 100 +#define YYFINAL 391 +#define YYFLAG -32768 +#define YYNTBASE 100 #define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140) -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 64, 2, 2, 2, 54, 53, 2, 55, - 56, 46, 44, 57, 45, 51, 47, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 58, 59, 48, - 50, 49, 96, 65, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 92, 2, 99, 62, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 60, 52, 61, 63, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 93, 94, 95, 97, 98 +static const char yytranslate[] = { 0, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 64, 2, 2, 2, 54, 53, 2, 55, +56, 46, 44, 57, 45, 51, 47, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 58, 59, 48, +50, 49, 96, 65, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +92, 2, 99, 62, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 60, 52, 61, 63, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 1, 2, 3, 4, 5, +6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +16, 17, 18, 19, 20, 21, 22, 23, 24, 25, +26, 27, 28, 29, 30, 31, 32, 33, 34, 35, +36, 37, 38, 39, 40, 41, 42, 43, 66, 67, +68, 69, 70, 71, 72, 73, 74, 75, 76, 77, +78, 79, 80, 81, 82, 83, 84, 85, 86, 87, +88, 89, 90, 91, 93, 94, 95, 97, 98 }; #if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 3, 6, 8, 10, 12, 19, 21, 24, - 25, 28, 30, 32, 34, 36, 38, 40, 43, 46, - 49, 53, 56, 61, 68, 70, 79, 90, 91, 93, - 95, 99, 110, 121, 129, 142, 152, 163, 171, 172, - 175, 176, 178, 179, 182, 183, 185, 187, 190, 193, - 197, 201, 203, 211, 219, 224, 232, 238, 240, 244, - 250, 258, 264, 271, 281, 290, 299, 307, 316, 324, - 332, 339, 347, 355, 357, 359, 363, 367, 371, 375, - 379, 383, 387, 391, 395, 398, 401, 403, 409, 413, - 417, 421, 425, 429, 433, 437, 441, 445, 449, 453, - 457, 461, 464, 467, 469, 471, 473, 475, 477, 479, - 481, 483, 485, 490, 498, 502, 509, 513, 517, 519, - 523, 525, 527, 530, 533, 536, 539, 542, 545, 548, - 551, 554, 557, 559, 561, 563, 567, 574, 577, 583, - 586, 590, 596, 601, 608, 615, 620, 627, 628, 630, - 632, 636, 637, 639, 641, 644, 649, 655, 660, 668, - 677, 679 +static const short yyprhs[] = { 0, +0, 2, 3, 6, 8, 10, 12, 19, 21, 24, +25, 28, 30, 32, 34, 36, 38, 40, 43, 46, +49, 53, 56, 61, 68, 70, 79, 90, 91, 93, +95, 99, 110, 121, 129, 142, 152, 163, 171, 172, +175, 176, 178, 179, 182, 183, 185, 187, 190, 193, +197, 201, 203, 211, 219, 224, 232, 238, 240, 244, +250, 258, 264, 271, 281, 290, 299, 307, 316, 324, +332, 339, 347, 355, 357, 359, 363, 367, 371, 375, +379, 383, 387, 391, 395, 398, 401, 403, 409, 413, +417, 421, 425, 429, 433, 437, 441, 445, 449, 453, +457, 461, 464, 467, 469, 471, 473, 475, 477, 479, +481, 483, 485, 490, 498, 502, 509, 513, 517, 519, +523, 525, 527, 530, 533, 536, 539, 542, 545, 548, +551, 554, 557, 559, 561, 563, 567, 574, 577, 583, +586, 590, 596, 601, 608, 615, 620, 625, 632, 633, +635, 637, 641, 642, 644, 646, 649, 654, 660, 665, +673, 682, 684 }; -static const short yyrhs[] = { 101, - 0, 0, 101, 102, 0, 106, 0, 107, 0, 103, - 0, 29, 38, 60, 104, 61, 59, 0, 107, 0, - 104, 107, 0, 0, 105, 106, 0, 121, 0, 122, - 0, 123, 0, 124, 0, 110, 0, 118, 0, 7, - 59, 0, 9, 59, 0, 13, 59, 0, 13, 126, - 59, 0, 125, 59, 0, 36, 50, 126, 59, 0, - 36, 50, 126, 57, 126, 59, 0, 40, 0, 3, - 38, 55, 108, 56, 60, 105, 61, 0, 3, 38, - 91, 38, 55, 108, 56, 60, 105, 61, 0, 0, - 109, 0, 37, 0, 109, 57, 37, 0, 24, 129, - 55, 126, 112, 56, 60, 136, 61, 59, 0, 5, - 129, 55, 113, 112, 114, 56, 60, 115, 61, 0, - 5, 129, 55, 113, 112, 114, 56, 0, 5, 129, - 55, 92, 113, 99, 112, 114, 56, 60, 115, 61, - 0, 5, 129, 55, 92, 113, 99, 112, 114, 56, - 0, 6, 129, 55, 113, 112, 114, 56, 60, 115, - 61, 0, 6, 129, 55, 113, 112, 114, 56, 0, - 0, 58, 38, 0, 0, 126, 0, 0, 57, 135, - 0, 0, 137, 0, 116, 0, 137, 116, 0, 111, - 59, 0, 116, 111, 59, 0, 60, 105, 61, 0, - 106, 0, 25, 55, 126, 56, 60, 119, 61, 0, - 27, 55, 126, 56, 60, 119, 61, 0, 26, 120, - 58, 105, 0, 26, 120, 58, 105, 19, 58, 105, - 0, 26, 120, 58, 105, 119, 0, 126, 0, 120, - 28, 126, 0, 11, 55, 126, 56, 117, 0, 11, - 55, 126, 56, 117, 8, 117, 0, 14, 55, 126, - 56, 117, 0, 15, 117, 14, 55, 126, 56, 0, - 20, 55, 126, 59, 126, 59, 126, 56, 117, 0, - 20, 55, 126, 59, 126, 59, 56, 117, 0, 20, - 55, 126, 59, 59, 126, 56, 117, 0, 20, 55, - 126, 59, 59, 56, 117, 0, 20, 55, 59, 126, - 59, 126, 56, 117, 0, 20, 55, 59, 126, 59, - 56, 117, 0, 20, 55, 59, 59, 126, 56, 117, - 0, 20, 55, 59, 59, 56, 117, 0, 21, 55, - 37, 23, 126, 56, 117, 0, 22, 55, 37, 23, - 126, 56, 117, 0, 131, 0, 131, 0, 55, 126, - 56, 0, 126, 62, 126, 0, 126, 54, 126, 0, - 126, 53, 126, 0, 126, 52, 126, 0, 126, 44, - 126, 0, 126, 45, 126, 0, 126, 46, 126, 0, - 126, 47, 126, 0, 45, 126, 0, 46, 126, 0, - 36, 0, 126, 96, 126, 58, 126, 0, 126, 48, - 126, 0, 126, 49, 126, 0, 126, 86, 126, 0, - 126, 87, 126, 0, 126, 84, 126, 0, 126, 85, - 126, 0, 126, 89, 126, 0, 126, 71, 126, 0, - 126, 72, 126, 0, 126, 88, 126, 0, 126, 90, - 126, 0, 126, 97, 126, 0, 126, 65, 126, 0, - 64, 126, 0, 63, 126, 0, 42, 0, 43, 0, - 35, 0, 7, 0, 127, 0, 128, 0, 38, 0, - 41, 0, 37, 0, 37, 92, 139, 99, 0, 3, - 55, 108, 56, 60, 105, 61, 0, 126, 51, 38, - 0, 126, 51, 38, 92, 139, 99, 0, 126, 66, - 129, 0, 126, 67, 129, 0, 38, 0, 55, 126, - 56, 0, 69, 0, 68, 0, 73, 126, 0, 74, - 126, 0, 75, 126, 0, 76, 126, 0, 77, 126, - 0, 78, 126, 0, 79, 126, 0, 80, 126, 0, - 81, 126, 0, 82, 126, 0, 132, 0, 133, 0, - 111, 0, 37, 50, 126, 0, 37, 92, 139, 99, - 50, 126, 0, 37, 130, 0, 37, 92, 139, 99, - 130, 0, 127, 130, 0, 127, 50, 126, 0, 127, - 50, 60, 135, 61, 0, 38, 55, 134, 56, 0, - 38, 91, 38, 55, 134, 56, 0, 126, 51, 38, - 55, 134, 56, 0, 32, 55, 126, 56, 0, 32, - 55, 126, 57, 41, 56, 0, 0, 135, 0, 126, - 0, 135, 57, 126, 0, 0, 137, 0, 138, 0, - 137, 138, 0, 38, 50, 126, 59, 0, 39, 38, - 50, 126, 59, 0, 24, 50, 126, 59, 0, 38, - 92, 139, 99, 50, 126, 59, 0, 39, 38, 92, - 139, 99, 50, 126, 59, 0, 126, 0, 139, 57, - 126, 0 +static const short yyrhs[] = { 101, +0, 0, 101, 102, 0, 106, 0, 107, 0, 103, +0, 29, 38, 60, 104, 61, 59, 0, 107, 0, +104, 107, 0, 0, 105, 106, 0, 121, 0, 122, +0, 123, 0, 124, 0, 110, 0, 118, 0, 7, +59, 0, 9, 59, 0, 13, 59, 0, 13, 126, +59, 0, 125, 59, 0, 36, 50, 126, 59, 0, +36, 50, 126, 57, 126, 59, 0, 40, 0, 3, +38, 55, 108, 56, 60, 105, 61, 0, 3, 38, +91, 38, 55, 108, 56, 60, 105, 61, 0, 0, +109, 0, 37, 0, 109, 57, 37, 0, 24, 129, +55, 126, 112, 56, 60, 136, 61, 59, 0, 5, +129, 55, 113, 112, 114, 56, 60, 115, 61, 0, +5, 129, 55, 113, 112, 114, 56, 0, 5, 129, +55, 92, 113, 99, 112, 114, 56, 60, 115, 61, +0, 5, 129, 55, 92, 113, 99, 112, 114, 56, +0, 6, 129, 55, 113, 112, 114, 56, 60, 115, +61, 0, 6, 129, 55, 113, 112, 114, 56, 0, +0, 58, 38, 0, 0, 126, 0, 0, 57, 135, +0, 0, 137, 0, 116, 0, 137, 116, 0, 111, +59, 0, 116, 111, 59, 0, 60, 105, 61, 0, +106, 0, 25, 55, 126, 56, 60, 119, 61, 0, +27, 55, 126, 56, 60, 119, 61, 0, 26, 120, +58, 105, 0, 26, 120, 58, 105, 19, 58, 105, +0, 26, 120, 58, 105, 119, 0, 126, 0, 120, +28, 126, 0, 11, 55, 126, 56, 117, 0, 11, +55, 126, 56, 117, 8, 117, 0, 14, 55, 126, +56, 117, 0, 15, 117, 14, 55, 126, 56, 0, +20, 55, 126, 59, 126, 59, 126, 56, 117, 0, +20, 55, 126, 59, 126, 59, 56, 117, 0, 20, +55, 126, 59, 59, 126, 56, 117, 0, 20, 55, +126, 59, 59, 56, 117, 0, 20, 55, 59, 126, +59, 126, 56, 117, 0, 20, 55, 59, 126, 59, +56, 117, 0, 20, 55, 59, 59, 126, 56, 117, +0, 20, 55, 59, 59, 56, 117, 0, 21, 55, +37, 23, 126, 56, 117, 0, 22, 55, 37, 23, +126, 56, 117, 0, 131, 0, 131, 0, 55, 126, +56, 0, 126, 62, 126, 0, 126, 54, 126, 0, +126, 53, 126, 0, 126, 52, 126, 0, 126, 44, +126, 0, 126, 45, 126, 0, 126, 46, 126, 0, +126, 47, 126, 0, 45, 126, 0, 46, 126, 0, +36, 0, 126, 96, 126, 58, 126, 0, 126, 48, +126, 0, 126, 49, 126, 0, 126, 86, 126, 0, +126, 87, 126, 0, 126, 84, 126, 0, 126, 85, +126, 0, 126, 89, 126, 0, 126, 71, 126, 0, +126, 72, 126, 0, 126, 88, 126, 0, 126, 90, +126, 0, 126, 97, 126, 0, 126, 65, 126, 0, +64, 126, 0, 63, 126, 0, 42, 0, 43, 0, +35, 0, 7, 0, 127, 0, 128, 0, 38, 0, +41, 0, 37, 0, 37, 92, 139, 99, 0, 3, +55, 108, 56, 60, 105, 61, 0, 126, 51, 38, +0, 126, 51, 38, 92, 139, 99, 0, 126, 66, +129, 0, 126, 67, 129, 0, 38, 0, 55, 126, +56, 0, 69, 0, 68, 0, 73, 126, 0, 74, +126, 0, 75, 126, 0, 76, 126, 0, 77, 126, +0, 78, 126, 0, 79, 126, 0, 80, 126, 0, +81, 126, 0, 82, 126, 0, 132, 0, 133, 0, +111, 0, 37, 50, 126, 0, 37, 92, 139, 99, +50, 126, 0, 37, 130, 0, 37, 92, 139, 99, +130, 0, 127, 130, 0, 127, 50, 126, 0, 127, +50, 60, 135, 61, 0, 38, 55, 134, 56, 0, +38, 91, 38, 55, 134, 56, 0, 126, 51, 38, +55, 134, 56, 0, 126, 55, 134, 56, 0, 32, +55, 126, 56, 0, 32, 55, 126, 57, 41, 56, +0, 0, 135, 0, 126, 0, 135, 57, 126, 0, +0, 137, 0, 138, 0, 137, 138, 0, 38, 50, +126, 59, 0, 39, 38, 50, 126, 59, 0, 24, +50, 126, 59, 0, 38, 92, 139, 99, 50, 126, +59, 0, 39, 38, 92, 139, 99, 50, 126, 59, +0, 126, 0, 139, 57, 126, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 161, 166, 168, 173, 175, 177, 182, 187, 189, 194, - 196, 201, 202, 203, 204, 205, 206, 207, 209, 211, - 213, 215, 217, 219, 221, 226, 228, 233, 235, 240, - 242, 247, 252, 254, 256, 258, 260, 262, 267, 269, - 274, 276, 281, 283, 288, 290, 292, 294, 299, 301, - 306, 308, 313, 315, 320, 322, 324, 329, 331, 336, - 338, 343, 345, 350, 352, 354, 356, 358, 360, 362, - 364, 369, 371, 376, 381, 383, 385, 387, 389, 391, - 393, 395, 397, 399, 401, 403, 405, 407, 409, 411, - 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, - 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, - 453, 455, 457, 459, 477, 479, 484, 486, 491, 493, - 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, - 518, 520, 525, 527, 529, 531, 533, 535, 537, 539, - 541, 543, 548, 550, 552, 557, 559, 564, 566, 571, - 573, 578, 580, 585, 587, 592, 594, 596, 598, 600, - 605, 607 +161, 166, 168, 173, 175, 177, 182, 187, 189, 194, +196, 201, 202, 203, 204, 205, 206, 207, 209, 211, +213, 215, 217, 219, 221, 226, 228, 233, 235, 240, +242, 247, 252, 254, 256, 258, 260, 262, 267, 269, +274, 276, 281, 283, 288, 290, 292, 294, 299, 301, +306, 308, 313, 315, 320, 322, 324, 329, 331, 336, +338, 343, 345, 350, 352, 354, 356, 358, 360, 362, +364, 369, 371, 376, 381, 383, 385, 387, 389, 391, +393, 395, 397, 399, 401, 403, 405, 407, 409, 411, +413, 415, 417, 419, 421, 423, 425, 427, 429, 431, +433, 435, 437, 439, 441, 443, 445, 447, 449, 451, +453, 455, 457, 459, 477, 479, 484, 486, 491, 493, +498, 500, 502, 504, 506, 508, 510, 512, 514, 516, +518, 520, 525, 527, 529, 531, 533, 535, 537, 539, +541, 543, 548, 550, 552, 554, 559, 561, 566, 568, +573, 575, 580, 582, 587, 589, 594, 596, 598, 600, +602, 607, 609 }; -static const char * const yytname[] = { "$","error","$undefined.","rwDEFINE", +static const char * const yytname[] = { "$","error","$undefined.","rwDEFINE", "rwENDDEF","rwDECLARE","rwDECLARESINGLETON","rwBREAK","rwELSE","rwCONTINUE", "rwGLOBAL","rwIF","rwNIL","rwRETURN","rwWHILE","rwDO","rwENDIF","rwENDWHILE", "rwENDFOR","rwDEFAULT","rwFOR","rwFOREACH","rwFOREACHSTR","rwIN","rwDATABLOCK", @@ -363,787 +363,805 @@ static const char * const yytname[] = { "$","error","$undefined.","rwDEFINE", }; #endif -static const short yyr1[] = { 0, - 100, 101, 101, 102, 102, 102, 103, 104, 104, 105, - 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 106, 106, 107, 107, 108, 108, 109, - 109, 110, 111, 111, 111, 111, 111, 111, 112, 112, - 113, 113, 114, 114, 115, 115, 115, 115, 116, 116, - 117, 117, 118, 118, 119, 119, 119, 120, 120, 121, - 121, 122, 122, 123, 123, 123, 123, 123, 123, 123, - 123, 124, 124, 125, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 127, 127, 128, 128, 129, 129, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 132, 132, 132, 133, 133, 134, 134, 135, - 135, 136, 136, 137, 137, 138, 138, 138, 138, 138, - 139, 139 +static const short yyr1[] = { 0, +100, 101, 101, 102, 102, 102, 103, 104, 104, 105, +105, 106, 106, 106, 106, 106, 106, 106, 106, 106, +106, 106, 106, 106, 106, 107, 107, 108, 108, 109, +109, 110, 111, 111, 111, 111, 111, 111, 112, 112, +113, 113, 114, 114, 115, 115, 115, 115, 116, 116, +117, 117, 118, 118, 119, 119, 119, 120, 120, 121, +121, 122, 122, 123, 123, 123, 123, 123, 123, 123, +123, 124, 124, 125, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 127, 127, 128, 128, 129, 129, +130, 130, 130, 130, 130, 130, 130, 130, 130, 130, +130, 130, 131, 131, 131, 131, 131, 131, 131, 131, +131, 131, 132, 132, 132, 132, 133, 133, 134, 134, +135, 135, 136, 136, 137, 137, 138, 138, 138, 138, +138, 139, 139 }; -static const short yyr2[] = { 0, - 1, 0, 2, 1, 1, 1, 6, 1, 2, 0, - 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, - 3, 2, 4, 6, 1, 8, 10, 0, 1, 1, - 3, 10, 10, 7, 12, 9, 10, 7, 0, 2, - 0, 1, 0, 2, 0, 1, 1, 2, 2, 3, - 3, 1, 7, 7, 4, 7, 5, 1, 3, 5, - 7, 5, 6, 9, 8, 8, 7, 8, 7, 7, - 6, 7, 7, 1, 1, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 1, 5, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 7, 3, 6, 3, 3, 1, 3, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 1, 1, 3, 6, 2, 5, 2, - 3, 5, 4, 6, 6, 4, 6, 0, 1, 1, - 3, 0, 1, 1, 2, 4, 5, 4, 7, 8, - 1, 3 +static const short yyr2[] = { 0, +1, 0, 2, 1, 1, 1, 6, 1, 2, 0, +2, 1, 1, 1, 1, 1, 1, 2, 2, 2, +3, 2, 4, 6, 1, 8, 10, 0, 1, 1, +3, 10, 10, 7, 12, 9, 10, 7, 0, 2, +0, 1, 0, 2, 0, 1, 1, 2, 2, 3, +3, 1, 7, 7, 4, 7, 5, 1, 3, 5, +7, 5, 6, 9, 8, 8, 7, 8, 7, 7, +6, 7, 7, 1, 1, 3, 3, 3, 3, 3, +3, 3, 3, 3, 2, 2, 1, 5, 3, 3, +3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +3, 2, 2, 1, 1, 1, 1, 1, 1, 1, +1, 1, 4, 7, 3, 6, 3, 3, 1, 3, +1, 1, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 1, 1, 1, 3, 6, 2, 5, 2, +3, 5, 4, 6, 6, 4, 4, 6, 0, 1, +1, 3, 0, 1, 1, 2, 4, 5, 4, 7, +8, 1, 3 }; -static const short yydefact[] = { 2, - 1, 0, 0, 0, 107, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 106, 87, - 112, 110, 25, 111, 104, 105, 0, 0, 0, 0, - 0, 3, 6, 4, 5, 16, 135, 17, 12, 13, - 14, 15, 0, 0, 108, 109, 75, 133, 134, 0, - 28, 119, 0, 0, 0, 18, 19, 0, 0, 107, - 87, 20, 0, 75, 0, 10, 52, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 122, 121, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 138, 148, 0, 85, 86, 0, 103, 102, 22, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 140, 28, 0, 30, - 0, 29, 0, 41, 41, 0, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 136, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 161, 0, 150, 0, 149, 0, 76, 81, 82, - 83, 84, 89, 90, 115, 80, 79, 78, 77, 101, - 117, 118, 96, 97, 93, 94, 91, 92, 98, 95, - 99, 0, 100, 0, 141, 0, 0, 0, 0, 120, - 41, 39, 42, 39, 0, 0, 51, 11, 0, 0, - 0, 0, 0, 0, 39, 0, 0, 0, 0, 8, - 146, 0, 0, 23, 0, 113, 143, 0, 148, 148, - 0, 0, 0, 0, 28, 10, 31, 0, 0, 43, - 43, 60, 62, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 9, 0, 0, 162, 0, - 139, 151, 0, 0, 0, 88, 142, 10, 0, 0, - 39, 40, 0, 0, 0, 0, 63, 71, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 147, 24, 137, 144, 145, 116, 0, 0, 114, - 43, 44, 34, 38, 61, 70, 69, 0, 67, 0, - 0, 0, 72, 73, 152, 0, 58, 53, 54, 26, - 10, 0, 45, 45, 68, 66, 65, 0, 0, 0, - 0, 0, 153, 154, 0, 10, 0, 36, 0, 0, - 47, 46, 0, 64, 0, 0, 0, 0, 0, 155, - 59, 55, 27, 45, 49, 33, 0, 48, 37, 0, - 0, 0, 0, 0, 32, 0, 57, 0, 50, 158, - 156, 0, 0, 0, 10, 35, 0, 157, 0, 56, - 0, 0, 159, 0, 160, 0, 0, 0 +static const short yydefact[] = { 2, +1, 0, 0, 0, 107, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 106, 87, +112, 110, 25, 111, 104, 105, 0, 0, 0, 0, +0, 3, 6, 4, 5, 16, 135, 17, 12, 13, +14, 15, 0, 0, 108, 109, 75, 133, 134, 0, +28, 119, 0, 0, 0, 18, 19, 0, 0, 107, +87, 20, 0, 75, 0, 10, 52, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 122, 121, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 138, 149, 0, 85, 86, 0, 103, 102, 22, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +149, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 140, 28, 0, +30, 0, 29, 0, 41, 41, 0, 21, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 136, 123, 124, 125, 126, 127, 128, 129, 130, +131, 132, 162, 0, 151, 0, 150, 0, 76, 81, +82, 83, 84, 89, 90, 115, 80, 79, 78, 0, +77, 101, 117, 118, 96, 97, 93, 94, 91, 92, +98, 95, 99, 0, 100, 0, 141, 0, 0, 0, +0, 120, 41, 39, 42, 39, 0, 0, 51, 11, +0, 0, 0, 0, 0, 0, 39, 0, 0, 0, +0, 8, 147, 0, 0, 23, 0, 113, 143, 0, +149, 149, 0, 146, 0, 0, 0, 28, 10, 31, +0, 0, 43, 43, 60, 62, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 9, 0, +0, 163, 0, 139, 152, 0, 0, 0, 88, 142, +10, 0, 0, 39, 40, 0, 0, 0, 0, 63, +71, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 7, 148, 24, 137, 144, 145, 116, +0, 0, 114, 43, 44, 34, 38, 61, 70, 69, +0, 67, 0, 0, 0, 72, 73, 153, 0, 58, +53, 54, 26, 10, 0, 45, 45, 68, 66, 65, +0, 0, 0, 0, 0, 154, 155, 0, 10, 0, +36, 0, 0, 47, 46, 0, 64, 0, 0, 0, +0, 0, 156, 59, 55, 27, 45, 49, 33, 0, +48, 37, 0, 0, 0, 0, 0, 32, 0, 57, +0, 50, 159, 157, 0, 0, 0, 10, 35, 0, +158, 0, 56, 0, 0, 160, 0, 161, 0, 0, +0 }; -static const short yydefgoto[] = { 386, - 1, 32, 33, 219, 139, 67, 35, 131, 132, 36, - 37, 240, 202, 274, 340, 341, 68, 38, 289, 316, - 39, 40, 41, 42, 43, 44, 45, 46, 54, 92, - 64, 48, 49, 165, 166, 332, 342, 334, 163 +static const short yydefgoto[] = { 389, +1, 32, 33, 221, 140, 67, 35, 132, 133, 36, +37, 243, 204, 277, 343, 344, 68, 38, 292, 319, +39, 40, 41, 42, 43, 44, 45, 46, 54, 92, +64, 48, 49, 166, 167, 335, 345, 337, 164 }; -static const short yypact[] = {-32768, - 210, -14, -2, -2, -38, -28, -11, 829, 4, 418, - 13, 64, 69, -2, 70, 71, 85, 72,-32768, 52, - 462, -40,-32768,-32768,-32768,-32768, 1225, 1225, 1225, 1225, - 1225,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 75, 2688, 560,-32768, 76,-32768,-32768, -22, - 92,-32768, 1225, 81, 86,-32768,-32768, 1225, 88,-32768, --32768,-32768, 1338,-32768, 1225,-32768,-32768, 116, 873, 103, - 107, 90, 1225, 1225, 96, 1225, 1225, 1225,-32768,-32768, - 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, - 1225,-32768, 1225, 93, 30, 30, 1392, 30, 30,-32768, - 1225, 1225, 1225, 1225, 1225, 1225, 108, 1225, 1225, 1225, - 1225, 1225, -2, -2, 1225, 1225, 1225, 1225, 1225, 1225, - 1225, 1225, 1225, 1225, 1225, 917,-32768, 92, 110,-32768, - 98, 95, 1446, 20, 1225, 1500,-32768, 1554, 550, 105, - 961, 1608, 138, 139, 1225, 1662, 1716, 164, 1230, 1284, - 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, - 2688, 2688, -39, 2688, 117, 115, 119,-32768, 47, 47, - 30, 30, 2945, 2945, -25, 2829, 2887, 30, 2858, 257, --32768,-32768, 421, 421, 2916, 2916, 2945, 2945, 2800, 2771, - 257, 1770, 257, 1225, 2688, 121, 120, 118, 151,-32768, - 1225, 133, 2688, 133, 418, 418,-32768,-32768, 1225, 1005, - 1824, 1049, 1225, 1225, 1878, 132, 134, 155, 11,-32768, --32768, 154, 1225,-32768, 1225, 2950,-32768, 1225, 1225, 1225, - 1225, 1225, -15, 136, 92,-32768,-32768, 101, 159, 141, - 141, 193,-32768, 1932, 418, 1986, 1093, 1137, 2040, 2094, - 2148, 146, 177, 177, 147,-32768, 153, 2202, 2688, 1225, --32768, 2688, 156, 158, -35, 2742,-32768,-32768, 162, 650, - 133,-32768, 1225, 166, 170, 418,-32768,-32768, 418, 418, - 2256, 418, 2310, 1181, 418, 418, 150, 1225, 167, 168, --32768,-32768,-32768, 2688,-32768,-32768,-32768, 695, 160,-32768, - 141, 115, 173, 176,-32768,-32768,-32768, 418,-32768, 418, - 418, 2364,-32768,-32768, 68, 12, 2688,-32768,-32768,-32768, --32768, 171, 94, 94,-32768,-32768,-32768, 418, 161, -21, - 200, 179, 68,-32768, 1225,-32768, 740, 181, 184, 188, - 99, 94, 196,-32768, 1225, 1225, 1225, -18, 195,-32768, - 2688, 144,-32768, 94,-32768,-32768, 199, 99,-32768, 2418, - 2472, -9, 1225, 1225,-32768, 201,-32768, 202,-32768,-32768, --32768, 211, 2526, -8,-32768,-32768, 1225,-32768, 212, 785, - 2580, 1225,-32768, 2634,-32768, 260, 264,-32768 +static const short yypact[] = { -32768, +213, -7, 55, 55, -37, -25, -18, 490, -13, 422, +5, 14, 41, 55, 47, 49, 9, 51,-32768, 57, +566, -23,-32768,-32768,-32768,-32768, 1187, 1187, 1187, 1187, +1187,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, -5, 2650, 3021,-32768, 35,-32768,-32768, -12, +62,-32768, 1187, 67, 68,-32768,-32768, 1187, 69,-32768, +-32768,-32768, 1300,-32768, 1187,-32768,-32768, 103, 835, 88, +89, 77, 1187, 1187, 73, 1187, 1187, 1187,-32768,-32768, +1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, +1187,-32768, 1187, 96, 219, 219, 1354, 219, 219,-32768, +1187, 1187, 1187, 1187, 1187, 1187, 97, 1187, 1187, 1187, +1187, 1187, 1187, 55, 55, 1187, 1187, 1187, 1187, 1187, +1187, 1187, 1187, 1187, 1187, 1187, 879,-32768, 62, 98, +-32768, 81, 91, 1408, 21, 1187, 1462,-32768, 1516, 556, +95, 923, 1570, 123, 131, 1187, 1624, 1678, 152, 1192, +1246, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, +2650, 2650, 2650, -38, 2650, 100, 104, 111,-32768, 145, +145, 219, 219, 3015, 3015, -40, 2845, 2939, 219, 112, +2892, 143,-32768,-32768, 277, 277, 2986, 2986, 3015, 3015, +2798, 2751, 143, 1732, 143, 1187, 2650, 113, 116, 107, +135,-32768, 1187, 119, 2650, 119, 422, 422,-32768,-32768, +1187, 967, 1786, 1011, 1187, 1187, 1840, 122, 126, 157, +13,-32768,-32768, 162, 1187,-32768, 1187, 3041,-32768, 1187, +1187, 1187, 1187,-32768, 1187, 44, 144, 62,-32768,-32768, +106, 170, 156, 156, 209,-32768, 1894, 422, 1948, 1055, +1099, 2002, 2056, 2110, 165, 197, 197, 166,-32768, 173, +2164, 2650, 1187,-32768, 2650, 174, 175, -28, 2704,-32768, +-32768, 176, 656, 119,-32768, 1187, 180, 183, 422,-32768, +-32768, 422, 422, 2218, 422, 2272, 1143, 422, 422, 181, +1187, 182, 185,-32768,-32768,-32768, 2650,-32768,-32768,-32768, +701, 184,-32768, 156, 104, 192, 200,-32768,-32768,-32768, +422,-32768, 422, 422, 2326,-32768,-32768, 76, 12, 2650, +-32768,-32768,-32768,-32768, 201, 92, 92,-32768,-32768,-32768, +422, 211, -20, 224, 202, 76,-32768, 1187,-32768, 746, +204, 206, 205, 39, 92, 208,-32768, 1187, 1187, 1187, +-17, 212,-32768, 2650, 138,-32768, 92,-32768,-32768, 216, +39,-32768, 2380, 2434, -21, 1187, 1187,-32768, 221,-32768, +222,-32768,-32768,-32768, 217, 2488, -8,-32768,-32768, 1187, +-32768, 230, 791, 2542, 1187,-32768, 2596,-32768, 289, 290, +-32768 }; -static const short yypgoto[] = {-32768, --32768,-32768,-32768,-32768, -233, 0, -132, -120,-32768,-32768, - -304, -176, -123, -228, -277, -76, -200,-32768, -243,-32768, --32768,-32768,-32768,-32768,-32768, 285,-32768,-32768, 3, -43, - -1,-32768,-32768, -108, -184,-32768, -48, -299, -227 +static const short yypgoto[] = { -32768, +-32768,-32768,-32768,-32768, -236, 0, -132, -118,-32768,-32768, +-306, -192, -113, -231, -262, -54, -202,-32768, -247,-32768, +-32768,-32768,-32768,-32768,-32768, 288,-32768,-32768, 4, -43, +-1,-32768,-32768, -104, -184,-32768, -26, -295, -229 }; -#define YYLAST 3042 +#define YYLAST 3123 -static const short yytable[] = { 47, - 34, 127, 270, 265, 242, 243, 55, 196, 47, 233, - 290, 204, 275, 218, 93, 220, 72, 225, 339, 339, - 56, 225, 59, 50, 3, 4, 60, 241, 346, 230, - 57, 363, 128, 350, 298, 52, 357, 339, 252, 335, - 51, 228, 350, 58, 278, 267, 343, 225, 225, 339, - 94, 18, 53, 357, 19, 61, 21, 22, 65, 226, - 24, 25, 26, 297, 27, 28, 231, 69, 129, 336, - 347, 255, 322, 364, 29, 305, 368, 238, 306, 307, - 107, 309, 30, 31, 313, 314, 256, 337, 302, 372, - 379, 329, 103, 104, 301, 113, 114, 107, 3, 4, - 110, 77, 352, 3, 4, 330, 331, 325, 367, 326, - 327, 201, 113, 114, 269, 181, 182, 329, 70, 362, - 263, 264, 75, 71, 73, 74, 76, 344, 130, 140, - 167, 330, 331, 100, -74, 134, 374, 47, 208, 143, - 135, 380, 51, 144, 145, 175, 59, 197, 3, 4, - 5, 199, 6, 198, 7, 148, 8, 9, 10, 209, - 213, 214, 366, 11, 12, 13, 218, 14, 15, 288, - 16, 228, 227, 229, 235, 18, 234, 236, 19, 20, - 21, 22, 261, 23, 24, 25, 26, 237, 27, 28, - 239, 253, 50, 254, 257, 268, 272, 273, 29, 271, - 276, 287, 288, 47, 47, 291, 30, 31, 292, 315, - 345, 295, 2, 296, 3, 4, 5, 299, 6, 321, - 7, 303, 8, 9, 10, 304, 338, 318, 319, 11, - 12, 13, 323, 14, 15, 324, 16, 348, 17, 349, - 354, 18, 355, 47, 19, 20, 21, 22, 356, 23, - 24, 25, 26, 365, 27, 28, 359, 369, 375, 387, - 377, 382, 376, 388, 29, 358, 333, 0, 47, 208, - 0, 0, 30, 31, 47, 0, 0, 47, 47, 0, - 47, 0, 0, 47, 47, 0, 0, 0, 0, 0, - 0, 0, 63, 0, 0, 0, 47, 208, 0, 0, - 101, 102, 103, 104, 0, 0, 47, 107, 47, 47, - 110, 95, 96, 97, 98, 99, 0, 0, 0, 0, - 0, 0, 113, 114, 0, 0, 47, 115, 116, 0, - 0, 0, 0, 0, 0, 47, 208, 133, 0, 0, - 0, 0, 136, 0, 0, 0, 0, 0, 0, 138, - 47, 208, 0, 142, 0, 0, 0, 146, 147, 0, - 149, 150, 151, 0, 0, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 0, 164, 47, 208, - 0, 0, 0, 0, 0, 169, 170, 171, 172, 173, - 174, 0, 176, 177, 178, 179, 180, 0, 0, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 195, 0, 0, 0, 0, 0, 0, 0, 203, 203, - 59, 0, 3, 4, 5, 211, 6, 0, 7, 215, - 8, 9, 10, 0, 0, 0, 0, 11, 12, 13, - 0, 14, 15, 0, 16, 0, 0, 0, 0, 18, - 0, 0, 19, 20, 21, 22, 0, 23, 24, 25, - 26, 0, 27, 28, 101, 102, 103, 104, 0, 0, - 0, 107, 29, 0, 110, 0, 0, 66, 164, 0, - 30, 31, 0, 0, 0, 203, 113, 114, 0, 0, - 0, 0, 0, 244, 246, 0, 249, 250, 251, 0, - 0, 0, 0, 0, 0, 0, 0, 258, 0, 259, - 0, 78, 262, 164, 164, 162, 266, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, - 80, 281, 283, 0, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 294, 0, 0, 0, 0, 0, - 0, 0, 59, 91, 3, 4, 5, 164, 6, 0, - 7, 0, 8, 9, 10, 0, 0, 0, 312, 11, - 12, 13, 317, 14, 15, 0, 16, 0, 0, 0, - 0, 18, 0, 0, 19, 20, 21, 22, 0, 23, - 24, 25, 26, 0, 27, 28, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 0, 0, 0, 0, 126, - 207, 0, 30, 31, 0, 0, 0, 0, 0, 351, - 0, 0, 0, 0, 0, 0, 0, 79, 80, 360, - 361, 162, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 0, 0, 0, 0, 0, 373, 162, 0, - 0, 0, 59, 0, 3, 4, 5, 0, 6, 0, - 7, 381, 8, 9, 10, 0, 384, 0, 0, 11, - 12, 13, 0, 14, 15, 0, 16, 0, 0, 0, - 0, 18, 0, 0, 19, 20, 21, 22, 0, 23, - 24, 25, 26, 0, 27, 28, 0, 59, 0, 3, - 4, 5, 0, 6, 29, 7, 0, 8, 9, 10, - 300, 0, 30, 31, 11, 12, 13, 0, 14, 15, - 0, 16, 0, 0, 0, 0, 18, 0, 0, 19, - 20, 21, 22, 0, 23, 24, 25, 26, 0, 27, - 28, 0, 59, 0, 3, 4, 5, 0, 6, 29, - 7, 0, 8, 9, 10, 320, 0, 30, 31, 11, - 12, 13, 0, 14, 15, 0, 16, 0, 0, 0, - 0, 18, 0, 0, 19, 20, 21, 22, 0, 23, - 24, 25, 26, 0, 27, 28, 0, 59, 0, 3, - 4, 5, 0, 6, 29, 7, 0, 8, 9, 10, - 353, 0, 30, 31, 11, 12, 13, 0, 14, 15, - 0, 16, 0, 0, 0, 0, 18, 0, 0, 19, - 20, 21, 22, 0, 23, 24, 25, 26, 0, 27, - 28, 59, 0, 3, 4, 60, 0, 0, 0, 29, - 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 0, 0, 19, 61, 21, 22, 0, 0, 24, - 25, 26, 0, 27, 28, 59, 0, 3, 4, 60, - 0, 0, 0, 29, 0, 0, 0, 62, 0, 0, - 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 0, 0, 19, 61, 21, - 22, 0, 0, 24, 25, 26, 0, 27, 28, 59, - 0, 3, 4, 60, 0, 0, 0, 29, 0, 0, - 0, 141, 0, 0, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, - 0, 19, 61, 21, 22, 0, 0, 24, 25, 26, - 0, 27, 28, 59, 0, 3, 4, 60, 0, 0, - 0, 29, 0, 0, 0, 0, 194, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 0, 0, 19, 61, 21, 22, 0, - 0, 24, 25, 26, 0, 27, 28, 59, 0, 3, - 4, 60, 0, 0, 0, 29, 0, 0, 0, 210, - 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 19, - 61, 21, 22, 0, 0, 24, 25, 26, 0, 27, - 28, 59, 0, 3, 4, 60, 0, 0, 0, 29, - 245, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 0, 0, 19, 61, 21, 22, 0, 0, 24, - 25, 26, 0, 27, 28, 59, 0, 3, 4, 60, - 0, 0, 0, 29, 0, 0, 0, 248, 0, 0, - 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 0, 0, 19, 61, 21, - 22, 0, 0, 24, 25, 26, 0, 27, 28, 59, - 0, 3, 4, 60, 0, 0, 0, 29, 280, 0, - 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, - 0, 19, 61, 21, 22, 0, 0, 24, 25, 26, - 0, 27, 28, 59, 0, 3, 4, 60, 0, 0, - 0, 29, 282, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 0, 0, 19, 61, 21, 22, 0, - 0, 24, 25, 26, 0, 27, 28, 59, 0, 3, - 4, 60, 0, 0, 0, 29, 311, 0, 0, 0, - 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 19, - 61, 21, 22, 0, 0, 24, 25, 26, 0, 27, - 28, 0, 0, 101, 102, 103, 104, 105, 106, 29, - 107, 108, 109, 110, 0, 221, 222, 30, 31, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 0, - 223, 0, 224, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 137, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 168, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 200, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 205, 0, 0, 0, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 206, - 0, 0, 0, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 212, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 216, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 217, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 0, 0, 232, 0, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 0, - 0, 0, 247, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 239, 0, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 277, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 279, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 0, 0, 0, 284, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 285, - 0, 0, 0, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 286, 0, 0, 0, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 0, 0, 0, - 293, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 308, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 310, 0, 0, 0, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 328, - 0, 0, 0, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 370, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 0, 0, 0, - 371, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 0, 0, 0, 378, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 0, 0, 0, 383, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 0, - 0, 0, 385, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 0, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 0, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 101, 102, 103, 104, 105, 106, - 0, 107, 108, 109, 110, 117, 118, 119, 120, 121, - 122, 123, 111, 0, 0, 112, 113, 114, 125, 0, - 0, 115, 116, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 117, 118, 119, 120, 121, 0, - 123, 111, 0, 0, 112, 113, 114, 125, 0, 0, - 115, 116, 101, 102, 103, 104, 105, 106, 0, 107, - 0, 109, 110, 117, 118, 119, 120, 0, 0, 123, - 111, 0, 0, 112, 113, 114, 125, 0, 0, 115, - 116, 101, 102, 103, 104, 105, 106, 0, 107, 0, - 109, 110, 117, 118, 119, 120, 0, 0, 123, 0, - 0, 0, 112, 113, 114, 125, 0, 0, 115, 116, - 101, 102, 103, 104, 105, 106, 0, 107, 0, 0, - 110, 117, 118, 119, 120, 0, 0, 123, 0, 0, - 0, 112, 113, 114, 125, 0, 0, 115, 116, 101, - 102, 103, 104, 105, 106, 0, 107, 0, 0, 110, - 117, 118, 119, 120, 0, 0, 123, 0, 0, 0, - 112, 113, 114, 125, 0, 0, 115, 116, 101, 102, - 103, 104, 0, 0, 0, 107, 0, 0, 110, 260, - 0, 119, 120, 0, 0, 123, 0, 0, 0, 112, - 113, 114, 125, 0, 0, 115, 116, 79, 80, 0, - 0, 0, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 0, 0, 123, 0, 0, 0, 0, 0, - 0, 125 +static const short yytable[] = { 47, +34, 128, 273, 268, 245, 246, 180, 55, 47, 293, +198, 236, 278, 244, 232, 220, 222, 72, 227, 342, +342, 56, 206, 59, 255, 3, 4, 60, 227, 349, +50, 93, 366, 57, 301, 227, 58, 360, 342, 338, +353, 65, 129, 3, 4, 281, 75, 51, 227, 353, +342, 233, 18, 100, 360, 19, 61, 21, 22, 69, +228, 24, 25, 26, 346, 27, 28, 94, 70, 339, +300, 350, 325, 258, 367, 29, 308, 375, 130, 309, +310, 304, 312, 30, 31, 316, 317, 340, 259, 241, +382, 305, 52, -74, 371, 71, 3, 4, 131, 332, +230, 73, 355, 74, 270, 76, 77, 370, 328, 53, +329, 330, 203, 333, 334, 332, 141, 183, 184, 272, +365, 135, 136, 51, 144, 145, 266, 267, 347, 333, +334, 146, 149, 168, 176, 199, 200, 377, 47, 210, +59, 383, 3, 4, 5, 215, 6, 201, 7, 211, +8, 9, 10, 216, 220, 229, 369, 11, 12, 13, +230, 14, 15, 291, 16, 231, 239, 234, 237, 18, +238, 240, 19, 20, 21, 22, 242, 23, 24, 25, +26, 256, 27, 28, 264, 257, 101, 102, 103, 104, +103, 104, 29, 107, 50, 107, 110, 111, 110, 111, +30, 31, 260, 271, 274, 47, 47, 275, 114, 115, +114, 115, 276, 116, 117, 2, 279, 3, 4, 5, +290, 6, 291, 7, 294, 8, 9, 10, 295, 298, +299, 302, 11, 12, 13, 306, 14, 15, 307, 16, +318, 17, 321, 324, 18, 322, 47, 19, 20, 21, +22, 326, 23, 24, 25, 26, 341, 27, 28, 327, +348, 351, 352, 357, 358, 359, 380, 29, 362, 107, +368, 47, 210, 111, 372, 30, 31, 47, 378, 385, +47, 47, 379, 47, 114, 115, 47, 47, 390, 391, +361, 336, 0, 0, 0, 63, 0, 0, 0, 47, +210, 0, 0, 0, 0, 0, 0, 0, 0, 47, +0, 47, 47, 0, 95, 96, 97, 98, 99, 0, +101, 102, 103, 104, 0, 0, 0, 107, 0, 47, +110, 111, 0, 0, 0, 0, 0, 0, 47, 210, +134, 0, 114, 115, 0, 137, 0, 0, 0, 0, +0, 0, 139, 47, 210, 0, 143, 0, 0, 0, +147, 148, 0, 150, 151, 152, 0, 0, 153, 154, +155, 156, 157, 158, 159, 160, 161, 162, 163, 0, +165, 47, 210, 0, 0, 0, 0, 0, 170, 171, +172, 173, 174, 175, 0, 177, 178, 179, 165, 181, +182, 0, 0, 185, 186, 187, 188, 189, 190, 191, +192, 193, 194, 195, 197, 0, 0, 0, 0, 0, +0, 0, 205, 205, 59, 0, 3, 4, 5, 213, +6, 0, 7, 217, 8, 9, 10, 0, 0, 0, +0, 11, 12, 13, 0, 14, 15, 0, 16, 0, +0, 0, 0, 18, 0, 0, 19, 20, 21, 22, +0, 23, 24, 25, 26, 0, 27, 28, 0, 0, +0, 0, 0, 0, 0, 0, 29, 0, 0, 0, +0, 66, 0, 165, 30, 31, 0, 0, 0, 0, +205, 0, 59, 0, 3, 4, 60, 0, 247, 249, +0, 252, 253, 254, 0, 0, 0, 0, 0, 0, +0, 0, 261, 0, 262, 0, 0, 265, 165, 165, +163, 18, 269, 0, 19, 61, 21, 22, 0, 0, +24, 25, 26, 0, 27, 28, 0, 284, 286, 0, +0, 0, 0, 0, 29, 0, 0, 0, 62, 0, +297, 0, 30, 31, 0, 0, 0, 0, 59, 0, +3, 4, 5, 165, 6, 0, 7, 0, 8, 9, +10, 0, 0, 0, 315, 11, 12, 13, 320, 14, +15, 0, 16, 0, 0, 0, 0, 18, 0, 0, +19, 20, 21, 22, 0, 23, 24, 25, 26, 0, +27, 28, 0, 0, 0, 0, 0, 0, 0, 0, +29, 0, 0, 0, 0, 78, 209, 0, 30, 31, +0, 0, 0, 0, 0, 354, 0, 0, 0, 0, +0, 0, 0, 79, 80, 363, 364, 163, 81, 82, +83, 84, 85, 86, 87, 88, 89, 90, 0, 0, +0, 0, 0, 376, 163, 0, 0, 91, 59, 0, +3, 4, 5, 0, 6, 0, 7, 384, 8, 9, +10, 0, 387, 0, 0, 11, 12, 13, 0, 14, +15, 0, 16, 0, 0, 0, 0, 18, 0, 0, +19, 20, 21, 22, 0, 23, 24, 25, 26, 0, +27, 28, 0, 59, 0, 3, 4, 5, 0, 6, +29, 7, 0, 8, 9, 10, 303, 0, 30, 31, +11, 12, 13, 0, 14, 15, 0, 16, 0, 0, +0, 0, 18, 0, 0, 19, 20, 21, 22, 0, +23, 24, 25, 26, 0, 27, 28, 0, 59, 0, +3, 4, 5, 0, 6, 29, 7, 0, 8, 9, +10, 323, 0, 30, 31, 11, 12, 13, 0, 14, +15, 0, 16, 0, 0, 0, 0, 18, 0, 0, +19, 20, 21, 22, 0, 23, 24, 25, 26, 0, +27, 28, 0, 59, 0, 3, 4, 5, 0, 6, +29, 7, 0, 8, 9, 10, 356, 0, 30, 31, +11, 12, 13, 0, 14, 15, 0, 16, 0, 0, +0, 0, 18, 0, 0, 19, 20, 21, 22, 0, +23, 24, 25, 26, 0, 27, 28, 59, 0, 3, +4, 60, 0, 0, 0, 29, 0, 0, 0, 0, +0, 0, 0, 30, 31, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 18, 0, 0, 19, +61, 21, 22, 0, 0, 24, 25, 26, 0, 27, +28, 59, 0, 3, 4, 60, 0, 0, 0, 29, +0, 0, 0, 142, 0, 0, 0, 30, 31, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +18, 0, 0, 19, 61, 21, 22, 0, 0, 24, +25, 26, 0, 27, 28, 59, 0, 3, 4, 60, +0, 0, 0, 29, 0, 0, 0, 0, 196, 0, +0, 30, 31, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 18, 0, 0, 19, 61, 21, +22, 0, 0, 24, 25, 26, 0, 27, 28, 59, +0, 3, 4, 60, 0, 0, 0, 29, 0, 0, +0, 212, 0, 0, 0, 30, 31, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 18, 0, +0, 19, 61, 21, 22, 0, 0, 24, 25, 26, +0, 27, 28, 59, 0, 3, 4, 60, 0, 0, +0, 29, 248, 0, 0, 0, 0, 0, 0, 30, +31, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 18, 0, 0, 19, 61, 21, 22, 0, +0, 24, 25, 26, 0, 27, 28, 59, 0, 3, +4, 60, 0, 0, 0, 29, 0, 0, 0, 251, +0, 0, 0, 30, 31, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 18, 0, 0, 19, +61, 21, 22, 0, 0, 24, 25, 26, 0, 27, +28, 59, 0, 3, 4, 60, 0, 0, 0, 29, +283, 0, 0, 0, 0, 0, 0, 30, 31, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +18, 0, 0, 19, 61, 21, 22, 0, 0, 24, +25, 26, 0, 27, 28, 59, 0, 3, 4, 60, +0, 0, 0, 29, 285, 0, 0, 0, 0, 0, +0, 30, 31, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 18, 0, 0, 19, 61, 21, +22, 0, 0, 24, 25, 26, 0, 27, 28, 59, +0, 3, 4, 60, 0, 0, 0, 29, 314, 0, +0, 0, 0, 0, 0, 30, 31, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 18, 0, +0, 19, 61, 21, 22, 0, 0, 24, 25, 26, +0, 27, 28, 0, 0, 101, 102, 103, 104, 105, +106, 29, 107, 108, 109, 110, 111, 223, 224, 30, +31, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 0, 225, 0, 226, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 138, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 169, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 202, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 207, 0, 0, +0, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 208, 0, 0, 0, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 214, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 218, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 219, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 0, 0, 235, +0, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 0, 0, 0, 250, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 242, 0, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 280, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 282, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 0, 0, 0, +287, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 288, 0, 0, 0, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 289, 0, 0, 0, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 0, +0, 0, 296, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 311, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 313, 0, 0, +0, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 331, 0, 0, 0, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 373, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 0, +0, 0, 374, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 0, 0, 0, 381, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 0, 0, 0, +386, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 0, 0, 0, 388, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 0, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 0, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 101, 102, 103, 104, 105, 106, +126, 107, 108, 109, 110, 111, 0, 0, 0, 0, +0, 0, 112, 0, 0, 113, 114, 115, 0, 0, +0, 116, 117, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 118, 119, 120, 121, 122, 0, +124, 101, 102, 103, 104, 105, 106, 126, 107, 108, +109, 110, 111, 0, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 0, 0, 124, 101, 102, +103, 104, 105, 106, 126, 107, 0, 109, 110, 111, +0, 0, 0, 0, 0, 0, 112, 0, 0, 113, +114, 115, 0, 0, 0, 116, 117, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 118, 119, +120, 121, 0, 0, 124, 101, 102, 103, 104, 105, +106, 126, 107, 0, 109, 110, 111, 0, 0, 0, +0, 0, 0, 0, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 0, +0, 124, 101, 102, 103, 104, 105, 106, 126, 107, +0, 0, 110, 111, 0, 0, 0, 0, 0, 0, +0, 0, 0, 113, 114, 115, 0, 0, 0, 116, +117, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 118, 119, 120, 121, 0, 0, 124, 101, +102, 103, 104, 105, 106, 126, 107, 0, 0, 110, +111, 0, 0, 0, 0, 0, 0, 0, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 101, 102, +103, 104, 0, 0, 0, 107, 0, 0, 110, 111, +127, 120, 121, 0, 0, 124, 0, 0, 0, 113, +114, 115, 126, 0, 0, 116, 117, 0, 79, 80, +263, 0, 0, 81, 82, 83, 84, 85, 86, 87, +88, 89, 90, 0, 124, 0, 0, 0, 79, 80, +0, 126, 0, 81, 82, 83, 84, 85, 86, 87, +88, 89, 90 }; -static const short yycheck[] = { 1, - 1, 45, 236, 231, 205, 206, 4, 128, 10, 194, - 254, 135, 241, 3, 55, 148, 14, 57, 323, 324, - 59, 57, 3, 38, 5, 6, 7, 204, 50, 55, - 59, 50, 55, 333, 268, 38, 341, 342, 215, 28, - 55, 57, 342, 55, 245, 61, 324, 57, 57, 354, - 91, 32, 55, 358, 35, 36, 37, 38, 55, 99, - 41, 42, 43, 99, 45, 46, 92, 55, 91, 58, - 92, 61, 301, 92, 55, 276, 354, 201, 279, 280, - 51, 282, 63, 64, 285, 286, 219, 321, 273, 99, - 99, 24, 46, 47, 271, 66, 67, 51, 5, 6, - 54, 50, 336, 5, 6, 38, 39, 308, 352, 310, - 311, 92, 66, 67, 235, 113, 114, 24, 55, 347, - 229, 230, 38, 55, 55, 55, 55, 328, 37, 14, - 38, 38, 39, 59, 59, 55, 364, 139, 139, 37, - 55, 375, 55, 37, 55, 38, 3, 38, 5, 6, - 7, 57, 9, 56, 11, 60, 13, 14, 15, 55, - 23, 23, 19, 20, 21, 22, 3, 24, 25, 26, - 27, 57, 56, 55, 55, 32, 56, 60, 35, 36, - 37, 38, 226, 40, 41, 42, 43, 37, 45, 46, - 58, 60, 38, 60, 41, 60, 38, 57, 55, 99, - 8, 56, 26, 205, 206, 59, 63, 64, 56, 60, - 50, 56, 3, 56, 5, 6, 7, 56, 9, 60, - 11, 56, 13, 14, 15, 56, 56, 61, 61, 20, - 21, 22, 60, 24, 25, 60, 27, 38, 29, 61, - 60, 32, 59, 245, 35, 36, 37, 38, 61, 40, - 41, 42, 43, 59, 45, 46, 61, 59, 58, 0, - 50, 50, 61, 0, 55, 342, 315, -1, 270, 270, - -1, -1, 63, 64, 276, -1, -1, 279, 280, -1, - 282, -1, -1, 285, 286, -1, -1, -1, -1, -1, - -1, -1, 8, -1, -1, -1, 298, 298, -1, -1, - 44, 45, 46, 47, -1, -1, 308, 51, 310, 311, - 54, 27, 28, 29, 30, 31, -1, -1, -1, -1, - -1, -1, 66, 67, -1, -1, 328, 71, 72, -1, - -1, -1, -1, -1, -1, 337, 337, 53, -1, -1, - -1, -1, 58, -1, -1, -1, -1, -1, -1, 65, - 352, 352, -1, 69, -1, -1, -1, 73, 74, -1, - 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, -1, 93, 380, 380, - -1, -1, -1, -1, -1, 101, 102, 103, 104, 105, - 106, -1, 108, 109, 110, 111, 112, -1, -1, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, -1, -1, -1, -1, -1, -1, -1, 134, 135, - 3, -1, 5, 6, 7, 141, 9, -1, 11, 145, - 13, 14, 15, -1, -1, -1, -1, 20, 21, 22, - -1, 24, 25, -1, 27, -1, -1, -1, -1, 32, - -1, -1, 35, 36, 37, 38, -1, 40, 41, 42, - 43, -1, 45, 46, 44, 45, 46, 47, -1, -1, - -1, 51, 55, -1, 54, -1, -1, 60, 194, -1, - 63, 64, -1, -1, -1, 201, 66, 67, -1, -1, - -1, -1, -1, 209, 210, -1, 212, 213, 214, -1, - -1, -1, -1, -1, -1, -1, -1, 223, -1, 225, - -1, 50, 228, 229, 230, 231, 232, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, - 69, 247, 248, -1, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 260, -1, -1, -1, -1, -1, - -1, -1, 3, 92, 5, 6, 7, 273, 9, -1, - 11, -1, 13, 14, 15, -1, -1, -1, 284, 20, - 21, 22, 288, 24, 25, -1, 27, -1, -1, -1, - -1, 32, -1, -1, 35, 36, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, -1, -1, -1, -1, - -1, -1, -1, -1, 55, -1, -1, -1, -1, 50, - 61, -1, 63, 64, -1, -1, -1, -1, -1, 335, - -1, -1, -1, -1, -1, -1, -1, 68, 69, 345, - 346, 347, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, -1, -1, -1, -1, -1, 363, 364, -1, - -1, -1, 3, -1, 5, 6, 7, -1, 9, -1, - 11, 377, 13, 14, 15, -1, 382, -1, -1, 20, - 21, 22, -1, 24, 25, -1, 27, -1, -1, -1, - -1, 32, -1, -1, 35, 36, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, -1, 3, -1, 5, - 6, 7, -1, 9, 55, 11, -1, 13, 14, 15, - 61, -1, 63, 64, 20, 21, 22, -1, 24, 25, - -1, 27, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, 40, 41, 42, 43, -1, 45, - 46, -1, 3, -1, 5, 6, 7, -1, 9, 55, - 11, -1, 13, 14, 15, 61, -1, 63, 64, 20, - 21, 22, -1, 24, 25, -1, 27, -1, -1, -1, - -1, 32, -1, -1, 35, 36, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, -1, 3, -1, 5, - 6, 7, -1, 9, 55, 11, -1, 13, 14, 15, - 61, -1, 63, 64, 20, 21, 22, -1, 24, 25, - -1, 27, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, 40, 41, 42, 43, -1, 45, - 46, 3, -1, 5, 6, 7, -1, -1, -1, 55, - -1, -1, -1, -1, -1, -1, -1, 63, 64, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 32, -1, -1, 35, 36, 37, 38, -1, -1, 41, - 42, 43, -1, 45, 46, 3, -1, 5, 6, 7, - -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, - -1, 63, 64, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 32, -1, -1, 35, 36, 37, - 38, -1, -1, 41, 42, 43, -1, 45, 46, 3, - -1, 5, 6, 7, -1, -1, -1, 55, -1, -1, - -1, 59, -1, -1, -1, 63, 64, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, - -1, 35, 36, 37, 38, -1, -1, 41, 42, 43, - -1, 45, 46, 3, -1, 5, 6, 7, -1, -1, - -1, 55, -1, -1, -1, -1, 60, -1, -1, 63, - 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 32, -1, -1, 35, 36, 37, 38, -1, - -1, 41, 42, 43, -1, 45, 46, 3, -1, 5, - 6, 7, -1, -1, -1, 55, -1, -1, -1, 59, - -1, -1, -1, 63, 64, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, -1, 41, 42, 43, -1, 45, - 46, 3, -1, 5, 6, 7, -1, -1, -1, 55, - 56, -1, -1, -1, -1, -1, -1, 63, 64, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 32, -1, -1, 35, 36, 37, 38, -1, -1, 41, - 42, 43, -1, 45, 46, 3, -1, 5, 6, 7, - -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, - -1, 63, 64, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 32, -1, -1, 35, 36, 37, - 38, -1, -1, 41, 42, 43, -1, 45, 46, 3, - -1, 5, 6, 7, -1, -1, -1, 55, 56, -1, - -1, -1, -1, -1, -1, 63, 64, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, - -1, 35, 36, 37, 38, -1, -1, 41, 42, 43, - -1, 45, 46, 3, -1, 5, 6, 7, -1, -1, - -1, 55, 56, -1, -1, -1, -1, -1, -1, 63, - 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 32, -1, -1, 35, 36, 37, 38, -1, - -1, 41, 42, 43, -1, 45, 46, 3, -1, 5, - 6, 7, -1, -1, -1, 55, 56, -1, -1, -1, - -1, -1, -1, 63, 64, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, -1, 41, 42, 43, -1, 45, - 46, -1, -1, 44, 45, 46, 47, 48, 49, 55, - 51, 52, 53, 54, -1, 56, 57, 63, 64, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, -1, - 57, -1, 59, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, 59, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, 56, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, 56, -1, -1, -1, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, 56, - -1, -1, -1, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, 59, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, 56, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, -1, -1, 58, -1, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, -1, - -1, -1, 59, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, 58, -1, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, 56, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, -1, -1, -1, 59, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, 56, - -1, -1, -1, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, 56, -1, -1, -1, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, -1, -1, -1, - 59, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, 56, -1, -1, -1, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, 56, - -1, -1, -1, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, 59, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, -1, -1, -1, - 59, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, -1, -1, -1, 59, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, -1, -1, -1, 59, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, -1, - -1, -1, 59, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, -1, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, -1, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, 44, 45, 46, 47, 48, 49, - -1, 51, 52, 53, 54, 84, 85, 86, 87, 88, - 89, 90, 62, -1, -1, 65, 66, 67, 97, -1, - -1, 71, 72, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, 84, 85, 86, 87, 88, -1, - 90, 62, -1, -1, 65, 66, 67, 97, -1, -1, - 71, 72, 44, 45, 46, 47, 48, 49, -1, 51, - -1, 53, 54, 84, 85, 86, 87, -1, -1, 90, - 62, -1, -1, 65, 66, 67, 97, -1, -1, 71, - 72, 44, 45, 46, 47, 48, 49, -1, 51, -1, - 53, 54, 84, 85, 86, 87, -1, -1, 90, -1, - -1, -1, 65, 66, 67, 97, -1, -1, 71, 72, - 44, 45, 46, 47, 48, 49, -1, 51, -1, -1, - 54, 84, 85, 86, 87, -1, -1, 90, -1, -1, - -1, 65, 66, 67, 97, -1, -1, 71, 72, 44, - 45, 46, 47, 48, 49, -1, 51, -1, -1, 54, - 84, 85, 86, 87, -1, -1, 90, -1, -1, -1, - 65, 66, 67, 97, -1, -1, 71, 72, 44, 45, - 46, 47, -1, -1, -1, 51, -1, -1, 54, 50, - -1, 86, 87, -1, -1, 90, -1, -1, -1, 65, - 66, 67, 97, -1, -1, 71, 72, 68, 69, -1, - -1, -1, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, -1, -1, 90, -1, -1, -1, -1, -1, - -1, 97 +static const short yycheck[] = { 1, +1, 45, 239, 233, 207, 208, 111, 4, 10, 257, +129, 196, 244, 206, 55, 3, 149, 14, 57, 326, +327, 59, 136, 3, 217, 5, 6, 7, 57, 50, +38, 55, 50, 59, 271, 57, 55, 344, 345, 28, +336, 55, 55, 5, 6, 248, 38, 55, 57, 345, +357, 92, 32, 59, 361, 35, 36, 37, 38, 55, +99, 41, 42, 43, 327, 45, 46, 91, 55, 58, +99, 92, 304, 61, 92, 55, 279, 99, 91, 282, +283, 274, 285, 63, 64, 288, 289, 324, 221, 203, +99, 276, 38, 59, 357, 55, 5, 6, 37, 24, +57, 55, 339, 55, 61, 55, 50, 355, 311, 55, +313, 314, 92, 38, 39, 24, 14, 114, 115, 238, +350, 55, 55, 55, 37, 37, 231, 232, 331, 38, +39, 55, 60, 38, 38, 38, 56, 367, 140, 140, +3, 378, 5, 6, 7, 23, 9, 57, 11, 55, +13, 14, 15, 23, 3, 56, 19, 20, 21, 22, +57, 24, 25, 26, 27, 55, 60, 56, 56, 32, +55, 37, 35, 36, 37, 38, 58, 40, 41, 42, +43, 60, 45, 46, 228, 60, 44, 45, 46, 47, +46, 47, 55, 51, 38, 51, 54, 55, 54, 55, +63, 64, 41, 60, 99, 207, 208, 38, 66, 67, +66, 67, 57, 71, 72, 3, 8, 5, 6, 7, +56, 9, 26, 11, 59, 13, 14, 15, 56, 56, +56, 56, 20, 21, 22, 56, 24, 25, 56, 27, +60, 29, 61, 60, 32, 61, 248, 35, 36, 37, +38, 60, 40, 41, 42, 43, 56, 45, 46, 60, +50, 38, 61, 60, 59, 61, 50, 55, 61, 51, +59, 273, 273, 55, 59, 63, 64, 279, 58, 50, +282, 283, 61, 285, 66, 67, 288, 289, 0, 0, +345, 318, -1, -1, -1, 8, -1, -1, -1, 301, +301, -1, -1, -1, -1, -1, -1, -1, -1, 311, +-1, 313, 314, -1, 27, 28, 29, 30, 31, -1, +44, 45, 46, 47, -1, -1, -1, 51, -1, 331, +54, 55, -1, -1, -1, -1, -1, -1, 340, 340, +53, -1, 66, 67, -1, 58, -1, -1, -1, -1, +-1, -1, 65, 355, 355, -1, 69, -1, -1, -1, +73, 74, -1, 76, 77, 78, -1, -1, 81, 82, +83, 84, 85, 86, 87, 88, 89, 90, 91, -1, +93, 383, 383, -1, -1, -1, -1, -1, 101, 102, +103, 104, 105, 106, -1, 108, 109, 110, 111, 112, +113, -1, -1, 116, 117, 118, 119, 120, 121, 122, +123, 124, 125, 126, 127, -1, -1, -1, -1, -1, +-1, -1, 135, 136, 3, -1, 5, 6, 7, 142, +9, -1, 11, 146, 13, 14, 15, -1, -1, -1, +-1, 20, 21, 22, -1, 24, 25, -1, 27, -1, +-1, -1, -1, 32, -1, -1, 35, 36, 37, 38, +-1, 40, 41, 42, 43, -1, 45, 46, -1, -1, +-1, -1, -1, -1, -1, -1, 55, -1, -1, -1, +-1, 60, -1, 196, 63, 64, -1, -1, -1, -1, +203, -1, 3, -1, 5, 6, 7, -1, 211, 212, +-1, 214, 215, 216, -1, -1, -1, -1, -1, -1, +-1, -1, 225, -1, 227, -1, -1, 230, 231, 232, +233, 32, 235, -1, 35, 36, 37, 38, -1, -1, +41, 42, 43, -1, 45, 46, -1, 250, 251, -1, +-1, -1, -1, -1, 55, -1, -1, -1, 59, -1, +263, -1, 63, 64, -1, -1, -1, -1, 3, -1, +5, 6, 7, 276, 9, -1, 11, -1, 13, 14, +15, -1, -1, -1, 287, 20, 21, 22, 291, 24, +25, -1, 27, -1, -1, -1, -1, 32, -1, -1, +35, 36, 37, 38, -1, 40, 41, 42, 43, -1, +45, 46, -1, -1, -1, -1, -1, -1, -1, -1, +55, -1, -1, -1, -1, 50, 61, -1, 63, 64, +-1, -1, -1, -1, -1, 338, -1, -1, -1, -1, +-1, -1, -1, 68, 69, 348, 349, 350, 73, 74, +75, 76, 77, 78, 79, 80, 81, 82, -1, -1, +-1, -1, -1, 366, 367, -1, -1, 92, 3, -1, +5, 6, 7, -1, 9, -1, 11, 380, 13, 14, +15, -1, 385, -1, -1, 20, 21, 22, -1, 24, +25, -1, 27, -1, -1, -1, -1, 32, -1, -1, +35, 36, 37, 38, -1, 40, 41, 42, 43, -1, +45, 46, -1, 3, -1, 5, 6, 7, -1, 9, +55, 11, -1, 13, 14, 15, 61, -1, 63, 64, +20, 21, 22, -1, 24, 25, -1, 27, -1, -1, +-1, -1, 32, -1, -1, 35, 36, 37, 38, -1, +40, 41, 42, 43, -1, 45, 46, -1, 3, -1, +5, 6, 7, -1, 9, 55, 11, -1, 13, 14, +15, 61, -1, 63, 64, 20, 21, 22, -1, 24, +25, -1, 27, -1, -1, -1, -1, 32, -1, -1, +35, 36, 37, 38, -1, 40, 41, 42, 43, -1, +45, 46, -1, 3, -1, 5, 6, 7, -1, 9, +55, 11, -1, 13, 14, 15, 61, -1, 63, 64, +20, 21, 22, -1, 24, 25, -1, 27, -1, -1, +-1, -1, 32, -1, -1, 35, 36, 37, 38, -1, +40, 41, 42, 43, -1, 45, 46, 3, -1, 5, +6, 7, -1, -1, -1, 55, -1, -1, -1, -1, +-1, -1, -1, 63, 64, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, 32, -1, -1, 35, +36, 37, 38, -1, -1, 41, 42, 43, -1, 45, +46, 3, -1, 5, 6, 7, -1, -1, -1, 55, +-1, -1, -1, 59, -1, -1, -1, 63, 64, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +32, -1, -1, 35, 36, 37, 38, -1, -1, 41, +42, 43, -1, 45, 46, 3, -1, 5, 6, 7, +-1, -1, -1, 55, -1, -1, -1, -1, 60, -1, +-1, 63, 64, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, 32, -1, -1, 35, 36, 37, +38, -1, -1, 41, 42, 43, -1, 45, 46, 3, +-1, 5, 6, 7, -1, -1, -1, 55, -1, -1, +-1, 59, -1, -1, -1, 63, 64, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, 32, -1, +-1, 35, 36, 37, 38, -1, -1, 41, 42, 43, +-1, 45, 46, 3, -1, 5, 6, 7, -1, -1, +-1, 55, 56, -1, -1, -1, -1, -1, -1, 63, +64, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, 32, -1, -1, 35, 36, 37, 38, -1, +-1, 41, 42, 43, -1, 45, 46, 3, -1, 5, +6, 7, -1, -1, -1, 55, -1, -1, -1, 59, +-1, -1, -1, 63, 64, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, 32, -1, -1, 35, +36, 37, 38, -1, -1, 41, 42, 43, -1, 45, +46, 3, -1, 5, 6, 7, -1, -1, -1, 55, +56, -1, -1, -1, -1, -1, -1, 63, 64, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +32, -1, -1, 35, 36, 37, 38, -1, -1, 41, +42, 43, -1, 45, 46, 3, -1, 5, 6, 7, +-1, -1, -1, 55, 56, -1, -1, -1, -1, -1, +-1, 63, 64, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, 32, -1, -1, 35, 36, 37, +38, -1, -1, 41, 42, 43, -1, 45, 46, 3, +-1, 5, 6, 7, -1, -1, -1, 55, 56, -1, +-1, -1, -1, -1, -1, 63, 64, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, 32, -1, +-1, 35, 36, 37, 38, -1, -1, 41, 42, 43, +-1, 45, 46, -1, -1, 44, 45, 46, 47, 48, +49, 55, 51, 52, 53, 54, 55, 56, 57, 63, +64, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, -1, 57, -1, 59, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, 59, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, 56, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, 56, -1, -1, +-1, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, 56, -1, -1, -1, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, 59, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, 56, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, -1, -1, 58, +-1, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, -1, -1, -1, 59, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, 58, -1, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, 56, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, -1, -1, -1, +59, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, 56, -1, -1, -1, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, 56, -1, -1, -1, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, -1, +-1, -1, 59, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, 56, -1, -1, +-1, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, 56, -1, -1, -1, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, 59, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, -1, +-1, -1, 59, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, -1, -1, -1, 59, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, -1, -1, -1, +59, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, -1, -1, -1, 59, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, -1, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, -1, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, 44, 45, 46, 47, 48, 49, +97, 51, 52, 53, 54, 55, -1, -1, -1, -1, +-1, -1, 62, -1, -1, 65, 66, 67, -1, -1, +-1, 71, 72, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, 84, 85, 86, 87, 88, -1, +90, 44, 45, 46, 47, 48, 49, 97, 51, 52, +53, 54, 55, -1, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, -1, -1, 90, 44, 45, +46, 47, 48, 49, 97, 51, -1, 53, 54, 55, +-1, -1, -1, -1, -1, -1, 62, -1, -1, 65, +66, 67, -1, -1, -1, 71, 72, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, 84, 85, +86, 87, -1, -1, 90, 44, 45, 46, 47, 48, +49, 97, 51, -1, 53, 54, 55, -1, -1, -1, +-1, -1, -1, -1, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, -1, +-1, 90, 44, 45, 46, 47, 48, 49, 97, 51, +-1, -1, 54, 55, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 65, 66, 67, -1, -1, -1, 71, +72, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, 84, 85, 86, 87, -1, -1, 90, 44, +45, 46, 47, 48, 49, 97, 51, -1, -1, 54, +55, -1, -1, -1, -1, -1, -1, -1, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, 44, 45, +46, 47, -1, -1, -1, 51, -1, -1, 54, 55, +50, 86, 87, -1, -1, 90, -1, -1, -1, 65, +66, 67, 97, -1, -1, 71, 72, -1, 68, 69, +50, -1, -1, 73, 74, 75, 76, 77, 78, 79, +80, 81, 82, -1, 90, -1, -1, -1, 68, 69, +-1, 97, -1, 73, 74, 75, 76, 77, 78, 79, +80, 81, 82 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "bison.simple" /* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +Bison output file, you may use that output file without restriction. +This special exception was added by the Free Software Foundation +in version 1.24 of Bison. */ #ifndef alloca #ifdef __GNUC__ @@ -1157,15 +1175,15 @@ static const short yycheck[] = { 1, #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) #include - #pragma alloca +#pragma alloca #else /* not MSDOS, __TURBOC__, or _AIX */ #ifdef __hpux #ifdef __cplusplus extern "C" { -void *alloca (unsigned int); + void *alloca(unsigned int); }; #else /* not __cplusplus */ -void *alloca (); +void *alloca(); #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ @@ -1175,58 +1193,58 @@ void *alloca (); #endif /* alloca not defined. */ /* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ +when the %semantic_parser declaration is not specified in the grammar. +It was written by Richard Stallman by simplifying the hairy parser +used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ +It is replaced by the list of actions, each action +as one case of the switch. */ -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab +This remains here temporarily to ease the +transition to the new meaning of YYERROR, for GCC. +Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 #ifndef YYPURE -#define YYLEX yylex() +#define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval, &yylloc) +#define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +#define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif @@ -1235,32 +1253,32 @@ while (0) #ifndef YYPURE -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ #ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ #endif -int yynerrs; /* number of parse errors so far */ +int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ +int yydebug; /* nonzero means print parse trace */ + /* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ #endif -/* YYINITDEPTH indicates the initial size of the parser's stacks */ + /* YYINITDEPTH indicates the initial size of the parser's stacks */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ + /* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH @@ -1270,57 +1288,57 @@ int yydebug; /* nonzero means print parse trace */ #define YYMAXDEPTH 10000 #endif -/* Prevent warning if -Wstrict-prototypes. */ + /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ -int yyparse (void); +int yyparse(void); #endif - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +in available built-in functions on various systems. */ static void -__yy_memcpy (from, to, count) - char *from; - char *to; - int count; +__yy_memcpy(from, to, count) +char *from; +char *to; +int count; { - char *f = from; - char *t = to; - int i = count; + register char *f = from; + register char *t = to; + register int i = count; - while (i-- > 0) - *t++ = *f++; + while (i-- > 0) + *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +in available built-in functions on various systems. */ static void -__yy_memcpy (char *from, char *to, int count) +__yy_memcpy(char *from, char *to, int count) { - char *f = from; - char *t = to; - int i = count; + register char *f = from; + register char *t = to; + register int i = count; - while (i-- > 0) - *t++ = *f++; + while (i-- > 0) + *t++ = *f++; } #endif #endif - + #line 192 "bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +into yyparse. The argument should have type void *. +It should actually point to an object. +Grammar actions can access the variable by casting it +to the proper pointer type. */ #ifdef YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; @@ -1331,78 +1349,78 @@ __yy_memcpy (char *from, char *to, int count) int yyparse(YYPARSE_PARAM) - YYPARSE_PARAM_DECL +YYPARSE_PARAM_DECL { - int yystate; - int yyn; - short *yyssp; - YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif - int yystacksize = YYINITDEPTH; + int yystacksize = YYINITDEPTH; #ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; + int yychar; + YYSTYPE yylval; + int yynerrs; #ifdef YYLSP_NEEDED - YYLTYPE yylloc; + YYLTYPE yylloc; #endif #endif - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ - int yylen; + int yylen; #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); + if (yydebug) + fprintf(stderr, "Starting parse\n"); #endif - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ - yyssp = yyss - 1; - yyvsp = yyvs; + yyssp = yyss - 1; + yyvsp = yyvs; #ifdef YYLSP_NEEDED - yylsp = yyls; + yylsp = yyls; #endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks + /* Push a new state, which is found in yystate . */ + /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: - *++yyssp = yystate; + *++yyssp = yystate; - if (yyssp >= yyss + yystacksize - 1) - { + if (yyssp >= yyss + yystacksize - 1) + { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; @@ -1416,20 +1434,20 @@ yynewstate: #ifdef yyoverflow /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ + the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ + but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); + &yyss1, size * sizeof(*yyssp), + &yyvs1, size * sizeof(*yyvsp), + &yyls1, size * sizeof(*yylsp), + &yystacksize); #else yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); + &yyss1, size * sizeof(*yyssp), + &yyvs1, size * sizeof(*yyvsp), + &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; @@ -1439,20 +1457,20 @@ yynewstate: #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } + { + yyerror("parser stack overflow"); + return 2; + } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); + yystacksize = YYMAXDEPTH; + yyss = (short *)alloca(yystacksize * sizeof(*yyssp)); + __yy_memcpy((char *)yyss1, (char *)yyss, size * sizeof(*yyssp)); + yyvs = (YYSTYPE *)alloca(yystacksize * sizeof(*yyvsp)); + __yy_memcpy((char *)yyvs1, (char *)yyvs, size * sizeof(*yyvsp)); #ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); + yyls = (YYLTYPE *)alloca(yystacksize * sizeof(*yylsp)); + __yy_memcpy((char *)yyls1, (char *)yyls, size * sizeof(*yylsp)); #endif #endif /* no yyoverflow */ @@ -1464,989 +1482,995 @@ yynewstate: #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); + fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } + YYABORT; + } #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); #endif - goto yybackup; - yybackup: + goto yybackup; +yybackup: -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. */ + /* Read a lookahead token if we need one and don't already have one. */ + /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ - if (yychar == YYEMPTY) - { + if (yychar == YYEMPTY) + { #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Reading a token: "); + fprintf(stderr, "Reading a token: "); #endif yychar = YYLEX; - } + } - /* Convert token to internal form (in yychar1) for indexing tables with */ + /* Convert token to internal form (in yychar1) for indexing tables with */ - if (yychar <= 0) /* This means end of input. */ - { + if (yychar <= 0) /* This means end of input. */ + { yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ + yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Now at end of input.\n"); + fprintf(stderr, "Now at end of input.\n"); #endif - } - else - { + } + else + { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ + { + fprintf(stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ #ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); + YYPRINT(stderr, yychar, yylval); +#endif + fprintf(stderr, ")\n"); + } #endif - fprintf (stderr, ")\n"); } -#endif - } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; - yyn = yytable[yyn]; + yyn = yytable[yyn]; - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ - if (yyn < 0) - { + if (yyn < 0) + { if (yyn == YYFLAG) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; + } + else if (yyn == 0) + goto yyerrlab; - if (yyn == YYFINAL) - YYACCEPT; + if (yyn == YYFINAL) + YYACCEPT; - /* Shift the lookahead token. */ + /* Shift the lookahead token. */ #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; - *++yyvsp = yylval; + *++yyvsp = yylval; #ifdef YYLSP_NEEDED - *++yylsp = yylloc; + *++yylsp = yylloc; #endif - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; - yystate = yyn; - goto yynewstate; + yystate = yyn; + goto yynewstate; -/* Do the default action for the current state. */ + /* Do the default action for the current state. */ yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; -/* Do a reduction. yyn is the number of a rule to reduce with. */ + /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1 - yylen]; /* implement default value of the action */ #if YYDEBUG != 0 - if (yydebug) - { + if (yydebug) + { int i; - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + fprintf(stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } + fprintf(stderr, "%s ", yytname[yyrhs[i]]); + fprintf(stderr, " -> %s\n", yytname[yyr1[yyn]]); + } #endif - switch (yyn) { + switch (yyn) { -case 1: + case 1: #line 162 "cmdgram.y" -{ ; - break;} -case 2: + {; + break; } + case 2: #line 167 "cmdgram.y" -{ yyval.stmt = nil; ; - break;} -case 3: + { yyval.stmt = nil; ; + break; } + case 3: #line 169 "cmdgram.y" -{ if(!gStatementList) { gStatementList = yyvsp[0].stmt; } else { gStatementList->append(yyvsp[0].stmt); } ; - break;} -case 4: + { if (!gStatementList) { gStatementList = yyvsp[0].stmt; } + else { gStatementList->append(yyvsp[0].stmt); }; + break; } + case 4: #line 174 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 5: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 5: #line 176 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 6: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 6: #line 178 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 7: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 7: #line 183 "cmdgram.y" -{ yyval.stmt = yyvsp[-2].stmt; for(StmtNode *walk = (yyvsp[-2].stmt);walk;walk = walk->getNext() ) walk->setPackage(yyvsp[-4].s.value); ; - break;} -case 8: + { yyval.stmt = yyvsp[-2].stmt; for (StmtNode *walk = (yyvsp[-2].stmt); walk; walk = walk->getNext()) walk->setPackage(yyvsp[-4].s.value); ; + break; } + case 8: #line 188 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 9: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 9: #line 190 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].stmt; (yyvsp[-1].stmt)->append(yyvsp[0].stmt); ; - break;} -case 10: + { yyval.stmt = yyvsp[-1].stmt; (yyvsp[-1].stmt)->append(yyvsp[0].stmt); ; + break; } + case 10: #line 195 "cmdgram.y" -{ yyval.stmt = nil; ; - break;} -case 11: + { yyval.stmt = nil; ; + break; } + case 11: #line 197 "cmdgram.y" -{ if(!yyvsp[-1].stmt) { yyval.stmt = yyvsp[0].stmt; } else { (yyvsp[-1].stmt)->append(yyvsp[0].stmt); yyval.stmt = yyvsp[-1].stmt; } ; - break;} -case 18: + { if (!yyvsp[-1].stmt) { yyval.stmt = yyvsp[0].stmt; } + else { (yyvsp[-1].stmt)->append(yyvsp[0].stmt); yyval.stmt = yyvsp[-1].stmt; }; + break; } + case 18: #line 208 "cmdgram.y" -{ yyval.stmt = BreakStmtNode::alloc( yyvsp[-1].i.lineNumber ); ; - break;} -case 19: + { yyval.stmt = BreakStmtNode::alloc(yyvsp[-1].i.lineNumber); ; + break; } + case 19: #line 210 "cmdgram.y" -{ yyval.stmt = ContinueStmtNode::alloc( yyvsp[-1].i.lineNumber ); ; - break;} -case 20: + { yyval.stmt = ContinueStmtNode::alloc(yyvsp[-1].i.lineNumber); ; + break; } + case 20: #line 212 "cmdgram.y" -{ yyval.stmt = ReturnStmtNode::alloc( yyvsp[-1].i.lineNumber, NULL ); ; - break;} -case 21: + { yyval.stmt = ReturnStmtNode::alloc(yyvsp[-1].i.lineNumber, NULL); ; + break; } + case 21: #line 214 "cmdgram.y" -{ yyval.stmt = ReturnStmtNode::alloc( yyvsp[-2].i.lineNumber, yyvsp[-1].expr ); ; - break;} -case 22: + { yyval.stmt = ReturnStmtNode::alloc(yyvsp[-2].i.lineNumber, yyvsp[-1].expr); ; + break; } + case 22: #line 216 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].stmt; ; - break;} -case 23: + { yyval.stmt = yyvsp[-1].stmt; ; + break; } + case 23: #line 218 "cmdgram.y" -{ yyval.stmt = TTagSetStmtNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr, NULL ); ; - break;} -case 24: + { yyval.stmt = TTagSetStmtNode::alloc(yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr, NULL); ; + break; } + case 24: #line 220 "cmdgram.y" -{ yyval.stmt = TTagSetStmtNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[-1].expr ); ; - break;} -case 25: + { yyval.stmt = TTagSetStmtNode::alloc(yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[-1].expr); ; + break; } + case 25: #line 222 "cmdgram.y" -{ yyval.stmt = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, false, true ); ; - break;} -case 26: + { yyval.stmt = StrConstNode::alloc(yyvsp[0].str.lineNumber, yyvsp[0].str.value, false, true); ; + break; } + case 26: #line 227 "cmdgram.y" -{ yyval.stmt = FunctionDeclStmtNode::alloc( yyvsp[-7].i.lineNumber, yyvsp[-6].s.value, NULL, yyvsp[-4].var, yyvsp[-1].stmt ); ; - break;} -case 27: + { yyval.stmt = FunctionDeclStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-6].s.value, NULL, yyvsp[-4].var, yyvsp[-1].stmt); ; + break; } + case 27: #line 229 "cmdgram.y" -{ yyval.stmt = FunctionDeclStmtNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-6].s.value, yyvsp[-8].s.value, yyvsp[-4].var, yyvsp[-1].stmt ); ; - break;} -case 28: + { yyval.stmt = FunctionDeclStmtNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-6].s.value, yyvsp[-8].s.value, yyvsp[-4].var, yyvsp[-1].stmt); ; + break; } + case 28: #line 234 "cmdgram.y" -{ yyval.var = NULL; ; - break;} -case 29: + { yyval.var = NULL; ; + break; } + case 29: #line 236 "cmdgram.y" -{ yyval.var = yyvsp[0].var; ; - break;} -case 30: + { yyval.var = yyvsp[0].var; ; + break; } + case 30: #line 241 "cmdgram.y" -{ yyval.var = VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL ); ; - break;} -case 31: + { yyval.var = VarNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL); ; + break; } + case 31: #line 243 "cmdgram.y" -{ yyval.var = yyvsp[-2].var; ((StmtNode*)(yyvsp[-2].var))->append((StmtNode*)VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL ) ); ; - break;} -case 32: + { yyval.var = yyvsp[-2].var; ((StmtNode*)(yyvsp[-2].var))->append((StmtNode*)VarNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL)); ; + break; } + case 32: #line 248 "cmdgram.y" -{ yyval.stmt = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, NULL, yyvsp[-5].s.value, yyvsp[-2].slist, NULL, true, false, false); ; - break;} -case 33: + { yyval.stmt = ObjectDeclNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, NULL, yyvsp[-5].s.value, yyvsp[-2].slist, NULL, true, false, false); ; + break; } + case 33: #line 253 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, false); ; - break;} -case 34: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, false); ; + break; } + case 34: #line 255 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, false); ; - break;} -case 35: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, false); ; + break; } + case 35: #line 257 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-11].i.lineNumber, yyvsp[-10].expr, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, true, false); ; - break;} -case 36: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-11].i.lineNumber, yyvsp[-10].expr, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, true, false); ; + break; } + case 36: #line 259 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-8].i.lineNumber, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, true, false); ; - break;} -case 37: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-8].i.lineNumber, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, true, false); ; + break; } + case 37: #line 261 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, true); ; - break;} -case 38: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, true); ; + break; } + case 38: #line 263 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, true); ; - break;} -case 39: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, true); ; + break; } + case 39: #line 268 "cmdgram.y" -{ yyval.s.value = NULL; ; - break;} -case 40: + { yyval.s.value = NULL; ; + break; } + case 40: #line 270 "cmdgram.y" -{ yyval.s = yyvsp[0].s; ; - break;} -case 41: + { yyval.s = yyvsp[0].s; ; + break; } + case 41: #line 275 "cmdgram.y" -{ yyval.expr = StrConstNode::alloc( CodeBlock::smCurrentParser->getCurrentLine(), "", false); ; - break;} -case 42: + { yyval.expr = StrConstNode::alloc(CodeBlock::smCurrentParser->getCurrentLine(), "", false); ; + break; } + case 42: #line 277 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 43: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 43: #line 282 "cmdgram.y" -{ yyval.expr = NULL; ; - break;} -case 44: + { yyval.expr = NULL; ; + break; } + case 44: #line 284 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 45: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 45: #line 289 "cmdgram.y" -{ yyval.odcl.slots = NULL; yyval.odcl.decls = NULL; ; - break;} -case 46: + { yyval.odcl.slots = NULL; yyval.odcl.decls = NULL; ; + break; } + case 46: #line 291 "cmdgram.y" -{ yyval.odcl.slots = yyvsp[0].slist; yyval.odcl.decls = NULL; ; - break;} -case 47: + { yyval.odcl.slots = yyvsp[0].slist; yyval.odcl.decls = NULL; ; + break; } + case 47: #line 293 "cmdgram.y" -{ yyval.odcl.slots = NULL; yyval.odcl.decls = yyvsp[0].od; ; - break;} -case 48: + { yyval.odcl.slots = NULL; yyval.odcl.decls = yyvsp[0].od; ; + break; } + case 48: #line 295 "cmdgram.y" -{ yyval.odcl.slots = yyvsp[-1].slist; yyval.odcl.decls = yyvsp[0].od; ; - break;} -case 49: + { yyval.odcl.slots = yyvsp[-1].slist; yyval.odcl.decls = yyvsp[0].od; ; + break; } + case 49: #line 300 "cmdgram.y" -{ yyval.od = yyvsp[-1].od; ; - break;} -case 50: + { yyval.od = yyvsp[-1].od; ; + break; } + case 50: #line 302 "cmdgram.y" -{ yyvsp[-2].od->append(yyvsp[-1].od); yyval.od = yyvsp[-2].od; ; - break;} -case 51: + { yyvsp[-2].od->append(yyvsp[-1].od); yyval.od = yyvsp[-2].od; ; + break; } + case 51: #line 307 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].stmt; ; - break;} -case 52: + { yyval.stmt = yyvsp[-1].stmt; ; + break; } + case 52: #line 309 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 53: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 53: #line 314 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, false); ; - break;} -case 54: + { yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, false); ; + break; } + case 54: #line 316 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, true); ; - break;} -case 55: + { yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, true); ; + break; } + case 55: #line 321 "cmdgram.y" -{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-3].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; - break;} -case 56: + { yyval.ifnode = IfStmtNode::alloc(yyvsp[-3].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; + break; } + case 56: #line 323 "cmdgram.y" -{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].stmt, yyvsp[0].stmt, false); ; - break;} -case 57: + { yyval.ifnode = IfStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].stmt, yyvsp[0].stmt, false); ; + break; } + case 57: #line 325 "cmdgram.y" -{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-4].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].stmt, yyvsp[0].ifnode, true); ; - break;} -case 58: + { yyval.ifnode = IfStmtNode::alloc(yyvsp[-4].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].stmt, yyvsp[0].ifnode, true); ; + break; } + case 58: #line 330 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr;; - break;} -case 59: + { yyval.expr = yyvsp[0].expr;; + break; } + case 59: #line 332 "cmdgram.y" -{ (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr=yyvsp[-2].expr; ; - break;} -case 60: + { (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr = yyvsp[-2].expr; ; + break; } + case 60: #line 337 "cmdgram.y" -{ yyval.stmt = IfStmtNode::alloc(yyvsp[-4].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; - break;} -case 61: + { yyval.stmt = IfStmtNode::alloc(yyvsp[-4].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; + break; } + case 61: #line 339 "cmdgram.y" -{ yyval.stmt = IfStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt, false); ; - break;} -case 62: + { yyval.stmt = IfStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt, false); ; + break; } + case 62: #line 344 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-4].i.lineNumber, nil, yyvsp[-2].expr, nil, yyvsp[0].stmt, false); ; - break;} -case 63: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-4].i.lineNumber, nil, yyvsp[-2].expr, nil, yyvsp[0].stmt, false); ; + break; } + case 63: #line 346 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-3].i.lineNumber, nil, yyvsp[-1].expr, nil, yyvsp[-4].stmt, true); ; - break;} -case 64: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-3].i.lineNumber, nil, yyvsp[-1].expr, nil, yyvsp[-4].stmt, true); ; + break; } + case 64: #line 351 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-8].i.lineNumber, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 65: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-8].i.lineNumber, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 65: #line 353 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; - break;} -case 66: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; + break; } + case 66: #line 355 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 67: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 67: #line 357 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, NULL, NULL, yyvsp[0].stmt, false); ; - break;} -case 68: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, NULL, NULL, yyvsp[0].stmt, false); ; + break; } + case 68: #line 359 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 69: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 69: #line 361 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; - break;} -case 70: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; + break; } + case 70: #line 363 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 71: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 71: #line 365 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-5].i.lineNumber, NULL, NULL, NULL, yyvsp[0].stmt, false); ; - break;} -case 72: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-5].i.lineNumber, NULL, NULL, NULL, yyvsp[0].stmt, false); ; + break; } + case 72: #line 370 "cmdgram.y" -{ yyval.stmt = IterStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, false ); ; - break;} -case 73: + { yyval.stmt = IterStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 73: #line 372 "cmdgram.y" -{ yyval.stmt = IterStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, true ); ; - break;} -case 74: + { yyval.stmt = IterStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, true); ; + break; } + case 74: #line 377 "cmdgram.y" -{ yyval.stmt = yyvsp[0].expr; ; - break;} -case 75: + { yyval.stmt = yyvsp[0].expr; ; + break; } + case 75: #line 382 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 76: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 76: #line 384 "cmdgram.y" -{ yyval.expr = yyvsp[-1].expr; ; - break;} -case 77: + { yyval.expr = yyvsp[-1].expr; ; + break; } + case 77: #line 386 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 78: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 78: #line 388 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 79: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 79: #line 390 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 80: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 80: #line 392 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 81: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 81: #line 394 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 82: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 82: #line 396 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 83: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 83: #line 398 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 84: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 84: #line 400 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 85: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 85: #line 402 "cmdgram.y" -{ yyval.expr = FloatUnaryExprNode::alloc( yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; - break;} -case 86: + { yyval.expr = FloatUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; + break; } + case 86: #line 404 "cmdgram.y" -{ yyval.expr = TTagDerefNode::alloc( yyvsp[-1].i.lineNumber, yyvsp[0].expr ); ; - break;} -case 87: + { yyval.expr = TTagDerefNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[0].expr); ; + break; } + case 87: #line 406 "cmdgram.y" -{ yyval.expr = TTagExprNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ; - break;} -case 88: + { yyval.expr = TTagExprNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value); ; + break; } + case 88: #line 408 "cmdgram.y" -{ yyval.expr = ConditionalExprNode::alloc( yyvsp[-4].expr->dbgLineNumber, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 89: + { yyval.expr = ConditionalExprNode::alloc(yyvsp[-4].expr->dbgLineNumber, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 89: #line 410 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 90: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 90: #line 412 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 91: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 91: #line 414 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 92: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 92: #line 416 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 93: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 93: #line 418 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 94: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 94: #line 420 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 95: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 95: #line 422 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 96: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 96: #line 424 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 97: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 97: #line 426 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 98: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 98: #line 428 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 99: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 99: #line 430 "cmdgram.y" -{ yyval.expr = StreqExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, true); ; - break;} -case 100: + { yyval.expr = StreqExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, true); ; + break; } + case 100: #line 432 "cmdgram.y" -{ yyval.expr = StreqExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, false); ; - break;} -case 101: + { yyval.expr = StreqExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, false); ; + break; } + case 101: #line 434 "cmdgram.y" -{ yyval.expr = StrcatExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].i.value); ; - break;} -case 102: + { yyval.expr = StrcatExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].i.value); ; + break; } + case 102: #line 436 "cmdgram.y" -{ yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; - break;} -case 103: + { yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; + break; } + case 103: #line 438 "cmdgram.y" -{ yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; - break;} -case 104: + { yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; + break; } + case 104: #line 440 "cmdgram.y" -{ yyval.expr = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, true); ; - break;} -case 105: + { yyval.expr = StrConstNode::alloc(yyvsp[0].str.lineNumber, yyvsp[0].str.value, true); ; + break; } + case 105: #line 442 "cmdgram.y" -{ yyval.expr = FloatNode::alloc( yyvsp[0].f.lineNumber, yyvsp[0].f.value ); ; - break;} -case 106: + { yyval.expr = FloatNode::alloc(yyvsp[0].f.lineNumber, yyvsp[0].f.value); ; + break; } + case 106: #line 444 "cmdgram.y" -{ yyval.expr = IntNode::alloc( yyvsp[0].i.lineNumber, yyvsp[0].i.value ); ; - break;} -case 107: + { yyval.expr = IntNode::alloc(yyvsp[0].i.lineNumber, yyvsp[0].i.value); ; + break; } + case 107: #line 446 "cmdgram.y" -{ yyval.expr = ConstantNode::alloc( yyvsp[0].i.lineNumber, StringTable->insert("break")); ; - break;} -case 108: + { yyval.expr = ConstantNode::alloc(yyvsp[0].i.lineNumber, StringTable->insert("break")); ; + break; } + case 108: #line 448 "cmdgram.y" -{ yyval.expr = SlotAccessNode::alloc( yyvsp[0].slot.lineNumber, yyvsp[0].slot.object, yyvsp[0].slot.array, yyvsp[0].slot.slotName ); ; - break;} -case 109: + { yyval.expr = SlotAccessNode::alloc(yyvsp[0].slot.lineNumber, yyvsp[0].slot.object, yyvsp[0].slot.array, yyvsp[0].slot.slotName); ; + break; } + case 109: #line 450 "cmdgram.y" -{ yyval.expr = InternalSlotAccessNode::alloc( yyvsp[0].intslot.lineNumber, yyvsp[0].intslot.object, yyvsp[0].intslot.slotExpr, yyvsp[0].intslot.recurse); ; - break;} -case 110: + { yyval.expr = InternalSlotAccessNode::alloc(yyvsp[0].intslot.lineNumber, yyvsp[0].intslot.object, yyvsp[0].intslot.slotExpr, yyvsp[0].intslot.recurse); ; + break; } + case 110: #line 452 "cmdgram.y" -{ yyval.expr = ConstantNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ; - break;} -case 111: + { yyval.expr = ConstantNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value); ; + break; } + case 111: #line 454 "cmdgram.y" -{ yyval.expr = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, false); ; - break;} -case 112: + { yyval.expr = StrConstNode::alloc(yyvsp[0].str.lineNumber, yyvsp[0].str.value, false); ; + break; } + case 112: #line 456 "cmdgram.y" -{ yyval.expr = (ExprNode*)VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL); ; - break;} -case 113: + { yyval.expr = (ExprNode*)VarNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL); ; + break; } + case 113: #line 458 "cmdgram.y" -{ yyval.expr = (ExprNode*)VarNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr ); ; - break;} -case 114: + { yyval.expr = (ExprNode*)VarNode::alloc(yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr); ; + break; } + case 114: #line 460 "cmdgram.y" -{ + { const U32 bufLen = 64; UTF8 buffer[bufLen]; dSprintf(buffer, bufLen, "__anonymous_function%d", gAnonFunctionID++); StringTableEntry fName = StringTable->insert(buffer); StmtNode *fndef = FunctionDeclStmtNode::alloc(yyvsp[-6].i.lineNumber, fName, NULL, yyvsp[-4].var, yyvsp[-1].stmt); - if(!gAnonFunctionList) + if (!gAnonFunctionList) gAnonFunctionList = fndef; else gAnonFunctionList->append(fndef); - yyval.expr = StrConstNode::alloc( yyvsp[-6].i.lineNumber, (UTF8*)fName, false ); - ; - break;} -case 115: + yyval.expr = StrConstNode::alloc(yyvsp[-6].i.lineNumber, (UTF8*)fName, false); + ; + break; } + case 115: #line 478 "cmdgram.y" -{ yyval.slot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.slot.object = yyvsp[-2].expr; yyval.slot.slotName = yyvsp[0].s.value; yyval.slot.array = NULL; ; - break;} -case 116: + { yyval.slot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.slot.object = yyvsp[-2].expr; yyval.slot.slotName = yyvsp[0].s.value; yyval.slot.array = NULL; ; + break; } + case 116: #line 480 "cmdgram.y" -{ yyval.slot.lineNumber = yyvsp[-5].expr->dbgLineNumber; yyval.slot.object = yyvsp[-5].expr; yyval.slot.slotName = yyvsp[-3].s.value; yyval.slot.array = yyvsp[-1].expr; ; - break;} -case 117: + { yyval.slot.lineNumber = yyvsp[-5].expr->dbgLineNumber; yyval.slot.object = yyvsp[-5].expr; yyval.slot.slotName = yyvsp[-3].s.value; yyval.slot.array = yyvsp[-1].expr; ; + break; } + case 117: #line 485 "cmdgram.y" -{ yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = false; ; - break;} -case 118: + { yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = false; ; + break; } + case 118: #line 487 "cmdgram.y" -{ yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = true; ; - break;} -case 119: + { yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = true; ; + break; } + case 119: #line 492 "cmdgram.y" -{ yyval.expr = ConstantNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ; - break;} -case 120: + { yyval.expr = ConstantNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value); ; + break; } + case 120: #line 494 "cmdgram.y" -{ yyval.expr = yyvsp[-1].expr; ; - break;} -case 121: + { yyval.expr = yyvsp[-1].expr; ; + break; } + case 121: #line 499 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = '+'; yyval.asn.expr = FloatNode::alloc( yyvsp[0].i.lineNumber, 1 ); ; - break;} -case 122: + { yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = opPLUSPLUS; yyval.asn.expr = FloatNode::alloc(yyvsp[0].i.lineNumber, 1); ; + break; } + case 122: #line 501 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = '-'; yyval.asn.expr = FloatNode::alloc( yyvsp[0].i.lineNumber, 1 ); ; - break;} -case 123: + { yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = opMINUSMINUS; yyval.asn.expr = FloatNode::alloc(yyvsp[0].i.lineNumber, 1); ; + break; } + case 123: #line 503 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '+'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 124: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '+'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 124: #line 505 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '-'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 125: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '-'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 125: #line 507 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '*'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 126: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '*'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 126: #line 509 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '/'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 127: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '/'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 127: #line 511 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '%'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 128: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '%'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 128: #line 513 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '&'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 129: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '&'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 129: #line 515 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '^'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 130: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '^'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 130: #line 517 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '|'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 131: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '|'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 131: #line 519 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHL; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 132: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHL; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 132: #line 521 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHR; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 133: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHR; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 133: #line 526 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 134: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 134: #line 528 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 135: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 135: #line 530 "cmdgram.y" -{ yyval.expr = yyvsp[0].od; ; - break;} -case 136: + { yyval.expr = yyvsp[0].od; ; + break; } + case 136: #line 532 "cmdgram.y" -{ yyval.expr = AssignExprNode::alloc( yyvsp[-2].s.lineNumber, yyvsp[-2].s.value, NULL, yyvsp[0].expr); ; - break;} -case 137: + { yyval.expr = AssignExprNode::alloc(yyvsp[-2].s.lineNumber, yyvsp[-2].s.value, NULL, yyvsp[0].expr); ; + break; } + case 137: #line 534 "cmdgram.y" -{ yyval.expr = AssignExprNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[0].expr); ; - break;} -case 138: + { yyval.expr = AssignExprNode::alloc(yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[0].expr); ; + break; } + case 138: #line 536 "cmdgram.y" -{ yyval.expr = AssignOpExprNode::alloc( yyvsp[-1].s.lineNumber, yyvsp[-1].s.value, NULL, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; - break;} -case 139: + { yyval.expr = AssignOpExprNode::alloc(yyvsp[-1].s.lineNumber, yyvsp[-1].s.value, NULL, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; + break; } + case 139: #line 538 "cmdgram.y" -{ yyval.expr = AssignOpExprNode::alloc( yyvsp[-4].s.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; - break;} -case 140: + { yyval.expr = AssignOpExprNode::alloc(yyvsp[-4].s.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; + break; } + case 140: #line 540 "cmdgram.y" -{ yyval.expr = SlotAssignOpNode::alloc( yyvsp[-1].slot.lineNumber, yyvsp[-1].slot.object, yyvsp[-1].slot.slotName, yyvsp[-1].slot.array, yyvsp[0].asn.token, yyvsp[0].asn.expr); ; - break;} -case 141: + { yyval.expr = SlotAssignOpNode::alloc(yyvsp[-1].slot.lineNumber, yyvsp[-1].slot.object, yyvsp[-1].slot.slotName, yyvsp[-1].slot.array, yyvsp[0].asn.token, yyvsp[0].asn.expr); ; + break; } + case 141: #line 542 "cmdgram.y" -{ yyval.expr = SlotAssignNode::alloc( yyvsp[-2].slot.lineNumber, yyvsp[-2].slot.object, yyvsp[-2].slot.array, yyvsp[-2].slot.slotName, yyvsp[0].expr); ; - break;} -case 142: + { yyval.expr = SlotAssignNode::alloc(yyvsp[-2].slot.lineNumber, yyvsp[-2].slot.object, yyvsp[-2].slot.array, yyvsp[-2].slot.slotName, yyvsp[0].expr); ; + break; } + case 142: #line 544 "cmdgram.y" -{ yyval.expr = SlotAssignNode::alloc( yyvsp[-4].slot.lineNumber, yyvsp[-4].slot.object, yyvsp[-4].slot.array, yyvsp[-4].slot.slotName, yyvsp[-1].expr); ; - break;} -case 143: + { yyval.expr = SlotAssignNode::alloc(yyvsp[-4].slot.lineNumber, yyvsp[-4].slot.object, yyvsp[-4].slot.array, yyvsp[-4].slot.slotName, yyvsp[-1].expr); ; + break; } + case 143: #line 549 "cmdgram.y" -{ yyval.expr = FuncCallExprNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, NULL, yyvsp[-1].expr, false); ; - break;} -case 144: + { yyval.expr = FuncCallExprNode::alloc(yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, NULL, yyvsp[-1].expr, false); ; + break; } + case 144: #line 551 "cmdgram.y" -{ yyval.expr = FuncCallExprNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-3].s.value, yyvsp[-5].s.value, yyvsp[-1].expr, false); ; - break;} -case 145: + { yyval.expr = FuncCallExprNode::alloc(yyvsp[-5].s.lineNumber, yyvsp[-3].s.value, yyvsp[-5].s.value, yyvsp[-1].expr, false); ; + break; } + case 145: #line 553 "cmdgram.y" -{ yyvsp[-5].expr->append(yyvsp[-1].expr); yyval.expr = FuncCallExprNode::alloc( yyvsp[-5].expr->dbgLineNumber, yyvsp[-3].s.value, NULL, yyvsp[-5].expr, true); ; - break;} -case 146: -#line 558 "cmdgram.y" -{ yyval.expr = AssertCallExprNode::alloc( yyvsp[-3].i.lineNumber, yyvsp[-1].expr, NULL ); ; - break;} -case 147: + { yyvsp[-5].expr->append(yyvsp[-1].expr); yyval.expr = FuncCallExprNode::alloc(yyvsp[-5].expr->dbgLineNumber, yyvsp[-3].s.value, NULL, yyvsp[-5].expr, true); ; + break; } + case 146: +#line 555 "cmdgram.y" + { yyval.expr = FuncPointerCallExprNode::alloc(yyvsp[-3].expr->dbgLineNumber, yyvsp[-3].expr, yyvsp[-1].expr); ; + break; } + case 147: #line 560 "cmdgram.y" -{ yyval.expr = AssertCallExprNode::alloc( yyvsp[-5].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].str.value ); ; - break;} -case 148: -#line 565 "cmdgram.y" -{ yyval.expr = NULL; ; - break;} -case 149: + { yyval.expr = AssertCallExprNode::alloc(yyvsp[-3].i.lineNumber, yyvsp[-1].expr, NULL); ; + break; } + case 148: +#line 562 "cmdgram.y" + { yyval.expr = AssertCallExprNode::alloc(yyvsp[-5].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].str.value); ; + break; } + case 149: #line 567 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 150: -#line 572 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 151: + { yyval.expr = NULL; ; + break; } + case 150: +#line 569 "cmdgram.y" + { yyval.expr = yyvsp[0].expr; ; + break; } + case 151: #line 574 "cmdgram.y" -{ (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr = yyvsp[-2].expr; ; - break;} -case 152: -#line 579 "cmdgram.y" -{ yyval.slist = NULL; ; - break;} -case 153: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 152: +#line 576 "cmdgram.y" + { (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr = yyvsp[-2].expr; ; + break; } + case 153: #line 581 "cmdgram.y" -{ yyval.slist = yyvsp[0].slist; ; - break;} -case 154: -#line 586 "cmdgram.y" -{ yyval.slist = yyvsp[0].slist; ; - break;} -case 155: + { yyval.slist = NULL; ; + break; } + case 154: +#line 583 "cmdgram.y" + { yyval.slist = yyvsp[0].slist; ; + break; } + case 155: #line 588 "cmdgram.y" -{ yyvsp[-1].slist->append(yyvsp[0].slist); yyval.slist = yyvsp[-1].slist; ; - break;} -case 156: -#line 593 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-3].s.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr); ; - break;} -case 157: + { yyval.slist = yyvsp[0].slist; ; + break; } + case 156: +#line 590 "cmdgram.y" + { yyvsp[-1].slist->append(yyvsp[0].slist); yyval.slist = yyvsp[-1].slist; ; + break; } + case 157: #line 595 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-4].i.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr, yyvsp[-4].i.value); ; - break;} -case 158: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-3].s.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr); ; + break; } + case 158: #line 597 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-3].i.lineNumber, NULL, NULL, StringTable->insert("datablock"), yyvsp[-1].expr); ; - break;} -case 159: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-4].i.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr, yyvsp[-4].i.value); ; + break; } + case 159: #line 599 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-6].s.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr); ; - break;} -case 160: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-3].i.lineNumber, NULL, NULL, StringTable->insert("datablock"), yyvsp[-1].expr); ; + break; } + case 160: #line 601 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr, yyvsp[-7].i.value); ; - break;} -case 161: -#line 606 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 162: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-6].s.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr); ; + break; } + case 161: +#line 603 "cmdgram.y" + { yyval.slist = SlotAssignNode::alloc(yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr, yyvsp[-7].i.value); ; + break; } + case 162: #line 608 "cmdgram.y" -{ yyval.expr = CommaCatExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -} + { yyval.expr = yyvsp[0].expr; ; + break; } + case 163: +#line 610 "cmdgram.y" + { yyval.expr = CommaCatExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + } /* the action file gets copied in in place of this dollarsign */ #line 487 "bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; + + yyvsp -= yylen; + yyssp -= yylen; #ifdef YYLSP_NEEDED - yylsp -= yylen; + yylsp -= yylen; #endif #if YYDEBUG != 0 - if (yydebug) - { + if (yydebug) + { short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); + fprintf(stderr, "state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } + fprintf(stderr, " %d", *++ssp1); + fprintf(stderr, "\n"); + } #endif - *++yyvsp = yyval; + *++yyvsp = yyval; #ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { + yylsp++; + if (yylen == 0) + { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; + yylsp->last_line = (yylsp - 1)->last_line; + yylsp->last_column = (yylsp - 1)->last_column; yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } + } + else + { + yylsp->last_line = (yylsp + yylen - 1)->last_line; + yylsp->last_column = (yylsp + yylen - 1)->last_column; + } #endif - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ - yyn = yyr1[yyn]; + yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; - goto yynewstate; + goto yynewstate; yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { + if (!yyerrstatus) + /* If not already recovering from an error, report this error. */ + { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *)malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } } + yyerror(msg); + free(msg); + } + else + yyerror("parse error; also virtual memory exceeded"); } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } + yyerror("parse error"); + } - goto yyerrlab1; + goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ - if (yyerrstatus == 3) - { + if (yyerrstatus == 3) + { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) - YYABORT; + YYABORT; #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; - } + } - /* Else will try to reuse lookahead token - after shifting the error token. */ + /* Else will try to reuse lookahead token + after shifting the error token. */ - yyerrstatus = 3; /* Each real token shifted decrements this */ + yyerrstatus = 3; /* Each real token shifted decrements this */ - goto yyerrhandle; + goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; #ifdef YYLSP_NEEDED - yylsp--; + yylsp--; #endif #if YYDEBUG != 0 - if (yydebug) - { + if (yydebug) + { short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); + fprintf(stderr, "Error: state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } + fprintf(stderr, " %d", *++ssp1); + fprintf(stderr, "\n"); + } #endif yyerrhandle: - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; - yyn = yytable[yyn]; - if (yyn < 0) - { + yyn = yytable[yyn]; + if (yyn < 0) + { if (yyn == YYFLAG) - goto yyerrpop; + goto yyerrpop; yyn = -yyn; goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; + } + else if (yyn == 0) + goto yyerrpop; - if (yyn == YYFINAL) - YYACCEPT; + if (yyn == YYFINAL) + YYACCEPT; #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); + if (yydebug) + fprintf(stderr, "Shifting error token, "); #endif - *++yyvsp = yylval; + *++yyvsp = yylval; #ifdef YYLSP_NEEDED - *++yylsp = yylloc; + *++yylsp = yylloc; #endif - yystate = yyn; - goto yynewstate; + yystate = yyn; + goto yynewstate; } -#line 610 "cmdgram.y" +#line 612 "cmdgram.y" diff --git a/Engine/source/console/cmdgram.h b/Engine/source/console/cmdgram.h index fc22f3df2..83736a565 100644 --- a/Engine/source/console/cmdgram.h +++ b/Engine/source/console/cmdgram.h @@ -15,78 +15,78 @@ typedef union { AssignDecl asn; IfStmtNode* ifnode; } YYSTYPE; -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 extern YYSTYPE CMDlval; diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index 192b50f0f..f8f814f5b 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -63,11 +63,11 @@ CodeBlock::~CodeBlock() // Make sure we aren't lingering in the current code block... AssertFatal(smCurrentCodeBlock != this, "CodeBlock::~CodeBlock - Caught lingering in smCurrentCodeBlock!"); - if(name) + if (name) removeFromCodeList(); delete[] const_cast(globalStrings); delete[] const_cast(functionStrings); - + functionStringsMaxLen = 0; globalStringsMaxLen = 0; @@ -85,7 +85,7 @@ StringTableEntry CodeBlock::getCurrentCodeBlockName() return CodeBlock::getCurrentBlock()->name; else return NULL; -} +} StringTableEntry CodeBlock::getCurrentCodeBlockFullPath() { @@ -105,8 +105,8 @@ StringTableEntry CodeBlock::getCurrentCodeBlockModName() CodeBlock *CodeBlock::find(StringTableEntry name) { - for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) - if(walk->name == name) + for (CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) + if (walk->name == name) return walk; return NULL; } @@ -116,9 +116,9 @@ CodeBlock *CodeBlock::find(StringTableEntry name) void CodeBlock::addToCodeList() { // remove any code blocks with my name - for(CodeBlock **walk = &smCodeBlockList; *walk;walk = &((*walk)->nextFile)) + for (CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile)) { - if((*walk)->name == name) + if ((*walk)->name == name) { *walk = (*walk)->nextFile; break; @@ -130,9 +130,9 @@ void CodeBlock::addToCodeList() void CodeBlock::clearAllBreaks() { - if(!lineBreakPairs) + if (!lineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; code[p[1]] = p[0] & 0xFF; @@ -141,12 +141,12 @@ void CodeBlock::clearAllBreaks() void CodeBlock::clearBreakpoint(U32 lineNumber) { - if(!lineBreakPairs) + if (!lineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; - if((p[0] >> 8) == lineNumber) + if ((p[0] >> 8) == lineNumber) { code[p[1]] = p[0] & 0xFF; return; @@ -156,9 +156,9 @@ void CodeBlock::clearBreakpoint(U32 lineNumber) void CodeBlock::setAllBreaks() { - if(!lineBreakPairs) + if (!lineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; code[p[1]] = OP_BREAK; @@ -167,13 +167,13 @@ void CodeBlock::setAllBreaks() bool CodeBlock::setBreakpoint(U32 lineNumber) { - if(!lineBreakPairs) + if (!lineBreakPairs) return false; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; - if((p[0] >> 8) == lineNumber) + if ((p[0] >> 8) == lineNumber) { code[p[1]] = OP_BREAK; return true; @@ -185,15 +185,15 @@ bool CodeBlock::setBreakpoint(U32 lineNumber) U32 CodeBlock::findFirstBreakLine(U32 lineNumber) { - if(!lineBreakPairs) + if (!lineBreakPairs) return 0; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; U32 line = (p[0] >> 8); - if( lineNumber <= line ) + if (lineNumber <= line) return line; } @@ -210,35 +210,35 @@ void CodeBlock::findBreakLine(U32 ip, U32 &line, U32 &instruction) { U32 min = 0; U32 max = lineBreakPairCount - 1; - LinePair *p = (LinePair *) lineBreakPairs; + LinePair *p = (LinePair *)lineBreakPairs; U32 found; - if(!lineBreakPairCount || p[min].ip > ip || p[max].ip < ip) + if (!lineBreakPairCount || p[min].ip > ip || p[max].ip < ip) { line = 0; instruction = OP_INVALID; return; } - else if(p[min].ip == ip) + else if (p[min].ip == ip) found = min; - else if(p[max].ip == ip) + else if (p[max].ip == ip) found = max; else { - for(;;) + for (;;) { - if(min == max - 1) + if (min == max - 1) { found = min; break; } U32 mid = (min + max) >> 1; - if(p[mid].ip == ip) + if (p[mid].ip == ip) { found = mid; break; } - else if(p[mid].ip > ip) + else if (p[mid].ip > ip) max = mid; else min = mid; @@ -260,9 +260,9 @@ const char *CodeBlock::getFileLine(U32 ip) void CodeBlock::removeFromCodeList() { - for(CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile)) + for (CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile)) { - if(*walk == this) + if (*walk == this) { *walk = nextFile; @@ -275,8 +275,8 @@ void CodeBlock::removeFromCodeList() // Let the telnet debugger know that this code // block has been unloaded and that it needs to // remove references to it. - if ( TelDebugger ) - TelDebugger->clearCodeBlockPointers( this ); + if (TelDebugger) + TelDebugger->clearCodeBlockPointers(this); } void CodeBlock::calcBreakList() @@ -285,21 +285,21 @@ void CodeBlock::calcBreakList() S32 line = -1; U32 seqCount = 0; U32 i; - for(i = 0; i < lineBreakPairCount; i++) + for (i = 0; i < lineBreakPairCount; i++) { U32 lineNumber = lineBreakPairs[i * 2]; - if(lineNumber == U32(line + 1)) + if (lineNumber == U32(line + 1)) seqCount++; else { - if(seqCount) + if (seqCount) size++; size++; seqCount = 1; } line = lineNumber; } - if(seqCount) + if (seqCount) size++; breakList = new U32[size]; @@ -308,15 +308,15 @@ void CodeBlock::calcBreakList() seqCount = 0; size = 0; - for(i = 0; i < lineBreakPairCount; i++) + for (i = 0; i < lineBreakPairCount; i++) { U32 lineNumber = lineBreakPairs[i * 2]; - if(lineNumber == U32(line + 1)) + if (lineNumber == U32(line + 1)) seqCount++; else { - if(seqCount) + if (seqCount) breakList[size++] = seqCount; breakList[size++] = lineNumber - getMax(0, line) - 1; seqCount = 1; @@ -325,10 +325,10 @@ void CodeBlock::calcBreakList() line = lineNumber; } - if(seqCount) + if (seqCount) breakList[size++] = seqCount; - for(i = 0; i < lineBreakPairCount; i++) + for (i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; p[0] = (p[0] << 8) | code[p[1]]; @@ -337,8 +337,8 @@ void CodeBlock::calcBreakList() // Let the telnet debugger know that this code // block has been loaded and that it can add break // points it has for it. - if ( TelDebugger ) - TelDebugger->addAllBreakpoints( this ); + if (TelDebugger) + TelDebugger->addAllBreakpoints(this); } bool CodeBlock::read(StringTableEntry fileName, Stream &st) @@ -348,19 +348,19 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) name = fileName; - if(fileName) + if (fileName) { fullPath = NULL; - if(Platform::isFullPath(fileName)) + if (Platform::isFullPath(fileName)) fullPath = fileName; - if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) + if (dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) name = StringTable->insert(fileName + dStrlen(exePath) + 1, true); - else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) + else if (dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) name = StringTable->insert(fileName + dStrlen(cwd) + 1, true); - if(fullPath == NULL) + if (fullPath == NULL) { char buf[1024]; fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); @@ -368,13 +368,13 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) modPath = Con::getModNameFromPath(fileName); } - + // addToCodeList(); - U32 globalSize,size,i; + U32 globalSize, size, i; st.read(&size); - if(size) + if (size) { globalStrings = new char[size]; globalStringsMaxLen = size; @@ -382,24 +382,24 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) } globalSize = size; st.read(&size); - if(size) + if (size) { functionStrings = new char[size]; functionStringsMaxLen = size; st.read(size, functionStrings); } st.read(&size); - if(size) + if (size) { globalFloats = new F64[size]; - for(U32 i = 0; i < size; i++) + for (U32 i = 0; i < size; i++) st.read(&globalFloats[i]); } st.read(&size); - if(size) + if (size) { functionFloats = new F64[size]; - for(U32 i = 0; i < size; i++) + for (U32 i = 0; i < size; i++) st.read(&functionFloats[i]); } U32 codeLength; @@ -409,17 +409,19 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) U32 totSize = codeLength + lineBreakPairCount * 2; code = new U32[totSize]; - for(i = 0; i < codeLength; i++) + // 0xFF is used as a flag to help compress the bytecode. + // If detected, the bytecode is only a U8. + for (i = 0; i < codeLength; i++) { U8 b; st.read(&b); - if(b == 0xFF) + if (b == 0xFF) st.read(&code[i]); else code[i] = b; } - for(i = codeLength; i < totSize; i++) + for (i = codeLength; i < totSize; i++) st.read(&code[i]); lineBreakPairs = code + codeLength; @@ -427,26 +429,30 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) // StringTable-ize our identifiers. U32 identCount; st.read(&identCount); - while(identCount--) + while (identCount--) { U32 offset; st.read(&offset); StringTableEntry ste; - if(offset < globalSize) + if (offset < globalSize) ste = StringTable->insert(globalStrings + offset); else ste = StringTable->EmptyString(); U32 count; st.read(&count); - while(count--) + while (count--) { U32 ip; st.read(&ip); - code[ip] = *((U32 *) &ste); +#ifdef TORQUE_CPU_X64 + *(U64*)(code + ip) = (U64)ste; +#else + code[ip] = *((U32 *)&ste); +#endif } } - if(lineBreakPairCount) + if (lineBreakPairCount) calcBreakList(); return true; @@ -456,11 +462,11 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, const char *inScript, bool overrideNoDso) { AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); - + // This will return true, but return value is ignored char *script; - chompUTF8BOM( inScript, &script ); - + chompUTF8BOM(inScript, &script); + gSyntaxError = false; consoleAllocReset(); @@ -490,19 +496,19 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con } - if(gSyntaxError) + if (gSyntaxError) { consoleAllocReset(); return false; - } + } #ifdef TORQUE_NO_DSO_GENERATION - if(!overrideNoDso) + if (!overrideNoDso) return false; #endif // !TORQUE_NO_DSO_GENERATION FileStream st; - if(!st.open(codeFileName, Torque::FS::File::Write)) + if (!st.open(codeFileName, Torque::FS::File::Write)) return false; st.write(U32(Con::DSOVersion)); @@ -513,7 +519,7 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con CodeStream codeStream; U32 lastIp; - if(gStatementList) + if (gStatementList) { lastIp = compileBlock(gStatementList, codeStream, 0) + 1; } @@ -522,10 +528,10 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con codeSize = 1; lastIp = 0; } - + codeStream.emit(OP_RETURN); codeStream.emitCodeStream(&codeSize, &code, &lineBreakPairs); - + lineBreakPairCount = codeStream.getNumLineBreaks(); // Write string table data... @@ -536,18 +542,18 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con getGlobalFloatTable().write(st); getFunctionFloatTable().write(st); - if(lastIp != codeSize) + if (lastIp != codeSize) Con::errorf(ConsoleLogEntry::General, "CodeBlock::compile - precompile size mismatch, a precompile/compile function pair is probably mismatched."); - + U32 totSize = codeSize + codeStream.getNumLineBreaks() * 2; st.write(codeSize); st.write(lineBreakPairCount); // Write out our bytecode, doing a bit of compression for low numbers. - U32 i; - for(i = 0; i < codeSize; i++) + U32 i; + for (i = 0; i < codeSize; i++) { - if(code[i] < 0xFF) + if (code[i] < 0xFF) st.write(U8(code[i])); else { @@ -557,7 +563,7 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con } // Write the break info... - for(i = codeSize; i < totSize; i++) + for (i = codeSize; i < totSize; i++) st.write(code[i]); getIdentTable().write(st); @@ -573,32 +579,32 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, S32 setFrame) { AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); - + // Check for a UTF8 script file char *string; - chompUTF8BOM( inString, &string ); + chompUTF8BOM(inString, &string); STEtoCode = evalSTEtoCode; consoleAllocReset(); name = fileName; - if(fileName) + if (fileName) { const StringTableEntry exePath = Platform::getMainDotCsDir(); const StringTableEntry cwd = Platform::getCurrentDirectory(); fullPath = NULL; - - if(Platform::isFullPath(fileName)) + + if (Platform::isFullPath(fileName)) fullPath = fileName; - if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) + if (dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) name = StringTable->insert(fileName + dStrlen(exePath) + 1, true); - else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) + else if (dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) name = StringTable->insert(fileName + dStrlen(cwd) + 1, true); - if(fullPath == NULL) + if (fullPath == NULL) { char buf[1024]; fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); @@ -607,9 +613,9 @@ ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *in modPath = Con::getModNameFromPath(fileName); } - if(name) + if (name) addToCodeList(); - + gStatementList = NULL; gAnonFunctionList = NULL; @@ -632,7 +638,7 @@ ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *in } } - if(!gStatementList) + if (!gStatementList) { delete this; return ConsoleValueRef(); @@ -641,32 +647,32 @@ ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *in resetTables(); smInFunction = false; - + CodeStream codeStream; U32 lastIp = compileBlock(gStatementList, codeStream, 0); lineBreakPairCount = codeStream.getNumLineBreaks(); - globalStrings = getGlobalStringTable().build(); + globalStrings = getGlobalStringTable().build(); globalStringsMaxLen = getGlobalStringTable().totalLen; functionStrings = getFunctionStringTable().build(); functionStringsMaxLen = getFunctionStringTable().totalLen; - globalFloats = getGlobalFloatTable().build(); - functionFloats = getFunctionFloatTable().build(); - + globalFloats = getGlobalFloatTable().build(); + functionFloats = getFunctionFloatTable().build(); + codeStream.emit(OP_RETURN); codeStream.emitCodeStream(&codeSize, &code, &lineBreakPairs); - + //dumpInstructions(0, false); - + consoleAllocReset(); - if(lineBreakPairCount && fileName) + if (lineBreakPairCount && fileName) calcBreakList(); - if(lastIp+1 != codeSize) + if (lastIp + 1 != codeSize) Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp); return exec(0, fileName, NULL, 0, 0, noCalls, NULL, setFrame); @@ -682,85 +688,85 @@ void CodeBlock::incRefCount() void CodeBlock::decRefCount() { refCount--; - if(!refCount) + if (!refCount) delete this; } //------------------------------------------------------------------------- -String CodeBlock::getFunctionArgs( U32 ip ) +String CodeBlock::getFunctionArgs(U32 ip) { StringBuilder str; - - U32 fnArgc = code[ ip + 5 ]; - for( U32 i = 0; i < fnArgc; ++ i ) - { - StringTableEntry var = CodeToSTE(code, ip + (i*2) + 6); - - if( i != 0 ) - str.append( ", " ); - str.append( "string " ); + U32 fnArgc = code[ip + 5]; + for (U32 i = 0; i < fnArgc; ++i) + { + StringTableEntry var = CodeToSTE(code, ip + (i * 2) + 6); + + if (i != 0) + str.append(", "); + + str.append("string "); // Try to capture junked parameters - if( var[ 0 ] ) - str.append( var + 1 ); + if (var[0]) + str.append(var + 1); else - str.append( "JUNK" ); + str.append("JUNK"); } - + return str.end(); } //------------------------------------------------------------------------- -void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) +void CodeBlock::dumpInstructions(U32 startIp, bool upToReturn) { U32 ip = startIp; smInFunction = false; U32 endFuncIp = 0; - - while( ip < codeSize ) + + while (ip < codeSize) { if (ip > endFuncIp) { smInFunction = false; } - - switch( code[ ip ++ ] ) + + switch (code[ip++]) { - + case OP_FUNC_DECL: { - StringTableEntry fnName = CodeToSTE(code, ip); - StringTableEntry fnNamespace = CodeToSTE(code, ip+2); - StringTableEntry fnPackage = CodeToSTE(code, ip+4); - bool hasBody = bool(code[ip+6]); - U32 newIp = code[ ip + 7 ]; - U32 argc = code[ ip + 8 ]; + StringTableEntry fnName = CodeToSTE(code, ip); + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnPackage = CodeToSTE(code, ip + 4); + bool hasBody = bool(code[ip + 6]); + U32 newIp = code[ip + 7]; + U32 argc = code[ip + 8]; endFuncIp = newIp; - - Con::printf( "%i: OP_FUNC_DECL name=%s nspace=%s package=%s hasbody=%i newip=%i argc=%i", - ip - 1, fnName, fnNamespace, fnPackage, hasBody, newIp, argc ); - + + Con::printf("%i: OP_FUNC_DECL name=%s nspace=%s package=%s hasbody=%i newip=%i argc=%i", + ip - 1, fnName, fnNamespace, fnPackage, hasBody, newIp, argc); + // Skip args. - + ip += 9 + (argc * 2); smInFunction = true; break; } - + case OP_CREATE_OBJECT: { StringTableEntry objParent = CodeToSTE(code, ip); - bool isDataBlock = code[ip + 2]; - bool isInternal = code[ip + 3]; - bool isSingleton = code[ip + 4]; - U32 lineNumber = code[ip + 5]; - U32 failJump = code[ip + 6]; - - Con::printf( "%i: OP_CREATE_OBJECT objParent=%s isDataBlock=%i isInternal=%i isSingleton=%i lineNumber=%i failJump=%i", - ip - 1, objParent, isDataBlock, isInternal, isSingleton, lineNumber, failJump ); + bool isDataBlock = code[ip + 2]; + bool isInternal = code[ip + 3]; + bool isSingleton = code[ip + 4]; + U32 lineNumber = code[ip + 5]; + U32 failJump = code[ip + 6]; + + Con::printf("%i: OP_CREATE_OBJECT objParent=%s isDataBlock=%i isInternal=%i isSingleton=%i lineNumber=%i failJump=%i", + ip - 1, objParent, isDataBlock, isInternal, isSingleton, lineNumber, failJump); ip += 7; break; @@ -769,87 +775,87 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ADD_OBJECT: { bool placeAtRoot = code[ip++]; - Con::printf( "%i: OP_ADD_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot ); + Con::printf("%i: OP_ADD_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot); break; } - + case OP_END_OBJECT: { bool placeAtRoot = code[ip++]; - Con::printf( "%i: OP_END_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot ); + Con::printf("%i: OP_END_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot); break; } - + case OP_FINISH_OBJECT: { - Con::printf( "%i: OP_FINISH_OBJECT", ip - 1 ); + Con::printf("%i: OP_FINISH_OBJECT", ip - 1); break; } - + case OP_JMPIFFNOT: { - Con::printf( "%i: OP_JMPIFFNOT ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFFNOT ip=%i", ip - 1, code[ip]); + ++ip; break; } - + case OP_JMPIFNOT: { - Con::printf( "%i: OP_JMPIFNOT ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFNOT ip=%i", ip - 1, code[ip]); + ++ip; break; } - + case OP_JMPIFF: { - Con::printf( "%i: OP_JMPIFF ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFF ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMPIF: { - Con::printf( "%i: OP_JMPIF ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIF ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMPIFNOT_NP: { - Con::printf( "%i: OP_JMPIFNOT_NP ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFNOT_NP ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMPIF_NP: { - Con::printf( "%i: OP_JMPIF_NP ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIF_NP ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMP: { - Con::printf( "%i: OP_JMP ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMP ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_RETURN: { - Con::printf( "%i: OP_RETURN", ip - 1 ); - - if( upToReturn ) + Con::printf("%i: OP_RETURN", ip - 1); + + if (upToReturn) return; - + break; } case OP_RETURN_VOID: { - Con::printf( "%i: OP_RETURNVOID", ip - 1 ); + Con::printf("%i: OP_RETURNVOID", ip - 1); - if( upToReturn ) + if (upToReturn) return; break; @@ -857,9 +863,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_RETURN_UINT: { - Con::printf( "%i: OP_RETURNUINT", ip - 1 ); + Con::printf("%i: OP_RETURNUINT", ip - 1); - if( upToReturn ) + if (upToReturn) return; break; @@ -867,9 +873,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_RETURN_FLT: { - Con::printf( "%i: OP_RETURNFLT", ip - 1 ); + Con::printf("%i: OP_RETURNFLT", ip - 1); - if( upToReturn ) + if (upToReturn) return; break; @@ -877,521 +883,593 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_CMPEQ: { - Con::printf( "%i: OP_CMPEQ", ip - 1 ); + Con::printf("%i: OP_CMPEQ", ip - 1); break; } case OP_CMPGR: { - Con::printf( "%i: OP_CMPGR", ip - 1 ); + Con::printf("%i: OP_CMPGR", ip - 1); break; } case OP_CMPGE: { - Con::printf( "%i: OP_CMPGE", ip - 1 ); + Con::printf("%i: OP_CMPGE", ip - 1); break; } case OP_CMPLT: { - Con::printf( "%i: OP_CMPLT", ip - 1 ); + Con::printf("%i: OP_CMPLT", ip - 1); break; } case OP_CMPLE: { - Con::printf( "%i: OP_CMPLE", ip - 1 ); + Con::printf("%i: OP_CMPLE", ip - 1); break; } case OP_CMPNE: { - Con::printf( "%i: OP_CMPNE", ip - 1 ); + Con::printf("%i: OP_CMPNE", ip - 1); break; } case OP_XOR: { - Con::printf( "%i: OP_XOR", ip - 1 ); + Con::printf("%i: OP_XOR", ip - 1); break; } case OP_MOD: { - Con::printf( "%i: OP_MOD", ip - 1 ); + Con::printf("%i: OP_MOD", ip - 1); break; } case OP_BITAND: { - Con::printf( "%i: OP_BITAND", ip - 1 ); + Con::printf("%i: OP_BITAND", ip - 1); break; } case OP_BITOR: { - Con::printf( "%i: OP_BITOR", ip - 1 ); + Con::printf("%i: OP_BITOR", ip - 1); break; } case OP_NOT: { - Con::printf( "%i: OP_NOT", ip - 1 ); + Con::printf("%i: OP_NOT", ip - 1); break; } case OP_NOTF: { - Con::printf( "%i: OP_NOTF", ip - 1 ); + Con::printf("%i: OP_NOTF", ip - 1); break; } case OP_ONESCOMPLEMENT: { - Con::printf( "%i: OP_ONESCOMPLEMENT", ip - 1 ); + Con::printf("%i: OP_ONESCOMPLEMENT", ip - 1); break; } case OP_SHR: { - Con::printf( "%i: OP_SHR", ip - 1 ); + Con::printf("%i: OP_SHR", ip - 1); break; } case OP_SHL: { - Con::printf( "%i: OP_SHL", ip - 1 ); + Con::printf("%i: OP_SHL", ip - 1); break; } case OP_AND: { - Con::printf( "%i: OP_AND", ip - 1 ); + Con::printf("%i: OP_AND", ip - 1); break; } case OP_OR: { - Con::printf( "%i: OP_OR", ip - 1 ); + Con::printf("%i: OP_OR", ip - 1); break; } case OP_ADD: { - Con::printf( "%i: OP_ADD", ip - 1 ); + Con::printf("%i: OP_ADD", ip - 1); break; } case OP_SUB: { - Con::printf( "%i: OP_SUB", ip - 1 ); + Con::printf("%i: OP_SUB", ip - 1); break; } case OP_MUL: { - Con::printf( "%i: OP_MUL", ip - 1 ); + Con::printf("%i: OP_MUL", ip - 1); break; } case OP_DIV: { - Con::printf( "%i: OP_DIV", ip - 1 ); + Con::printf("%i: OP_DIV", ip - 1); break; } case OP_NEG: { - Con::printf( "%i: OP_NEG", ip - 1 ); + Con::printf("%i: OP_NEG", ip - 1); + break; + } + + case OP_INC: + { + Con::printf("%i: OP_INC varName=%s", ip - 1, CodeToSTE(code, ip)); + ip += 2; + break; + } + + case OP_DEC: + { + Con::printf("%i: OP_DEC varName=%s", ip - 1, CodeToSTE(code, ip)); + ip += 2; break; } case OP_SETCURVAR: { StringTableEntry var = CodeToSTE(code, ip); - - Con::printf( "%i: OP_SETCURVAR var=%s", ip - 1, var ); + + Con::printf("%i: OP_SETCURVAR var=%s", ip - 1, var); ip += 2; break; } - + case OP_SETCURVAR_CREATE: { StringTableEntry var = CodeToSTE(code, ip); - - Con::printf( "%i: OP_SETCURVAR_CREATE var=%s", ip - 1, var ); + + Con::printf("%i: OP_SETCURVAR_CREATE var=%s", ip - 1, var); ip += 2; break; } - + case OP_SETCURVAR_ARRAY: { - Con::printf( "%i: OP_SETCURVAR_ARRAY", ip - 1 ); + Con::printf("%i: OP_SETCURVAR_ARRAY", ip - 1); break; } - + + case OP_SETCURVAR_ARRAY_VARLOOKUP: + { + StringTableEntry arrayName = CodeToSTE(code, ip); + StringTableEntry arrayLookup = CodeToSTE(code, ip + 2); + + Con::printf("%i: OP_SETCURVAR_ARRAY_VARLOOKUP arrayName=%s arrayLookup=%s", ip - 1, arrayName, arrayLookup); + ip += 4; + break; + } + case OP_SETCURVAR_ARRAY_CREATE: { - Con::printf( "%i: OP_SETCURVAR_ARRAY_CREATE", ip - 1 ); + Con::printf("%i: OP_SETCURVAR_ARRAY_CREATE", ip - 1); break; } - + + case OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP: + { + StringTableEntry arrayName = CodeToSTE(code, ip); + StringTableEntry arrayLookup = CodeToSTE(code, ip + 2); + + Con::printf("%i: OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP arrayName=%s arrayLookup=%s", ip - 1, arrayName, arrayLookup); + ip += 4; + break; + } + case OP_LOADVAR_UINT: { - Con::printf( "%i: OP_LOADVAR_UINT", ip - 1 ); + Con::printf("%i: OP_LOADVAR_UINT", ip - 1); break; } - + case OP_LOADVAR_FLT: { - Con::printf( "%i: OP_LOADVAR_FLT", ip - 1 ); + Con::printf("%i: OP_LOADVAR_FLT", ip - 1); break; } case OP_LOADVAR_STR: { - Con::printf( "%i: OP_LOADVAR_STR", ip - 1 ); + Con::printf("%i: OP_LOADVAR_STR", ip - 1); break; } case OP_LOADVAR_VAR: { - Con::printf( "%i: OP_LOADVAR_VAR", ip - 1 ); + Con::printf("%i: OP_LOADVAR_VAR", ip - 1); break; } case OP_SAVEVAR_UINT: { - Con::printf( "%i: OP_SAVEVAR_UINT", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_UINT", ip - 1); break; } case OP_SAVEVAR_FLT: { - Con::printf( "%i: OP_SAVEVAR_FLT", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_FLT", ip - 1); break; } case OP_SAVEVAR_STR: { - Con::printf( "%i: OP_SAVEVAR_STR", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_STR", ip - 1); break; } case OP_SAVEVAR_VAR: { - Con::printf( "%i: OP_SAVEVAR_VAR", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_VAR", ip - 1); break; } case OP_SETCUROBJECT: { - Con::printf( "%i: OP_SETCUROBJECT", ip - 1 ); + Con::printf("%i: OP_SETCUROBJECT", ip - 1); break; } case OP_SETCUROBJECT_NEW: { - Con::printf( "%i: OP_SETCUROBJECT_NEW", ip - 1 ); + Con::printf("%i: OP_SETCUROBJECT_NEW", ip - 1); break; } - + case OP_SETCUROBJECT_INTERNAL: { - Con::printf( "%i: OP_SETCUROBJECT_INTERNAL", ip - 1 ); - ++ ip; + Con::printf("%i: OP_SETCUROBJECT_INTERNAL", ip - 1); + ++ip; break; } - + case OP_SETCURFIELD: { StringTableEntry curField = CodeToSTE(code, ip); - Con::printf( "%i: OP_SETCURFIELD field=%s", ip - 1, curField ); + Con::printf("%i: OP_SETCURFIELD field=%s", ip - 1, curField); ip += 2; break; } - + case OP_SETCURFIELD_ARRAY: { - Con::printf( "%i: OP_SETCURFIELD_ARRAY", ip - 1 ); + Con::printf("%i: OP_SETCURFIELD_ARRAY", ip - 1); + break; + } + + case OP_SETCURFIELD_ARRAY_VAR: + { + StringTableEntry var = CodeToSTE(code, ip); + Con::printf("%i: OP_SETCURFIELD_ARRAY_VAR var=%s", ip - 1, var); + ip += 2; + break; + } + + case OP_SETCURFIELD_THIS: + { + StringTableEntry curField = CodeToSTE(code, ip); + Con::printf("%i: OP_SETCURFIELD_THIS field=%s", ip - 1, curField); + ip += 2; break; } case OP_SETCURFIELD_TYPE: { - U32 type = code[ ip ]; - Con::printf( "%i: OP_SETCURFIELD_TYPE type=%i", ip - 1, type ); - ++ ip; + U32 type = code[ip]; + Con::printf("%i: OP_SETCURFIELD_TYPE type=%i", ip - 1, type); + ++ip; break; } case OP_LOADFIELD_UINT: { - Con::printf( "%i: OP_LOADFIELD_UINT", ip - 1 ); + Con::printf("%i: OP_LOADFIELD_UINT", ip - 1); break; } case OP_LOADFIELD_FLT: { - Con::printf( "%i: OP_LOADFIELD_FLT", ip - 1 ); + Con::printf("%i: OP_LOADFIELD_FLT", ip - 1); break; } case OP_LOADFIELD_STR: { - Con::printf( "%i: OP_LOADFIELD_STR", ip - 1 ); + Con::printf("%i: OP_LOADFIELD_STR", ip - 1); break; } case OP_SAVEFIELD_UINT: { - Con::printf( "%i: OP_SAVEFIELD_UINT", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_UINT", ip - 1); break; } case OP_SAVEFIELD_FLT: { - Con::printf( "%i: OP_SAVEFIELD_FLT", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_FLT", ip - 1); break; } case OP_SAVEFIELD_STR: { - Con::printf( "%i: OP_SAVEFIELD_STR", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_STR", ip - 1); break; } case OP_STR_TO_UINT: { - Con::printf( "%i: OP_STR_TO_UINT", ip - 1 ); + Con::printf("%i: OP_STR_TO_UINT", ip - 1); break; } case OP_STR_TO_FLT: { - Con::printf( "%i: OP_STR_TO_FLT", ip - 1 ); + Con::printf("%i: OP_STR_TO_FLT", ip - 1); break; } case OP_STR_TO_NONE: { - Con::printf( "%i: OP_STR_TO_NONE", ip - 1 ); + Con::printf("%i: OP_STR_TO_NONE", ip - 1); break; } case OP_FLT_TO_UINT: { - Con::printf( "%i: OP_FLT_TO_UINT", ip - 1 ); + Con::printf("%i: OP_FLT_TO_UINT", ip - 1); break; } case OP_FLT_TO_STR: { - Con::printf( "%i: OP_FLT_TO_STR", ip - 1 ); + Con::printf("%i: OP_FLT_TO_STR", ip - 1); break; } case OP_FLT_TO_NONE: { - Con::printf( "%i: OP_FLT_TO_NONE", ip - 1 ); + Con::printf("%i: OP_FLT_TO_NONE", ip - 1); break; } case OP_UINT_TO_FLT: { - Con::printf( "%i: OP_SAVEFIELD_STR", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_STR", ip - 1); break; } case OP_UINT_TO_STR: { - Con::printf( "%i: OP_UINT_TO_STR", ip - 1 ); + Con::printf("%i: OP_UINT_TO_STR", ip - 1); break; } case OP_UINT_TO_NONE: { - Con::printf( "%i: OP_UINT_TO_NONE", ip - 1 ); + Con::printf("%i: OP_UINT_TO_NONE", ip - 1); break; } case OP_COPYVAR_TO_NONE: { - Con::printf( "%i: OP_COPYVAR_TO_NONE", ip - 1 ); + Con::printf("%i: OP_COPYVAR_TO_NONE", ip - 1); break; } case OP_LOADIMMED_UINT: { - U32 val = code[ ip ]; - Con::printf( "%i: OP_LOADIMMED_UINT val=%i", ip - 1, val ); - ++ ip; + U32 val = code[ip]; + Con::printf("%i: OP_LOADIMMED_UINT val=%i", ip - 1, val); + ++ip; break; } case OP_LOADIMMED_FLT: { - F64 val = (smInFunction ? functionFloats : globalFloats)[ code[ ip ] ]; - Con::printf( "%i: OP_LOADIMMED_FLT val=%f", ip - 1, val ); - ++ ip; + F64 val = (smInFunction ? functionFloats : globalFloats)[code[ip]]; + Con::printf("%i: OP_LOADIMMED_FLT val=%f", ip - 1, val); + ++ip; break; } case OP_TAG_TO_STR: { - const char* str = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_TAG_TO_STR str=%s", ip - 1, str ); - ++ ip; + const char* str = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_TAG_TO_STR str=%s", ip - 1, str); + ++ip; break; } - + case OP_LOADIMMED_STR: { - const char* str = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_LOADIMMED_STR str=%s", ip - 1, str ); - ++ ip; + const char* str = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_LOADIMMED_STR str=%s", ip - 1, str); + ++ip; break; } case OP_DOCBLOCK_STR: { - const char* str = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_DOCBLOCK_STR str=%s", ip - 1, str ); - ++ ip; + const char* str = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_DOCBLOCK_STR str=%s", ip - 1, str); + ++ip; break; } - + case OP_LOADIMMED_IDENT: { StringTableEntry str = CodeToSTE(code, ip); - Con::printf( "%i: OP_LOADIMMED_IDENT str=%s", ip - 1, str ); + Con::printf("%i: OP_LOADIMMED_IDENT str=%s", ip - 1, str); ip += 2; break; } case OP_CALLFUNC_RESOLVE: { - StringTableEntry fnNamespace = CodeToSTE(code, ip+2); - StringTableEntry fnName = CodeToSTE(code, ip); - U32 callType = code[ip+2]; + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnName = CodeToSTE(code, ip); + U32 callType = code[ip + 2]; - Con::printf( "%i: OP_CALLFUNC_RESOLVE name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, + Con::printf("%i: OP_CALLFUNC_RESOLVE name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, callType == FuncCallExprNode::FunctionCall ? "FunctionCall" - : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall" ); - + : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall"); + ip += 5; break; } - + case OP_CALLFUNC: { - StringTableEntry fnNamespace = CodeToSTE(code, ip+2); - StringTableEntry fnName = CodeToSTE(code, ip); - U32 callType = code[ip+4]; + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnName = CodeToSTE(code, ip); + U32 callType = code[ip + 4]; - Con::printf( "%i: OP_CALLFUNC name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, + Con::printf("%i: OP_CALLFUNC name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, callType == FuncCallExprNode::FunctionCall ? "FunctionCall" - : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall" ); - + : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall"); + ip += 5; break; } + case OP_CALLFUNC_POINTER: + { + Con::printf("%i: OP_CALLFUNC_POINTER", ip - 1); + break; + } + + case OP_CALLFUNC_THIS: + { + StringTableEntry fnName = CodeToSTE(code, ip); + Con::printf("%i: OP_CALLFUNC_THIS name=%s ", ip - 1, fnName); + + ip += 2; + break; + } + case OP_ADVANCE_STR: { - Con::printf( "%i: OP_ADVANCE_STR", ip - 1 ); + Con::printf("%i: OP_ADVANCE_STR", ip - 1); break; } case OP_ADVANCE_STR_APPENDCHAR: { - char ch = code[ ip ]; - Con::printf( "%i: OP_ADVANCE_STR_APPENDCHAR char=%c", ip - 1, ch ); - ++ ip; + char ch = code[ip]; + Con::printf("%i: OP_ADVANCE_STR_APPENDCHAR char=%c", ip - 1, ch); + ++ip; break; } case OP_ADVANCE_STR_COMMA: { - Con::printf( "%i: OP_ADVANCE_STR_COMMA", ip - 1 ); + Con::printf("%i: OP_ADVANCE_STR_COMMA", ip - 1); break; } case OP_ADVANCE_STR_NUL: { - Con::printf( "%i: OP_ADVANCE_STR_NUL", ip - 1 ); + Con::printf("%i: OP_ADVANCE_STR_NUL", ip - 1); break; } case OP_REWIND_STR: { - Con::printf( "%i: OP_REWIND_STR", ip - 1 ); + Con::printf("%i: OP_REWIND_STR", ip - 1); break; } case OP_TERMINATE_REWIND_STR: { - Con::printf( "%i: OP_TERMINATE_REWIND_STR", ip - 1 ); + Con::printf("%i: OP_TERMINATE_REWIND_STR", ip - 1); break; } case OP_COMPARE_STR: { - Con::printf( "%i: OP_COMPARE_STR", ip - 1 ); + Con::printf("%i: OP_COMPARE_STR", ip - 1); break; } case OP_PUSH: { - Con::printf( "%i: OP_PUSH", ip - 1 ); + Con::printf("%i: OP_PUSH", ip - 1); break; } case OP_PUSH_UINT: { - Con::printf( "%i: OP_PUSH_UINT", ip - 1 ); + Con::printf("%i: OP_PUSH_UINT", ip - 1); break; } case OP_PUSH_FLT: { - Con::printf( "%i: OP_PUSH_FLT", ip - 1 ); + Con::printf("%i: OP_PUSH_FLT", ip - 1); break; } case OP_PUSH_VAR: { - Con::printf( "%i: OP_PUSH_VAR", ip - 1 ); + Con::printf("%i: OP_PUSH_VAR", ip - 1); + break; + } + + case OP_PUSH_THIS: + { + Con::printf("%i: OP_PUSH_THIS varName=%s", ip - 1, CodeToSTE(code, ip)); + ip += 2; break; } case OP_PUSH_FRAME: { - Con::printf( "%i: OP_PUSH_FRAME", ip - 1 ); + Con::printf("%i: OP_PUSH_FRAME", ip - 1); break; } case OP_ASSERT: { - const char* message = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_ASSERT message=%s", ip - 1, message ); - ++ ip; + const char* message = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_ASSERT message=%s", ip - 1, message); + ++ip; break; } case OP_BREAK: { - Con::printf( "%i: OP_BREAK", ip - 1 ); + Con::printf("%i: OP_BREAK", ip - 1); break; } - + case OP_ITER_BEGIN: { StringTableEntry varName = CodeToSTE(code, ip); - U32 failIp = code[ ip + 2 ]; - - Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp ); + U32 failIp = code[ip + 2]; + + Con::printf("%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp); ip += 3; break; @@ -1400,35 +1478,35 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ITER_BEGIN_STR: { StringTableEntry varName = CodeToSTE(code, ip); - U32 failIp = code[ ip + 2 ]; - - Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp ); + U32 failIp = code[ip + 2]; + + Con::printf("%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp); ip += 3; break; } - + case OP_ITER: { - U32 breakIp = code[ ip ]; - - Con::printf( "%i: OP_ITER breakIp=%i", ip - 1, breakIp ); + U32 breakIp = code[ip]; - ++ ip; + Con::printf("%i: OP_ITER breakIp=%i", ip - 1, breakIp); + + ++ip; break; } - + case OP_ITER_END: { - Con::printf( "%i: OP_ITER_END", ip - 1 ); + Con::printf("%i: OP_ITER_END", ip - 1); break; } default: - Con::printf( "%i: !!INVALID!!", ip - 1 ); + Con::printf("%i: !!INVALID!!", ip - 1); break; } } - + smInFunction = false; } diff --git a/Engine/source/console/codeBlock.h b/Engine/source/console/codeBlock.h index 71f15c95e..f789f1a92 100644 --- a/Engine/source/console/codeBlock.h +++ b/Engine/source/console/codeBlock.h @@ -35,10 +35,11 @@ class ConsoleValueRef; /// This class represents a block of code, usually mapped directly to a file. class CodeBlock { + friend class CodeInterpreter; private: static CodeBlock* smCodeBlockList; static CodeBlock* smCurrentCodeBlock; - + public: static bool smInFunction; static Compiler::ConsoleParser * smCurrentParser; @@ -89,7 +90,7 @@ public: void calcBreakList(); void clearAllBreaks(); void setAllBreaks(); - void dumpInstructions( U32 startIp = 0, bool upToReturn = false ); + void dumpInstructions(U32 startIp = 0, bool upToReturn = false); /// Returns the first breakable line or 0 if none was found. /// @param lineNumber The one based line number. @@ -106,7 +107,7 @@ public: const char *getFileLine(U32 ip); /// - String getFunctionArgs( U32 offset ); + String getFunctionArgs(U32 offset); bool read(StringTableEntry fileName, Stream &st); bool compile(const char *dsoName, StringTableEntry fileName, const char *script, bool overrideNoDso = false); @@ -129,8 +130,8 @@ public: /// with, zero being the top of the stack. If the the index is /// -1 a new frame is created. If the index is out of range the /// top stack frame is used. - ConsoleValueRef compileExec(StringTableEntry fileName, const char *script, - bool noCalls, S32 setFrame = -1 ); + ConsoleValueRef compileExec(StringTableEntry fileName, const char *script, + bool noCalls, S32 setFrame = -1); /// Executes the existing code in the CodeBlock. The return string is any /// result of the code executed, if any, or an empty string. @@ -147,7 +148,7 @@ public: /// -1 a new frame is created. If the index is out of range the /// top stack frame is used. /// @param packageName The code package name or null. - ConsoleValueRef exec(U32 offset, const char *fnName, Namespace *ns, U32 argc, + ConsoleValueRef exec(U32 offset, const char *fnName, Namespace *ns, U32 argc, ConsoleValueRef *argv, bool noCalls, StringTableEntry packageName, S32 setFrame = -1); }; diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp new file mode 100644 index 000000000..a0e13502f --- /dev/null +++ b/Engine/source/console/codeInterpreter.cpp @@ -0,0 +1,2979 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "console/codeInterpreter.h" +#include "console/compiler.h" +#include "console/simBase.h" +#include "console/telnetDebugger.h" +#include "sim/netStringTable.h" +#include "console/ICallMethod.h" +#include "console/stringStack.h" +#include "util/messaging/message.h" +#include "core/strings/findMatch.h" +#include "core/strings/stringUnit.h" +#include "console/console.h" +#include "console/consoleInternal.h" + +//#define TORQUE_VALIDATE_STACK + +using namespace Compiler; + +enum EvalConstants +{ + MaxStackSize = 1024, + FieldBufferSizeString = 2048, + FieldBufferSizeNumeric = 128, + MethodOnComponent = -2 +}; + +namespace Con +{ + // Current script file name and root, these are registered as + // console variables. + extern StringTableEntry gCurrentFile; + extern StringTableEntry gCurrentRoot; + extern S32 gObjectCopyFailures; +} + +// Gets a component of an object's field value or a variable and returns it +// in val. +static void getFieldComponent(SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField, char val[]) +{ + const char* prevVal = NULL; + + // Grab value from object. + if (object && field) + prevVal = object->getDataField(field, array); + + // Otherwise, grab from the string stack. The value coming in will always + // be a string because that is how multicomponent variables are handled. + else + prevVal = STR.getStringValue(); + + // Make sure we got a value. + if (prevVal && *prevVal) + { + static const StringTableEntry xyzw[] = + { + StringTable->insert("x"), + StringTable->insert("y"), + StringTable->insert("z"), + StringTable->insert("w") + }; + + static const StringTableEntry rgba[] = + { + StringTable->insert("r"), + StringTable->insert("g"), + StringTable->insert("b"), + StringTable->insert("a") + }; + + // Translate xyzw and rgba into the indexed component + // of the variable or field. + // + // Review: Should we use strncpy to prevent a buffer overflow? + if (subField == xyzw[0] || subField == rgba[0]) + dStrcpy(val, StringUnit::getUnit(prevVal, 0, " \t\n")); + + else if (subField == xyzw[1] || subField == rgba[1]) + dStrcpy(val, StringUnit::getUnit(prevVal, 1, " \t\n")); + + else if (subField == xyzw[2] || subField == rgba[2]) + dStrcpy(val, StringUnit::getUnit(prevVal, 2, " \t\n")); + + else if (subField == xyzw[3] || subField == rgba[3]) + dStrcpy(val, StringUnit::getUnit(prevVal, 3, " \t\n")); + + else + val[0] = 0; + } + else + val[0] = 0; +} + +// Sets a component of an object's field value based on the sub field. 'x' will +// set the first field, 'y' the second, and 'z' the third. +static void setFieldComponent(SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField) +{ + // Copy the current string value + char strValue[1024]; + dStrncpy(strValue, STR.getStringValue(), 1024); + + char val[1024] = ""; + const char* prevVal = NULL; + + // Set the value on an object field. + if (object && field) + prevVal = object->getDataField(field, array); + + // Set the value on a variable. + else if (gEvalState.currentVariable) + prevVal = gEvalState.getStringVariable(); + + // Ensure that the variable has a value + if (!prevVal) + return; + + static const StringTableEntry xyzw[] = + { + StringTable->insert("x"), + StringTable->insert("y"), + StringTable->insert("z"), + StringTable->insert("w") + }; + + static const StringTableEntry rgba[] = + { + StringTable->insert("r"), + StringTable->insert("g"), + StringTable->insert("b"), + StringTable->insert("a") + }; + + // Insert the value into the specified + // component of the string. + // + // Review: Should we use strncpy to prevent a buffer overflow? + if (subField == xyzw[0] || subField == rgba[0]) + dStrcpy(val, StringUnit::setUnit(prevVal, 0, strValue, " \t\n")); + + else if (subField == xyzw[1] || subField == rgba[1]) + dStrcpy(val, StringUnit::setUnit(prevVal, 1, strValue, " \t\n")); + + else if (subField == xyzw[2] || subField == rgba[2]) + dStrcpy(val, StringUnit::setUnit(prevVal, 2, strValue, " \t\n")); + + else if (subField == xyzw[3] || subField == rgba[3]) + dStrcpy(val, StringUnit::setUnit(prevVal, 3, strValue, " \t\n")); + + if (val[0] != 0) + { + // Update the field or variable. + if (object && field) + object->setDataField(field, 0, val); + else if (gEvalState.currentVariable) + gEvalState.setStringVariable(val); + } +} +extern ExprEvalState gEvalState; + +char sTraceBuffer[1024]; + +StringStack STR; +ConsoleValueStack CSTK; + +U32 _FLT = 0; ///< Stack pointer for floatStack. +U32 _UINT = 0; ///< Stack pointer for intStack. +U32 _ITER = 0; ///< Stack pointer for iterStack. + +IterStackRecord iterStack[MaxStackSize]; + +F64 floatStack[MaxStackSize]; +S64 intStack[MaxStackSize]; + +char curFieldArray[256]; +char prevFieldArray[256]; + +typedef OPCodeReturn(CodeInterpreter::*OpFn)(U32&); + +static OpFn gOpCodeArray[MAX_OP_CODELEN]; + +CodeInterpreter::CodeInterpreter(CodeBlock *cb) : + mCodeBlock(cb), + mIterDepth(0), + mCurFloatTable(nullptr), + mCurStringTable(nullptr), + mThisFunctionName(nullptr), + mPopFrame(false), + mObjectCreationStackIndex(0), + mCurrentNewObject(nullptr), + mFailJump(0), + mPrevField(nullptr), + mCurField(nullptr), + mPrevObject(nullptr), + mCurObject(nullptr), + mSaveObject(nullptr), + mThisObject(nullptr), + mNSEntry(nullptr), + mCurFNDocBlock(nullptr), + mCurNSDocBlock(nullptr), + mCallArgc(0), + mCallArgv(nullptr), + mSaveCodeBlock(nullptr), + mCurrentInstruction(0) +{ +} + +CodeInterpreter::~CodeInterpreter() +{ +} + +void CodeInterpreter::init() +{ + gOpCodeArray[OP_FUNC_DECL] = &CodeInterpreter::op_func_decl; + gOpCodeArray[OP_CREATE_OBJECT] = &CodeInterpreter::op_create_object; + gOpCodeArray[OP_ADD_OBJECT] = &CodeInterpreter::op_add_object; + gOpCodeArray[OP_END_OBJECT] = &CodeInterpreter::op_end_object; + gOpCodeArray[OP_FINISH_OBJECT] = &CodeInterpreter::op_finish_object; + gOpCodeArray[OP_JMPIFFNOT] = &CodeInterpreter::op_jmpiffnot; + gOpCodeArray[OP_JMPIFNOT] = &CodeInterpreter::op_jmpifnot; + gOpCodeArray[OP_JMPIFF] = &CodeInterpreter::op_jmpiff; + gOpCodeArray[OP_JMPIF] = &CodeInterpreter::op_jmpif; + gOpCodeArray[OP_JMPIFNOT_NP] = &CodeInterpreter::op_jmpifnot_np; + gOpCodeArray[OP_JMPIF_NP] = &CodeInterpreter::op_jmpif_np; + gOpCodeArray[OP_JMP] = &CodeInterpreter::op_jmp; + gOpCodeArray[OP_RETURN] = &CodeInterpreter::op_return; + gOpCodeArray[OP_RETURN_VOID] = &CodeInterpreter::op_return_void; + gOpCodeArray[OP_RETURN_FLT] = &CodeInterpreter::op_return_flt; + gOpCodeArray[OP_RETURN_UINT] = &CodeInterpreter::op_return_uint; + gOpCodeArray[OP_CMPEQ] = &CodeInterpreter::op_cmpeq; + gOpCodeArray[OP_CMPGR] = &CodeInterpreter::op_cmpgr; + gOpCodeArray[OP_CMPGE] = &CodeInterpreter::op_cmpge; + gOpCodeArray[OP_CMPLT] = &CodeInterpreter::op_cmplt; + gOpCodeArray[OP_CMPLE] = &CodeInterpreter::op_cmple; + gOpCodeArray[OP_CMPNE] = &CodeInterpreter::op_cmpne; + gOpCodeArray[OP_XOR] = &CodeInterpreter::op_xor; + gOpCodeArray[OP_MOD] = &CodeInterpreter::op_mod; + gOpCodeArray[OP_BITAND] = &CodeInterpreter::op_bitand; + gOpCodeArray[OP_BITOR] = &CodeInterpreter::op_bitor; + gOpCodeArray[OP_NOT] = &CodeInterpreter::op_not; + gOpCodeArray[OP_NOTF] = &CodeInterpreter::op_notf; + gOpCodeArray[OP_ONESCOMPLEMENT] = &CodeInterpreter::op_onescomplement; + gOpCodeArray[OP_SHR] = &CodeInterpreter::op_shr; + gOpCodeArray[OP_SHL] = &CodeInterpreter::op_shl; + gOpCodeArray[OP_AND] = &CodeInterpreter::op_and; + gOpCodeArray[OP_OR] = &CodeInterpreter::op_or; + gOpCodeArray[OP_ADD] = &CodeInterpreter::op_add; + gOpCodeArray[OP_SUB] = &CodeInterpreter::op_sub; + gOpCodeArray[OP_MUL] = &CodeInterpreter::op_mul; + gOpCodeArray[OP_DIV] = &CodeInterpreter::op_div; + gOpCodeArray[OP_NEG] = &CodeInterpreter::op_neg; + gOpCodeArray[OP_INC] = &CodeInterpreter::op_inc; + gOpCodeArray[OP_DEC] = &CodeInterpreter::op_dec; + gOpCodeArray[OP_SETCURVAR] = &CodeInterpreter::op_setcurvar; + gOpCodeArray[OP_SETCURVAR_CREATE] = &CodeInterpreter::op_setcurvar_create; + gOpCodeArray[OP_SETCURVAR_ARRAY] = &CodeInterpreter::op_setcurvar_array; + gOpCodeArray[OP_SETCURVAR_ARRAY_VARLOOKUP] = &CodeInterpreter::op_setcurvar_array_varlookup; + gOpCodeArray[OP_SETCURVAR_ARRAY_CREATE] = &CodeInterpreter::op_setcurvar_array_create; + gOpCodeArray[OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP] = &CodeInterpreter::op_setcurvar_array_create_varlookup; + gOpCodeArray[OP_LOADVAR_UINT] = &CodeInterpreter::op_loadvar_uint; + gOpCodeArray[OP_LOADVAR_FLT] = &CodeInterpreter::op_loadvar_flt; + gOpCodeArray[OP_LOADVAR_STR] = &CodeInterpreter::op_loadvar_str; + gOpCodeArray[OP_LOADVAR_VAR] = &CodeInterpreter::op_loadvar_var; + gOpCodeArray[OP_SAVEVAR_UINT] = &CodeInterpreter::op_savevar_uint; + gOpCodeArray[OP_SAVEVAR_FLT] = &CodeInterpreter::op_savevar_flt; + gOpCodeArray[OP_SAVEVAR_STR] = &CodeInterpreter::op_savevar_str; + gOpCodeArray[OP_SAVEVAR_VAR] = &CodeInterpreter::op_savevar_var; + gOpCodeArray[OP_SETCUROBJECT] = &CodeInterpreter::op_setcurobject; + gOpCodeArray[OP_SETCUROBJECT_INTERNAL] = &CodeInterpreter::op_setcurobject_internal; + gOpCodeArray[OP_SETCUROBJECT_NEW] = &CodeInterpreter::op_setcurobject_new; + gOpCodeArray[OP_SETCURFIELD] = &CodeInterpreter::op_setcurfield; + gOpCodeArray[OP_SETCURFIELD_ARRAY] = &CodeInterpreter::op_setcurfield_array; + gOpCodeArray[OP_SETCURFIELD_TYPE] = &CodeInterpreter::op_setcurfield_type; + gOpCodeArray[OP_SETCURFIELD_ARRAY_VAR] = &CodeInterpreter::op_setcurfield_array_var; + gOpCodeArray[OP_SETCURFIELD_THIS] = &CodeInterpreter::op_setcurfield_this; + gOpCodeArray[OP_LOADFIELD_UINT] = &CodeInterpreter::op_loadfield_uint; + gOpCodeArray[OP_LOADFIELD_FLT] = &CodeInterpreter::op_loadfield_flt; + gOpCodeArray[OP_LOADFIELD_STR] = &CodeInterpreter::op_loadfield_str; + gOpCodeArray[OP_SAVEFIELD_UINT] = &CodeInterpreter::op_savefield_uint; + gOpCodeArray[OP_SAVEFIELD_FLT] = &CodeInterpreter::op_savefield_flt; + gOpCodeArray[OP_SAVEFIELD_STR] = &CodeInterpreter::op_savefield_str; + gOpCodeArray[OP_STR_TO_UINT] = &CodeInterpreter::op_str_to_uint; + gOpCodeArray[OP_STR_TO_FLT] = &CodeInterpreter::op_str_to_flt; + gOpCodeArray[OP_STR_TO_NONE] = &CodeInterpreter::op_str_to_none; + gOpCodeArray[OP_FLT_TO_UINT] = &CodeInterpreter::op_flt_to_uint; + gOpCodeArray[OP_FLT_TO_STR] = &CodeInterpreter::op_flt_to_str; + gOpCodeArray[OP_FLT_TO_NONE] = &CodeInterpreter::op_flt_to_none; + gOpCodeArray[OP_UINT_TO_FLT] = &CodeInterpreter::op_uint_to_flt; + gOpCodeArray[OP_UINT_TO_STR] = &CodeInterpreter::op_uint_to_str; + gOpCodeArray[OP_UINT_TO_NONE] = &CodeInterpreter::op_uint_to_none; + gOpCodeArray[OP_COPYVAR_TO_NONE] = &CodeInterpreter::op_copyvar_to_none; + gOpCodeArray[OP_LOADIMMED_UINT] = &CodeInterpreter::op_loadimmed_uint; + gOpCodeArray[OP_LOADIMMED_FLT] = &CodeInterpreter::op_loadimmed_flt; + gOpCodeArray[OP_TAG_TO_STR] = &CodeInterpreter::op_tag_to_str; + gOpCodeArray[OP_LOADIMMED_STR] = &CodeInterpreter::op_loadimmed_str; + gOpCodeArray[OP_DOCBLOCK_STR] = &CodeInterpreter::op_docblock_str; + gOpCodeArray[OP_LOADIMMED_IDENT] = &CodeInterpreter::op_loadimmed_ident; + gOpCodeArray[OP_CALLFUNC_RESOLVE] = &CodeInterpreter::op_callfunc_resolve; + gOpCodeArray[OP_CALLFUNC] = &CodeInterpreter::op_callfunc; + gOpCodeArray[OP_CALLFUNC_POINTER] = &CodeInterpreter::op_callfunc_pointer; + gOpCodeArray[OP_CALLFUNC_THIS] = &CodeInterpreter::op_callfunc_this; + gOpCodeArray[OP_ADVANCE_STR] = &CodeInterpreter::op_advance_str; + gOpCodeArray[OP_ADVANCE_STR_APPENDCHAR] = &CodeInterpreter::op_advance_str_appendchar; + gOpCodeArray[OP_ADVANCE_STR_COMMA] = &CodeInterpreter::op_advance_str_comma; + gOpCodeArray[OP_ADVANCE_STR_NUL] = &CodeInterpreter::op_advance_str_nul; + gOpCodeArray[OP_REWIND_STR] = &CodeInterpreter::op_rewind_str; + gOpCodeArray[OP_TERMINATE_REWIND_STR] = &CodeInterpreter::op_terminate_rewind_str; + gOpCodeArray[OP_COMPARE_STR] = &CodeInterpreter::op_compare_str; + gOpCodeArray[OP_PUSH] = &CodeInterpreter::op_push; + gOpCodeArray[OP_PUSH_UINT] = &CodeInterpreter::op_push_uint; + gOpCodeArray[OP_PUSH_FLT] = &CodeInterpreter::op_push_flt; + gOpCodeArray[OP_PUSH_VAR] = &CodeInterpreter::op_push_var; + gOpCodeArray[OP_PUSH_THIS] = &CodeInterpreter::op_push_this; + gOpCodeArray[OP_PUSH_FRAME] = &CodeInterpreter::op_push_frame; + gOpCodeArray[OP_ASSERT] = &CodeInterpreter::op_assert; + gOpCodeArray[OP_BREAK] = &CodeInterpreter::op_break; + gOpCodeArray[OP_ITER_BEGIN_STR] = &CodeInterpreter::op_iter_begin_str; + gOpCodeArray[OP_ITER_BEGIN] = &CodeInterpreter::op_iter_begin; + gOpCodeArray[OP_ITER] = &CodeInterpreter::op_iter; + gOpCodeArray[OP_ITER_END] = &CodeInterpreter::op_iter_end; + gOpCodeArray[OP_INVALID] = &CodeInterpreter::op_invalid; +} + +ConsoleValueRef CodeInterpreter::exec(U32 ip, + StringTableEntry functionName, + Namespace *thisNamespace, + U32 argc, + ConsoleValueRef *argv, + bool noCalls, + StringTableEntry packageName, + S32 setFrame) +{ + mExec.functionName = functionName; + mExec.thisNamespace = thisNamespace; + mExec.argc = argc; + mExec.argv = argv; + mExec.noCalls = noCalls; + mExec.packageName = packageName; + mExec.setFrame = setFrame; + + mCodeBlock->incRefCount(); + + mPopFrame = false; + +#ifdef TORQUE_VALIDATE_STACK + U32 stackStart = STR.mStartStackSize; +#endif + + STR.clearFunctionOffset(); // ensures arg buffer offset is back to 0 + + // Lets load up our function arguments. + parseArgs(ip); + + // Grab the state of the telenet debugger here once + // so that the push and pop frames are always balanced. + const bool telDebuggerOn = TelDebugger && TelDebugger->isConnected(); + if (telDebuggerOn && setFrame < 0) + TelDebugger->pushStackFrame(); + + mSaveCodeBlock = CodeBlock::smCurrentCodeBlock; + CodeBlock::smCurrentCodeBlock = mCodeBlock; + if (mCodeBlock->name) + { + Con::gCurrentFile = mCodeBlock->name; + Con::gCurrentRoot = mCodeBlock->modPath; + } + + U32 *code = mCodeBlock->code; + + while (true) + { + mCurrentInstruction = code[ip++]; + mNSEntry = nullptr; + +#ifdef TORQUE_VALIDATE_STACK + // OP Code check. + AssertFatal(mCurrentInstruction < MAX_OP_CODELEN, "Invalid OP code in script interpreter"); +#endif + + breakContinueLabel: + OPCodeReturn ret = (this->*gOpCodeArray[mCurrentInstruction])(ip); + if (ret == OPCodeReturn::exitCode) + goto exitLabel; + else if (ret == OPCodeReturn::breakContinue) + goto breakContinueLabel; + } +exitLabel: + if (telDebuggerOn && setFrame < 0) + TelDebugger->popStackFrame(); + + if (mPopFrame) + gEvalState.popFrame(); + + if (argv) + { + if (gEvalState.traceOn) + { + sTraceBuffer[0] = 0; + dStrcat(sTraceBuffer, "Leaving "); + + if (packageName) + { + dStrcat(sTraceBuffer, "["); + dStrcat(sTraceBuffer, packageName); + dStrcat(sTraceBuffer, "]"); + } + if (thisNamespace && thisNamespace->mName) + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s::%s() - return %s", thisNamespace->mName, mThisFunctionName, STR.getStringValue()); + } + else + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s() - return %s", mThisFunctionName, STR.getStringValue()); + } + Con::printf("%s", sTraceBuffer); + } + } + + CodeBlock::smCurrentCodeBlock = mSaveCodeBlock; + if (mSaveCodeBlock && mSaveCodeBlock->name) + { + Con::gCurrentFile = mSaveCodeBlock->name; + Con::gCurrentRoot = mSaveCodeBlock->modPath; + } + + mCodeBlock->decRefCount(); + +#ifdef TORQUE_VALIDATE_STACK + AssertFatal(!(STR.mStartStackSize > stackStart), "String stack not popped enough in script exec"); + AssertFatal(!(STR.mStartStackSize < stackStart), "String stack popped too much in script exec"); +#endif + + return mReturnValue; +} + +void CodeInterpreter::parseArgs(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + if (mExec.argv) + { + U32 fnArgc = code[ip + 2 + 6]; + mThisFunctionName = Compiler::CodeToSTE(code, ip); + S32 wantedArgc = getMin(mExec.argc - 1, fnArgc); // argv[0] is func name + if (gEvalState.traceOn) + { + sTraceBuffer[0] = 0; + dStrcat(sTraceBuffer, "Entering "); + + if (mExec.packageName) + { + dStrcat(sTraceBuffer, "["); + dStrcat(sTraceBuffer, mExec.packageName); + dStrcat(sTraceBuffer, "]"); + } + if (mExec.thisNamespace && mExec.thisNamespace->mName) + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s::%s(", mExec.thisNamespace->mName, mThisFunctionName); + } + else + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s(", mThisFunctionName); + } + for (S32 i = 0; i < wantedArgc; i++) + { + dStrcat(sTraceBuffer, mExec.argv[i + 1]); + if (i != wantedArgc - 1) + dStrcat(sTraceBuffer, ", "); + } + dStrcat(sTraceBuffer, ")"); + Con::printf("%s", sTraceBuffer); + } + + gEvalState.pushFrame(mThisFunctionName, mExec.thisNamespace); + mPopFrame = true; + + StringTableEntry thisPointer = StringTable->insert("%this"); + + for (S32 i = 0; i < wantedArgc; i++) + { + StringTableEntry var = Compiler::CodeToSTE(code, ip + (2 + 6 + 1) + (i * 2)); + gEvalState.setCurVarNameCreate(var); + + ConsoleValueRef ref = mExec.argv[i + 1]; + + switch (ref.getType()) + { + case ConsoleValue::TypeInternalInt: + gEvalState.setIntVariable(ref); + break; + case ConsoleValue::TypeInternalFloat: + gEvalState.setFloatVariable(ref); + break; + case ConsoleValue::TypeInternalStringStackPtr: + gEvalState.setStringStackPtrVariable(ref.getStringStackPtrValue()); + break; + case ConsoleValue::TypeInternalStackString: + case ConsoleValue::TypeInternalString: + default: + gEvalState.setStringVariable(ref); + break; + } + + if (var == thisPointer) + { + // %this gets optimized as it is flagged as a constant. + // Since it is guarenteed to be constant, we can then perform optimizations. + gEvalState.currentVariable->mIsConstant = true; + + // Store a reference to the this pointer object. + mThisObject = Sim::findObject(gEvalState.getStringVariable()); + } + } + + ip = ip + (fnArgc * 2) + (2 + 6 + 1); + mCurFloatTable = mCodeBlock->functionFloats; + mCurStringTable = mCodeBlock->functionStrings; + } + else + { + mCurFloatTable = mCodeBlock->globalFloats; + mCurStringTable = mCodeBlock->globalStrings; + + // If requested stack frame isn't available, request a new one + // (this prevents assert failures when creating local + // variables without a stack frame) + if (gEvalState.getStackDepth() <= mExec.setFrame) + mExec.setFrame = -1; + + // Do we want this code to execute using a new stack frame? + if (mExec.setFrame < 0) + { + gEvalState.pushFrame(NULL, NULL); + mPopFrame = true; + } + else + { + // We want to copy a reference to an existing stack frame + // on to the top of the stack. Any change that occurs to + // the locals during this new frame will also occur in the + // original frame. + S32 stackIndex = gEvalState.getStackDepth() - mExec.setFrame - 1; + gEvalState.pushFrameRef(stackIndex); + mPopFrame = true; + } + } +} + +OPCodeReturn CodeInterpreter::op_func_decl(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + if (!mExec.noCalls) + { + StringTableEntry fnName = CodeToSTE(code, ip); + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnPackage = CodeToSTE(code, ip + 4); + bool hasBody = (code[ip + 6] & 0x01) != 0; + U32 lineNumber = code[ip + 6] >> 1; + + Namespace::unlinkPackages(); + Namespace *ns = Namespace::find(fnNamespace, fnPackage); + ns->addFunction(fnName, mCodeBlock, hasBody ? ip : 0, mCurFNDocBlock ? dStrdup(mCurFNDocBlock) : NULL, lineNumber);// if no body, set the IP to 0 + if (mCurNSDocBlock) + { + // If we have a docblock before we declare the function in the script file, + // this will attempt to set the doc block to the function. + // See OP_DOCBLOCK_STR + if (fnNamespace == StringTable->lookup(mNSDocBlockClass)) + { + char *usageStr = dStrdup(mCurNSDocBlock); + usageStr[dStrlen(usageStr)] = '\0'; + ns->mUsage = usageStr; + ns->mCleanUpUsage = true; + mCurNSDocBlock = NULL; + } + } + Namespace::relinkPackages(); + + // If we had a docblock, it's definitely not valid anymore, so clear it out. + mCurFNDocBlock = NULL; + + //Con::printf("Adding function %s::%s (%d)", fnNamespace, fnName, ip); + } + ip = code[ip + 7]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_create_object(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + // Read some useful info. + StringTableEntry objParent = CodeToSTE(code, ip); + bool isDataBlock = code[ip + 2]; + bool isInternal = code[ip + 3]; + bool isSingleton = code[ip + 4]; + U32 lineNumber = code[ip + 5]; + mFailJump = code[ip + 6]; + + // If we don't allow calls, we certainly don't allow creating objects! + // Moved this to after failJump is set. Engine was crashing when + // noCalls = true and an object was being created at the beginning of + // a file. ADL. + if (mExec.noCalls) + { + ip = mFailJump; + return OPCodeReturn::success; + } + + // Push the old info to the stack + //Assert( objectCreationStackIndex < objectCreationStackSize ); + mObjectCreationStack[mObjectCreationStackIndex].newObject = mCurrentNewObject; + mObjectCreationStack[mObjectCreationStackIndex++].failJump = mFailJump; + + // Get the constructor information off the stack. + CSTK.getArgcArgv(NULL, &mCallArgc, &mCallArgv); + const char *objectName = mCallArgv[2]; + + // Con::printf("Creating object..."); + + // objectName = argv[1]... + mCurrentNewObject = NULL; + + // Are we creating a datablock? If so, deal with case where we override + // an old one. + if (isDataBlock) + { + // Con::printf(" - is a datablock"); + + // Find the old one if any. + SimObject *db = Sim::getDataBlockGroup()->findObject(objectName); + + // Make sure we're not changing types on ourselves... + if (db && dStricmp(db->getClassName(), mCallArgv[1])) + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare data block %s with a different class.", mCodeBlock->getFileLine(ip), objectName); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + // If there was one, set the currentNewObject and move on. + if (db) + mCurrentNewObject = db; + } + else if (!isInternal) + { + // IF we aren't looking at a local/internal object, then check if + // this object already exists in the global space + + AbstractClassRep* rep = AbstractClassRep::findClassRep(objectName); + if (rep != NULL) { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot name object [%s] the same name as a script class.", + mCodeBlock->getFileLine(ip), objectName); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + SimObject *obj = Sim::findObject((const char*)objectName); + if (obj /*&& !obj->isLocalName()*/) + { + if (isSingleton) + { + // Make sure we're not trying to change types + if (dStricmp(obj->getClassName(), (const char*)mCallArgv[1]) != 0) + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s] with a different class [%s] - was [%s].", + mCodeBlock->getFileLine(ip), objectName, (const char*)mCallArgv[1], obj->getClassName()); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + // We're creating a singleton, so use the found object + // instead of creating a new object. + mCurrentNewObject = obj; + } + else + { + const char* redefineBehavior = Con::getVariable("$Con::redefineBehavior"); + + if (dStricmp(redefineBehavior, "replaceExisting") == 0) + { + // Save our constructor args as the argv vector is stored on the + // string stack and may get stomped if deleteObject triggers + // script execution. + + ConsoleValueRef savedArgv[StringStack::MaxArgs]; + for (int i = 0; i< mCallArgc; i++) { + savedArgv[i] = mCallArgv[i]; + } + //dMemcpy( savedArgv, callArgv, sizeof( savedArgv[ 0 ] ) * callArgc ); + + // Prevent stack value corruption + CSTK.pushFrame(); + STR.pushFrame(); + // -- + + obj->deleteObject(); + obj = NULL; + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + + //dMemcpy( callArgv, savedArgv, sizeof( callArgv[ 0 ] ) * callArgc ); + for (int i = 0; iinsert(newName); + break; + } + } + } + else if (dStricmp(redefineBehavior, "unnameNew") == 0) + { + objectName = StringTable->insert(""); + } + else if (dStricmp(redefineBehavior, "postfixNew") == 0) + { + const char* postfix = Con::getVariable("$Con::redefineBehaviorPostfix"); + String newName = String::ToString("%s%s", objectName, postfix); + + if (Sim::findObject(newName)) + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object with postfix [%s].", + mCodeBlock->getFileLine(ip), newName.c_str()); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + else + objectName = StringTable->insert(newName); + } + else + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s].", + mCodeBlock->getFileLine(ip), objectName); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + } + } + } + + STR.popFrame(); + CSTK.popFrame(); + + if (!mCurrentNewObject) + { + // Well, looks like we have to create a new object. + ConsoleObject *object = ConsoleObject::create((const char*)mCallArgv[1]); + + // Deal with failure! + if (!object) + { + Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-conobject class %s.", mCodeBlock->getFileLine(ip), (const char*)mCallArgv[1]); + ip = mFailJump; + return OPCodeReturn::success; + } + + // Do special datablock init if appropros + if (isDataBlock) + { + SimDataBlock *dataBlock = dynamic_cast(object); + if (dataBlock) + { + dataBlock->assignId(); + } + else + { + // They tried to make a non-datablock with a datablock keyword! + Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-datablock class %s.", mCodeBlock->getFileLine(ip), (const char*)mCallArgv[1]); + // Clean up... + delete object; + mCurrentNewObject = NULL; + ip = mFailJump; + return OPCodeReturn::success; + } + } + + // Finally, set currentNewObject to point to the new one. + mCurrentNewObject = dynamic_cast(object); + + // Deal with the case of a non-SimObject. + if (!mCurrentNewObject) + { + Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-SimObject class %s.", mCodeBlock->getFileLine(ip), (const char*)mCallArgv[1]); + delete object; + mCurrentNewObject = NULL; + ip = mFailJump; + return OPCodeReturn::success; + } + + // Set the declaration line + mCurrentNewObject->setDeclarationLine(lineNumber); + + // Set the file that this object was created in + mCurrentNewObject->setFilename(mCodeBlock->name); + + // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) + if (*objParent) + { + // Find it! + SimObject *parent; + if (Sim::findObject(objParent, parent)) + { + // Con::printf(" - Parent object found: %s", parent->getClassName()); + + mCurrentNewObject->setCopySource(parent); + mCurrentNewObject->assignFieldsFrom(parent); + + // copy any substitution statements + SimDataBlock* parent_db = dynamic_cast(parent); + if (parent_db) + { + SimDataBlock* currentNewObject_db = dynamic_cast(mCurrentNewObject); + if (currentNewObject_db) + currentNewObject_db->copySubstitutionsFrom(parent_db); + } + } + else + { + if (Con::gObjectCopyFailures == -1) + Con::errorf(ConsoleLogEntry::General, "%s: Unable to find parent object %s for %s.", mCodeBlock->getFileLine(ip), objParent, (const char*)mCallArgv[1]); + else + ++Con::gObjectCopyFailures; + + // Fail to create the object. + delete object; + mCurrentNewObject = NULL; + ip = mFailJump; + return OPCodeReturn::success; + } + } + + // If a name was passed, assign it. + if (objectName[0]) + { + if (!isInternal) + mCurrentNewObject->assignName(objectName); + else + mCurrentNewObject->setInternalName(objectName); + + // Set the original name + mCurrentNewObject->setOriginalName(objectName); + } + + // Prevent stack value corruption + CSTK.pushFrame(); + STR.pushFrame(); + // -- + + // Do the constructor parameters. + if (!mCurrentNewObject->processArguments(mCallArgc - 3, mCallArgv + 3)) + { + delete mCurrentNewObject; + mCurrentNewObject = NULL; + ip = mFailJump; + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; + } + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + + // If it's not a datablock, allow people to modify bits of it. + if (!isDataBlock) + { + mCurrentNewObject->setModStaticFields(true); + mCurrentNewObject->setModDynamicFields(true); + } + } + else + { + mCurrentNewObject->reloadReset(); // AFX (reload-reset) + // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) + if (*objParent) + { + // Find it! + SimObject *parent; + if (Sim::findObject(objParent, parent)) + { + // Con::printf(" - Parent object found: %s", parent->getClassName()); + + // temporarily block name change + SimObject::preventNameChanging = true; + mCurrentNewObject->setCopySource(parent); + mCurrentNewObject->assignFieldsFrom(parent); + // restore name changing + SimObject::preventNameChanging = false; + + // copy any substitution statements + SimDataBlock* parent_db = dynamic_cast(parent); + if (parent_db) + { + SimDataBlock* currentNewObject_db = dynamic_cast(mCurrentNewObject); + if (currentNewObject_db) + currentNewObject_db->copySubstitutionsFrom(parent_db); + } + } + else + Con::errorf(ConsoleLogEntry::General, "%d: Unable to find parent object %s for %s.", lineNumber, objParent, (const char*)mCallArgv[1]); + } + } + + // Advance the IP past the create info... + ip += 7; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_add_object(U32 &ip) +{ + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + // Do we place this object at the root? + bool placeAtRoot = mCodeBlock->code[ip++]; + + // Con::printf("Adding object %s", currentNewObject->getName()); + + // Prevent stack value corruption + CSTK.pushFrame(); + STR.pushFrame(); + // -- + + // Make sure it wasn't already added, then add it. + if (mCurrentNewObject->isProperlyAdded() == false) + { + bool ret = false; + + Message *msg = dynamic_cast(mCurrentNewObject); + if (msg) + { + SimObjectId id = Message::getNextMessageID(); + if (id != 0xffffffff) + ret = mCurrentNewObject->registerObject(id); + else + Con::errorf("%s: No more object IDs available for messages", mCodeBlock->getFileLine(ip)); + } + else + ret = mCurrentNewObject->registerObject(); + + if (!ret) + { + // This error is usually caused by failing to call Parent::initPersistFields in the class' initPersistFields(). + Con::warnf(ConsoleLogEntry::General, "%s: Register object failed for object %s of class %s.", mCodeBlock->getFileLine(ip), mCurrentNewObject->getName(), mCurrentNewObject->getClassName()); + delete mCurrentNewObject; + mCurrentNewObject = NULL; + ip = mFailJump; + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; + } + } + + // Are we dealing with a datablock? + SimDataBlock *dataBlock = dynamic_cast(mCurrentNewObject); + static String errorStr; + + // If so, preload it. + if (dataBlock && !dataBlock->preload(true, errorStr)) + { + Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", mCodeBlock->getFileLine(ip), + mCurrentNewObject->getName(), errorStr.c_str()); + dataBlock->deleteObject(); + mCurrentNewObject = NULL; + ip = mFailJump; + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; + } + + // What group will we be added to, if any? + U32 groupAddId = intStack[_UINT]; + SimGroup *grp = NULL; + SimSet *set = NULL; + bool isMessage = dynamic_cast(mCurrentNewObject) != NULL; + + if (!placeAtRoot || !mCurrentNewObject->getGroup()) + { + if (!isMessage) + { + if (!placeAtRoot) + { + // Otherwise just add to the requested group or set. + if (!Sim::findObject(groupAddId, grp)) + Sim::findObject(groupAddId, set); + } + + if (placeAtRoot) + { + // Deal with the instantGroup if we're being put at the root or we're adding to a component. + if (Con::gInstantGroup.isEmpty() + || !Sim::findObject(Con::gInstantGroup, grp)) + grp = Sim::getRootGroup(); + } + } + + // If we didn't get a group, then make sure we have a pointer to + // the rootgroup. + if (!grp) + grp = Sim::getRootGroup(); + + // add to the parent group + grp->addObject(mCurrentNewObject); + + // If for some reason the add failed, add the object to the + // root group so it won't leak. + if (!mCurrentNewObject->getGroup()) + Sim::getRootGroup()->addObject(mCurrentNewObject); + + // add to any set we might be in + if (set) + set->addObject(mCurrentNewObject); + } + + // store the new object's ID on the stack (overwriting the group/set + // id, if one was given, otherwise getting pushed) + if (placeAtRoot) + intStack[_UINT] = mCurrentNewObject->getId(); + else + intStack[++_UINT] = mCurrentNewObject->getId(); + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_end_object(U32 &ip) +{ + // If we're not to be placed at the root, make sure we clean up + // our group reference. + bool placeAtRoot = mCodeBlock->code[ip++]; + if (!placeAtRoot) + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_finish_object(U32 &ip) +{ + if (mCurrentNewObject) + mCurrentNewObject->onPostAdd(); + + //Assert( objectCreationStackIndex >= 0 ); + // Restore the object info from the stack [7/9/2007 Black] + mCurrentNewObject = mObjectCreationStack[--mObjectCreationStackIndex].newObject; + mFailJump = mObjectCreationStack[mObjectCreationStackIndex].failJump; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpiffnot(U32 &ip) +{ + if (floatStack[_FLT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + + +OPCodeReturn CodeInterpreter::op_jmpifnot(U32 &ip) +{ + if (intStack[_UINT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpiff(U32 &ip) +{ + if (!floatStack[_FLT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpif(U32 &ip) +{ + if (!intStack[_UINT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpifnot_np(U32 &ip) +{ + if (intStack[_UINT]) + { + _UINT--; + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpif_np(U32 &ip) +{ + if (!intStack[_UINT]) + { + _UINT--; + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmp(U32 &ip) +{ + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_return_void(U32 &ip) +{ + STR.setStringValue(""); + // We're falling thru here on purpose. + + OPCodeReturn ret = op_return(ip); + + return ret; +} + +OPCodeReturn CodeInterpreter::op_return(U32 &ip) +{ + StringStackPtr retValue = STR.getStringValuePtr(); + + if (mIterDepth > 0) + { + // Clear iterator state. + while (mIterDepth > 0) + { + iterStack[--_ITER].mIsStringIter = false; + --mIterDepth; + } + + STR.rewind(); + STR.setStringValue(StringStackPtrRef(retValue).getPtr(&STR)); // Not nice but works. + retValue = STR.getStringValuePtr(); + } + + // Previously the return value was on the stack and would be returned using STR.getStringValue(). + // Now though we need to wrap it in a ConsoleValueRef + mReturnValue.value = CSTK.pushStringStackPtr(retValue); + + return OPCodeReturn::exitCode; +} + +OPCodeReturn CodeInterpreter::op_return_flt(U32 &ip) +{ + if (mIterDepth > 0) + { + // Clear iterator state. + while (mIterDepth > 0) + { + iterStack[--_ITER].mIsStringIter = false; + --mIterDepth; + } + + } + + mReturnValue.value = CSTK.pushFLT(floatStack[_FLT]); + _FLT--; + + return OPCodeReturn::exitCode; +} + +OPCodeReturn CodeInterpreter::op_return_uint(U32 &ip) +{ + if (mIterDepth > 0) + { + // Clear iterator state. + while (mIterDepth > 0) + { + iterStack[--_ITER].mIsStringIter = false; + --mIterDepth; + } + } + + mReturnValue.value = CSTK.pushUINT(intStack[_UINT]); + _UINT--; + + return OPCodeReturn::exitCode; +} + +OPCodeReturn CodeInterpreter::op_cmpeq(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] == floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmpgr(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] > floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmpge(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] >= floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmplt(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] < floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmple(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] <= floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmpne(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] != floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_xor(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] ^ intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_mod(U32 &ip) +{ + if (intStack[_UINT - 1] != 0) + intStack[_UINT - 1] = intStack[_UINT] % intStack[_UINT - 1]; + else + intStack[_UINT - 1] = 0; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_bitand(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] & intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_bitor(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] | intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_not(U32 &ip) +{ + intStack[_UINT] = !intStack[_UINT]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_notf(U32 &ip) +{ + intStack[_UINT + 1] = !floatStack[_FLT]; + _FLT--; + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_onescomplement(U32 &ip) +{ + intStack[_UINT] = ~intStack[_UINT]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_shr(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] >> intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_shl(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] << intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_and(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] && intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_or(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] || intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_add(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] + floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_sub(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] - floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_mul(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] * floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_div(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] / floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_neg(U32 &ip) +{ + floatStack[_FLT] = -floatStack[_FLT]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_inc(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + F64 val = gEvalState.getFloatVariable() + 1.0; + gEvalState.setFloatVariable(val); + + // We gotta push val onto the stack. What if we have + // more expressions that have to use this. + // If we don't, we send out an op code to pop it. + floatStack[_FLT + 1] = val; + _FLT++; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_dec(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + F64 val = gEvalState.getFloatVariable() - 1.0; + gEvalState.setFloatVariable(val); + + // We gotta push val onto the stack. What if we have + // more expressions that have to use this. + // If we don't, we send out an op code to pop it. + floatStack[_FLT + 1] = val; + _FLT++; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarName(var); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_create(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array(U32 &ip) +{ + StringTableEntry var = STR.getSTValue(); + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarName(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array_varlookup(U32 &ip) +{ + StringTableEntry arrayName = CodeToSTE(mCodeBlock->code, ip); + StringTableEntry arrayLookup = CodeToSTE(mCodeBlock->code, ip + 2); + ip += 4; + + STR.setStringValue(arrayName); + STR.advance(); + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + // resolve arrayLookup to get the 'value' + // Note: we have to setCurVarNameCreate in case the var doesn't exist. + // this won't cause much of a performance hit since vars are hashed. + gEvalState.setCurVarNameCreate(arrayLookup); + StringTableEntry hash = gEvalState.getStringVariable(); + + STR.setStringValue(hash); + STR.rewind(); + + // Generate new array name. + StringTableEntry var = STR.getSTValue(); + gEvalState.setCurVarName(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array_create(U32 &ip) +{ + StringTableEntry var = STR.getSTValue(); + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array_create_varlookup(U32 &ip) +{ + StringTableEntry arrayName = CodeToSTE(mCodeBlock->code, ip); + StringTableEntry arrayLookup = CodeToSTE(mCodeBlock->code, ip + 2); + ip += 4; + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + STR.setStringValue(arrayName); + STR.advance(); + + // resolve arrayLookup to get the 'value' + // Note: we have to setCurVarNameCreate in case the var doesn't exist. + // this won't cause much of a performance hit since vars are hashed. + gEvalState.setCurVarNameCreate(arrayLookup); + StringTableEntry hash = gEvalState.getStringVariable(); + + STR.setStringValue(hash); + STR.rewind(); + + // Generate new array name. + StringTableEntry var = STR.getSTValue(); + gEvalState.setCurVarNameCreate(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_uint(U32 &ip) +{ + intStack[_UINT + 1] = gEvalState.getIntVariable(); + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_flt(U32 &ip) +{ + floatStack[_FLT + 1] = gEvalState.getFloatVariable(); + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_str(U32 &ip) +{ + StringTableEntry val = gEvalState.getStringVariable(); + STR.setStringValue(val); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_var(U32 &ip) +{ + // Sets current source of OP_SAVEVAR_VAR + gEvalState.copyVariable = gEvalState.currentVariable; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_uint(U32 &ip) +{ + gEvalState.setIntVariable(intStack[_UINT]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_flt(U32 &ip) +{ + gEvalState.setFloatVariable(floatStack[_FLT]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_str(U32 &ip) +{ + gEvalState.setStringVariable(STR.getStringValue()); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_var(U32 &ip) +{ + // this basically handles %var1 = %var2 + gEvalState.setCopyVariable(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurobject(U32 &ip) +{ + // Save the previous object for parsing vector fields. + mPrevObject = mCurObject; + StringTableEntry val = STR.getStringValue(); + + // Sim::findObject will sometimes find valid objects from + // multi-component strings. This makes sure that doesn't + // happen. + for (const char* check = val; *check; check++) + { + if (*check == ' ') + { + val = ""; + break; + } + } + mCurObject = Sim::findObject(val); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurobject_internal(U32 &ip) +{ + ++ip; // To skip the recurse flag if the object wasn't found + if (mCurObject) + { + SimSet *set = dynamic_cast(mCurObject); + if (set) + { + StringTableEntry intName = StringTable->insert(STR.getStringValue()); + bool recurse = mCodeBlock->code[ip - 1]; + SimObject *obj = set->findObjectByInternalName(intName, recurse); + intStack[_UINT + 1] = obj ? obj->getId() : 0; + _UINT++; + } + else + { + Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-set %s of class %s.", mCodeBlock->getFileLine(ip - 2), mCurObject->getName(), mCurObject->getClassName()); + intStack[_UINT] = 0; + } + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurobject_new(U32 &ip) +{ + mCurObject = mCurrentNewObject; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield(U32 &ip) +{ + // Save the previous field for parsing vector fields. + mPrevField = mCurField; + dStrcpy(prevFieldArray, curFieldArray); + mCurField = CodeToSTE(mCodeBlock->code, ip); + curFieldArray[0] = 0; + ip += 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_array(U32 &ip) +{ + dStrcpy(curFieldArray, STR.getStringValue()); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_type(U32 &ip) +{ + if (mCurObject) + mCurObject->setDataFieldType(mCodeBlock->code[ip], mCurField, curFieldArray); + ip++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_array_var(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // We set the current var name (create it as well in case if it doesn't exist, + // otherwise we will crash). + gEvalState.setCurVarNameCreate(var); + + // Then load the var and copy the contents to the current field array + dStrncpy(curFieldArray, gEvalState.currentVariable->getStringValue(), sizeof(curFieldArray)); + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_this(U32 &ip) +{ + // set the 'this pointer' as the current object. + mCurObject = mThisObject; + + mPrevField = mCurField; + dStrcpy(prevFieldArray, curFieldArray); + mCurField = CodeToSTE(mCodeBlock->code, ip); + curFieldArray[0] = 0; + ip += 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadfield_uint(U32 &ip) +{ + if (mCurObject) + intStack[_UINT + 1] = U32(dAtoi(mCurObject->getDataField(mCurField, curFieldArray))); + else + { + // The field is not being retrieved from an object. Maybe it's + // a special accessor? + char buff[FieldBufferSizeNumeric]; + memset(buff, 0, sizeof(buff)); + getFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField, buff); + intStack[_UINT + 1] = dAtoi(buff); + } + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadfield_flt(U32 &ip) +{ + if (mCurObject) + floatStack[_FLT + 1] = dAtof(mCurObject->getDataField(mCurField, curFieldArray)); + else + { + // The field is not being retrieved from an object. Maybe it's + // a special accessor? + char buff[FieldBufferSizeNumeric]; + memset(buff, 0, sizeof(buff)); + getFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField, buff); + floatStack[_FLT + 1] = dAtof(buff); + } + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadfield_str(U32 &ip) +{ + if (mCurObject) + { + StringTableEntry val = mCurObject->getDataField(mCurField, curFieldArray); + STR.setStringValue(val); + } + else + { + // The field is not being retrieved from an object. Maybe it's + // a special accessor? + char buff[FieldBufferSizeString]; + memset(buff, 0, sizeof(buff)); + getFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField, buff); + STR.setStringValue(buff); + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savefield_uint(U32 &ip) +{ + STR.setIntValue(intStack[_UINT]); + if (mCurObject) + mCurObject->setDataField(mCurField, curFieldArray, STR.getStringValue()); + else + { + // The field is not being set on an object. Maybe it's + // a special accessor? + setFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField); + mPrevObject = NULL; + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savefield_flt(U32 &ip) +{ + STR.setFloatValue(floatStack[_FLT]); + if (mCurObject) + mCurObject->setDataField(mCurField, curFieldArray, STR.getStringValue()); + else + { + // The field is not being set on an object. Maybe it's + // a special accessor? + setFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField); + mPrevObject = NULL; + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savefield_str(U32 &ip) +{ + if (mCurObject) + mCurObject->setDataField(mCurField, curFieldArray, STR.getStringValue()); + else + { + // The field is not being set on an object. Maybe it's + // a special accessor? + setFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField); + mPrevObject = NULL; + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_str_to_uint(U32 &ip) +{ + intStack[_UINT + 1] = STR.getIntValue(); + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_str_to_flt(U32 &ip) +{ + floatStack[_FLT + 1] = STR.getFloatValue(); + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_str_to_none(U32 &ip) +{ + // This exists simply to deal with certain typecast situations. + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_flt_to_uint(U32 &ip) +{ + intStack[_UINT + 1] = (S64)floatStack[_FLT]; + _FLT--; + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_flt_to_str(U32 &ip) +{ + STR.setFloatValue(floatStack[_FLT]); + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_flt_to_none(U32 &ip) +{ + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_uint_to_flt(U32 &ip) +{ + floatStack[_FLT + 1] = (F32)intStack[_UINT]; + _UINT--; + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_uint_to_str(U32 &ip) +{ + STR.setIntValue(intStack[_UINT]); + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_uint_to_none(U32 &ip) +{ + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_copyvar_to_none(U32 &ip) +{ + gEvalState.copyVariable = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_uint(U32 &ip) +{ + intStack[_UINT + 1] = mCodeBlock->code[ip++]; + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_flt(U32 &ip) +{ + floatStack[_FLT + 1] = mCurFloatTable[mCodeBlock->code[ip]]; + ip++; + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_tag_to_str(U32 &ip) +{ + mCodeBlock->code[ip - 1] = OP_LOADIMMED_STR; + // it's possible the string has already been converted + if (U8(mCurStringTable[mCodeBlock->code[ip]]) != StringTagPrefixByte) + { + U32 id = GameAddTaggedString(mCurStringTable + mCodeBlock->code[ip]); + dSprintf(mCurStringTable + mCodeBlock->code[ip] + 1, 7, "%d", id); + *(mCurStringTable + mCodeBlock->code[ip]) = StringTagPrefixByte; + } + + // Fallthrough + OPCodeReturn ret = op_loadimmed_str(ip); + + return ret; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_str(U32 &ip) +{ + STR.setStringValue(mCurStringTable + mCodeBlock->code[ip++]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_docblock_str(U32 &ip) +{ + // If the first word of the doc is '\class' or '@class', then this + // is a namespace doc block, otherwise it is a function doc block. + const char* docblock = mCurStringTable + mCodeBlock->code[ip++]; + + const char* sansClass = dStrstr(docblock, "@class"); + if (!sansClass) + sansClass = dStrstr(docblock, "\\class"); + + if (sansClass) + { + // Don't save the class declaration. Scan past the 'class' + // keyword and up to the first whitespace. + sansClass += 7; + S32 index = 0; + while ((*sansClass != ' ') && (*sansClass != '\n') && *sansClass && (index < (nsDocLength - 1))) + { + mNSDocBlockClass[index++] = *sansClass; + sansClass++; + } + mNSDocBlockClass[index] = '\0'; + + mCurNSDocBlock = sansClass + 1; + } + else + mCurFNDocBlock = docblock; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_ident(U32 &ip) +{ + STR.setStringValue(CodeToSTE(mCodeBlock->code, ip)); + ip += 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_callfunc_resolve(U32 &ip) +{ + // This deals with a function that is potentially living in a namespace. + StringTableEntry fnNamespace = CodeToSTE(mCodeBlock->code, ip + 2); + StringTableEntry fnName = CodeToSTE(mCodeBlock->code, ip); + + // Try to look it up. + mNSEntry = Namespace::find(fnNamespace)->lookup(fnName); + if (!mNSEntry) + { + ip += 5; + Con::warnf(ConsoleLogEntry::General, + "%s: Unable to find function %s%s%s", + mCodeBlock->getFileLine(ip - 7), fnNamespace ? fnNamespace : "", + fnNamespace ? "::" : "", fnName); + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + // Fallthrough to op_callfunc_resolve + OPCodeReturn ret = op_callfunc(ip); + + return ret; +} + +OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) +{ + // This routingId is set when we query the object as to whether + // it handles this method. It is set to an enum from the table + // above indicating whether it handles it on a component it owns + // or just on the object. + S32 routingId = 0; + + U32 *code = mCodeBlock->code; + + StringTableEntry fnName = CodeToSTE(code, ip); + + //if this is called from inside a function, append the ip and codeptr + if (gEvalState.getStackDepth() > 0) + { + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + } + + U32 callType = code[ip + 4]; + + ip += 5; + CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); + + const char *componentReturnValue = ""; + Namespace *ns = NULL; + + if (callType == FuncCallExprNode::FunctionCall) + { + if (!mNSEntry) + mNSEntry = Namespace::global()->lookup(fnName); + } + else if (callType == FuncCallExprNode::MethodCall) + { + mSaveObject = gEvalState.thisObject; + gEvalState.thisObject = Sim::findObject((const char*)mCallArgv[1]); + if (!gEvalState.thisObject) + { + // Go back to the previous saved object. + gEvalState.thisObject = mSaveObject; + + Con::warnf(ConsoleLogEntry::General, "%s: Unable to find object: '%s' attempting to call function '%s'", mCodeBlock->getFileLine(ip - 4), (const char*)mCallArgv[1], fnName); + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + return OPCodeReturn::success; + } + + bool handlesMethod = gEvalState.thisObject->handlesConsoleMethod(fnName, &routingId); + if (handlesMethod && routingId == MethodOnComponent) + { + ICallMethod *pComponent = dynamic_cast(gEvalState.thisObject); + if (pComponent) + componentReturnValue = pComponent->callMethodArgList(mCallArgc, mCallArgv, false); + } + + ns = gEvalState.thisObject->getNamespace(); + if (ns) + mNSEntry = ns->lookup(fnName); + else + mNSEntry = NULL; + } + else // it's a ParentCall + { + if (mExec.thisNamespace) + { + ns = mExec.thisNamespace->mParent; + if (ns) + mNSEntry = ns->lookup(fnName); + else + mNSEntry = NULL; + } + else + { + ns = NULL; + mNSEntry = NULL; + } + } + + Namespace::Entry::CallbackUnion * nsCb = NULL; + const char * nsUsage = NULL; + if (mNSEntry) + { + nsCb = &mNSEntry->cb; + nsUsage = mNSEntry->mUsage; + routingId = 0; + } + if (!mNSEntry || mExec.noCalls) + { + if (!mExec.noCalls && !(routingId == MethodOnComponent)) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + if (callType == FuncCallExprNode::MethodCall) + { + Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", + gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", + gEvalState.thisObject->getId(), Con::getNamespaceList(ns)); + } + } + STR.popFrame(); + CSTK.popFrame(); + + if (routingId == MethodOnComponent) + STR.setStringValue(componentReturnValue); + else + STR.setStringValue(""); + return OPCodeReturn::success; + } + + // ConsoleFunctionType is for any function defined by script. + // Any 'callback' type is an engine function that is exposed to script. + if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType) + { + ConsoleValueRef ret; + if (mNSEntry->mFunctionOffset) + ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage); + + STR.popFrame(); + // Functions are assumed to return strings, so look ahead to see if we can skip the conversion + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (U32)((S32)ret); + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = (F32)ret; + } + else if (code[ip] == OP_STR_TO_NONE) + { + STR.setStringValue(ret.getStringValue()); + ip++; + } + else + STR.setStringValue((const char*)ret); + + // This will clear everything including returnValue + CSTK.popFrame(); + //STR.clearFunctionOffset(); + } + else + { + const char* nsName = ns ? ns->mName : ""; +#ifndef TORQUE_DEBUG + // [tom, 12/13/2006] This stops tools functions from working in the console, + // which is useful behavior when debugging so I'm ifdefing this out for debug builds. + if (mNSEntry->mToolOnly && !Con::isCurrentScriptToolScript()) + { + Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", mCodeBlock->getFileLine(ip - 6), nsName, fnName); + } + else +#endif + if ((mNSEntry->mMinArgs && S32(mCallArgc) < mNSEntry->mMinArgs) || (mNSEntry->mMaxArgs && S32(mCallArgc) > mNSEntry->mMaxArgs)) + { + Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", + mCodeBlock->getFileLine(ip - 6), nsName, fnName, + mCallArgc, mNSEntry->mMinArgs, mNSEntry->mMaxArgs); + Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", mCodeBlock->getFileLine(ip - 6), mNSEntry->mUsage); + STR.popFrame(); + CSTK.popFrame(); + } + else + { + switch (mNSEntry->mType) + { + case Namespace::Entry::StringCallbackType: + { + const char *ret = mNSEntry->cb.mStringCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (ret != STR.getStringValue()) + STR.setStringValue(ret); + //else + // sSTR.setLen(dStrlen(ret)); + break; + } + case Namespace::Entry::IntCallbackType: + { + S32 result = mNSEntry->cb.mIntCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + case Namespace::Entry::FloatCallbackType: + { + F64 result = mNSEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (S64)result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setFloatValue(result); + break; + } + case Namespace::Entry::VoidCallbackType: + mNSEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + if (code[ip] != OP_STR_TO_NONE && Con::getBoolVariable("$Con::warnVoidAssignment", true)) + Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", mCodeBlock->getFileLine(ip - 6), fnName, mExec.functionName); + + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + break; + case Namespace::Entry::BoolCallbackType: + { + bool result = mNSEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + } + } + } + + if (callType == FuncCallExprNode::MethodCall) + gEvalState.thisObject = mSaveObject; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip) +{ + // get function name. This is the 'function pointer'. + StringTableEntry fnName = StringTable->insert(STR.getStringValue()); + + U32 *code = mCodeBlock->code; + + mNSEntry = Namespace::global()->lookup(fnName); + + //if this is called from inside a function, append the ip and codeptr + if (gEvalState.getStackDepth() > 0) + { + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + } + + CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); + + + if (!mNSEntry || mExec.noCalls) + { + if (!mExec.noCalls) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + } + STR.popFrame(); + CSTK.popFrame(); + + STR.setStringValue(""); + return OPCodeReturn::success; + } + + // ConsoleFunctionType is for any function defined by script. + // Any 'callback' type is an engine function that is exposed to script. + if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType) + { + ConsoleValueRef ret; + if (mNSEntry->mFunctionOffset) + ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage); + + STR.popFrame(); + // Functions are assumed to return strings, so look ahead to see if we can skip the conversion + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (U32)((S32)ret); + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = (F32)ret; + } + else if (code[ip] == OP_STR_TO_NONE) + { + STR.setStringValue(ret.getStringValue()); + ip++; + } + else + STR.setStringValue((const char*)ret); + + // This will clear everything including returnValue + CSTK.popFrame(); + //STR.clearFunctionOffset(); + } + else + { + const char* nsName = ""; + + Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; + const char * nsUsage = mNSEntry->mUsage; + +#ifndef TORQUE_DEBUG + // [tom, 12/13/2006] This stops tools functions from working in the console, + // which is useful behavior when debugging so I'm ifdefing this out for debug builds. + if (mNSEntry->mToolOnly && !Con::isCurrentScriptToolScript()) + { + Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", mCodeBlock->getFileLine(ip - 6), nsName, fnName); + } + else +#endif + if ((mNSEntry->mMinArgs && S32(mCallArgc) < mNSEntry->mMinArgs) || (mNSEntry->mMaxArgs && S32(mCallArgc) > mNSEntry->mMaxArgs)) + { + Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", + mCodeBlock->getFileLine(ip - 6), nsName, fnName, + mCallArgc, mNSEntry->mMinArgs, mNSEntry->mMaxArgs); + Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", mCodeBlock->getFileLine(ip - 6), mNSEntry->mUsage); + STR.popFrame(); + CSTK.popFrame(); + } + else + { + switch (mNSEntry->mType) + { + case Namespace::Entry::StringCallbackType: + { + const char *ret = mNSEntry->cb.mStringCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (ret != STR.getStringValue()) + STR.setStringValue(ret); + //else + // sSTR.setLen(dStrlen(ret)); + break; + } + case Namespace::Entry::IntCallbackType: + { + S32 result = mNSEntry->cb.mIntCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + case Namespace::Entry::FloatCallbackType: + { + F64 result = mNSEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (S64)result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setFloatValue(result); + break; + } + case Namespace::Entry::VoidCallbackType: + mNSEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + if (code[ip] != OP_STR_TO_NONE && Con::getBoolVariable("$Con::warnVoidAssignment", true)) + Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", mCodeBlock->getFileLine(ip - 6), fnName, mExec.functionName); + + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + break; + case Namespace::Entry::BoolCallbackType: + { + bool result = mNSEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + } + } + } + + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + StringTableEntry fnName = CodeToSTE(code, ip); + + //if this is called from inside a function, append the ip and codeptr + if (gEvalState.getStackDepth() > 0) + { + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + } + + ip += 2; + CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); + + Namespace *ns = mThisObject->getNamespace(); + if (ns) + mNSEntry = ns->lookup(fnName); + else + mNSEntry = NULL; + + if (!mNSEntry || mExec.noCalls) + { + if (!mExec.noCalls) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", + mThisObject->getName() ? mThisObject->getName() : "", + mThisObject->getId(), Con::getNamespaceList(ns)); + } + STR.popFrame(); + CSTK.popFrame(); + + STR.setStringValue(""); + return OPCodeReturn::success; + } + + // ConsoleFunctionType is for any function defined by script. + // Any 'callback' type is an engine function that is exposed to script. + if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType) + { + ConsoleValueRef ret; + if (mNSEntry->mFunctionOffset) + ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage); + + STR.popFrame(); + // Functions are assumed to return strings, so look ahead to see if we can skip the conversion + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (U32)((S32)ret); + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = (F32)ret; + } + else if (code[ip] == OP_STR_TO_NONE) + { + STR.setStringValue(ret.getStringValue()); + ip++; + } + else + STR.setStringValue((const char*)ret); + + // This will clear everything including returnValue + CSTK.popFrame(); + //STR.clearFunctionOffset(); + } + else + { + Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; + const char * nsUsage = mNSEntry->mUsage; + const char* nsName = ns ? ns->mName : ""; +#ifndef TORQUE_DEBUG + // [tom, 12/13/2006] This stops tools functions from working in the console, + // which is useful behavior when debugging so I'm ifdefing this out for debug builds. + if (mNSEntry->mToolOnly && !Con::isCurrentScriptToolScript()) + { + Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", mCodeBlock->getFileLine(ip - 6), nsName, fnName); + } + else +#endif + if ((mNSEntry->mMinArgs && S32(mCallArgc) < mNSEntry->mMinArgs) || (mNSEntry->mMaxArgs && S32(mCallArgc) > mNSEntry->mMaxArgs)) + { + Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", + mCodeBlock->getFileLine(ip - 6), nsName, fnName, + mCallArgc, mNSEntry->mMinArgs, mNSEntry->mMaxArgs); + Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", mCodeBlock->getFileLine(ip - 6), mNSEntry->mUsage); + STR.popFrame(); + CSTK.popFrame(); + } + else + { + switch (mNSEntry->mType) + { + case Namespace::Entry::StringCallbackType: + { + const char *ret = mNSEntry->cb.mStringCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (ret != STR.getStringValue()) + STR.setStringValue(ret); + //else + // sSTR.setLen(dStrlen(ret)); + break; + } + case Namespace::Entry::IntCallbackType: + { + S32 result = mNSEntry->cb.mIntCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + case Namespace::Entry::FloatCallbackType: + { + F64 result = mNSEntry->cb.mFloatCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (S64)result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setFloatValue(result); + break; + } + case Namespace::Entry::VoidCallbackType: + mNSEntry->cb.mVoidCallbackFunc(mThisObject, mCallArgc, mCallArgv); + if (code[ip] != OP_STR_TO_NONE && Con::getBoolVariable("$Con::warnVoidAssignment", true)) + Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", mCodeBlock->getFileLine(ip - 6), fnName, mExec.functionName); + + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + break; + case Namespace::Entry::BoolCallbackType: + { + bool result = mNSEntry->cb.mBoolCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + } + } + } + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str(U32 &ip) +{ + STR.advance(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str_appendchar(U32 &ip) +{ + STR.advanceChar(mCodeBlock->code[ip++]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str_comma(U32 &ip) +{ + STR.advanceChar('_'); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str_nul(U32 &ip) +{ + STR.advanceChar(0); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_rewind_str(U32 &ip) +{ + STR.rewind(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_terminate_rewind_str(U32 &ip) +{ + STR.rewindTerminate(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_compare_str(U32 &ip) +{ + intStack[++_UINT] = STR.compare(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push(U32 &ip) +{ + STR.push(); + CSTK.pushStringStackPtr(STR.getPreviousStringValuePtr()); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_uint(U32 &ip) +{ + CSTK.pushUINT(intStack[_UINT]); + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_flt(U32 &ip) +{ + CSTK.pushFLT(floatStack[_FLT]); + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_var(U32 &ip) +{ + if (gEvalState.currentVariable) + CSTK.pushValue(gEvalState.currentVariable->value); + else + CSTK.pushString(""); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_this(U32 &ip) +{ + StringTableEntry varName = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // shorthand OP_SETCURVAR + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarName(varName); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + // shorthand OP_LOADVAR_STR (since objs can be by name we can't assume uint) + STR.setStringValue(gEvalState.getStringVariable()); + + // shorthand OP_PUSH + STR.push(); + CSTK.pushStringStackPtr(STR.getPreviousStringValuePtr()); + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_frame(U32 &ip) +{ + STR.pushFrame(); + CSTK.pushFrame(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_assert(U32 &ip) +{ + if (!intStack[_UINT--]) + { + const char *message = mCurStringTable + mCodeBlock->code[ip]; + + U32 breakLine, inst; + mCodeBlock->findBreakLine(ip - 1, breakLine, inst); + + if (PlatformAssert::processAssert(PlatformAssert::Fatal, + mCodeBlock->name ? mCodeBlock->name : "eval", + breakLine, + message)) + { + if (TelDebugger && TelDebugger->isConnected() && breakLine > 0) + { + TelDebugger->breakProcess(); + } + else + Platform::debugBreak(); + } + } + + ip++; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_break(U32 &ip) +{ + //append the ip and codeptr before managing the breakpoint! + AssertFatal(gEvalState.getStackDepth() > 0, "Empty eval stack on break!"); + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + + U32 breakLine; + mCodeBlock->findBreakLine(ip - 1, breakLine, mCurrentInstruction); + if (!breakLine) + return OPCodeReturn::breakContinue; + TelDebugger->executionStopped(mCodeBlock, breakLine); + return OPCodeReturn::breakContinue; +} + +OPCodeReturn CodeInterpreter::op_iter_begin_str(U32 &ip) +{ + iterStack[_ITER].mIsStringIter = true; + + // Emulate fallthrough: + OPCodeReturn fallthrough = op_iter_begin(ip); + + return fallthrough; +} + +OPCodeReturn CodeInterpreter::op_iter_begin(U32 &ip) +{ + StringTableEntry varName = CodeToSTE(mCodeBlock->code, ip); + U32 failIp = mCodeBlock->code[ip + 2]; + + IterStackRecord& iter = iterStack[_ITER]; + + iter.mVariable = gEvalState.getCurrentFrame().add(varName); + + if (iter.mIsStringIter) + { + iter.mData.mStr.mString = STR.getStringValuePtr(); + iter.mData.mStr.mIndex = 0; + } + else + { + // Look up the object. + + SimSet* set; + if (!Sim::findObject(STR.getStringValue(), set)) + { + Con::errorf(ConsoleLogEntry::General, "No SimSet object '%s'", STR.getStringValue()); + Con::errorf(ConsoleLogEntry::General, "Did you mean to use 'foreach$' instead of 'foreach'?"); + ip = failIp; + return OPCodeReturn::success; + } + + // Set up. + + iter.mData.mObj.mSet = set; + iter.mData.mObj.mIndex = 0; + } + + _ITER++; + mIterDepth++; + + STR.push(); + + ip += 3; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_iter(U32 &ip) +{ + U32 breakIp = mCodeBlock->code[ip]; + IterStackRecord& iter = iterStack[_ITER - 1]; + + if (iter.mIsStringIter) + { + const char* str = StringStackPtrRef(iter.mData.mStr.mString).getPtr(&STR); + + U32 startIndex = iter.mData.mStr.mIndex; + U32 endIndex = startIndex; + + // Break if at end. + + if (!str[startIndex]) + { + ip = breakIp; + return OPCodeReturn::success; // continue in old interpreter + } + + // Find right end of current component. + + if (!dIsspace(str[endIndex])) + do ++endIndex; + while (str[endIndex] && !dIsspace(str[endIndex])); + + // Extract component. + + if (endIndex != startIndex) + { + char savedChar = str[endIndex]; + const_cast< char* >(str)[endIndex] = '\0'; // We are on the string stack so this is okay. + iter.mVariable->setStringValue(&str[startIndex]); + const_cast< char* >(str)[endIndex] = savedChar; + } + else + iter.mVariable->setStringValue(""); + + // Skip separator. + if (str[endIndex] != '\0') + ++endIndex; + + iter.mData.mStr.mIndex = endIndex; + } + else + { + U32 index = iter.mData.mObj.mIndex; + SimSet* set = iter.mData.mObj.mSet; + + if (index >= set->size()) + { + ip = breakIp; + return OPCodeReturn::success; // continue in old interpreter + } + + iter.mVariable->setIntValue(set->at(index)->getId()); + iter.mData.mObj.mIndex = index + 1; + } + + ++ip; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_iter_end(U32 &ip) +{ + --_ITER; + --mIterDepth; + STR.rewind(); + iterStack[_ITER].mIsStringIter = false; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_invalid(U32 &ip) +{ + // Invalid does nothing. + return OPCodeReturn::exitCode; +} diff --git a/Engine/source/console/codeInterpreter.h b/Engine/source/console/codeInterpreter.h new file mode 100644 index 000000000..133222726 --- /dev/null +++ b/Engine/source/console/codeInterpreter.h @@ -0,0 +1,262 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _CODEINTERPRETER_H_ +#define _CODEINTERPRETER_H_ + +#include "console/codeBlock.h" +#include "console/console.h" +#include "console/consoleInternal.h" + +/// Frame data for a foreach/foreach$ loop. +struct IterStackRecord +{ + /// If true, this is a foreach$ loop; if not, it's a foreach loop. + bool mIsStringIter; + + /// The iterator variable. + Dictionary::Entry* mVariable; + + /// Information for an object iterator loop. + struct ObjectPos + { + /// The set being iterated over. + SimSet* mSet; + + /// Current index in the set. + U32 mIndex; + }; + + /// Information for a string iterator loop. + struct StringPos + { + /// The raw string data on the string stack. + StringStackPtr mString; + + /// Current parsing position. + U32 mIndex; + }; + + union + { + ObjectPos mObj; + StringPos mStr; + } mData; +}; + +enum OPCodeReturn +{ + exitCode = -1, + success = 0, + breakContinue = 1 +}; + +class CodeInterpreter +{ +public: + CodeInterpreter(CodeBlock *cb); + ~CodeInterpreter(); + + ConsoleValueRef exec(U32 ip, + StringTableEntry functionName, + Namespace *thisNamespace, + U32 argc, + ConsoleValueRef *argv, + bool noCalls, + StringTableEntry packageName, + S32 setFrame); + + static void init(); + + // Methods +private: + void parseArgs(U32 &ip); + + /// Group op codes + /// @{ + + OPCodeReturn op_func_decl(U32 &ip); + OPCodeReturn op_create_object(U32 &ip); + OPCodeReturn op_add_object(U32 &ip); + OPCodeReturn op_end_object(U32 &ip); + OPCodeReturn op_finish_object(U32 &ip); + OPCodeReturn op_jmpiffnot(U32 &ip); + OPCodeReturn op_jmpifnot(U32 &ip); + OPCodeReturn op_jmpiff(U32 &ip); + OPCodeReturn op_jmpif(U32 &ip); + OPCodeReturn op_jmpifnot_np(U32 &ip); + OPCodeReturn op_jmpif_np(U32 &ip); + OPCodeReturn op_jmp(U32 &ip); + OPCodeReturn op_return_void(U32 &ip); + OPCodeReturn op_return(U32 &ip); + OPCodeReturn op_return_flt(U32 &ip); + OPCodeReturn op_return_uint(U32 &ip); + OPCodeReturn op_cmpeq(U32 &ip); + OPCodeReturn op_cmpgr(U32 &ip); + OPCodeReturn op_cmpge(U32 &ip); + OPCodeReturn op_cmplt(U32 &ip); + OPCodeReturn op_cmple(U32 &ip); + OPCodeReturn op_cmpne(U32 &ip); + OPCodeReturn op_xor(U32 &ip); + OPCodeReturn op_mod(U32 &ip); + OPCodeReturn op_bitand(U32 &ip); + OPCodeReturn op_bitor(U32 &ip); + OPCodeReturn op_not(U32 &ip); + OPCodeReturn op_notf(U32 &ip); + OPCodeReturn op_onescomplement(U32 &ip); + OPCodeReturn op_shr(U32 &ip); + OPCodeReturn op_shl(U32 &ip); + OPCodeReturn op_and(U32 &ip); + OPCodeReturn op_or(U32 &ip); + OPCodeReturn op_add(U32 &ip); + OPCodeReturn op_sub(U32 &ip); + OPCodeReturn op_mul(U32 &ip); + OPCodeReturn op_div(U32 &ip); + OPCodeReturn op_neg(U32 &ip); + OPCodeReturn op_inc(U32 &ip); + OPCodeReturn op_dec(U32 &ip); + OPCodeReturn op_setcurvar(U32 &ip); + OPCodeReturn op_setcurvar_create(U32 &ip); + OPCodeReturn op_setcurvar_array(U32 &ip); + OPCodeReturn op_setcurvar_array_varlookup(U32 &ip); + OPCodeReturn op_setcurvar_array_create(U32 &ip); + OPCodeReturn op_setcurvar_array_create_varlookup(U32 &ip); + OPCodeReturn op_loadvar_uint(U32 &ip); + OPCodeReturn op_loadvar_flt(U32 &ip); + OPCodeReturn op_loadvar_str(U32 &ip); + OPCodeReturn op_loadvar_var(U32 &ip); + OPCodeReturn op_savevar_uint(U32 &ip); + OPCodeReturn op_savevar_flt(U32 &ip); + OPCodeReturn op_savevar_str(U32 &ip); + OPCodeReturn op_savevar_var(U32 &ip); + OPCodeReturn op_setcurobject(U32 &ip); + OPCodeReturn op_setcurobject_internal(U32 &ip); + OPCodeReturn op_setcurobject_new(U32 &ip); + OPCodeReturn op_setcurfield(U32 &ip); + OPCodeReturn op_setcurfield_array(U32 &ip); + OPCodeReturn op_setcurfield_type(U32 &ip); + OPCodeReturn op_setcurfield_this(U32 &ip); + OPCodeReturn op_setcurfield_array_var(U32 &ip); + OPCodeReturn op_loadfield_uint(U32 &ip); + OPCodeReturn op_loadfield_flt(U32 &ip); + OPCodeReturn op_loadfield_str(U32 &ip); + OPCodeReturn op_savefield_uint(U32 &ip); + OPCodeReturn op_savefield_flt(U32 &ip); + OPCodeReturn op_savefield_str(U32 &ip); + OPCodeReturn op_str_to_uint(U32 &ip); + OPCodeReturn op_str_to_flt(U32 &ip); + OPCodeReturn op_str_to_none(U32 &ip); + OPCodeReturn op_flt_to_uint(U32 &ip); + OPCodeReturn op_flt_to_str(U32 &ip); + OPCodeReturn op_flt_to_none(U32 &ip); + OPCodeReturn op_uint_to_flt(U32 &ip); + OPCodeReturn op_uint_to_str(U32 &ip); + OPCodeReturn op_uint_to_none(U32 &ip); + OPCodeReturn op_copyvar_to_none(U32 &ip); + OPCodeReturn op_loadimmed_uint(U32 &ip); + OPCodeReturn op_loadimmed_flt(U32 &ip); + OPCodeReturn op_tag_to_str(U32 &ip); + OPCodeReturn op_loadimmed_str(U32 &ip); + OPCodeReturn op_docblock_str(U32 &ip); + OPCodeReturn op_loadimmed_ident(U32 &ip); + OPCodeReturn op_callfunc_resolve(U32 &ip); + OPCodeReturn op_callfunc(U32 &ip); + OPCodeReturn op_callfunc_pointer(U32 &ip); + OPCodeReturn op_callfunc_this(U32 &ip); + OPCodeReturn op_advance_str(U32 &ip); + OPCodeReturn op_advance_str_appendchar(U32 &ip); + OPCodeReturn op_advance_str_comma(U32 &ip); + OPCodeReturn op_advance_str_nul(U32 &ip); + OPCodeReturn op_rewind_str(U32 &ip); + OPCodeReturn op_terminate_rewind_str(U32 &ip); + OPCodeReturn op_compare_str(U32 &ip); + OPCodeReturn op_push(U32 &ip); + OPCodeReturn op_push_uint(U32 &ip); + OPCodeReturn op_push_flt(U32 &ip); + OPCodeReturn op_push_var(U32 &ip); + OPCodeReturn op_push_this(U32 &ip); + OPCodeReturn op_push_frame(U32 &ip); + OPCodeReturn op_assert(U32 &ip); + OPCodeReturn op_break(U32 &ip); + OPCodeReturn op_iter_begin_str(U32 &ip); + OPCodeReturn op_iter_begin(U32 &ip); + OPCodeReturn op_iter(U32 &ip); + OPCodeReturn op_iter_end(U32 &ip); + OPCodeReturn op_invalid(U32 &ip); + + /// @} + +private: + CodeBlock *mCodeBlock; + + /// Group exec arguments. + struct + { + StringTableEntry functionName; + Namespace *thisNamespace; + U32 argc; + ConsoleValueRef *argv; + bool noCalls; + StringTableEntry packageName; + S32 setFrame; + } mExec; + + U32 mIterDepth; + F64 *mCurFloatTable; + char *mCurStringTable; + StringTableEntry mThisFunctionName; + bool mPopFrame; + + // Add local object creation stack [7/9/2007 Black] + static const U32 objectCreationStackSize = 32; + U32 mObjectCreationStackIndex; + struct + { + SimObject *newObject; + U32 failJump; + } mObjectCreationStack[objectCreationStackSize]; + + SimObject *mCurrentNewObject; + U32 mFailJump; + StringTableEntry mPrevField; + StringTableEntry mCurField; + SimObject *mPrevObject; + SimObject *mCurObject; + SimObject *mSaveObject; + SimObject *mThisObject; + Namespace::Entry *mNSEntry; + StringTableEntry mCurFNDocBlock; + StringTableEntry mCurNSDocBlock; + U32 mCallArgc; + ConsoleValueRef *mCallArgv; + CodeBlock *mSaveCodeBlock; + + // note: anything returned is pushed to CSTK and will be invalidated on the next exec() + ConsoleValueRef mReturnValue; + + U32 mCurrentInstruction; + + static const S32 nsDocLength = 128; + char mNSDocBlockClass[nsDocLength]; +}; + +#endif \ No newline at end of file diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 1d872df8a..dc6f8a5f5 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -20,11 +20,6 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// -// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames -// Copyright (C) 2015 Faust Logic, Inc. -//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// - #include "platform/platform.h" #include "console/console.h" @@ -45,95 +40,38 @@ #include "util/messaging/message.h" #include "core/frameAllocator.h" +#include "console/codeInterpreter.h" + #ifndef TORQUE_TGB_ONLY #include "materials/materialDefinition.h" #include "materials/materialManager.h" #endif -// Uncomment to optimize function calls at the expense of potential invalid package lookups -//#define COMPILER_OPTIMIZE_FUNCTION_CALLS - using namespace Compiler; -enum EvalConstants { - MaxStackSize = 1024, - MethodOnComponent = -2 -}; - namespace Con { -// Current script file name and root, these are registered as -// console variables. -extern StringTableEntry gCurrentFile; -extern StringTableEntry gCurrentRoot; -extern S32 gObjectCopyFailures; + // Current script file name and root, these are registered as + // console variables. + extern StringTableEntry gCurrentFile; + extern StringTableEntry gCurrentRoot; + extern S32 gObjectCopyFailures; } -/// Frame data for a foreach/foreach$ loop. -struct IterStackRecord -{ - /// If true, this is a foreach$ loop; if not, it's a foreach loop. - bool mIsStringIter; - - /// The iterator variable. - Dictionary::Entry* mVariable; - - /// Information for an object iterator loop. - struct ObjectPos - { - /// The set being iterated over. - SimSet* mSet; - - /// Current index in the set. - U32 mIndex; - }; - - /// Information for a string iterator loop. - struct StringPos - { - /// The raw string data on the string stack. - StringStackPtr mString; - - /// Current parsing position. - U32 mIndex; - }; - - union - { - ObjectPos mObj; - StringPos mStr; - } mData; -}; - -IterStackRecord iterStack[ MaxStackSize ]; - -F64 floatStack[MaxStackSize]; -S64 intStack[MaxStackSize]; - - - - -StringStack STR; -ConsoleValueStack CSTK; - -U32 _FLT = 0; ///< Stack pointer for floatStack. -U32 _UINT = 0; ///< Stack pointer for intStack. -U32 _ITER = 0; ///< Stack pointer for iterStack. - namespace Con { const char *getNamespaceList(Namespace *ns) { U32 size = 1; Namespace * walk; - for(walk = ns; walk; walk = walk->mParent) + for (walk = ns; walk; walk = walk->mParent) size += dStrlen(walk->mName) + 4; char *ret = Con::getReturnBuffer(size); ret[0] = 0; - for(walk = ns; walk; walk = walk->mParent) + for (walk = ns; walk; walk = walk->mParent) { dStrcat(ret, walk->mName); - if(walk->mParent) + if (walk->mParent) dStrcat(ret, " -> "); } return ret; @@ -145,13 +83,13 @@ namespace Con F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line) { F64 val = dAtof(str); - if(val != 0) + if (val != 0) return val; - else if(!dStricmp(str, "true")) + else if (!dStricmp(str, "true")) return 1; - else if(!dStricmp(str, "false")) + else if (!dStricmp(str, "false")) return 0; - else if(file) + else if (file) { Con::warnf(ConsoleLogEntry::General, "%s (%d): string always evaluates to 0.", file, line); return 0; @@ -170,28 +108,28 @@ namespace Con return STR.getReturnBuffer(bufferSize); } - char *getReturnBuffer( const char *stringToCopy ) + char *getReturnBuffer(const char *stringToCopy) { - U32 len = dStrlen( stringToCopy ) + 1; - char *ret = STR.getReturnBuffer( len); - dMemcpy( ret, stringToCopy, len ); + U32 len = dStrlen(stringToCopy) + 1; + char *ret = STR.getReturnBuffer(len); + dMemcpy(ret, stringToCopy, len); return ret; } - char* getReturnBuffer( const String& str ) + char* getReturnBuffer(const String& str) { const U32 size = str.size(); - char* ret = STR.getReturnBuffer( size ); - dMemcpy( ret, str.c_str(), size ); + char* ret = STR.getReturnBuffer(size); + dMemcpy(ret, str.c_str(), size); return ret; } - char* getReturnBuffer( const StringBuilder& str ) + char* getReturnBuffer(const StringBuilder& str) { - char* buffer = Con::getReturnBuffer( str.length() + 1 ); - str.copy( buffer ); - buffer[ str.length() ] = '\0'; - + char* buffer = Con::getReturnBuffer(str.length() + 1); + str.copy(buffer); + buffer[str.length()] = '\0'; + return buffer; } @@ -221,40 +159,40 @@ namespace Con return ret; } - char *getStringArg( const char *arg ) + char *getStringArg(const char *arg) { - U32 len = dStrlen( arg ) + 1; - char *ret = STR.getArgBuffer( len ); - dMemcpy( ret, arg, len ); + U32 len = dStrlen(arg) + 1; + char *ret = STR.getArgBuffer(len); + dMemcpy(ret, arg, len); return ret; } - char* getStringArg( const String& arg ) + char* getStringArg(const String& arg) { const U32 size = arg.size(); - char* ret = STR.getArgBuffer( size ); - dMemcpy( ret, arg.c_str(), size ); + char* ret = STR.getArgBuffer(size); + dMemcpy(ret, arg.c_str(), size); return ret; } } //------------------------------------------------------------ -inline void ExprEvalState::setCurVarName(StringTableEntry name) +void ExprEvalState::setCurVarName(StringTableEntry name) { - if(name[0] == '$') + if (name[0] == '$') currentVariable = globalVars.lookup(name); - else if( getStackDepth() > 0 ) + else if (getStackDepth() > 0) currentVariable = getCurrentFrame().lookup(name); - if(!currentVariable && gWarnUndefinedScriptVariables) + if (!currentVariable && gWarnUndefinedScriptVariables) Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name); } -inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name) +void ExprEvalState::setCurVarNameCreate(StringTableEntry name) { - if(name[0] == '$') + if (name[0] == '$') currentVariable = globalVars.add(name); - else if( getStackDepth() > 0 ) + else if (getStackDepth() > 0) currentVariable = getCurrentFrame().add(name); else { @@ -265,48 +203,48 @@ inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name) //------------------------------------------------------------ -inline S32 ExprEvalState::getIntVariable() +S32 ExprEvalState::getIntVariable() { return currentVariable ? currentVariable->getIntValue() : 0; } -inline F64 ExprEvalState::getFloatVariable() +F64 ExprEvalState::getFloatVariable() { return currentVariable ? currentVariable->getFloatValue() : 0; } -inline const char *ExprEvalState::getStringVariable() +const char *ExprEvalState::getStringVariable() { return currentVariable ? currentVariable->getStringValue() : ""; } //------------------------------------------------------------ -inline void ExprEvalState::setIntVariable(S32 val) +void ExprEvalState::setIntVariable(S32 val) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setIntValue(val); } -inline void ExprEvalState::setFloatVariable(F64 val) +void ExprEvalState::setFloatVariable(F64 val) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setFloatValue(val); } -inline void ExprEvalState::setStringVariable(const char *val) +void ExprEvalState::setStringVariable(const char *val) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setStringValue(val); } -inline void ExprEvalState::setStringStackPtrVariable(StringStackPtr str) +void ExprEvalState::setStringStackPtrVariable(StringStackPtr str) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setStringStackPtrValue(str); } -inline void ExprEvalState::setCopyVariable() +void ExprEvalState::setCopyVariable() { if (copyVariable) { @@ -314,2004 +252,24 @@ inline void ExprEvalState::setCopyVariable() { case ConsoleValue::TypeInternalInt: currentVariable->setIntValue(copyVariable->getIntValue()); - break; + break; case ConsoleValue::TypeInternalFloat: currentVariable->setFloatValue(copyVariable->getFloatValue()); - break; + break; default: currentVariable->setStringValue(copyVariable->getStringValue()); - break; + break; } } } //------------------------------------------------------------ -// Gets a component of an object's field value or a variable and returns it -// in val. -static void getFieldComponent( SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField, char val[] ) -{ - const char* prevVal = NULL; - - // Grab value from object. - if( object && field ) - prevVal = object->getDataField( field, array ); - - // Otherwise, grab from the string stack. The value coming in will always - // be a string because that is how multicomponent variables are handled. - else - prevVal = STR.getStringValue(); - - // Make sure we got a value. - if ( prevVal && *prevVal ) - { - static const StringTableEntry xyzw[] = - { - StringTable->insert( "x" ), - StringTable->insert( "y" ), - StringTable->insert( "z" ), - StringTable->insert( "w" ) - }; - - static const StringTableEntry rgba[] = - { - StringTable->insert( "r" ), - StringTable->insert( "g" ), - StringTable->insert( "b" ), - StringTable->insert( "a" ) - }; - - // Translate xyzw and rgba into the indexed component - // of the variable or field. - if ( subField == xyzw[0] || subField == rgba[0] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 0, " \t\n") ); - - else if ( subField == xyzw[1] || subField == rgba[1] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 1, " \t\n") ); - - else if ( subField == xyzw[2] || subField == rgba[2] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 2, " \t\n") ); - - else if ( subField == xyzw[3] || subField == rgba[3] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 3, " \t\n") ); - - else - val[0] = 0; - } - else - val[0] = 0; -} - -// Sets a component of an object's field value based on the sub field. 'x' will -// set the first field, 'y' the second, and 'z' the third. -static void setFieldComponent( SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField ) -{ - // Copy the current string value - char strValue[1024]; - dStrncpy( strValue, STR.getStringValue(), 1024 ); - - char val[1024] = ""; - const char* prevVal = NULL; - - // Set the value on an object field. - if( object && field ) - prevVal = object->getDataField( field, array ); - - // Set the value on a variable. - else if( gEvalState.currentVariable ) - prevVal = gEvalState.getStringVariable(); - - // Ensure that the variable has a value - if (!prevVal) - return; - - static const StringTableEntry xyzw[] = - { - StringTable->insert( "x" ), - StringTable->insert( "y" ), - StringTable->insert( "z" ), - StringTable->insert( "w" ) - }; - - static const StringTableEntry rgba[] = - { - StringTable->insert( "r" ), - StringTable->insert( "g" ), - StringTable->insert( "b" ), - StringTable->insert( "a" ) - }; - - // Insert the value into the specified - // component of the string. - if ( subField == xyzw[0] || subField == rgba[0] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") ); - - else if ( subField == xyzw[1] || subField == rgba[1] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 1, strValue, " \t\n") ); - - else if ( subField == xyzw[2] || subField == rgba[2] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 2, strValue, " \t\n") ); - - else if ( subField == xyzw[3] || subField == rgba[3] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 3, strValue, " \t\n") ); - - if ( val[0] != 0 ) - { - // Update the field or variable. - if( object && field ) - object->setDataField( field, 0, val ); - else if( gEvalState.currentVariable ) - gEvalState.setStringVariable( val ); - } -} ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNamespace, U32 argc, ConsoleValueRef *argv, bool noCalls, StringTableEntry packageName, S32 setFrame) { - -#ifdef TORQUE_VALIDATE_STACK - U32 stackStart = STR.mStartStackSize; - U32 consoleStackStart = CSTK.mStackPos; -#endif - - //Con::printf("CodeBlock::exec(%s,%u)", functionName ? functionName : "??", ip); - - static char traceBuffer[1024]; - S32 i; - - U32 iterDepth = 0; - - incRefCount(); - F64 *curFloatTable; - char *curStringTable; - S32 curStringTableLen = 0; //clint to ensure we dont overwrite it - STR.clearFunctionOffset(); // ensures arg buffer offset is back to 0 - StringTableEntry thisFunctionName = NULL; - bool popFrame = false; - if(argv) - { - // assume this points into a function decl: - U32 fnArgc = code[ip + 2 + 6]; - thisFunctionName = CodeToSTE(code, ip); - S32 wantedArgc = getMin(argc-1, fnArgc); // argv[0] is func name - if(gEvalState.traceOn) - { - traceBuffer[0] = 0; - dStrcat(traceBuffer, "Entering "); - if(packageName) - { - dStrcat(traceBuffer, "["); - dStrcat(traceBuffer, packageName); - dStrcat(traceBuffer, "]"); - } - if(thisNamespace && thisNamespace->mName) - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s::%s(", thisNamespace->mName, thisFunctionName); - } - else - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s(", thisFunctionName); - } - for(i = 0; i < wantedArgc; i++) - { - dStrcat(traceBuffer, argv[i+1]); - if(i != wantedArgc - 1) - dStrcat(traceBuffer, ", "); - } - dStrcat(traceBuffer, ")"); - Con::printf("%s", traceBuffer); - } - gEvalState.pushFrame(thisFunctionName, thisNamespace); - popFrame = true; - - for(i = 0; i < wantedArgc; i++) - { - StringTableEntry var = CodeToSTE(code, ip + (2 + 6 + 1) + (i * 2)); - gEvalState.setCurVarNameCreate(var); - - ConsoleValueRef ref = argv[i+1]; - - switch(argv[i+1].getType()) - { - case ConsoleValue::TypeInternalInt: - gEvalState.setIntVariable(argv[i+1]); - break; - case ConsoleValue::TypeInternalFloat: - gEvalState.setFloatVariable(argv[i+1]); - break; - case ConsoleValue::TypeInternalStringStackPtr: - gEvalState.setStringStackPtrVariable(argv[i+1].getStringStackPtrValue()); - break; - case ConsoleValue::TypeInternalStackString: - case ConsoleValue::TypeInternalString: - default: - gEvalState.setStringVariable(argv[i+1]); - break; - } - } - - ip = ip + (fnArgc * 2) + (2 + 6 + 1); - curFloatTable = functionFloats; - curStringTable = functionStrings; - curStringTableLen = functionStringsMaxLen; - } - else - { - curFloatTable = globalFloats; - curStringTable = globalStrings; - curStringTableLen = globalStringsMaxLen; - - // If requested stack frame isn't available, request a new one - // (this prevents assert failures when creating local - // variables without a stack frame) - if (gEvalState.getStackDepth() <= setFrame) - setFrame = -1; - - // Do we want this code to execute using a new stack frame? - if (setFrame < 0) - { - gEvalState.pushFrame(NULL, NULL); - popFrame = true; - } - else - { - // We want to copy a reference to an existing stack frame - // on to the top of the stack. Any change that occurs to - // the locals during this new frame will also occur in the - // original frame. - S32 stackIndex = gEvalState.getStackDepth() - setFrame - 1; - gEvalState.pushFrameRef( stackIndex ); - popFrame = true; - } - } - - // Grab the state of the telenet debugger here once - // so that the push and pop frames are always balanced. - const bool telDebuggerOn = TelDebugger && TelDebugger->isConnected(); - if ( telDebuggerOn && setFrame < 0 ) - TelDebugger->pushStackFrame(); - - StringTableEntry var, objParent; - StringTableEntry fnName; - StringTableEntry fnNamespace, fnPackage; - - // Add local object creation stack [7/9/2007 Black] - static const U32 objectCreationStackSize = 32; - U32 objectCreationStackIndex = 0; - struct { - SimObject *newObject; - U32 failJump; - } objectCreationStack[ objectCreationStackSize ]; - - SimObject *currentNewObject = 0; - U32 failJump = 0; - StringTableEntry prevField = NULL; - StringTableEntry curField = NULL; - SimObject *prevObject = NULL; - SimObject *curObject = NULL; - SimObject *saveObject=NULL; - Namespace::Entry *nsEntry; - Namespace *ns; - const char* curFNDocBlock = NULL; - const char* curNSDocBlock = NULL; - const S32 nsDocLength = 128; - char nsDocBlockClass[nsDocLength]; - - U32 callArgc; - ConsoleValueRef *callArgv; - - static char curFieldArray[256]; - static char prevFieldArray[256]; - - CodeBlock *saveCodeBlock = smCurrentCodeBlock; - smCurrentCodeBlock = this; - if(this->name) - { - Con::gCurrentFile = this->name; - Con::gCurrentRoot = this->modPath; - } - const char * val; - StringStackPtr retValue; - - // note: anything returned is pushed to CSTK and will be invalidated on the next exec() - ConsoleValueRef returnValue; - - // The frame temp is used by the variable accessor ops (OP_SAVEFIELD_* and - // OP_LOADFIELD_*) to store temporary values for the fields. - static S32 VAL_BUFFER_SIZE = 1024; - FrameTemp valBuffer( VAL_BUFFER_SIZE ); - - for(;;) - { - U32 instruction = code[ip++]; - nsEntry = NULL; -breakContinue: - switch(instruction) - { - case OP_FUNC_DECL: - if(!noCalls) - { - fnName = CodeToSTE(code, ip); - fnNamespace = CodeToSTE(code, ip+2); - fnPackage = CodeToSTE(code, ip+4); - bool hasBody = ( code[ ip + 6 ] & 0x01 ) != 0; - U32 lineNumber = code[ ip + 6 ] >> 1; - - Namespace::unlinkPackages(); - ns = Namespace::find(fnNamespace, fnPackage); - ns->addFunction(fnName, this, hasBody ? ip : 0, curFNDocBlock ? dStrdup( curFNDocBlock ) : NULL, lineNumber );// if no body, set the IP to 0 - if( curNSDocBlock ) - { - if( fnNamespace == StringTable->lookup( nsDocBlockClass ) ) - { - char *usageStr = dStrdup( curNSDocBlock ); - usageStr[dStrlen(usageStr)] = '\0'; - ns->mUsage = usageStr; - ns->mCleanUpUsage = true; - curNSDocBlock = NULL; - } - } - Namespace::relinkPackages(); - - // If we had a docblock, it's definitely not valid anymore, so clear it out. - curFNDocBlock = NULL; - - //Con::printf("Adding function %s::%s (%d)", fnNamespace, fnName, ip); - } - ip = code[ip + 7]; - break; - - case OP_CREATE_OBJECT: - { - // Read some useful info. - objParent = CodeToSTE(code, ip); - bool isDataBlock = code[ip + 2]; - bool isInternal = code[ip + 3]; - bool isSingleton = code[ip + 4]; - U32 lineNumber = code[ip + 5]; - failJump = code[ip + 6]; - - // If we don't allow calls, we certainly don't allow creating objects! - // Moved this to after failJump is set. Engine was crashing when - // noCalls = true and an object was being created at the beginning of - // a file. ADL. - if(noCalls) - { - ip = failJump; - break; - } - - // Push the old info to the stack - //Assert( objectCreationStackIndex < objectCreationStackSize ); - objectCreationStack[ objectCreationStackIndex ].newObject = currentNewObject; - objectCreationStack[ objectCreationStackIndex++ ].failJump = failJump; - - // Get the constructor information off the stack. - CSTK.getArgcArgv(NULL, &callArgc, &callArgv); - const char *objectName = callArgv[ 2 ]; - - // Con::printf("Creating object..."); - - // objectName = argv[1]... - currentNewObject = NULL; - - // Are we creating a datablock? If so, deal with case where we override - // an old one. - if(isDataBlock) - { - // Con::printf(" - is a datablock"); - - // Find the old one if any. - SimObject *db = Sim::getDataBlockGroup()->findObject( objectName ); - - // Make sure we're not changing types on ourselves... - if(db && dStricmp(db->getClassName(), callArgv[1])) - { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare data block %s with a different class.", getFileLine(ip), objectName); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - - // If there was one, set the currentNewObject and move on. - if(db) - currentNewObject = db; - } - else if (!isInternal) - { - // IF we aren't looking at a local/internal object, then check if - // this object already exists in the global space - - AbstractClassRep* rep = AbstractClassRep::findClassRep( objectName ); - if (rep != NULL) { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot name object [%s] the same name as a script class.", - getFileLine(ip), objectName); - ip = failJump; - STR.popFrame(); - break; - } - - SimObject *obj = Sim::findObject( (const char*)objectName ); - if (obj /*&& !obj->isLocalName()*/) - { - if ( isSingleton ) - { - // Make sure we're not trying to change types - if ( dStricmp( obj->getClassName(), (const char*)callArgv[1] ) != 0 ) - { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s] with a different class [%s] - was [%s].", - getFileLine(ip), objectName, (const char*)callArgv[1], obj->getClassName()); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - - // We're creating a singleton, so use the found object - // instead of creating a new object. - currentNewObject = obj; - } - else - { - const char* redefineBehavior = Con::getVariable( "$Con::redefineBehavior" ); - - if( dStricmp( redefineBehavior, "replaceExisting" ) == 0 ) - { - // Save our constructor args as the argv vector is stored on the - // string stack and may get stomped if deleteObject triggers - // script execution. - - ConsoleValueRef savedArgv[ StringStack::MaxArgs ]; - for (int i=0; ideleteObject(); - obj = NULL; - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - - //dMemcpy( callArgv, savedArgv, sizeof( callArgv[ 0 ] ) * callArgc ); - for (int i=0; iinsert( newName ); - break; - } - } - } - else if( dStricmp( redefineBehavior, "unnameNew" ) == 0 ) - { - objectName = StringTable->insert( "" ); - } - else if( dStricmp( redefineBehavior, "postfixNew" ) == 0 ) - { - const char* postfix = Con::getVariable( "$Con::redefineBehaviorPostfix" ); - String newName = String::ToString( "%s%s", objectName, postfix ); - - if( Sim::findObject( newName ) ) - { - Con::errorf( ConsoleLogEntry::General, "%s: Cannot re-declare object with postfix [%s].", - getFileLine(ip), newName.c_str() ); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - else - objectName = StringTable->insert( newName ); - } - else - { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s].", - getFileLine(ip), objectName); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - } - } - } - - STR.popFrame(); - CSTK.popFrame(); - - if(!currentNewObject) - { - // Well, looks like we have to create a new object. - ConsoleObject *object = ConsoleObject::create((const char*)callArgv[1]); - - // Deal with failure! - if(!object) - { - Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-conobject class %s.", getFileLine(ip), (const char*)callArgv[1]); - ip = failJump; - break; - } - - // Do special datablock init if appropros - if(isDataBlock) - { - SimDataBlock *dataBlock = dynamic_cast(object); - if(dataBlock) - { - dataBlock->assignId(); - } - else - { - // They tried to make a non-datablock with a datablock keyword! - Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-datablock class %s.", getFileLine(ip), (const char*)callArgv[1]); - // Clean up... - delete object; - currentNewObject = NULL; - ip = failJump; - break; - } - } - - // Finally, set currentNewObject to point to the new one. - currentNewObject = dynamic_cast(object); - - // Deal with the case of a non-SimObject. - if(!currentNewObject) - { - Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-SimObject class %s.", getFileLine(ip), (const char*)callArgv[1]); - delete object; - currentNewObject = NULL; - ip = failJump; - break; - } - - // Set the declaration line - currentNewObject->setDeclarationLine(lineNumber); - - // Set the file that this object was created in - currentNewObject->setFilename(name); - - // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) - if(*objParent) - { - // Find it! - SimObject *parent; - if(Sim::findObject(objParent, parent)) - { - // Con::printf(" - Parent object found: %s", parent->getClassName()); - - currentNewObject->setCopySource( parent ); - currentNewObject->assignFieldsFrom( parent ); - // copy any substitution statements - SimDataBlock* parent_db = dynamic_cast(parent); - if (parent_db) - { - SimDataBlock* currentNewObject_db = dynamic_cast(currentNewObject); - if (currentNewObject_db) - currentNewObject_db->copySubstitutionsFrom(parent_db); - } - } - else - { - if ( Con::gObjectCopyFailures == -1 ) - Con::errorf(ConsoleLogEntry::General, "%s: Unable to find parent object %s for %s.", getFileLine(ip), objParent, (const char*)callArgv[1]); - else - ++Con::gObjectCopyFailures; - - // Fail to create the object. - delete object; - currentNewObject = NULL; - ip = failJump; - break; - } - } - - // If a name was passed, assign it. - if( objectName[ 0 ] ) - { - if( !isInternal ) - currentNewObject->assignName( objectName ); - else - currentNewObject->setInternalName( objectName ); - - // Set the original name - currentNewObject->setOriginalName( objectName ); - } - - // Prevent stack value corruption - CSTK.pushFrame(); - STR.pushFrame(); - // -- - - // Do the constructor parameters. - if(!currentNewObject->processArguments(callArgc-3, callArgv+3)) - { - delete currentNewObject; - currentNewObject = NULL; - ip = failJump; - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - - // If it's not a datablock, allow people to modify bits of it. - if(!isDataBlock) - { - currentNewObject->setModStaticFields(true); - currentNewObject->setModDynamicFields(true); - } - } - else - { - currentNewObject->reloadReset(); // AFX (reload-reset) - // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) - if(*objParent) - { - // Find it! - SimObject *parent; - if(Sim::findObject(objParent, parent)) - { - // Con::printf(" - Parent object found: %s", parent->getClassName()); - - // temporarily block name change - SimObject::preventNameChanging = true; - currentNewObject->setCopySource( parent ); - currentNewObject->assignFieldsFrom(parent); - // restore name changing - SimObject::preventNameChanging = false; - - // copy any substitution statements - SimDataBlock* parent_db = dynamic_cast(parent); - if (parent_db) - { - SimDataBlock* currentNewObject_db = dynamic_cast(currentNewObject); - if (currentNewObject_db) - currentNewObject_db->copySubstitutionsFrom(parent_db); - } - } - else - Con::errorf(ConsoleLogEntry::General, "%d: Unable to find parent object %s for %s.", lineNumber, objParent, (const char*)callArgv[1]); - } - } - - // Advance the IP past the create info... - ip += 7; - break; - } - - case OP_ADD_OBJECT: - { - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - - // Do we place this object at the root? - bool placeAtRoot = code[ip++]; - - // Con::printf("Adding object %s", currentNewObject->getName()); - - // Prevent stack value corruption - CSTK.pushFrame(); - STR.pushFrame(); - // -- - - // Make sure it wasn't already added, then add it. - if(currentNewObject->isProperlyAdded() == false) - { - bool ret = false; - - Message *msg = dynamic_cast(currentNewObject); - if(msg) - { - SimObjectId id = Message::getNextMessageID(); - if(id != 0xffffffff) - ret = currentNewObject->registerObject(id); - else - Con::errorf("%s: No more object IDs available for messages", getFileLine(ip)); - } - else - ret = currentNewObject->registerObject(); - - if(! ret) - { - // This error is usually caused by failing to call Parent::initPersistFields in the class' initPersistFields(). - Con::warnf(ConsoleLogEntry::General, "%s: Register object failed for object %s of class %s.", getFileLine(ip), currentNewObject->getName(), currentNewObject->getClassName()); - delete currentNewObject; - currentNewObject = NULL; - ip = failJump; - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - } - - // Are we dealing with a datablock? - SimDataBlock *dataBlock = dynamic_cast(currentNewObject); - static String errorStr; - - - - // If so, preload it. - if(dataBlock && !dataBlock->preload(true, errorStr)) - { - Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", getFileLine(ip), - currentNewObject->getName(), errorStr.c_str()); - dataBlock->deleteObject(); - currentNewObject = NULL; - ip = failJump; - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - - // What group will we be added to, if any? - U32 groupAddId = intStack[_UINT]; - SimGroup *grp = NULL; - SimSet *set = NULL; - bool isMessage = dynamic_cast(currentNewObject) != NULL; - - if(!placeAtRoot || !currentNewObject->getGroup()) - { - if(! isMessage) - { - if(! placeAtRoot) - { - // Otherwise just add to the requested group or set. - if(!Sim::findObject(groupAddId, grp)) - Sim::findObject(groupAddId, set); - } - - if(placeAtRoot) - { - // Deal with the instantGroup if we're being put at the root or we're adding to a component. - if( Con::gInstantGroup.isEmpty() - || !Sim::findObject( Con::gInstantGroup, grp ) ) - grp = Sim::getRootGroup(); - } - } - - // If we didn't get a group, then make sure we have a pointer to - // the rootgroup. - if(!grp) - grp = Sim::getRootGroup(); - - // add to the parent group - grp->addObject(currentNewObject); - - // If for some reason the add failed, add the object to the - // root group so it won't leak. - if( !currentNewObject->getGroup() ) - Sim::getRootGroup()->addObject( currentNewObject ); - - // add to any set we might be in - if(set) - set->addObject(currentNewObject); - } - - // store the new object's ID on the stack (overwriting the group/set - // id, if one was given, otherwise getting pushed) - if(placeAtRoot) - intStack[_UINT] = currentNewObject->getId(); - else - intStack[++_UINT] = currentNewObject->getId(); - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - - case OP_END_OBJECT: - { - // If we're not to be placed at the root, make sure we clean up - // our group reference. - bool placeAtRoot = code[ip++]; - if(!placeAtRoot) - _UINT--; - break; - } - - case OP_FINISH_OBJECT: - { - if (currentNewObject) - currentNewObject->onPostAdd(); - - //Assert( objectCreationStackIndex >= 0 ); - // Restore the object info from the stack [7/9/2007 Black] - currentNewObject = objectCreationStack[ --objectCreationStackIndex ].newObject; - failJump = objectCreationStack[ objectCreationStackIndex ].failJump; - break; - } - - case OP_JMPIFFNOT: - if(floatStack[_FLT--]) - { - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIFNOT: - if(intStack[_UINT--]) - { - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIFF: - if(!floatStack[_FLT--]) - { - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIF: - if(!intStack[_UINT--]) - { - ip ++; - break; - } - ip = code[ip]; - break; - case OP_JMPIFNOT_NP: - if(intStack[_UINT]) - { - _UINT--; - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIF_NP: - if(!intStack[_UINT]) - { - _UINT--; - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMP: - ip = code[ip]; - break; - - // This fixes a bug when not explicitly returning a value. - case OP_RETURN_VOID: - STR.setStringValue(""); - // We're falling thru here on purpose. - - case OP_RETURN: - retValue = STR.getStringValuePtr(); - - if( iterDepth > 0 ) - { - // Clear iterator state. - while( iterDepth > 0 ) - { - iterStack[ -- _ITER ].mIsStringIter = false; - -- iterDepth; - } - - STR.rewind(); - STR.setStringValue( StringStackPtrRef(retValue).getPtr(&STR) ); // Not nice but works. - retValue = STR.getStringValuePtr(); - } - - // Previously the return value was on the stack and would be returned using STR.getStringValue(). - // Now though we need to wrap it in a ConsoleValueRef - returnValue.value = CSTK.pushStringStackPtr(retValue); - - goto execFinished; - - case OP_RETURN_FLT: - - if( iterDepth > 0 ) - { - // Clear iterator state. - while( iterDepth > 0 ) - { - iterStack[ -- _ITER ].mIsStringIter = false; - -- iterDepth; - } - - } - - returnValue.value = CSTK.pushFLT(floatStack[_FLT]); - _FLT--; - - goto execFinished; - - case OP_RETURN_UINT: - - if( iterDepth > 0 ) - { - // Clear iterator state. - while( iterDepth > 0 ) - { - iterStack[ -- _ITER ].mIsStringIter = false; - -- iterDepth; - } - } - - returnValue.value = CSTK.pushUINT(intStack[_UINT]); - _UINT--; - - goto execFinished; - - case OP_CMPEQ: - intStack[_UINT+1] = bool(floatStack[_FLT] == floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPGR: - intStack[_UINT+1] = bool(floatStack[_FLT] > floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPGE: - intStack[_UINT+1] = bool(floatStack[_FLT] >= floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPLT: - intStack[_UINT+1] = bool(floatStack[_FLT] < floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPLE: - intStack[_UINT+1] = bool(floatStack[_FLT] <= floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPNE: - intStack[_UINT+1] = bool(floatStack[_FLT] != floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_XOR: - intStack[_UINT-1] = intStack[_UINT] ^ intStack[_UINT-1]; - _UINT--; - break; - - case OP_MOD: - if( intStack[_UINT-1] != 0 ) - intStack[_UINT-1] = intStack[_UINT] % intStack[_UINT-1]; - else - intStack[_UINT-1] = 0; - _UINT--; - break; - - case OP_BITAND: - intStack[_UINT-1] = intStack[_UINT] & intStack[_UINT-1]; - _UINT--; - break; - - case OP_BITOR: - intStack[_UINT-1] = intStack[_UINT] | intStack[_UINT-1]; - _UINT--; - break; - - case OP_NOT: - intStack[_UINT] = !intStack[_UINT]; - break; - - case OP_NOTF: - intStack[_UINT+1] = !floatStack[_FLT]; - _FLT--; - _UINT++; - break; - - case OP_ONESCOMPLEMENT: - intStack[_UINT] = ~intStack[_UINT]; - break; - - case OP_SHR: - intStack[_UINT-1] = intStack[_UINT] >> intStack[_UINT-1]; - _UINT--; - break; - - case OP_SHL: - intStack[_UINT-1] = intStack[_UINT] << intStack[_UINT-1]; - _UINT--; - break; - - case OP_AND: - intStack[_UINT-1] = intStack[_UINT] && intStack[_UINT-1]; - _UINT--; - break; - - case OP_OR: - intStack[_UINT-1] = intStack[_UINT] || intStack[_UINT-1]; - _UINT--; - break; - - case OP_ADD: - floatStack[_FLT-1] = floatStack[_FLT] + floatStack[_FLT-1]; - _FLT--; - break; - - case OP_SUB: - floatStack[_FLT-1] = floatStack[_FLT] - floatStack[_FLT-1]; - _FLT--; - break; - - case OP_MUL: - floatStack[_FLT-1] = floatStack[_FLT] * floatStack[_FLT-1]; - _FLT--; - break; - case OP_DIV: - floatStack[_FLT-1] = floatStack[_FLT] / floatStack[_FLT-1]; - _FLT--; - break; - case OP_NEG: - floatStack[_FLT] = -floatStack[_FLT]; - break; - - case OP_SETCURVAR: - var = CodeToSTE(code, ip); - ip += 2; - - // If a variable is set, then these must be NULL. It is necessary - // to set this here so that the vector parser can appropriately - // identify whether it's dealing with a vector. - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarName(var); - - // In order to let docblocks work properly with variables, we have - // clear the current docblock when we do an assign. This way it - // won't inappropriately carry forward to following function decls. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_SETCURVAR_CREATE: - var = CodeToSTE(code, ip); - ip += 2; - - // See OP_SETCURVAR - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarNameCreate(var); - - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_SETCURVAR_ARRAY: - var = STR.getSTValue(); - - // See OP_SETCURVAR - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarName(var); - - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_SETCURVAR_ARRAY_CREATE: - var = STR.getSTValue(); - - // See OP_SETCURVAR - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarNameCreate(var); - - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_LOADVAR_UINT: - intStack[_UINT+1] = gEvalState.getIntVariable(); - _UINT++; - break; - - case OP_LOADVAR_FLT: - floatStack[_FLT+1] = gEvalState.getFloatVariable(); - _FLT++; - break; - - case OP_LOADVAR_STR: - val = gEvalState.getStringVariable(); - STR.setStringValue(val); - break; - - case OP_LOADVAR_VAR: - // Sets current source of OP_SAVEVAR_VAR - gEvalState.copyVariable = gEvalState.currentVariable; - break; - - case OP_SAVEVAR_UINT: - gEvalState.setIntVariable(intStack[_UINT]); - break; - - case OP_SAVEVAR_FLT: - gEvalState.setFloatVariable(floatStack[_FLT]); - break; - - case OP_SAVEVAR_STR: - gEvalState.setStringVariable(STR.getStringValue()); - break; - - case OP_SAVEVAR_VAR: - // this basically handles %var1 = %var2 - gEvalState.setCopyVariable(); - break; - - case OP_SETCUROBJECT: - // Save the previous object for parsing vector fields. - prevObject = curObject; - val = STR.getStringValue(); - - // Sim::findObject will sometimes find valid objects from - // multi-component strings. This makes sure that doesn't - // happen. - for( const char* check = val; *check; check++ ) - { - if( *check == ' ' ) - { - val = ""; - break; - } - } - curObject = Sim::findObject(val); - break; - - case OP_SETCUROBJECT_INTERNAL: - ++ip; // To skip the recurse flag if the object wasn't found - if(curObject) - { - SimSet *set = dynamic_cast(curObject); - if(set) - { - StringTableEntry intName = StringTable->insert(STR.getStringValue()); - bool recurse = code[ip-1]; - SimObject *obj = set->findObjectByInternalName(intName, recurse); - intStack[_UINT+1] = obj ? obj->getId() : 0; - _UINT++; - } - else - { - Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-set %s of class %s.", getFileLine(ip-2), curObject->getName(), curObject->getClassName()); - intStack[_UINT] = 0; - } - } - break; - - case OP_SETCUROBJECT_NEW: - curObject = currentNewObject; - break; - - case OP_SETCURFIELD: - // Save the previous field for parsing vector fields. - prevField = curField; - dStrcpy( prevFieldArray, curFieldArray ); - curField = CodeToSTE(code, ip); - curFieldArray[0] = 0; - ip += 2; - break; - - case OP_SETCURFIELD_ARRAY: - dStrcpy(curFieldArray, STR.getStringValue()); - break; - - case OP_SETCURFIELD_TYPE: - if(curObject) - curObject->setDataFieldType(code[ip], curField, curFieldArray); - ip++; - break; - - case OP_LOADFIELD_UINT: - if(curObject) - intStack[_UINT+1] = U32(dAtoi(curObject->getDataField(curField, curFieldArray))); - else - { - // The field is not being retrieved from an object. Maybe it's - // a special accessor? - getFieldComponent( prevObject, prevField, prevFieldArray, curField, valBuffer ); - intStack[_UINT+1] = dAtoi( valBuffer ); - } - _UINT++; - break; - - case OP_LOADFIELD_FLT: - if(curObject) - floatStack[_FLT+1] = dAtof(curObject->getDataField(curField, curFieldArray)); - else - { - // The field is not being retrieved from an object. Maybe it's - // a special accessor? - getFieldComponent( prevObject, prevField, prevFieldArray, curField, valBuffer ); - floatStack[_FLT+1] = dAtof( valBuffer ); - } - _FLT++; - break; - - case OP_LOADFIELD_STR: - if(curObject) - { - val = curObject->getDataField(curField, curFieldArray); - STR.setStringValue( val ); - } - else - { - // The field is not being retrieved from an object. Maybe it's - // a special accessor? - getFieldComponent( prevObject, prevField, prevFieldArray, curField, valBuffer ); - STR.setStringValue( valBuffer ); - } - break; - - case OP_SAVEFIELD_UINT: - STR.setIntValue(intStack[_UINT]); - if(curObject) - curObject->setDataField(curField, curFieldArray, STR.getStringValue()); - else - { - // The field is not being set on an object. Maybe it's - // a special accessor? - setFieldComponent( prevObject, prevField, prevFieldArray, curField ); - prevObject = NULL; - } - break; - - case OP_SAVEFIELD_FLT: - STR.setFloatValue(floatStack[_FLT]); - if(curObject) - curObject->setDataField(curField, curFieldArray, STR.getStringValue()); - else - { - // The field is not being set on an object. Maybe it's - // a special accessor? - setFieldComponent( prevObject, prevField, prevFieldArray, curField ); - prevObject = NULL; - } - break; - - case OP_SAVEFIELD_STR: - if(curObject) - curObject->setDataField(curField, curFieldArray, STR.getStringValue()); - else - { - // The field is not being set on an object. Maybe it's - // a special accessor? - setFieldComponent( prevObject, prevField, prevFieldArray, curField ); - prevObject = NULL; - } - break; - - case OP_STR_TO_UINT: - intStack[_UINT+1] = STR.getIntValue(); - _UINT++; - break; - - case OP_STR_TO_FLT: - floatStack[_FLT+1] = STR.getFloatValue(); - _FLT++; - break; - - case OP_STR_TO_NONE: - // This exists simply to deal with certain typecast situations. - break; - - case OP_FLT_TO_UINT: - intStack[_UINT+1] = (S64)floatStack[_FLT]; - _FLT--; - _UINT++; - break; - - case OP_FLT_TO_STR: - STR.setFloatValue(floatStack[_FLT]); - _FLT--; - break; - - case OP_FLT_TO_NONE: - _FLT--; - break; - - case OP_UINT_TO_FLT: - floatStack[_FLT+1] = (F32)intStack[_UINT]; - _UINT--; - _FLT++; - break; - - case OP_UINT_TO_STR: - STR.setIntValue(intStack[_UINT]); - _UINT--; - break; - - case OP_UINT_TO_NONE: - _UINT--; - break; - - case OP_COPYVAR_TO_NONE: - gEvalState.copyVariable = NULL; - break; - - case OP_LOADIMMED_UINT: - intStack[_UINT+1] = code[ip++]; - _UINT++; - break; - - case OP_LOADIMMED_FLT: - floatStack[_FLT+1] = curFloatTable[code[ip]]; - ip++; - _FLT++; - break; - - case OP_TAG_TO_STR: - code[ip-1] = OP_LOADIMMED_STR; - // it's possible the string has already been converted - if(U8(curStringTable[code[ip]]) != StringTagPrefixByte) - { - U32 id = GameAddTaggedString(curStringTable + code[ip]); - dSprintf(curStringTable + code[ip] + 1, 7, "%d", id); - *(curStringTable + code[ip]) = StringTagPrefixByte; - } - case OP_LOADIMMED_STR: - STR.setStringValue(curStringTable + code[ip++]); - break; - - case OP_DOCBLOCK_STR: - { - // If the first word of the doc is '\class' or '@class', then this - // is a namespace doc block, otherwise it is a function doc block. - const char* docblock = curStringTable + code[ip++]; - - const char* sansClass = dStrstr( docblock, "@class" ); - if( !sansClass ) - sansClass = dStrstr( docblock, "\\class" ); - - if( sansClass ) - { - // Don't save the class declaration. Scan past the 'class' - // keyword and up to the first whitespace. - sansClass += 7; - S32 index = 0; - while( ( *sansClass != ' ' ) && ( *sansClass != '\n' ) && *sansClass && ( index < ( nsDocLength - 1 ) ) ) - { - nsDocBlockClass[index++] = *sansClass; - sansClass++; - } - nsDocBlockClass[index] = '\0'; - - curNSDocBlock = sansClass + 1; - } - else - curFNDocBlock = docblock; - } - - break; - - case OP_LOADIMMED_IDENT: - STR.setStringValue(CodeToSTE(code, ip)); - ip += 2; - break; - - case OP_CALLFUNC_RESOLVE: - // This deals with a function that is potentially living in a namespace. - fnNamespace = CodeToSTE(code, ip+2); - fnName = CodeToSTE(code, ip); - - // Try to look it up. - ns = Namespace::find(fnNamespace); - nsEntry = ns->lookup(fnName); - if(!nsEntry) - { - ip+= 5; - Con::warnf(ConsoleLogEntry::General, - "%s: Unable to find function %s%s%s", - getFileLine(ip-7), fnNamespace ? fnNamespace : "", - fnNamespace ? "::" : "", fnName); - STR.popFrame(); - CSTK.popFrame(); - break; - } - -#ifdef COMPILER_OPTIMIZE_FUNCTION_CALLS - // Now fall through to OP_CALLFUNC... - // Now, rewrite our code a bit (ie, avoid future lookups) and fall - // through to OP_CALLFUNC -#ifdef TORQUE_CPU_X64 - *((U64*)(code+ip+2)) = ((U64)nsEntry); -#else - code[ip+2] = ((U32)nsEntry); -#endif - code[ip-1] = OP_CALLFUNC; -#endif - - case OP_CALLFUNC: - { - // This routingId is set when we query the object as to whether - // it handles this method. It is set to an enum from the table - // above indicating whether it handles it on a component it owns - // or just on the object. - S32 routingId = 0; - - fnName = CodeToSTE(code, ip); - - //if this is called from inside a function, append the ip and codeptr - if( gEvalState.getStackDepth() > 0 ) - { - gEvalState.getCurrentFrame().code = this; - gEvalState.getCurrentFrame().ip = ip - 1; - } - - U32 callType = code[ip+4]; - - ip += 5; - CSTK.getArgcArgv(fnName, &callArgc, &callArgv); - - const char *componentReturnValue = ""; - - if(callType == FuncCallExprNode::FunctionCall) - { - if( !nsEntry ) - { -#ifdef COMPILER_OPTIMIZE_FUNCTION_CALLS -#ifdef TORQUE_CPU_X64 - nsEntry = ((Namespace::Entry *) *((U64*)(code+ip-3))); -#else - nsEntry = ((Namespace::Entry *) *(code+ip-3)); -#endif -#else - nsEntry = Namespace::global()->lookup( fnName ); -#endif - ns = NULL; - } - ns = NULL; - } - else if(callType == FuncCallExprNode::MethodCall) - { - saveObject = gEvalState.thisObject; - gEvalState.thisObject = Sim::findObject((const char*)callArgv[1]); - if(!gEvalState.thisObject) - { - // Go back to the previous saved object. - gEvalState.thisObject = saveObject; - - Con::warnf(ConsoleLogEntry::General,"%s: Unable to find object: '%s' attempting to call function '%s'", getFileLine(ip-4), (const char*)callArgv[1], fnName); - STR.popFrame(); - CSTK.popFrame(); - STR.setStringValue(""); - break; - } - - bool handlesMethod = gEvalState.thisObject->handlesConsoleMethod(fnName,&routingId); - if( handlesMethod && routingId == MethodOnComponent ) - { - ICallMethod *pComponent = dynamic_cast( gEvalState.thisObject ); - if( pComponent ) - componentReturnValue = pComponent->callMethodArgList( callArgc, callArgv, false ); - } - - ns = gEvalState.thisObject->getNamespace(); - if(ns) - nsEntry = ns->lookup(fnName); - else - nsEntry = NULL; - } - else // it's a ParentCall - { - if(thisNamespace) - { - ns = thisNamespace->mParent; - if(ns) - nsEntry = ns->lookup(fnName); - else - nsEntry = NULL; - } - else - { - ns = NULL; - nsEntry = NULL; - } - } - - Namespace::Entry::CallbackUnion * nsCb = NULL; - const char * nsUsage = NULL; - if (nsEntry) - { - nsCb = &nsEntry->cb; - nsUsage = nsEntry->mUsage; - routingId = 0; - } - if(!nsEntry || noCalls) - { - if(!noCalls && !( routingId == MethodOnComponent ) ) - { - Con::warnf(ConsoleLogEntry::General,"%s: Unknown command %s.", getFileLine(ip-6), fnName); - if(callType == FuncCallExprNode::MethodCall) - { - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", - gEvalState.thisObject->getId(), Con::getNamespaceList(ns) ); - } - } - STR.popFrame(); - CSTK.popFrame(); - - if( routingId == MethodOnComponent ) - STR.setStringValue( componentReturnValue ); - else - STR.setStringValue( "" ); - - break; - } - if(nsEntry->mType == Namespace::Entry::ConsoleFunctionType) - { - ConsoleValueRef ret; - if(nsEntry->mFunctionOffset) - ret = nsEntry->mCode->exec(nsEntry->mFunctionOffset, fnName, nsEntry->mNamespace, callArgc, callArgv, false, nsEntry->mPackage); - - STR.popFrame(); - // Functions are assumed to return strings, so look ahead to see if we can skip the conversion - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = (U32)((S32)ret); - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = (F32)ret; - } - else if(code[ip] == OP_STR_TO_NONE) - { - STR.setStringValue(ret.getStringValue()); - ip++; - } - else - STR.setStringValue((const char*)ret); - - // This will clear everything including returnValue - CSTK.popFrame(); - //STR.clearFunctionOffset(); - } - else - { - const char* nsName = ns? ns->mName: ""; -#ifndef TORQUE_DEBUG - // [tom, 12/13/2006] This stops tools functions from working in the console, - // which is useful behavior when debugging so I'm ifdefing this out for debug builds. - if(nsEntry->mToolOnly && ! Con::isCurrentScriptToolScript()) - { - Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", getFileLine(ip-6), nsName, fnName); - } - else -#endif - if((nsEntry->mMinArgs && S32(callArgc) < nsEntry->mMinArgs) || (nsEntry->mMaxArgs && S32(callArgc) > nsEntry->mMaxArgs)) - { - Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", - getFileLine(ip-6), nsName, fnName, - callArgc, nsEntry->mMinArgs, nsEntry->mMaxArgs); - Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", getFileLine(ip-6), nsEntry->mUsage); - STR.popFrame(); - CSTK.popFrame(); - } - else - { - switch(nsEntry->mType) - { - case Namespace::Entry::StringCallbackType: - { - const char *ret = nsEntry->cb.mStringCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(ret != STR.getStringValue()) - STR.setStringValue(ret); - //else - // STR.setLen(dStrlen(ret)); - break; - } - case Namespace::Entry::IntCallbackType: - { - S32 result = nsEntry->cb.mIntCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = result; - break; - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = result; - break; - } - else if(code[ip] == OP_STR_TO_NONE) - ip++; - else - STR.setIntValue(result); - break; - } - case Namespace::Entry::FloatCallbackType: - { - F64 result = nsEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = (S64)result; - break; - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = result; - break; - } - else if(code[ip] == OP_STR_TO_NONE) - ip++; - else - STR.setFloatValue(result); - break; - } - case Namespace::Entry::VoidCallbackType: - nsEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - if( code[ ip ] != OP_STR_TO_NONE && Con::getBoolVariable( "$Con::warnVoidAssignment", true ) ) - Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", getFileLine(ip-6), fnName, functionName); - - STR.popFrame(); - CSTK.popFrame(); - STR.setStringValue(""); - break; - case Namespace::Entry::BoolCallbackType: - { - bool result = nsEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = result; - break; - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = result; - break; - } - else if(code[ip] == OP_STR_TO_NONE) - ip++; - else - STR.setIntValue(result); - break; - } - } - } - } - - if(callType == FuncCallExprNode::MethodCall) - gEvalState.thisObject = saveObject; - break; - } - case OP_ADVANCE_STR: - STR.advance(); - break; - case OP_ADVANCE_STR_APPENDCHAR: - STR.advanceChar(code[ip++]); - break; - - case OP_ADVANCE_STR_COMMA: - STR.advanceChar('_'); - break; - - case OP_ADVANCE_STR_NUL: - STR.advanceChar(0); - break; - - case OP_REWIND_STR: - STR.rewind(); - break; - - case OP_TERMINATE_REWIND_STR: - STR.rewindTerminate(); - break; - - case OP_COMPARE_STR: - intStack[++_UINT] = STR.compare(); - break; - case OP_PUSH: - STR.push(); - CSTK.pushStringStackPtr(STR.getPreviousStringValuePtr()); - break; - case OP_PUSH_UINT: - CSTK.pushUINT(intStack[_UINT]); - _UINT--; - break; - case OP_PUSH_FLT: - CSTK.pushFLT(floatStack[_FLT]); - _FLT--; - break; - case OP_PUSH_VAR: - if (gEvalState.currentVariable) - CSTK.pushValue(gEvalState.currentVariable->value); - else - CSTK.pushString(""); - break; - - case OP_PUSH_FRAME: - STR.pushFrame(); - CSTK.pushFrame(); - break; - - case OP_ASSERT: - { - if( !intStack[_UINT--] ) - { - const char *message = curStringTable + code[ip]; - - U32 breakLine, inst; - findBreakLine( ip - 1, breakLine, inst ); - - if ( PlatformAssert::processAssert( PlatformAssert::Fatal, - name ? name : "eval", - breakLine, - message ) ) - { - if ( TelDebugger && TelDebugger->isConnected() && breakLine > 0 ) - { - TelDebugger->breakProcess(); - } - else - Platform::debugBreak(); - } - } - - ip++; - break; - } - - case OP_BREAK: - { - //append the ip and codeptr before managing the breakpoint! - AssertFatal( gEvalState.getStackDepth() > 0, "Empty eval stack on break!"); - gEvalState.getCurrentFrame().code = this; - gEvalState.getCurrentFrame().ip = ip - 1; - - U32 breakLine; - findBreakLine(ip-1, breakLine, instruction); - if(!breakLine) - goto breakContinue; - TelDebugger->executionStopped(this, breakLine); - goto breakContinue; - } - - case OP_ITER_BEGIN_STR: - { - iterStack[ _ITER ].mIsStringIter = true; - /* fallthrough */ - } - - case OP_ITER_BEGIN: - { - StringTableEntry varName = CodeToSTE(code, ip); - U32 failIp = code[ ip + 2 ]; - - IterStackRecord& iter = iterStack[ _ITER ]; - - iter.mVariable = gEvalState.getCurrentFrame().add( varName ); - - if( iter.mIsStringIter ) - { - iter.mData.mStr.mString = STR.getStringValuePtr(); - iter.mData.mStr.mIndex = 0; - } - else - { - // Look up the object. - - SimSet* set; - if( !Sim::findObject( STR.getStringValue(), set ) ) - { - Con::errorf( ConsoleLogEntry::General, "No SimSet object '%s'", STR.getStringValue() ); - Con::errorf( ConsoleLogEntry::General, "Did you mean to use 'foreach$' instead of 'foreach'?" ); - ip = failIp; - continue; - } - - // Set up. - - iter.mData.mObj.mSet = set; - iter.mData.mObj.mIndex = 0; - } - - _ITER ++; - iterDepth ++; - - STR.push(); - - ip += 3; - break; - } - - case OP_ITER: - { - U32 breakIp = code[ ip ]; - IterStackRecord& iter = iterStack[ _ITER - 1 ]; - - if( iter.mIsStringIter ) - { - const char* str = StringStackPtrRef(iter.mData.mStr.mString).getPtr(&STR); - - U32 startIndex = iter.mData.mStr.mIndex; - U32 endIndex = startIndex; - - // Break if at end. - - if( !str[ startIndex ] ) - { - ip = breakIp; - continue; - } - - // Find right end of current component. - - if( !dIsspace( str[ endIndex ] ) ) - do ++ endIndex; - while( str[ endIndex ] && !dIsspace( str[ endIndex ] ) ); - - // Extract component. - - if( endIndex != startIndex ) - { - char savedChar = str[ endIndex ]; - const_cast< char* >( str )[ endIndex ] = '\0'; // We are on the string stack so this is okay. - iter.mVariable->setStringValue( &str[ startIndex ] ); - const_cast< char* >( str )[ endIndex ] = savedChar; - } - else - iter.mVariable->setStringValue( "" ); - - // Skip separator. - if( str[ endIndex ] != '\0' ) - ++ endIndex; - - iter.mData.mStr.mIndex = endIndex; - } - else - { - U32 index = iter.mData.mObj.mIndex; - SimSet* set = iter.mData.mObj.mSet; - - if( index >= set->size() ) - { - ip = breakIp; - continue; - } - - iter.mVariable->setIntValue( set->at( index )->getId() ); - iter.mData.mObj.mIndex = index + 1; - } - - ++ ip; - break; - } - - case OP_ITER_END: - { - -- _ITER; - -- iterDepth; - - STR.rewind(); - - iterStack[ _ITER ].mIsStringIter = false; - break; - } - - case OP_INVALID: - - default: - // error! - goto execFinished; - } - } -execFinished: - - if ( telDebuggerOn && setFrame < 0 ) - TelDebugger->popStackFrame(); - - if ( popFrame ) - gEvalState.popFrame(); - - if(argv) - { - if(gEvalState.traceOn) - { - traceBuffer[0] = 0; - dStrcat(traceBuffer, "Leaving "); - - if(packageName) - { - dStrcat(traceBuffer, "["); - dStrcat(traceBuffer, packageName); - dStrcat(traceBuffer, "]"); - } - if(thisNamespace && thisNamespace->mName) - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s::%s() - return %s", thisNamespace->mName, thisFunctionName, STR.getStringValue()); - } - else - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s() - return %s", thisFunctionName, STR.getStringValue()); - } - Con::printf("%s", traceBuffer); - } - } - - smCurrentCodeBlock = saveCodeBlock; - if(saveCodeBlock && saveCodeBlock->name) - { - Con::gCurrentFile = saveCodeBlock->name; - Con::gCurrentRoot = saveCodeBlock->modPath; - } - - decRefCount(); - -#ifdef TORQUE_VALIDATE_STACK - AssertFatal(!(STR.mStartStackSize > stackStart), "String stack not popped enough in script exec"); - AssertFatal(!(STR.mStartStackSize < stackStart), "String stack popped too much in script exec"); -#endif - - return returnValue; + CodeInterpreter interpreter(this); + return interpreter.exec(ip, functionName, thisNamespace, argc, argv, noCalls, packageName, setFrame); } //------------------------------------------------------------ diff --git a/Engine/source/console/compiler.cpp b/Engine/source/console/compiler.cpp index fd871c036..0330f4d59 100644 --- a/Engine/source/console/compiler.cpp +++ b/Engine/source/console/compiler.cpp @@ -40,13 +40,13 @@ namespace Compiler F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line) { F64 val = dAtof(str); - if(val != 0) + if (val != 0) return val; - else if(!dStricmp(str, "true")) + else if (!dStricmp(str, "true")) return 1; - else if(!dStricmp(str, "false")) + else if (!dStricmp(str, "false")) return 0; - else if(file) + else if (file) { Con::warnf(ConsoleLogEntry::General, "%s (%d): string always evaluates to 0.", file, line); return 0; @@ -57,7 +57,7 @@ namespace Compiler //------------------------------------------------------------ CompilerStringTable *gCurrentStringTable, gGlobalStringTable, gFunctionStringTable; - CompilerFloatTable *gCurrentFloatTable, gGlobalFloatTable, gFunctionFloatTable; + CompilerFloatTable *gCurrentFloatTable, gGlobalFloatTable, gFunctionFloatTable; DataChunker gConsoleAllocator; CompilerIdentTable gIdentTable; @@ -71,16 +71,16 @@ namespace Compiler *ptr = (U32)ste; #endif } - + void compileSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr) { - if(ste) + if (ste) getIdentTable().add(ste, ip); *ptr = 0; - *(ptr+1) = 0; + *(ptr + 1) = 0; } - - void (*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr) = evalSTEtoCode; + + void(*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr) = evalSTEtoCode; //------------------------------------------------------------ @@ -88,23 +88,23 @@ namespace Compiler //------------------------------------------------------------ - CompilerStringTable *getCurrentStringTable() { return gCurrentStringTable; } - CompilerStringTable &getGlobalStringTable() { return gGlobalStringTable; } + CompilerStringTable *getCurrentStringTable() { return gCurrentStringTable; } + CompilerStringTable &getGlobalStringTable() { return gGlobalStringTable; } CompilerStringTable &getFunctionStringTable() { return gFunctionStringTable; } - void setCurrentStringTable (CompilerStringTable* cst) { gCurrentStringTable = cst; } + void setCurrentStringTable(CompilerStringTable* cst) { gCurrentStringTable = cst; } - CompilerFloatTable *getCurrentFloatTable() { return gCurrentFloatTable; } - CompilerFloatTable &getGlobalFloatTable() { return gGlobalFloatTable; } - CompilerFloatTable &getFunctionFloatTable() { return gFunctionFloatTable; } + CompilerFloatTable *getCurrentFloatTable() { return gCurrentFloatTable; } + CompilerFloatTable &getGlobalFloatTable() { return gGlobalFloatTable; } + CompilerFloatTable &getFunctionFloatTable() { return gFunctionFloatTable; } - void setCurrentFloatTable (CompilerFloatTable* cst) { gCurrentFloatTable = cst; } + void setCurrentFloatTable(CompilerFloatTable* cst) { gCurrentFloatTable = cst; } CompilerIdentTable &getIdentTable() { return gIdentTable; } void precompileIdent(StringTableEntry ident) { - if(ident) + if (ident) gGlobalStringTable.add(ident); } @@ -119,8 +119,8 @@ namespace Compiler getIdentTable().reset(); } - void *consoleAlloc(U32 size) { return gConsoleAllocator.alloc(size); } - void consoleAllocReset() { gConsoleAllocator.freeBlocks(); } + void *consoleAlloc(U32 size) { return gConsoleAllocator.alloc(size); } + void consoleAllocReset() { gConsoleAllocator.freeBlocks(); } } @@ -135,36 +135,40 @@ U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag) { // Is it already in? Entry **walk; - for(walk = &list; *walk; walk = &((*walk)->next)) + for (walk = &list; *walk; walk = &((*walk)->next)) { - if((*walk)->tag != tag) + if ((*walk)->tag != tag) continue; - if(caseSens) + if (caseSens) { - if(!dStrcmp((*walk)->string, str)) + if (!dStrcmp((*walk)->string, str)) return (*walk)->start; } else { - if(!dStricmp((*walk)->string, str)) + if (!dStricmp((*walk)->string, str)) return (*walk)->start; } } // Write it out. - Entry *newStr = (Entry *) consoleAlloc(sizeof(Entry)); + Entry *newStr = (Entry *)consoleAlloc(sizeof(Entry)); *walk = newStr; newStr->next = NULL; newStr->start = totalLen; U32 len = dStrlen(str) + 1; - if(tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul + if (tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul len = 7; totalLen += len; - newStr->string = (char *) consoleAlloc(len); + newStr->string = (char *)consoleAlloc(len); newStr->len = len; newStr->tag = tag; dStrcpy(newStr->string, str); + + // Put into the hash table. + hashTable[str] = newStr; + return newStr->start; } @@ -189,7 +193,8 @@ void CompilerStringTable::reset() char *CompilerStringTable::build() { char *ret = new char[totalLen]; - for(Entry *walk = list; walk; walk = walk->next) + dMemset(ret, 0, totalLen); + for (Entry *walk = list; walk; walk = walk->next) dStrcpy(ret + walk->start, walk->string); return ret; } @@ -197,7 +202,7 @@ char *CompilerStringTable::build() void CompilerStringTable::write(Stream &st) { st.write(totalLen); - for(Entry *walk = list; walk; walk = walk->next) + for (Entry *walk = list; walk; walk = walk->next) st.write(walk->len, walk->string); } @@ -207,15 +212,15 @@ U32 CompilerFloatTable::add(F64 value) { Entry **walk; U32 i = 0; - for(walk = &list; *walk; walk = &((*walk)->next), i++) - if(value == (*walk)->val) + for (walk = &list; *walk; walk = &((*walk)->next), i++) + if (value == (*walk)->val) return i; - Entry *newFloat = (Entry *) consoleAlloc(sizeof(Entry)); + Entry *newFloat = (Entry *)consoleAlloc(sizeof(Entry)); newFloat->val = value; newFloat->next = NULL; count++; *walk = newFloat; - return count-1; + return count - 1; } void CompilerFloatTable::reset() { @@ -226,7 +231,7 @@ F64 *CompilerFloatTable::build() { F64 *ret = new F64[count]; U32 i = 0; - for(Entry *walk = list; walk; walk = walk->next, i++) + for (Entry *walk = list; walk; walk = walk->next, i++) ret[i] = walk->val; return ret; } @@ -234,7 +239,7 @@ F64 *CompilerFloatTable::build() void CompilerFloatTable::write(Stream &st) { st.write(count); - for(Entry *walk = list; walk; walk = walk->next) + for (Entry *walk = list; walk; walk = walk->next) st.write(walk->val); } @@ -248,12 +253,12 @@ void CompilerIdentTable::reset() void CompilerIdentTable::add(StringTableEntry ste, U32 ip) { U32 index = gGlobalStringTable.add(ste, false); - Entry *newEntry = (Entry *) consoleAlloc(sizeof(Entry)); + Entry *newEntry = (Entry *)consoleAlloc(sizeof(Entry)); newEntry->offset = index; newEntry->ip = ip; - for(Entry *walk = list; walk; walk = walk->next) + for (Entry *walk = list; walk; walk = walk->next) { - if(walk->offset == index) + if (walk->offset == index) { newEntry->nextIdent = walk->nextIdent; walk->nextIdent = newEntry; @@ -269,24 +274,24 @@ void CompilerIdentTable::write(Stream &st) { U32 count = 0; Entry * walk; - for(walk = list; walk; walk = walk->next) + for (walk = list; walk; walk = walk->next) count++; st.write(count); - for(walk = list; walk; walk = walk->next) + for (walk = list; walk; walk = walk->next) { U32 ec = 0; Entry * el; - for(el = walk; el; el = el->nextIdent) + for (el = walk; el; el = el->nextIdent) ec++; st.write(walk->offset); st.write(ec); - for(el = walk; el; el = el->nextIdent) + for (el = walk; el; el = el->nextIdent) st.write(el->ip); } } //------------------------------------------------------------------------- - + U8 *CodeStream::allocCode(U32 sz) { U8 *ptr = NULL; @@ -300,12 +305,12 @@ U8 *CodeStream::allocCode(U32 sz) return ptr; } } - + CodeData *data = new CodeData; data->data = (U8*)dMalloc(BlockSize); data->size = sz; data->next = NULL; - + if (mCodeHead) mCodeHead->next = data; mCodeHead = data; @@ -313,21 +318,21 @@ U8 *CodeStream::allocCode(U32 sz) mCode = data; return data->data; } - + //------------------------------------------------------------------------- - + void CodeStream::fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint) { AssertFatal(mFixStack.size() > 0, "Fix stack mismatch"); - - U32 fixStart = mFixStack[mFixStack.size()-1]; - for (U32 i=fixStart; inext : NULL; while (itr != NULL) @@ -403,7 +408,7 @@ void CodeStream::reset() delete(itr); itr = next; } - + if (mCode) { mCode->size = 0; diff --git a/Engine/source/console/compiler.h b/Engine/source/console/compiler.h index 3f1fb5339..df69d0819 100644 --- a/Engine/source/console/compiler.h +++ b/Engine/source/console/compiler.h @@ -30,6 +30,9 @@ #include #endif +#include +#include + class Stream; class DataChunker; @@ -91,10 +94,15 @@ namespace Compiler OP_DIV, OP_NEG, + OP_INC, + OP_DEC, + OP_SETCURVAR, OP_SETCURVAR_CREATE, OP_SETCURVAR_ARRAY, + OP_SETCURVAR_ARRAY_VARLOOKUP, OP_SETCURVAR_ARRAY_CREATE, + OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP, OP_LOADVAR_UINT,// 40 OP_LOADVAR_FLT, @@ -113,6 +121,8 @@ namespace Compiler OP_SETCURFIELD, OP_SETCURFIELD_ARRAY, // 50 OP_SETCURFIELD_TYPE, + OP_SETCURFIELD_ARRAY_VAR, + OP_SETCURFIELD_THIS, OP_LOADFIELD_UINT, OP_LOADFIELD_FLT, @@ -142,6 +152,8 @@ namespace Compiler OP_CALLFUNC_RESOLVE, OP_CALLFUNC, + OP_CALLFUNC_POINTER, + OP_CALLFUNC_THIS, OP_ADVANCE_STR, OP_ADVANCE_STR_APPENDCHAR, @@ -155,23 +167,26 @@ namespace Compiler OP_PUSH_UINT, // Integer OP_PUSH_FLT, // Float OP_PUSH_VAR, // Variable + OP_PUSH_THIS, // This pointer OP_PUSH_FRAME, // Frame OP_ASSERT, OP_BREAK, - + OP_ITER_BEGIN, ///< Prepare foreach iterator. OP_ITER_BEGIN_STR, ///< Prepare foreach$ iterator. OP_ITER, ///< Enter foreach loop. OP_ITER_END, ///< End foreach loop. - OP_INVALID // 90 + OP_INVALID, // 90 + + MAX_OP_CODELEN ///< The amount of op codes. }; //------------------------------------------------------------ F64 consoleStringToNumber(const char *str, StringTableEntry file = 0, U32 line = 0); - + U32 compileBlock(StmtNode *block, CodeStream &codeStream, U32 ip); //------------------------------------------------------------ @@ -207,6 +222,7 @@ namespace Compiler Entry *list; char buf[256]; + std::unordered_map hashTable; U32 add(const char *str, bool caseSens = true, bool tag = false); U32 addIntString(U32 value); @@ -239,14 +255,14 @@ namespace Compiler inline StringTableEntry CodeToSTE(U32 *code, U32 ip) { #ifdef TORQUE_CPU_X64 - return (StringTableEntry)(*((U64*)(code+ip))); + return (StringTableEntry)(*((U64*)(code + ip))); #else - return (StringTableEntry)(*(code+ip)); + return (StringTableEntry)(*(code + ip)); #endif } - extern void (*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr); - + extern void(*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr); + void evalSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr); void compileSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr); @@ -254,13 +270,13 @@ namespace Compiler CompilerStringTable &getGlobalStringTable(); CompilerStringTable &getFunctionStringTable(); - void setCurrentStringTable (CompilerStringTable* cst); + void setCurrentStringTable(CompilerStringTable* cst); CompilerFloatTable *getCurrentFloatTable(); CompilerFloatTable &getGlobalFloatTable(); CompilerFloatTable &getFunctionFloatTable(); - void setCurrentFloatTable (CompilerFloatTable* cst); + void setCurrentFloatTable(CompilerFloatTable* cst); CompilerIdentTable &getIdentTable(); @@ -280,7 +296,7 @@ namespace Compiler class CodeStream { public: - + enum FixType { // For loops @@ -288,37 +304,37 @@ public: FIXTYPE_BREAK, FIXTYPE_CONTINUE }; - + enum Constants { BlockSize = 16384, }; - + protected: - + typedef struct PatchEntry { U32 addr; ///< Address to patch U32 value; ///< Value to place at addr - - PatchEntry() {;} - PatchEntry(U32 a, U32 v) : addr(a), value(v) {;} + + PatchEntry() { ; } + PatchEntry(U32 a, U32 v) : addr(a), value(v) { ; } } PatchEntry; - + typedef struct CodeData { U8 *data; ///< Allocated data (size is BlockSize) U32 size; ///< Bytes used in data CodeData *next; ///< Next block } CodeData; - + /// @name Emitted code /// { CodeData *mCode; CodeData *mCodeHead; U32 mCodePos; /// } - + /// @name Code fixing stacks /// { Vector mFixList; @@ -326,28 +342,28 @@ protected: Vector mFixLoopStack; Vector mPatchList; /// } - + Vector mBreakLines; ///< Line numbers - + public: CodeStream() : mCode(0), mCodeHead(NULL), mCodePos(0) { } - + ~CodeStream() { reset(); - + if (mCode) { dFree(mCode->data); delete mCode; } } - + U8 *allocCode(U32 sz); - + inline U32 emit(U32 code) { U32 *ptr = (U32*)allocCode(4); @@ -357,7 +373,7 @@ public: #endif return mCodePos++; } - + inline void patch(U32 addr, U32 code) { #ifdef DEBUG_CODESTREAM @@ -365,7 +381,7 @@ public: #endif mPatchList.push_back(PatchEntry(addr, code)); } - + inline U32 emitSTE(const char *code) { U64 *ptr = (U64*)allocCode(8); @@ -375,70 +391,70 @@ public: printf("code[%u] = %s\n", mCodePos, code); #endif mCodePos += 2; - return mCodePos-2; + return mCodePos - 2; } - + inline U32 tell() { return mCodePos; } - + inline bool inLoop() { - for (U32 i=0; i 0, "Fix stack mismatch"); - - U32 newSize = mFixStack[mFixStack.size()-1]; + + U32 newSize = mFixStack[mFixStack.size() - 1]; while (mFixList.size() > newSize) mFixList.pop_back(); mFixStack.pop_back(); mFixLoopStack.pop_back(); } - + void fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint); - + inline void addBreakLine(U32 lineNumber, U32 ip) { mBreakLines.push_back(lineNumber); mBreakLines.push_back(ip); } - + inline U32 getNumLineBreaks() { return mBreakLines.size() / 2; } - + void emitCodeStream(U32 *size, U32 **stream, U32 **lineBreaks); - + void reset(); }; diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 303c19fed..4009a5393 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -24,13 +24,13 @@ #define _CONSOLE_H_ #ifndef _PLATFORM_H_ - #include "platform/platform.h" +#include "platform/platform.h" #endif #ifndef _BITSET_H_ - #include "core/bitSet.h" +#include "core/bitSet.h" #endif #ifndef _REFBASE_H_ - #include "core/util/refBase.h" +#include "core/util/refBase.h" #endif #include @@ -95,8 +95,8 @@ struct ConsoleLogEntry Script, GUI, Network, - GGConnect, - NUM_TYPE + GGConnect, + NUM_TYPE } mType; /// Indicates the actual log entry. @@ -120,7 +120,7 @@ extern char *typeValueEmpty; class ConsoleValue { public: - + enum { TypeInternalInt = -5, @@ -129,17 +129,17 @@ public: TypeInternalStackString = -2, TypeInternalString = -1, }; - + S32 type; - + public: - + // NOTE: This is protected to ensure no one outside // of this structure is messing with it. - + #pragma warning( push ) #pragma warning( disable : 4201 ) // warning C4201: nonstandard extension used : nameless struct/union - + // An variable is either a real dynamic type or // its one exposed from C++ using a data pointer. // @@ -154,24 +154,24 @@ public: F32 fval; U32 bufferLen; }; - + struct { /// The real data pointer. void *dataPtr; - + /// The enum lookup table for enumerated types. const EnumTable *enumTable; }; }; - + U32 getIntValue(); S32 getSignedIntValue(); F32 getFloatValue(); const char *getStringValue(); StringStackPtr getStringStackPtr(); bool getBoolValue(); - + void setIntValue(U32 val); void setIntValue(S32 val); void setFloatValue(F32 val); @@ -179,7 +179,7 @@ public: void setStackStringValue(const char *value); void setStringStackPtrValue(StringStackPtr ptr); void setBoolValue(bool val); - + void init() { ival = 0; @@ -188,7 +188,7 @@ public: bufferLen = 0; type = TypeInternalString; } - + void cleanup() { if ((type <= TypeInternalString) && (bufferLen > 0)) @@ -201,8 +201,8 @@ public: ival = 0; fval = 0; } - ConsoleValue(){ init(); }; - ~ConsoleValue(){ cleanup(); }; + ConsoleValue() { init(); }; + ~ConsoleValue() { cleanup(); }; }; // Proxy class for console variables @@ -234,7 +234,7 @@ public: inline operator S32() { return getSignedIntValue(); } inline operator F32() { return getFloatValue(); } inline operator bool() { return getBoolValue(); } - + inline bool isStringStackPtr() { return value ? value->type == ConsoleValue::TypeInternalStringStackPtr : false; } inline bool isString() { return value ? value->type >= ConsoleValue::TypeInternalStringStackPtr : true; } inline bool isInt() { return value ? value->type == ConsoleValue::TypeInternalInt : false; } @@ -320,12 +320,12 @@ public: /// typedef const char * (*StringCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef S32 (*IntCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef F32 (*FloatCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef void (*VoidCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); // We have it return a value so things don't break.. -typedef bool (*BoolCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); +typedef S32(*IntCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); +typedef F32(*FloatCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); +typedef void(*VoidCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); // We have it return a value so things don't break.. +typedef bool(*BoolCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef void (*ConsumerCallback)(U32 level, const char *consoleLine); +typedef void(*ConsumerCallback)(U32 level, const char *consoleLine); /// @} /// @defgroup console_types Scripting Engine Type Functions @@ -333,7 +333,7 @@ typedef void (*ConsumerCallback)(U32 level, const char *consoleLine); /// @see Con::registerType /// @{ typedef const char* (*GetDataFunction)(void *dptr, EnumTable *tbl, BitSet32 flag); -typedef void (*SetDataFunction)(void *dptr, S32 argc, const char **argv, EnumTable *tbl, BitSet32 flag); +typedef void(*SetDataFunction)(void *dptr, S32 argc, const char **argv, EnumTable *tbl, BitSet32 flag); /// @} /// This namespace contains the core of the console functionality. @@ -347,7 +347,7 @@ typedef void (*SetDataFunction)(void *dptr, S32 argc, const char **argv, namespace Con { /// Various configuration constants. - enum Constants + enum Constants { /// This is the version number associated with DSO files. /// @@ -361,20 +361,22 @@ namespace Con /// 12/29/04 - BJG - 33->34 Removed some opcodes, part of namespace upgrade. /// 12/30/04 - BJG - 34->35 Reordered some things, further general shuffling. /// 11/03/05 - BJG - 35->36 Integrated new debugger code. - // 09/08/06 - THB - 36->37 New opcode for internal names - // 09/15/06 - THB - 37->38 Added unit conversions - // 11/23/06 - THB - 38->39 Added recursive internal name operator - // 02/15/07 - THB - 39->40 Bumping to 40 for TGB since the console has been - // majorly hacked without the version number being bumped - // 02/16/07 - THB - 40->41 newmsg operator - // 06/15/07 - THB - 41->42 script types + /// 09/08/06 - THB - 36->37 New opcode for internal names + /// 09/15/06 - THB - 37->38 Added unit conversions + /// 11/23/06 - THB - 38->39 Added recursive internal name operator + /// 02/15/07 - THB - 39->40 Bumping to 40 for TGB since the console has been + /// majorly hacked without the version number being bumped + /// 02/16/07 - THB - 40->41 newmsg operator + /// 06/15/07 - THB - 41->42 script types /// 07/31/07 - THB - 42->43 Patch from Andreas Kirsch: Added opcode to support nested new declarations. /// 09/12/07 - CAF - 43->44 remove newmsg operator /// 09/27/07 - RDB - 44->45 Patch from Andreas Kirsch: Added opcode to support correct void return /// 01/13/09 - TMS - 45->46 Added script assert /// 09/07/14 - jamesu - 46->47 64bit support /// 10/14/14 - jamesu - 47->48 Added opcodes to reduce reliance on strings in function calls - DSOVersion = 48, + /// 10/07/17 - JTH - 48->49 Added opcode for function pointers and revamp of interpreter + /// from switch to function calls. + DSOVersion = 49, MaxLineLength = 512, ///< Maximum length of a line of console input. MaxDataTypes = 256 ///< Maximum number of registered data types. @@ -552,11 +554,11 @@ namespace Con /// @param usage Documentation string. /// /// @see ConsoleDynamicTypes - void addVariable( const char *name, - S32 type, - void *pointer, - const char* usage = NULL ); - + void addVariable(const char *name, + S32 type, + void *pointer, + const char* usage = NULL); + /// Add a console constant that references the value of a constant in C++ code. /// /// @param name Global console constant name to create. @@ -565,11 +567,11 @@ namespace Con /// @param usage Documentation string. /// /// @see ConsoleDynamicTypes - void addConstant( const char *name, - S32 type, - const void *pointer, - const char* usage = NULL ); - + void addConstant(const char *name, + S32 type, + const void *pointer, + const char* usage = NULL); + /// Remove a console variable. /// /// @param name Global console variable name to remove @@ -582,14 +584,14 @@ namespace Con /// @param name An existing global console variable name. /// @param callback The notification delegate function. /// - void addVariableNotify( const char *name, const NotifyDelegate &callback ); + void addVariableNotify(const char *name, const NotifyDelegate &callback); /// Remove an existing variable assignment notification callback. /// /// @param name An existing global console variable name. /// @param callback The notification delegate function. /// - void removeVariableNotify( const char *name, const NotifyDelegate &callback ); + void removeVariableNotify(const char *name, const NotifyDelegate &callback); /// Assign a string value to a locally scoped console variable /// @@ -628,31 +630,31 @@ namespace Con const char* getObjectField(const char* name); /// Same as setVariable(), but for bools. - void setBoolVariable (const char* name,bool var); + void setBoolVariable(const char* name, bool var); /// Same as getVariable(), but for bools. /// /// @param name Name of the variable. /// @param def Default value to supply if no matching variable is found. - bool getBoolVariable (const char* name,bool def = false); + bool getBoolVariable(const char* name, bool def = false); /// Same as setVariable(), but for ints. - void setIntVariable (const char* name,S32 var); + void setIntVariable(const char* name, S32 var); /// Same as getVariable(), but for ints. /// /// @param name Name of the variable. /// @param def Default value to supply if no matching variable is found. - S32 getIntVariable (const char* name,S32 def = 0); + S32 getIntVariable(const char* name, S32 def = 0); /// Same as setVariable(), but for floats. - void setFloatVariable(const char* name,F32 var); + void setFloatVariable(const char* name, F32 var); /// Same as getVariable(), but for floats. /// /// @param name Name of the variable. /// @param def Default value to supply if no matching variable is found. - F32 getFloatVariable(const char* name,F32 def = .0f); + F32 getFloatVariable(const char* name, F32 def = .0f); /// @} @@ -668,52 +670,52 @@ namespace Con /// @param maxArgs Maximum number of arguments this function accepts /// @param toolOnly Wether this is a TORQUE_TOOLS only function. /// @param header The extended function header. - void addCommand( const char* name, StringCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + void addCommand(const char* name, StringCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); - void addCommand( const char* name, IntCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand( const char* name, FloatCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand( const char* name, VoidCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand( const char* name, BoolCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - - /// @} + void addCommand(const char* name, IntCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char* name, FloatCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char* name, VoidCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char* name, BoolCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - /// @name Namespace Function Registration - /// @{ + /// @} - /// Register a C++ function with the console making it callable - /// as a method of the given namespace from the scripting engine. - /// - /// @param nameSpace Name of the namespace to associate the new function with; this is usually the name of a class. - /// @param name Name of the new function. - /// @param cb Pointer to the function implementing the scripting call; a console callback function returning a specific type value. - /// @param usage Documentation for this function. @ref console_autodoc - /// @param minArgs Minimum number of arguments this function accepts - /// @param maxArgs Maximum number of arguments this function accepts - /// @param toolOnly Wether this is a TORQUE_TOOLS only function. - /// @param header The extended function header. - void addCommand(const char *nameSpace, const char *name,StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + /// @name Namespace Function Registration + /// @{ - void addCommand(const char *nameSpace, const char *name,IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand(const char *nameSpace, const char *name,FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand(const char *nameSpace, const char *name,VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand(const char *nameSpace, const char *name,BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + /// Register a C++ function with the console making it callable + /// as a method of the given namespace from the scripting engine. + /// + /// @param nameSpace Name of the namespace to associate the new function with; this is usually the name of a class. + /// @param name Name of the new function. + /// @param cb Pointer to the function implementing the scripting call; a console callback function returning a specific type value. + /// @param usage Documentation for this function. @ref console_autodoc + /// @param minArgs Minimum number of arguments this function accepts + /// @param maxArgs Maximum number of arguments this function accepts + /// @param toolOnly Wether this is a TORQUE_TOOLS only function. + /// @param header The extended function header. + void addCommand(const char *nameSpace, const char *name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); - /// @} + void addCommand(const char *nameSpace, const char *name, IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char *nameSpace, const char *name, FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char *nameSpace, const char *name, VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char *nameSpace, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - /// @name Special Purpose Registration - /// - /// These are special-purpose functions that exist to allow commands to be grouped, so - /// that when we generate console docs, they can be more meaningfully presented. - /// - /// @ref console_autodoc "Click here for more information about console docs and grouping." - /// - /// @{ + /// @} - void markCommandGroup (const char * nsName, const char *name, const char* usage=NULL); + /// @name Special Purpose Registration + /// + /// These are special-purpose functions that exist to allow commands to be grouped, so + /// that when we generate console docs, they can be more meaningfully presented. + /// + /// @ref console_autodoc "Click here for more information about console docs and grouping." + /// + /// @{ + + void markCommandGroup(const char * nsName, const char *name, const char* usage = NULL); void beginCommandGroup(const char * nsName, const char *name, const char* usage); - void endCommandGroup (const char * nsName, const char *name); + void endCommandGroup(const char * nsName, const char *name); - void noteScriptCallback( const char *className, const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL ); + void noteScriptCallback(const char *className, const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL); /// @} @@ -841,15 +843,15 @@ namespace Con /// char* getReturnBuffer(U32 bufferSize); char* getReturnBuffer(const char *stringToCopy); - char* getReturnBuffer( const String& str ); - char* getReturnBuffer( const StringBuilder& str ); + char* getReturnBuffer(const String& str); + char* getReturnBuffer(const StringBuilder& str); char* getArgBuffer(U32 bufferSize); char* getFloatArg(F64 arg); - char* getIntArg (S32 arg); + char* getIntArg(S32 arg); char* getBoolArg(bool arg); - char* getStringArg( const char* arg ); - char* getStringArg( const String& arg ); + char* getStringArg(const char* arg); + char* getStringArg(const String& arg); /// @} /// @name Namespaces @@ -877,7 +879,7 @@ namespace Con /// @name Instant Group /// @{ - void pushInstantGroup( String name = String() ); + void pushInstantGroup(String name = String()); void popInstantGroup(); /// @} @@ -915,7 +917,7 @@ namespace Con template ConsoleValueRef executef(R r, ArgTs ...argTs) { - _EngineConsoleExecCallbackHelper callback( r ); + _EngineConsoleExecCallbackHelper callback(r); return callback.template call(argTs...); } /// } @@ -931,25 +933,25 @@ struct ConsoleFunctionHeader { /// Return type string. const char* mReturnString; - + /// List of arguments taken by the function. Used for documentation. const char* mArgString; - + /// List of default argument values. Used for documentation. const char* mDefaultArgString; - + /// Whether this is a static method in a class. bool mIsStatic; - + ConsoleFunctionHeader( const char* returnString, const char* argString, const char* defaultArgString, - bool isStatic = false ) - : mReturnString( returnString ), - mArgString( argString ), - mDefaultArgString( defaultArgString ), - mIsStatic( isStatic ) {} + bool isStatic = false) + : mReturnString(returnString), + mArgString(argString), + mDefaultArgString(defaultArgString), + mIsStatic(isStatic) {} }; @@ -969,7 +971,7 @@ public: /// /// @ref console_autodoc /// @{ - + StringCallback sc; ///< A function/method that returns a string. IntCallback ic; ///< A function/method that returns an int. FloatCallback fc; ///< A function/method that returns a float. @@ -979,18 +981,18 @@ public: bool ns; ///< Indicates that this is a namespace marker. /// @deprecated Unused. bool callback; ///< Is this a callback into script? - - /// @} - /// Minimum number of arguments expected by the function. + /// @} + + /// Minimum number of arguments expected by the function. S32 mina; - + /// Maximum number of arguments accepted by the funtion. Zero for varargs. S32 maxa; - + /// Name of the function/method. const char* funcName; - + /// Name of the class namespace to which to add the method. const char* className; @@ -999,10 +1001,10 @@ public: /// Whether this is a TORQUE_TOOLS only function. bool toolOnly; - + /// The extended function header. ConsoleFunctionHeader* header; - + /// @name ConsoleConstructor Innards /// /// The ConsoleConstructor class is used as the backend for the ConsoleFunction() and @@ -1067,7 +1069,7 @@ public: ConsoleConstructor *next; static ConsoleConstructor *first; - void init( const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); static void setup(); @@ -1079,12 +1081,12 @@ public: /// @name Basic Console Constructors /// @{ - ConsoleConstructor( const char* className, const char* funcName, StringCallback sfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, IntCallback ifunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, FloatCallback ffunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, VoidCallback vfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, BoolCallback bfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - + ConsoleConstructor(const char* className, const char* funcName, StringCallback sfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, IntCallback ifunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, FloatCallback ffunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, VoidCallback vfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, BoolCallback bfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + /// @} /// @name Magic Console Constructors @@ -1097,10 +1099,10 @@ public: /// /// @see Con::markCommandGroup /// @ref console_autodoc - ConsoleConstructor( const char *className, const char *groupName, const char* usage ); + ConsoleConstructor(const char *className, const char *groupName, const char* usage); /// Indicates a callback declared with the DECLARE_SCRIPT_CALLBACK macro and friends. - ConsoleConstructor( const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header ); + ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header); /// @} }; @@ -1112,25 +1114,25 @@ struct ConsoleDocFragment /// The class in which to put the fragment. If NULL, the fragment /// will be placed globally. const char* mClass; - + /// The definition to output for this fragment. NULL for fragments /// not associated with a definition. const char* mDefinition; - + /// The documentation text. const char* mText; - + /// Next fragment in the global link chain. ConsoleDocFragment* mNext; - + /// First fragment in the global link chain. static ConsoleDocFragment* smFirst; - - ConsoleDocFragment( const char* text, const char* inClass = NULL, const char* definition = NULL ) - : mClass( inClass ), - mDefinition( definition ), - mText( text ), - mNext( smFirst ) + + ConsoleDocFragment(const char* text, const char* inClass = NULL, const char* definition = NULL) + : mClass(inClass), + mDefinition(definition), + mText(text), + mNext(smFirst) { smFirst = this; } @@ -1229,7 +1231,7 @@ public: # define ConsoleMethodGroupEnd(className, groupName) \ static ConsoleConstructor cc_##className##_##groupName##_GroupEnd(#className,#groupName,NULL) - + /// Add a fragment of auto-doc text to the console API reference. /// @note There can only be one ConsoleDoc per source file. # define ConsoleDoc( text ) \ diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index b63d7293a..4fb6921dd 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -185,7 +185,7 @@ void printGroupStart(const char * aName, const char * aDocs) Con::printf(" /*! */"); } -void printClassMember(const bool isDeprec, const char * aType, const char * aName, const char * aDocs) +void printClassMember(const bool isDeprec, const char * aType, const char * aName, const char * aDocs, S32 aElementCount) { Con::printf(" /*!"); @@ -200,7 +200,14 @@ void printClassMember(const bool isDeprec, const char * aType, const char * aNam Con::printf(" */"); - Con::printf(" %s %s;", isDeprec ? "deprecated" : aType, aName); + if (aElementCount == 1) + { + Con::printf(" %s %s;", isDeprec ? "deprecated" : aType, aName); + } + else + { + Con::printf(" %s %s[%i];", isDeprec ? "deprecated" : aType, aName, aElementCount); + } } void printGroupEnd() @@ -235,8 +242,17 @@ void Namespace::printNamespaceEntries(Namespace * g, bool dumpScript, bool dumpE // If it's a function if( eType >= Entry::ConsoleFunctionType ) { - printClassMethod(true, typeNames[eType], funcName, ewalk->getArgumentsString().c_str(), - ewalk->getDocString().c_str()); + if (ewalk->mHeader != NULL) + { + // The function was defined with types, so we can print out the actual return type + printClassMethod(true, ewalk->mHeader->mReturnString, funcName, ewalk->getArgumentsString().c_str(), + ewalk->getDocString().c_str()); + } + else + { + printClassMethod(true, typeNames[eType], funcName, (ewalk->getArgumentsString() + "...").c_str(), + ewalk->getDocString().c_str()); + } } else if(ewalk->mType == Entry::GroupMarker) { @@ -416,7 +432,8 @@ void Namespace::dumpClasses( bool dumpScript, bool dumpEngine ) true, "", (*fieldList)[j].pFieldname, - (*fieldList)[j].pFieldDocs + (*fieldList)[j].pFieldDocs, + (*fieldList)[j].elementCount ); } else @@ -427,7 +444,8 @@ void Namespace::dumpClasses( bool dumpScript, bool dumpEngine ) false, cbt ? cbt->getTypeClassName() : "", (*fieldList)[j].pFieldname, - (*fieldList)[j].pFieldDocs + (*fieldList)[j].pFieldDocs, + (*fieldList)[j].elementCount ); } } diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index c9016e8dc..eadee5d7b 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -20,6 +20,8 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +#include + #include "platform/platform.h" #include "console/console.h" @@ -43,28 +45,42 @@ DataChunker Namespace::mAllocator; Namespace *Namespace::mNamespaceList = NULL; Namespace *Namespace::mGlobalNamespace = NULL; +namespace std +{ + template<> struct hash> + { + typedef std::pair argument_type; + typedef size_t result_type; + result_type operator()(argument_type const& s) const + { + return HashPointer(s.first) ^ (HashPointer(s.second) << 1); + } + }; +}; + +std::unordered_map, Namespace*> gNamespaceCache; bool canTabComplete(const char *prevText, const char *bestMatch, - const char *newText, S32 baseLen, bool fForward) + const char *newText, S32 baseLen, bool fForward) { // test if it matches the first baseLen chars: - if(dStrnicmp(newText, prevText, baseLen)) + if (dStrnicmp(newText, prevText, baseLen)) return false; if (fForward) { - if(!bestMatch) + if (!bestMatch) return dStricmp(newText, prevText) > 0; else return (dStricmp(newText, prevText) > 0) && - (dStricmp(newText, bestMatch) < 0); + (dStricmp(newText, bestMatch) < 0); } else { - if (dStrlen(prevText) == (U32) baseLen) + if (dStrlen(prevText) == (U32)baseLen) { // look for the 'worst match' - if(!bestMatch) + if (!bestMatch) return dStricmp(newText, prevText) > 0; else return dStricmp(newText, bestMatch) > 0; @@ -75,7 +91,7 @@ bool canTabComplete(const char *prevText, const char *bestMatch, return (dStricmp(newText, prevText) < 0); else return (dStricmp(newText, prevText) < 0) && - (dStricmp(newText, bestMatch) > 0); + (dStricmp(newText, bestMatch) > 0); } } } @@ -100,7 +116,7 @@ struct StringValue StringValue & StringValue::operator=(const char *string) { - if(!val) + if (!val) { val = dStrdup(string); size = dStrlen(val); @@ -108,7 +124,7 @@ StringValue & StringValue::operator=(const char *string) else { S32 len = dStrlen(string); - if(len < size) + if (len < size) dStrcpy(val, string); else { @@ -120,9 +136,9 @@ StringValue & StringValue::operator=(const char *string) return *this; } -static S32 QSORT_CALLBACK varCompare(const void* a,const void* b) +static S32 QSORT_CALLBACK varCompare(const void* a, const void* b) { - return dStricmp( (*((Dictionary::Entry **) a))->name, (*((Dictionary::Entry **) b))->name ); + return dStricmp((*((Dictionary::Entry **) a))->name, (*((Dictionary::Entry **) b))->name); } void Dictionary::exportVariables(const char *varString, const char *fileName, bool append) @@ -130,44 +146,44 @@ void Dictionary::exportVariables(const char *varString, const char *fileName, bo const char *searchStr = varString; Vector sortList(__FILE__, __LINE__); - for(S32 i = 0; i < hashTable->size;i ++) + for (S32 i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while(walk) + while (walk) { - if(FindMatch::isMatch((char *) searchStr, (char *) walk->name)) + if (FindMatch::isMatch((char *)searchStr, (char *)walk->name)) sortList.push_back(walk); walk = walk->nextEntry; } } - if(!sortList.size()) + if (!sortList.size()) return; - dQsort((void *) &sortList[0], sortList.size(), sizeof(Entry *), varCompare); + dQsort((void *)&sortList[0], sortList.size(), sizeof(Entry *), varCompare); Vector::iterator s; char expandBuffer[1024]; FileStream *strm = NULL; - if(fileName) + if (fileName) { - if((strm = FileStream::createAndOpen( fileName, append ? Torque::FS::File::ReadWrite : Torque::FS::File::Write )) == NULL) + if ((strm = FileStream::createAndOpen(fileName, append ? Torque::FS::File::ReadWrite : Torque::FS::File::Write)) == NULL) { Con::errorf(ConsoleLogEntry::General, "Unable to open file '%s for writing.", fileName); return; } - if(append) + if (append) strm->setPosition(strm->getStreamSize()); } char buffer[1024]; const char *cat = fileName ? "\r\n" : ""; - for(s = sortList.begin(); s != sortList.end(); s++) + for (s = sortList.begin(); s != sortList.end(); s++) { - switch((*s)->value.type) + switch ((*s)->value.type) { case ConsoleValue::TypeInternalInt: dSprintf(buffer, sizeof(buffer), "%s = %d;%s", (*s)->name, (*s)->value.ival, cat); @@ -180,65 +196,65 @@ void Dictionary::exportVariables(const char *varString, const char *fileName, bo dSprintf(buffer, sizeof(buffer), "%s = \"%s\";%s", (*s)->name, expandBuffer, cat); break; } - if(strm) + if (strm) strm->write(dStrlen(buffer), buffer); else Con::printf("%s", buffer); } - if(strm) + if (strm) delete strm; } -void Dictionary::exportVariables( const char *varString, Vector *names, Vector *values ) +void Dictionary::exportVariables(const char *varString, Vector *names, Vector *values) { const char *searchStr = varString; Vector sortList(__FILE__, __LINE__); - for ( S32 i = 0; i < hashTable->size; i++ ) + for (S32 i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while ( walk ) + while (walk) { - if ( FindMatch::isMatch( (char*)searchStr, (char*)walk->name ) ) - sortList.push_back( walk ); + if (FindMatch::isMatch((char*)searchStr, (char*)walk->name)) + sortList.push_back(walk); walk = walk->nextEntry; } } - if ( !sortList.size() ) + if (!sortList.size()) return; - dQsort((void *) &sortList[0], sortList.size(), sizeof(Entry *), varCompare); + dQsort((void *)&sortList[0], sortList.size(), sizeof(Entry *), varCompare); - if ( names ) - names->reserve( sortList.size() ); - if ( values ) - values->reserve( sortList.size() ); + if (names) + names->reserve(sortList.size()); + if (values) + values->reserve(sortList.size()); char expandBuffer[1024]; Vector::iterator s; - for ( s = sortList.begin(); s != sortList.end(); s++ ) + for (s = sortList.begin(); s != sortList.end(); s++) { - if ( names ) - names->push_back( String( (*s)->name ) ); + if (names) + names->push_back(String((*s)->name)); - if ( values ) + if (values) { - switch ( (*s)->value.type ) + switch ((*s)->value.type) { - case ConsoleValue::TypeInternalInt: - values->push_back( String::ToString( (*s)->value.ival ) ); - break; - case ConsoleValue::TypeInternalFloat: - values->push_back( String::ToString( (*s)->value.fval ) ); - break; - default: - expandEscape( expandBuffer, (*s)->getStringValue() ); - values->push_back( expandBuffer ); - break; + case ConsoleValue::TypeInternalInt: + values->push_back(String::ToString((*s)->value.ival)); + break; + case ConsoleValue::TypeInternalFloat: + values->push_back(String::ToString((*s)->value.fval)); + break; + default: + expandEscape(expandBuffer, (*s)->getStringValue()); + values->push_back(expandBuffer); + break; } } } @@ -248,12 +264,12 @@ void Dictionary::deleteVariables(const char *varString) { const char *searchStr = varString; - for(S32 i = 0; i < hashTable->size; i++) + for (S32 i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while(walk) + while (walk) { - Entry *matchedEntry = (FindMatch::isMatch((char *) searchStr, (char *) walk->name)) ? walk : NULL; + Entry *matchedEntry = (FindMatch::isMatch((char *)searchStr, (char *)walk->name)) ? walk : NULL; walk = walk->nextEntry; if (matchedEntry) remove(matchedEntry); // assumes remove() is a stable remove (will not reorder entries on remove) @@ -269,9 +285,9 @@ U32 HashPointer(StringTableEntry ptr) Dictionary::Entry *Dictionary::lookup(StringTableEntry name) { Entry *walk = hashTable->data[HashPointer(name) % hashTable->size]; - while(walk) + while (walk) { - if(walk->name == name) + if (walk->name == name) return walk; else walk = walk->nextEntry; @@ -284,56 +300,56 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name) { // Try to find an existing match. //printf("Add Variable %s\n", name); - - Entry* ret = lookup( name ); - if( ret ) + + Entry* ret = lookup(name); + if (ret) return ret; - + // Rehash if the table get's too crowded. Be aware that this might // modify a table that we don't own. - hashTable->count ++; - if( hashTable->count > hashTable->size * 2 ) + hashTable->count++; + if (hashTable->count > hashTable->size * 2) { // Allocate a new table. - + const U32 newTableSize = hashTable->size * 4 - 1; - Entry** newTableData = new Entry*[ newTableSize ]; - dMemset( newTableData, 0, newTableSize * sizeof( Entry* ) ); - + Entry** newTableData = new Entry*[newTableSize]; + dMemset(newTableData, 0, newTableSize * sizeof(Entry*)); + // Move the entries over. - - for( U32 i = 0; i < hashTable->size; ++ i ) - for( Entry* entry = hashTable->data[ i ]; entry != NULL; ) + + for (U32 i = 0; i < hashTable->size; ++i) + for (Entry* entry = hashTable->data[i]; entry != NULL; ) { Entry* next = entry->nextEntry; - U32 index = HashPointer( entry->name ) % newTableSize; - - entry->nextEntry = newTableData[ index ]; - newTableData[ index ] = entry; - + U32 index = HashPointer(entry->name) % newTableSize; + + entry->nextEntry = newTableData[index]; + newTableData[index] = entry; + entry = next; } - + // Switch the tables. - + delete[] hashTable->data; hashTable->data = newTableData; hashTable->size = newTableSize; } - - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Adding entry '%s'", name ); - #endif - + +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Adding entry '%s'", name); +#endif + // Add the new entry. ret = hashTable->mChunker.alloc(); - constructInPlace( ret, name ); + constructInPlace(ret, name); U32 idx = HashPointer(name) % hashTable->size; ret->nextEntry = hashTable->data[idx]; hashTable->data[idx] = ret; - + return ret; } @@ -341,88 +357,88 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name) void Dictionary::remove(Dictionary::Entry *ent) { Entry **walk = &hashTable->data[HashPointer(ent->name) % hashTable->size]; - while(*walk != ent) + while (*walk != ent) walk = &((*walk)->nextEntry); - - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Removing entry '%s'", ent->name ); - #endif + +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Removing entry '%s'", ent->name); +#endif *walk = (ent->nextEntry); - destructInPlace( ent ); - hashTable->mChunker.free( ent ); + destructInPlace(ent); + hashTable->mChunker.free(ent); hashTable->count--; } Dictionary::Dictionary() - : hashTable( NULL ), + : hashTable(NULL), #pragma warning( disable : 4355 ) - ownHashTable( this ), // Warning with VC++ but this is safe. + ownHashTable(this), // Warning with VC++ but this is safe. #pragma warning( default : 4355 ) - exprState( NULL ), - scopeName( NULL ), - scopeNamespace( NULL ), - code( NULL ), - ip( 0 ) + exprState(NULL), + scopeName(NULL), + scopeNamespace(NULL), + code(NULL), + ip(0) { } void Dictionary::setState(ExprEvalState *state, Dictionary* ref) { exprState = state; - - if( ref ) + + if (ref) { hashTable = ref->hashTable; return; } - if( !ownHashTable.data ) + if (!ownHashTable.data) { ownHashTable.count = 0; ownHashTable.size = ST_INIT_SIZE; - ownHashTable.data = new Entry *[ ownHashTable.size ]; - - dMemset( ownHashTable.data, 0, ownHashTable.size * sizeof( Entry* ) ); + ownHashTable.data = new Entry *[ownHashTable.size]; + + dMemset(ownHashTable.data, 0, ownHashTable.size * sizeof(Entry*)); } - + hashTable = &ownHashTable; } Dictionary::~Dictionary() { reset(); - if( ownHashTable.data ) - delete [] ownHashTable.data; + if (ownHashTable.data) + delete[] ownHashTable.data; } void Dictionary::reset() { - if( hashTable && hashTable->owner != this ) + if (hashTable && hashTable->owner != this) { hashTable = NULL; return; } - - for( U32 i = 0; i < ownHashTable.size; ++ i ) + + for (U32 i = 0; i < ownHashTable.size; ++i) { Entry* walk = ownHashTable.data[i]; - while( walk ) + while (walk) { Entry* temp = walk->nextEntry; - destructInPlace( walk ); + destructInPlace(walk); walk = temp; } } - dMemset( ownHashTable.data, 0, ownHashTable.size * sizeof( Entry* ) ); - ownHashTable.mChunker.freeBlocks( true ); - + dMemset(ownHashTable.data, 0, ownHashTable.size * sizeof(Entry*)); + ownHashTable.mChunker.freeBlocks(true); + ownHashTable.count = 0; hashTable = NULL; - + scopeName = NULL; scopeNamespace = NULL; code = NULL; @@ -435,12 +451,12 @@ const char *Dictionary::tabComplete(const char *prevText, S32 baseLen, bool fFor S32 i; const char *bestMatch = NULL; - for(i = 0; i < hashTable->size; i++) + for (i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while(walk) + while (walk) { - if(canTabComplete(prevText, bestMatch, walk->name, baseLen, fForward)) + if (canTabComplete(prevText, bestMatch, walk->name, baseLen, fForward)) bestMatch = walk->name; walk = walk->nextEntry; } @@ -469,24 +485,24 @@ Dictionary::Entry::~Entry() { value.cleanup(); - if ( notify ) + if (notify) delete notify; } const char *Dictionary::getVariable(StringTableEntry name, bool *entValid) { Entry *ent = lookup(name); - if(ent) + if (ent) { - if(entValid) + if (entValid) *entValid = true; return ent->getStringValue(); } - if(entValid) + if (entValid) *entValid = false; // Warn users when they access a variable that isn't defined. - if(gWarnUndefinedScriptVariables) + if (gWarnUndefinedScriptVariables) Con::warnf(" *** Accessed undefined variable '%s'", name); return ""; @@ -496,20 +512,20 @@ void ConsoleValue::setStringValue(const char * value) { if (value == NULL) value = typeValueEmpty; - if(type <= ConsoleValue::TypeInternalString) + if (type <= ConsoleValue::TypeInternalString) { // Let's not remove empty-string-valued global vars from the dict. // If we remove them, then they won't be exported, and sometimes // it could be necessary to export such a global. There are very // few empty-string global vars so there's no performance-related // need to remove them from the dict. -/* + /* if(!value[0] && name[0] == '$') { - gEvalState.globalVars.remove(this); - return; + gEvalState.globalVars.remove(this); + return; } -*/ + */ if (value == typeValueEmpty) { if (bufferLen > 0) @@ -531,7 +547,7 @@ void ConsoleValue::setStringValue(const char * value) // // (This decision may come back to haunt you. Shame on you if it // does.) - if(stringLen < 256) + if (stringLen < 256) { fval = dAtof(value); ival = dAtoi(value); @@ -544,11 +560,11 @@ void ConsoleValue::setStringValue(const char * value) // may as well pad to the next cache line U32 newLen = ((stringLen + 1) + 15) & ~15; - - if(bufferLen == 0) - sval = (char *) dMalloc(newLen); - else if(newLen > bufferLen) - sval = (char *) dRealloc(sval, newLen); + + if (bufferLen == 0) + sval = (char *)dMalloc(newLen); + else if (newLen > bufferLen) + sval = (char *)dRealloc(sval, newLen); type = TypeInternalString; @@ -556,7 +572,7 @@ void ConsoleValue::setStringValue(const char * value) dStrcpy(sval, value); } else - Con::setData(type, dataPtr, 0, 1, &value, enumTable); + Con::setData(type, dataPtr, 0, 1, &value, enumTable); } @@ -564,7 +580,7 @@ void ConsoleValue::setStackStringValue(const char *value) { if (value == NULL) value = typeValueEmpty; - if(type <= ConsoleValue::TypeInternalString) + if (type <= ConsoleValue::TypeInternalString) { // sval might still be temporarily present so we need to check and free it if (bufferLen > 0) @@ -583,7 +599,7 @@ void ConsoleValue::setStackStringValue(const char *value) } U32 stringLen = dStrlen(value); - if(stringLen < 256) + if (stringLen < 256) { fval = dAtof(value); ival = dAtoi(value); @@ -599,12 +615,12 @@ void ConsoleValue::setStackStringValue(const char *value) bufferLen = 0; } else - Con::setData(type, dataPtr, 0, 1, &value, enumTable); + Con::setData(type, dataPtr, 0, 1, &value, enumTable); } void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) { - if(type <= ConsoleValue::TypeInternalString) + if (type <= ConsoleValue::TypeInternalString) { const char *value = StringStackPtrRef(ptrValue).getPtr(&STR); if (bufferLen > 0) @@ -614,7 +630,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) } U32 stringLen = dStrlen(value); - if(stringLen < 256) + if (stringLen < 256) { fval = dAtof(value); ival = dAtoi(value); @@ -632,37 +648,37 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) else { const char *value = StringStackPtrRef(ptrValue).getPtr(&STR); - Con::setData(type, dataPtr, 0, 1, &value, enumTable); + Con::setData(type, dataPtr, 0, 1, &value, enumTable); } } S32 Dictionary::getIntVariable(StringTableEntry name, bool *entValid) { Entry *ent = lookup(name); - if(ent) + if (ent) { - if(entValid) + if (entValid) *entValid = true; return ent->getIntValue(); } - if(entValid) + if (entValid) *entValid = false; - return 0; + return 0; } F32 Dictionary::getFloatVariable(StringTableEntry name, bool *entValid) { Entry *ent = lookup(name); - if(ent) + if (ent) { - if(entValid) + if (entValid) *entValid = true; return ent->getFloatValue(); } - if(entValid) + if (entValid) *entValid = false; return 0; @@ -671,19 +687,19 @@ F32 Dictionary::getFloatVariable(StringTableEntry name, bool *entValid) void Dictionary::setVariable(StringTableEntry name, const char *value) { Entry *ent = add(name); - if(!value) + if (!value) value = ""; ent->setStringValue(value); } -Dictionary::Entry* Dictionary::addVariable( const char *name, - S32 type, - void *dataPtr, - const char* usage ) +Dictionary::Entry* Dictionary::addVariable(const char *name, + S32 type, + void *dataPtr, + const char* usage) { - AssertFatal( type >= 0, "Dictionary::addVariable - Got bad type!" ); + AssertFatal(type >= 0, "Dictionary::addVariable - Got bad type!"); - if(name[0] != '$') + if (name[0] != '$') { scratchBuffer[0] = '$'; dStrcpy(scratchBuffer + 1, name); @@ -691,142 +707,142 @@ Dictionary::Entry* Dictionary::addVariable( const char *name, } Entry *ent = add(StringTable->insert(name)); - - if ( ent->value.type <= ConsoleValue::TypeInternalString && - ent->value.bufferLen > 0 ) + + if (ent->value.type <= ConsoleValue::TypeInternalString && + ent->value.bufferLen > 0) dFree(ent->value.sval); ent->value.type = type; ent->value.dataPtr = dataPtr; ent->mUsage = usage; - + // Fetch enum table, if any. - - ConsoleBaseType* conType = ConsoleBaseType::getType( type ); - AssertFatal( conType, "Dictionary::addVariable - invalid console type" ); + + ConsoleBaseType* conType = ConsoleBaseType::getType(type); + AssertFatal(conType, "Dictionary::addVariable - invalid console type"); ent->value.enumTable = conType->getEnumTable(); - + return ent; } bool Dictionary::removeVariable(StringTableEntry name) { - if( Entry *ent = lookup(name) ) + if (Entry *ent = lookup(name)) { - remove( ent ); + remove(ent); return true; } return false; } -void Dictionary::addVariableNotify( const char *name, const Con::NotifyDelegate &callback ) +void Dictionary::addVariableNotify(const char *name, const Con::NotifyDelegate &callback) { Entry *ent = lookup(StringTable->insert(name)); - if ( !ent ) - return; + if (!ent) + return; - if ( !ent->notify ) + if (!ent->notify) ent->notify = new Entry::NotifySignal(); - ent->notify->notify( callback ); + ent->notify->notify(callback); } -void Dictionary::removeVariableNotify( const char *name, const Con::NotifyDelegate &callback ) +void Dictionary::removeVariableNotify(const char *name, const Con::NotifyDelegate &callback) { Entry *ent = lookup(StringTable->insert(name)); - if ( ent && ent->notify ) - ent->notify->remove( callback ); + if (ent && ent->notify) + ent->notify->remove(callback); } void Dictionary::validate() { - AssertFatal( ownHashTable.owner == this, - "Dictionary::validate() - Dictionary not owner of own hashtable!" ); + AssertFatal(ownHashTable.owner == this, + "Dictionary::validate() - Dictionary not owner of own hashtable!"); } void ExprEvalState::pushFrame(StringTableEntry frameName, Namespace *ns) -{ - #ifdef DEBUG_SPEW +{ +#ifdef DEBUG_SPEW validate(); - Platform::outputDebugString( "[ConsoleInternal] Pushing new frame for '%s' at %i", - frameName, mStackDepth ); - #endif - - if( mStackDepth + 1 > stack.size() ) + Platform::outputDebugString("[ConsoleInternal] Pushing new frame for '%s' at %i", + frameName, mStackDepth); +#endif + + if (mStackDepth + 1 > stack.size()) { - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Growing stack by one frame" ); - #endif - - stack.push_back( new Dictionary ); +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Growing stack by one frame"); +#endif + + stack.push_back(new Dictionary); } - - Dictionary& newFrame = *( stack[ mStackDepth ] ); - newFrame.setState( this ); - + + Dictionary& newFrame = *(stack[mStackDepth]); + newFrame.setState(this); + newFrame.scopeName = frameName; newFrame.scopeNamespace = ns; - mStackDepth ++; + mStackDepth++; currentVariable = NULL; - - AssertFatal( !newFrame.getCount(), "ExprEvalState::pushFrame - Dictionary not empty!" ); - - #ifdef DEBUG_SPEW + + AssertFatal(!newFrame.getCount(), "ExprEvalState::pushFrame - Dictionary not empty!"); + +#ifdef DEBUG_SPEW validate(); - #endif +#endif } void ExprEvalState::popFrame() { - AssertFatal( mStackDepth > 0, "ExprEvalState::popFrame - Stack Underflow!" ); - - #ifdef DEBUG_SPEW - validate(); - - Platform::outputDebugString( "[ConsoleInternal] Popping %sframe at %i", - getCurrentFrame().isOwner() ? "" : "shared ", mStackDepth - 1 ); - #endif + AssertFatal(mStackDepth > 0, "ExprEvalState::popFrame - Stack Underflow!"); - mStackDepth --; - stack[ mStackDepth ]->reset(); +#ifdef DEBUG_SPEW + validate(); + + Platform::outputDebugString("[ConsoleInternal] Popping %sframe at %i", + getCurrentFrame().isOwner() ? "" : "shared ", mStackDepth - 1); +#endif + + mStackDepth--; + stack[mStackDepth]->reset(); currentVariable = NULL; - #ifdef DEBUG_SPEW +#ifdef DEBUG_SPEW validate(); - #endif +#endif } void ExprEvalState::pushFrameRef(S32 stackIndex) { - AssertFatal( stackIndex >= 0 && stackIndex < stack.size(), "You must be asking for a valid frame!" ); + AssertFatal(stackIndex >= 0 && stackIndex < stack.size(), "You must be asking for a valid frame!"); - #ifdef DEBUG_SPEW +#ifdef DEBUG_SPEW validate(); - - Platform::outputDebugString( "[ConsoleInternal] Cloning frame from %i to %i", - stackIndex, mStackDepth ); - #endif - if( mStackDepth + 1 > stack.size() ) + Platform::outputDebugString("[ConsoleInternal] Cloning frame from %i to %i", + stackIndex, mStackDepth); +#endif + + if (mStackDepth + 1 > stack.size()) { - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Growing stack by one frame" ); - #endif - - stack.push_back( new Dictionary ); +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Growing stack by one frame"); +#endif + + stack.push_back(new Dictionary); } - Dictionary& newFrame = *( stack[ mStackDepth ] ); - newFrame.setState( this, stack[ stackIndex ] ); - - mStackDepth ++; + Dictionary& newFrame = *(stack[mStackDepth]); + newFrame.setState(this, stack[stackIndex]); + + mStackDepth++; currentVariable = NULL; - - #ifdef DEBUG_SPEW + +#ifdef DEBUG_SPEW validate(); - #endif +#endif } ExprEvalState::ExprEvalState() @@ -837,7 +853,7 @@ ExprEvalState::ExprEvalState() traceOn = false; currentVariable = NULL; mStackDepth = 0; - stack.reserve( 64 ); + stack.reserve(64); mShouldReset = false; mResetLocked = false; } @@ -845,8 +861,8 @@ ExprEvalState::ExprEvalState() ExprEvalState::~ExprEvalState() { // Delete callframes. - - while( !stack.empty() ) + + while (!stack.empty()) { delete stack.last(); stack.decrement(); @@ -855,14 +871,14 @@ ExprEvalState::~ExprEvalState() void ExprEvalState::validate() { - AssertFatal( mStackDepth <= stack.size(), - "ExprEvalState::validate() - Stack depth pointing beyond last stack frame!" ); - - for( U32 i = 0; i < stack.size(); ++ i ) - stack[ i ]->validate(); + AssertFatal(mStackDepth <= stack.size(), + "ExprEvalState::validate() - Stack depth pointing beyond last stack frame!"); + + for (U32 i = 0; i < stack.size(); ++i) + stack[i]->validate(); } -DefineEngineFunction(backtrace, void, ( ),, +DefineEngineFunction(backtrace, void, (), , "@brief Prints the scripting call stack to the console log.\n\n" "Used to trace functions called from within functions. Can help discover what functions were called " "(and not yet exited) before the current point in scripts.\n\n" @@ -870,34 +886,34 @@ DefineEngineFunction(backtrace, void, ( ),, { U32 totalSize = 1; - for(U32 i = 0; i < gEvalState.getStackDepth(); i++) + for (U32 i = 0; i < gEvalState.getStackDepth(); i++) { - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) - totalSize += dStrlen(gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + 2; - if(gEvalState.stack[i]->scopeName) - totalSize += dStrlen(gEvalState.stack[i]->scopeName) + 3; - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + totalSize += dStrlen(gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + 2; + if (gEvalState.stack[i]->scopeName) + totalSize += dStrlen(gEvalState.stack[i]->scopeName) + 3; + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) totalSize += dStrlen(gEvalState.stack[i]->scopeNamespace->mName) + 2; } char *buf = Con::getReturnBuffer(totalSize); buf[0] = 0; - for(U32 i = 0; i < gEvalState.getStackDepth(); i++) + for (U32 i = 0; i < gEvalState.getStackDepth(); i++) { dStrcat(buf, "->"); - - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) - { - dStrcat(buf, "["); - dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage); - dStrcat(buf, "]"); - } - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) + + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + { + dStrcat(buf, "["); + dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage); + dStrcat(buf, "]"); + } + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) { dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mName); dStrcat(buf, "::"); } - if(gEvalState.stack[i]->scopeName) + if (gEvalState.stack[i]->scopeName) dStrcat(buf, gEvalState.stack[i]->scopeName); } @@ -915,14 +931,14 @@ Namespace::Entry::Entry() void Namespace::Entry::clear() { - if(mCode) + if (mCode) { mCode->decRefCount(); mCode = NULL; } // Clean up usage strings generated for script functions. - if( ( mType == Namespace::Entry::ConsoleFunctionType ) && mUsage ) + if ((mType == Namespace::Entry::ConsoleFunctionType) && mUsage) { dFree(mUsage); mUsage = NULL; @@ -948,7 +964,7 @@ Namespace::Namespace() Namespace::~Namespace() { clearEntries(); - if( mUsage && mCleanUpUsage ) + if (mUsage && mCleanUpUsage) { dFree(mUsage); mUsage = NULL; @@ -958,33 +974,36 @@ Namespace::~Namespace() void Namespace::clearEntries() { - for(Entry *walk = mEntryList; walk; walk = walk->mNext) + for (Entry *walk = mEntryList; walk; walk = walk->mNext) walk->clear(); } Namespace *Namespace::find(StringTableEntry name, StringTableEntry package) { - if ( name == NULL && package == NULL ) + if (name == NULL && package == NULL) return mGlobalNamespace; - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) - { - if(walk->mName == name && walk->mPackage == package) - return walk; - } + auto pair = std::make_pair(name, package); + auto pos = gNamespaceCache.find(pair); + if (pos != gNamespaceCache.end()) + return pos->second; - Namespace *ret = (Namespace *) mAllocator.alloc(sizeof(Namespace)); + Namespace *ret = (Namespace *)mAllocator.alloc(sizeof(Namespace)); constructInPlace(ret); ret->mPackage = package; ret->mName = name; ret->mNext = mNamespaceList; mNamespaceList = ret; + + // insert into namespace cache. + gNamespaceCache[pair] = ret; + return ret; } -bool Namespace::unlinkClass( Namespace *parent ) +bool Namespace::unlinkClass(Namespace *parent) { - AssertFatal( mPackage == NULL, "Namespace::unlinkClass - Must not be called on a namespace coming from a package!" ); + AssertFatal(mPackage == NULL, "Namespace::unlinkClass - Must not be called on a namespace coming from a package!"); // Skip additions to this namespace coming from packages. @@ -992,7 +1011,7 @@ bool Namespace::unlinkClass( Namespace *parent ) // Make sure "parent" is the direct parent namespace. - if( parent != NULL && walk->mParent && walk->mParent != parent ) + if (parent != NULL && walk->mParent && walk->mParent != parent) { Con::errorf(ConsoleLogEntry::General, "Namespace::unlinkClass - cannot unlink namespace parent linkage for %s for %s.", walk->mName, walk->mParent->mName); @@ -1003,12 +1022,12 @@ bool Namespace::unlinkClass( Namespace *parent ) // the bottom-most namespace, i.e. the one guaranteed not // to come from a package. - mRefCountToParent --; - AssertFatal( mRefCountToParent >= 0, "Namespace::unlinkClass - reference count to parent is less than 0" ); + mRefCountToParent--; + AssertFatal(mRefCountToParent >= 0, "Namespace::unlinkClass - reference count to parent is less than 0"); // Unlink if the count dropped to zero. - if( mRefCountToParent == 0 ) + if (mRefCountToParent == 0) { walk->mParent = NULL; trashCache(); @@ -1022,7 +1041,7 @@ bool Namespace::classLinkTo(Namespace *parent) { Namespace* walk = getPackageRoot(); - if(walk->mParent && walk->mParent != parent) + if (walk->mParent && walk->mParent != parent) { Con::errorf(ConsoleLogEntry::General, "Error: cannot change namespace parent linkage of %s from %s to %s.", walk->mName, walk->mParent->mName, parent->mName); @@ -1039,10 +1058,10 @@ bool Namespace::classLinkTo(Namespace *parent) void Namespace::buildHashTable() { - if(mHashSequence == mCacheSequence) + if (mHashSequence == mCacheSequence) return; - if(!mEntryList && mParent) + if (!mEntryList && mParent) { mParent->buildHashTable(); mHashTable = mParent->mHashTable; @@ -1053,33 +1072,33 @@ void Namespace::buildHashTable() U32 entryCount = 0; Namespace * ns; - for(ns = this; ns; ns = ns->mParent) - for(Entry *walk = ns->mEntryList; walk; walk = walk->mNext) - if(lookupRecursive(walk->mFunctionName) == walk) + for (ns = this; ns; ns = ns->mParent) + for (Entry *walk = ns->mEntryList; walk; walk = walk->mNext) + if (lookupRecursive(walk->mFunctionName) == walk) entryCount++; mHashSize = entryCount + (entryCount >> 1) + 1; - if(!(mHashSize & 1)) + if (!(mHashSize & 1)) mHashSize++; - mHashTable = (Entry **) mCacheAllocator.alloc(sizeof(Entry *) * mHashSize); - for(U32 i = 0; i < mHashSize; i++) + mHashTable = (Entry **)mCacheAllocator.alloc(sizeof(Entry *) * mHashSize); + for (U32 i = 0; i < mHashSize; i++) mHashTable[i] = NULL; - for(ns = this; ns; ns = ns->mParent) + for (ns = this; ns; ns = ns->mParent) { - for(Entry *walk = ns->mEntryList; walk; walk = walk->mNext) + for (Entry *walk = ns->mEntryList; walk; walk = walk->mNext) { U32 index = HashPointer(walk->mFunctionName) % mHashSize; - while(mHashTable[index] && mHashTable[index]->mFunctionName != walk->mFunctionName) + while (mHashTable[index] && mHashTable[index]->mFunctionName != walk->mFunctionName) { index++; - if(index >= mHashSize) + if (index >= mHashSize) index = 0; } - if(!mHashTable[index]) + if (!mHashTable[index]) mHashTable[index] = walk; } } @@ -1087,15 +1106,15 @@ void Namespace::buildHashTable() mHashSequence = mCacheSequence; } -void Namespace::getUniqueEntryLists( Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList ) +void Namespace::getUniqueEntryLists(Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList) { // All namespace entries in the common ACR should be // ignored when checking for duplicate entry names. static VectorPtr commonEntries; commonEntries.clear(); - AbstractClassRep *commonACR = mClassRep->getCommonParent( other->mClassRep ); - commonACR->getNameSpace()->getEntryList( &commonEntries ); + AbstractClassRep *commonACR = mClassRep->getCommonParent(other->mClassRep); + commonACR->getNameSpace()->getEntryList(&commonEntries); // Make life easier VectorPtr &thisEntries = *outThisList; @@ -1105,29 +1124,29 @@ void Namespace::getUniqueEntryLists( Namespace *other, VectorPtr *outTh thisEntries.clear(); compEntries.clear(); - getEntryList( &thisEntries ); - other->getEntryList( &compEntries ); + getEntryList(&thisEntries); + other->getEntryList(&compEntries); // Run through all of the entries in the common ACR, and remove them from // the other two entry lists - for( NamespaceEntryListIterator itr = commonEntries.begin(); itr != commonEntries.end(); itr++ ) + for (NamespaceEntryListIterator itr = commonEntries.begin(); itr != commonEntries.end(); itr++) { // Check this entry list - for( NamespaceEntryListIterator thisItr = thisEntries.begin(); thisItr != thisEntries.end(); thisItr++ ) + for (NamespaceEntryListIterator thisItr = thisEntries.begin(); thisItr != thisEntries.end(); thisItr++) { - if( *thisItr == *itr ) + if (*thisItr == *itr) { - thisEntries.erase( thisItr ); + thisEntries.erase(thisItr); break; } } // Same check for component entry list - for( NamespaceEntryListIterator compItr = compEntries.begin(); compItr != compEntries.end(); compItr++ ) + for (NamespaceEntryListIterator compItr = compEntries.begin(); compItr != compEntries.end(); compItr++) { - if( *compItr == *itr ) + if (*compItr == *itr) { - compEntries.erase( compItr ); + compEntries.erase(compItr); break; } } @@ -1137,12 +1156,15 @@ void Namespace::getUniqueEntryLists( Namespace *other, VectorPtr *outTh void Namespace::init() { // create the global namespace - mGlobalNamespace = (Namespace *) mAllocator.alloc(sizeof(Namespace)); + mGlobalNamespace = (Namespace *)mAllocator.alloc(sizeof(Namespace)); constructInPlace(mGlobalNamespace); mGlobalNamespace->mPackage = NULL; mGlobalNamespace->mName = NULL; mGlobalNamespace->mNext = NULL; mNamespaceList = mGlobalNamespace; + + // Insert into namespace cache. + gNamespaceCache[std::make_pair(mGlobalNamespace->mName, mGlobalNamespace->mPackage)] = mGlobalNamespace; } Namespace *Namespace::global() @@ -1155,7 +1177,7 @@ void Namespace::shutdown() // The data chunker will release all memory in one go // without calling destructors, so we do this manually here. - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) walk->~Namespace(); } @@ -1167,21 +1189,21 @@ void Namespace::trashCache() const char *Namespace::tabComplete(const char *prevText, S32 baseLen, bool fForward) { - if(mHashSequence != mCacheSequence) + if (mHashSequence != mCacheSequence) buildHashTable(); const char *bestMatch = NULL; - for(U32 i = 0; i < mHashSize; i++) - if(mHashTable[i] && canTabComplete(prevText, bestMatch, mHashTable[i]->mFunctionName, baseLen, fForward)) + for (U32 i = 0; i < mHashSize; i++) + if (mHashTable[i] && canTabComplete(prevText, bestMatch, mHashTable[i]->mFunctionName, baseLen, fForward)) bestMatch = mHashTable[i]->mFunctionName; return bestMatch; } Namespace::Entry *Namespace::lookupRecursive(StringTableEntry name) { - for(Namespace *ns = this; ns; ns = ns->mParent) - for(Entry *walk = ns->mEntryList; walk; walk = walk->mNext) - if(walk->mFunctionName == name) + for (Namespace *ns = this; ns; ns = ns->mParent) + for (Entry *walk = ns->mEntryList; walk; walk = walk->mNext) + if (walk->mFunctionName == name) return walk; return NULL; @@ -1189,20 +1211,20 @@ Namespace::Entry *Namespace::lookupRecursive(StringTableEntry name) Namespace::Entry *Namespace::lookup(StringTableEntry name) { - if(mHashSequence != mCacheSequence) + if (mHashSequence != mCacheSequence) buildHashTable(); U32 index = HashPointer(name) % mHashSize; - while(mHashTable[index] && mHashTable[index]->mFunctionName != name) + while (mHashTable[index] && mHashTable[index]->mFunctionName != name) { index++; - if(index >= mHashSize) + if (index >= mHashSize) index = 0; } return mHashTable[index]; } -static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b) +static S32 QSORT_CALLBACK compareEntries(const void* a, const void* b) { const Namespace::Entry* fa = *((Namespace::Entry**)a); const Namespace::Entry* fb = *((Namespace::Entry**)b); @@ -1212,28 +1234,28 @@ static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b) void Namespace::getEntryList(VectorPtr *vec) { - if(mHashSequence != mCacheSequence) + if (mHashSequence != mCacheSequence) buildHashTable(); - for(U32 i = 0; i < mHashSize; i++) - if(mHashTable[i]) + for (U32 i = 0; i < mHashSize; i++) + if (mHashTable[i]) vec->push_back(mHashTable[i]); - dQsort(vec->address(),vec->size(),sizeof(Namespace::Entry *),compareEntries); + dQsort(vec->address(), vec->size(), sizeof(Namespace::Entry *), compareEntries); } Namespace::Entry *Namespace::createLocalEntry(StringTableEntry name) { - for(Entry *walk = mEntryList; walk; walk = walk->mNext) + for (Entry *walk = mEntryList; walk; walk = walk->mNext) { - if(walk->mFunctionName == name) + if (walk->mFunctionName == name) { walk->clear(); return walk; } } - Entry *ent = (Entry *) mAllocator.alloc(sizeof(Entry)); + Entry *ent = (Entry *)mAllocator.alloc(sizeof(Entry)); constructInPlace(ent); ent->mNamespace = this; @@ -1245,7 +1267,7 @@ Namespace::Entry *Namespace::createLocalEntry(StringTableEntry name) return ent; } -void Namespace::addFunction( StringTableEntry name, CodeBlock *cb, U32 functionOffset, const char* usage, U32 lineNumber ) +void Namespace::addFunction(StringTableEntry name, CodeBlock *cb, U32 functionOffset, const char* usage, U32 lineNumber) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1255,10 +1277,10 @@ void Namespace::addFunction( StringTableEntry name, CodeBlock *cb, U32 functionO ent->mFunctionOffset = functionOffset; ent->mCode->incRefCount(); ent->mType = Entry::ConsoleFunctionType; - ent->mFunctionLineNumber = lineNumber; + ent->mFunctionLineNumber = lineNumber; } -void Namespace::addCommand( StringTableEntry name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1273,7 +1295,7 @@ void Namespace::addCommand( StringTableEntry name, StringCallback cb, const char ent->cb.mStringCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1288,7 +1310,7 @@ void Namespace::addCommand( StringTableEntry name, IntCallback cb, const char *u ent->cb.mIntCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1303,7 +1325,7 @@ void Namespace::addCommand( StringTableEntry name, VoidCallback cb, const char * ent->cb.mVoidCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1318,7 +1340,7 @@ void Namespace::addCommand( StringTableEntry name, FloatCallback cb, const char ent->cb.mFloatCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1333,16 +1355,16 @@ void Namespace::addCommand( StringTableEntry name, BoolCallback cb, const char * ent->cb.mBoolCallbackFunc = cb; } -void Namespace::addScriptCallback( const char *funcName, const char *usage, ConsoleFunctionHeader* header ) +void Namespace::addScriptCallback(const char *funcName, const char *usage, ConsoleFunctionHeader* header) { - static U32 uid=0; + static U32 uid = 0; char buffer[1024]; char lilBuffer[32]; dStrcpy(buffer, funcName); dSprintf(lilBuffer, 32, "_%d_cb", uid++); dStrcat(buffer, lilBuffer); - Entry *ent = createLocalEntry(StringTable->insert( buffer )); + Entry *ent = createLocalEntry(StringTable->insert(buffer)); trashCache(); ent->mUsage = usage; @@ -1356,17 +1378,17 @@ void Namespace::addScriptCallback( const char *funcName, const char *usage, Cons void Namespace::markGroup(const char* name, const char* usage) { - static U32 uid=0; + static U32 uid = 0; char buffer[1024]; char lilBuffer[32]; dStrcpy(buffer, name); dSprintf(lilBuffer, 32, "_%d", uid++); dStrcat(buffer, lilBuffer); - Entry *ent = createLocalEntry(StringTable->insert( buffer )); + Entry *ent = createLocalEntry(StringTable->insert(buffer)); trashCache(); - if(usage != NULL) + if (usage != NULL) lastUsage = (char*)(ent->mUsage = usage); else ent->mUsage = lastUsage; @@ -1384,9 +1406,9 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE { STR.clearFunctionOffset(); - if(mType == ConsoleFunctionType) + if (mType == ConsoleFunctionType) { - if(mFunctionOffset) + if (mFunctionOffset) { return mCode->exec(mFunctionOffset, argv[0], mNamespace, argc, argv, false, mPackage); } @@ -1399,35 +1421,35 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE #ifndef TORQUE_DEBUG // [tom, 12/13/2006] This stops tools functions from working in the console, // which is useful behavior when debugging so I'm ifdefing this out for debug builds. - if(mToolOnly && ! Con::isCurrentScriptToolScript()) + if (mToolOnly && !Con::isCurrentScriptToolScript()) { Con::errorf(ConsoleLogEntry::Script, "%s::%s - attempting to call tools only function from outside of tools", mNamespace->mName, mFunctionName); return ConsoleValueRef(); } #endif - if((mMinArgs && argc < mMinArgs) || (mMaxArgs && argc > mMaxArgs)) + if ((mMinArgs && argc < mMinArgs) || (mMaxArgs && argc > mMaxArgs)) { Con::warnf(ConsoleLogEntry::Script, "%s::%s - wrong number of arguments.", mNamespace->mName, mFunctionName); Con::warnf(ConsoleLogEntry::Script, "usage: %s", mUsage); return ConsoleValueRef(); } - switch(mType) + switch (mType) { case StringCallbackType: return ConsoleValueRef::fromValue(CSTK.pushStackString(cb.mStringCallbackFunc(state->thisObject, argc, argv))); case IntCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case FloatCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case VoidCallbackType: cb.mVoidCallbackFunc(state->thisObject, argc, argv); return ConsoleValueRef(); case BoolCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); } - + return ConsoleValueRef(); } @@ -1439,181 +1461,183 @@ namespace { /// Scan the given usage string for an argument list description. With the /// old console macros, these were usually included as the first part of the /// usage string. - bool sFindArgumentListSubstring( const char* usage, const char*& start, const char*& end ) + bool sFindArgumentListSubstring(const char* usage, const char*& start, const char*& end) { - if( !usage ) + if (!usage) return false; - + const char* ptr = usage; - while( *ptr && *ptr != '(' && *ptr != '\n' ) // Only scan first line of usage string. + while (*ptr && *ptr != '(' && *ptr != '\n') // Only scan first line of usage string. { // Stop on the first alphanumeric character as we expect // argument lists to precede descriptions. - if( dIsalnum( *ptr ) ) + if (dIsalnum(*ptr)) return false; - - ptr ++; + + ptr++; } - - if( *ptr != '(' ) + + if (*ptr != '(') return false; start = ptr; - ptr ++; - + ptr++; + bool inString = false; U32 nestingCount = 0; - - while( *ptr && ( *ptr != ')' || nestingCount > 0 || inString ) ) + + while (*ptr && (*ptr != ')' || nestingCount > 0 || inString)) { - if( *ptr == '(' ) - nestingCount ++; - else if( *ptr == ')' ) - nestingCount --; - else if( *ptr == '"' ) + if (*ptr == '(') + nestingCount++; + else if (*ptr == ')') + nestingCount--; + else if (*ptr == '"') inString = !inString; - else if( *ptr == '\\' && ptr[ 1 ] == '"' ) - ptr ++; - ptr ++; + else if (*ptr == '\\' && ptr[1] == '"') + ptr++; + ptr++; } - - if( *ptr ) - ptr ++; + + if (*ptr) + ptr++; end = ptr; - + return true; } - + /// - void sParseList( const char* str, Vector< String >& outList ) + void sParseList(const char* str, Vector< String >& outList) { // Skip the initial '( '. - + const char* ptr = str; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; - - if( *ptr == '(' ) + while (*ptr && dIsspace(*ptr)) + ptr++; + + if (*ptr == '(') { - ptr ++; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; + ptr++; + while (*ptr && dIsspace(*ptr)) + ptr++; } - + // Parse out list items. - - while( *ptr && *ptr != ')' ) + + while (*ptr && *ptr != ')') { // Find end of element. - + const char* start = ptr; bool inString = false; U32 nestingCount = 0; - while( *ptr && ( ( *ptr != ')' && *ptr != ',' ) || nestingCount > 0 || inString ) ) + while (*ptr && ((*ptr != ')' && *ptr != ',') || nestingCount > 0 || inString)) { - if( *ptr == '(' ) - nestingCount ++; - else if( *ptr == ')' ) - nestingCount --; - else if( *ptr == '"' ) + if (*ptr == '(') + nestingCount++; + else if (*ptr == ')') + nestingCount--; + else if (*ptr == '"') inString = !inString; - else if( *ptr == '\\' && ptr[ 1 ] == '"' ) - ptr ++; - ptr ++; + else if (*ptr == '\\' && ptr[1] == '"') + ptr++; + ptr++; } - + // Backtrack to remove trailing whitespace. - + const char* end = ptr; - if( *end == ',' || *end == ')' ) - end --; - while( end > start && dIsspace( *end ) ) - end --; - if( *end ) - end ++; - + if (*end == ',' || *end == ')') + end--; + while (end > start && dIsspace(*end)) + end--; + if (*end) + end++; + // Add to list. - - if( start != end ) - outList.push_back( String( start, end - start ) ); - + + if (start != end) + outList.push_back(String(start, end - start)); + // Skip comma and whitespace. - - if( *ptr == ',' ) - ptr ++; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; + + if (*ptr == ',') + ptr++; + while (*ptr && dIsspace(*ptr)) + ptr++; } } - + /// - void sGetArgNameAndType( const String& str, String& outType, String& outName ) + void sGetArgNameAndType(const String& str, String& outType, String& outName) { - if( !str.length() ) + if (!str.length()) { outType = String::EmptyString; outName = String::EmptyString; return; } - + // Find first non-ID character from right. - + S32 index = str.length() - 1; - while( index >= 0 && ( dIsalnum( str[ index ] ) || str[ index ] == '_' ) ) - index --; - + while (index >= 0 && (dIsalnum(str[index]) || str[index] == '_')) + index--; + const U32 nameStartIndex = index + 1; - + // Find end of type name by skipping rightmost whitespace inwards. - - while( index >= 0 && dIsspace( str[ index ] ) ) - index --; - + + while (index >= 0 && dIsspace(str[index])) + index--; + // - - outName = String( &( ( const char* ) str )[ nameStartIndex ] ); - outType = String( str, index + 1 ); + + outName = String(&((const char*)str)[nameStartIndex]); + outType = String(str, index + 1); } - + /// Return the type name to show in documentation for the given C++ type. - const char* sGetDocTypeString( const char* nativeType ) + const char* sGetDocTypeString(const char* nativeType) { - if( dStrncmp( nativeType, "const ", 6 ) == 0 ) + if (dStrncmp(nativeType, "const ", 6) == 0) nativeType += 6; - if( dStrcmp( nativeType, "char*" ) == 0 || dStrcmp( nativeType, "char *" ) == 0 ) + if (dStrcmp(nativeType, "char*") == 0 || dStrcmp(nativeType, "char *") == 0) return "string"; - else if( dStrcmp( nativeType, "S32" ) == 0 || dStrcmp( nativeType, "U32" ) == 0 ) + else if (dStrcmp(nativeType, "S32") == 0) return "int"; - else if( dStrcmp( nativeType, "F32" ) == 0 ) + else if (dStrcmp(nativeType, "U32") == 0) + return "uint"; + else if (dStrcmp(nativeType, "F32") == 0) return "float"; - - const U32 length = dStrlen( nativeType ); - if( nativeType[ length - 1 ] == '&' || nativeType[ length - 1 ] == '*' ) - return StringTable->insertn( nativeType, length - 1 ); - + + const U32 length = dStrlen(nativeType); + if (nativeType[length - 1] == '&' || nativeType[length - 1] == '*') + return StringTable->insertn(nativeType, length - 1); + return nativeType; } } -String Namespace::Entry::getBriefDescription( String* outRemainingDocText ) const +String Namespace::Entry::getBriefDescription(String* outRemainingDocText) const { String docString = getDocString(); - - S32 newline = docString.find( '\n' ); - if( newline == -1 ) + + S32 newline = docString.find('\n'); + if (newline == -1) { - if( outRemainingDocText ) + if (outRemainingDocText) *outRemainingDocText = String(); return docString; } - - String brief = docString.substr( 0, newline ); - if( outRemainingDocText ) - *outRemainingDocText = docString.substr( newline + 1 ); - + + String brief = docString.substr(0, newline); + if (outRemainingDocText) + *outRemainingDocText = docString.substr(newline + 1); + return brief; } @@ -1621,92 +1645,92 @@ String Namespace::Entry::getDocString() const { const char* argListStart; const char* argListEnd; - - if( sFindArgumentListSubstring( mUsage, argListStart, argListEnd ) ) + + if (sFindArgumentListSubstring(mUsage, argListStart, argListEnd)) { // Skip the " - " part present in some old doc strings. - + const char* ptr = argListEnd; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; - - if( *ptr == '-' ) + while (*ptr && dIsspace(*ptr)) + ptr++; + + if (*ptr == '-') { - ptr ++; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; + ptr++; + while (*ptr && dIsspace(*ptr)) + ptr++; } - + return ptr; } - + return mUsage; } String Namespace::Entry::getArgumentsString() const { StringBuilder str; - - if( mHeader ) + + if (mHeader) { // Parse out the argument list string supplied with the extended // function header and add default arguments as we go. - + Vector< String > argList; Vector< String > defaultArgList; - - sParseList( mHeader->mArgString, argList ); - sParseList( mHeader->mDefaultArgString, defaultArgList ); - - str.append( '(' ); - + + sParseList(mHeader->mArgString, argList); + sParseList(mHeader->mDefaultArgString, defaultArgList); + + str.append('('); + const U32 numArgs = argList.size(); const U32 numDefaultArgs = defaultArgList.size(); const U32 firstDefaultArgIndex = numArgs - numDefaultArgs; - - for( U32 i = 0; i < numArgs; ++ i ) + + for (U32 i = 0; i < numArgs; ++i) { // Add separator if not first arg. - - if( i > 0 ) - str.append( ',' ); - + + if (i > 0) + str.append(','); + // Add type and name. - + String name; String type; - - sGetArgNameAndType( argList[ i ], type, name ); - - str.append( ' ' ); - str.append( sGetDocTypeString( type ) ); - str.append( ' ' ); - str.append( name ); - + + sGetArgNameAndType(argList[i], type, name); + + str.append(' '); + str.append(sGetDocTypeString(type)); + str.append(' '); + str.append(name); + // Add default value, if any. - - if( i >= firstDefaultArgIndex ) + + if (i >= firstDefaultArgIndex) { - str.append( '=' ); - str.append( defaultArgList[ i - firstDefaultArgIndex ] ); + str.append('='); + str.append(defaultArgList[i - firstDefaultArgIndex]); } } - - if( numArgs > 0 ) - str.append( ' ' ); - str.append( ')' ); + + if (numArgs > 0) + str.append(' '); + str.append(')'); } else { // No extended function header. Try to parse out the argument // list from the usage string. - + const char* argListStart; const char* argListEnd; - - if( sFindArgumentListSubstring( mUsage, argListStart, argListEnd ) ) - str.append( argListStart, argListEnd - argListStart ); - else if( mType == ConsoleFunctionType && mCode ) + + if (sFindArgumentListSubstring(mUsage, argListStart, argListEnd)) + str.append(argListStart, argListEnd - argListStart); + else if (mType == ConsoleFunctionType && mCode) { // This isn't correct but the nonsense console stuff is set up such that all // functions that have no function bodies are keyed to offset 0 to indicate "no code." @@ -1714,70 +1738,70 @@ String Namespace::Entry::getArgumentsString() const // tell here what the actual prototype is except if we searched though the entire opcode // stream for the corresponding OP_FUNC_DECL (which would require dealing with the // variable-size instructions). - - if( !mFunctionOffset ) + + if (!mFunctionOffset) return "()"; - - String args = mCode->getFunctionArgs( mFunctionOffset ); - if( args.isEmpty() ) + + String args = mCode->getFunctionArgs(mFunctionOffset); + if (args.isEmpty()) return "()"; - - str.append( "( " ); - str.append( args ); - str.append( " )" ); + + str.append("( "); + str.append(args); + str.append(" )"); } } - + return str.end(); } String Namespace::Entry::getPrototypeString() const { StringBuilder str; - + // Start with return type. - - if( mHeader && mHeader->mReturnString ) + + if (mHeader && mHeader->mReturnString) { - str.append( sGetDocTypeString( mHeader->mReturnString ) ); - str.append( ' ' ); + str.append(sGetDocTypeString(mHeader->mReturnString)); + str.append(' '); } else - switch( mType ) + switch (mType) { case StringCallbackType: - str.append( "string " ); + str.append("string "); break; - + case IntCallbackType: - str.append( "int " ); + str.append("int "); break; case FloatCallbackType: - str.append( "float " ); + str.append("float "); break; case VoidCallbackType: - str.append( "void " ); + str.append("void "); break; case BoolCallbackType: - str.append( "bool " ); + str.append("bool "); break; - + case ScriptCallbackType: break; } - + // Add function name and arguments. - if( mType == ScriptCallbackType ) - str.append( cb.mCallbackName ); + if (mType == ScriptCallbackType) + str.append(cb.mCallbackName); else - str.append( mFunctionName ); - - str.append( getArgumentsString() ); - + str.append(mFunctionName); + + str.append(getArgumentsString()); + return str.end(); } @@ -1789,8 +1813,8 @@ U32 Namespace::mOldNumActivePackages = 0; bool Namespace::isPackage(StringTableEntry name) { - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) - if(walk->mPackage == name) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + if (walk->mPackage == name) return true; return false; } @@ -1802,7 +1826,7 @@ U32 Namespace::getActivePackagesCount() StringTableEntry Namespace::getActivePackage(U32 index) { - if( index >= mNumActivePackages ) + if (index >= mNumActivePackages) return StringTable->EmptyString(); return mActivePackages[index]; @@ -1810,26 +1834,26 @@ StringTableEntry Namespace::getActivePackage(U32 index) void Namespace::activatePackage(StringTableEntry name) { - if(mNumActivePackages == MaxActivePackages) + if (mNumActivePackages == MaxActivePackages) { Con::printf("ActivatePackage(%s) failed - Max package limit reached: %d", name, MaxActivePackages); return; } - if(!name) + if (!name) return; // see if this one's already active - for(U32 i = 0; i < mNumActivePackages; i++) - if(mActivePackages[i] == name) + for (U32 i = 0; i < mNumActivePackages; i++) + if (mActivePackages[i] == name) return; // kill the cache trashCache(); // find all the package namespaces... - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) { - if(walk->mPackage == name) + if (walk->mPackage == name) { Namespace *parent = Namespace::find(walk->mName); // hook the parent @@ -1838,10 +1862,10 @@ void Namespace::activatePackage(StringTableEntry name) // now swap the entries: Entry *ew; - for(ew = parent->mEntryList; ew; ew = ew->mNext) + for (ew = parent->mEntryList; ew; ew = ew->mNext) ew->mNamespace = walk; - for(ew = walk->mEntryList; ew; ew = ew->mNext) + for (ew = walk->mEntryList; ew; ew = ew->mNext) ew->mNamespace = parent; ew = walk->mEntryList; @@ -1857,33 +1881,33 @@ void Namespace::deactivatePackage(StringTableEntry name) U32 oldNumActivePackages = mNumActivePackages; // Remove all packages down to the given one - deactivatePackageStack( name ); + deactivatePackageStack(name); // Now add back all packages that followed the given one - if(!oldNumActivePackages) + if (!oldNumActivePackages) return; - for(U32 i = mNumActivePackages+1; i < oldNumActivePackages; i++) + for (U32 i = mNumActivePackages + 1; i < oldNumActivePackages; i++) activatePackage(mActivePackages[i]); } void Namespace::deactivatePackageStack(StringTableEntry name) { S32 i, j; - for(i = 0; i < mNumActivePackages; i++) - if(mActivePackages[i] == name) + for (i = 0; i < mNumActivePackages; i++) + if (mActivePackages[i] == name) break; - if(i == mNumActivePackages) + if (i == mNumActivePackages) return; trashCache(); // Remove all packages down to the given one - for(j = mNumActivePackages - 1; j >= i; j--) + for (j = mNumActivePackages - 1; j >= i; j--) { // gotta unlink em in reverse order... - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) { - if(walk->mPackage == mActivePackages[j]) + if (walk->mPackage == mActivePackages[j]) { Namespace *parent = Namespace::find(walk->mName); // hook the parent @@ -1892,10 +1916,10 @@ void Namespace::deactivatePackageStack(StringTableEntry name) // now swap the entries: Entry *ew; - for(ew = parent->mEntryList; ew; ew = ew->mNext) + for (ew = parent->mEntryList; ew; ew = ew->mNext) ew->mNamespace = walk; - for(ew = walk->mEntryList; ew; ew = ew->mNext) + for (ew = walk->mEntryList; ew; ew = ew->mNext) ew->mNamespace = parent; ew = walk->mEntryList; @@ -1910,21 +1934,21 @@ void Namespace::deactivatePackageStack(StringTableEntry name) void Namespace::unlinkPackages() { mOldNumActivePackages = mNumActivePackages; - if(!mNumActivePackages) + if (!mNumActivePackages) return; deactivatePackageStack(mActivePackages[0]); } void Namespace::relinkPackages() { - if(!mOldNumActivePackages) + if (!mOldNumActivePackages) return; - for(U32 i = 0; i < mOldNumActivePackages; i++) + for (U32 i = 0; i < mOldNumActivePackages; i++) activatePackage(mActivePackages[i]); } -DefineEngineFunction(isPackage, bool, ( String identifier ),, +DefineEngineFunction(isPackage, bool, (String identifier), , "@brief Returns true if the identifier is the name of a declared package.\n\n" "@ingroup Packages\n") { @@ -1932,7 +1956,7 @@ DefineEngineFunction(isPackage, bool, ( String identifier ),, return Namespace::isPackage(name); } -DefineEngineFunction(activatePackage, void, ( String packageName ),, +DefineEngineFunction(activatePackage, void, (String packageName), , "@brief Activates an existing package.\n\n" "The activation occurs by updating the namespace linkage of existing functions and methods. " "If the package is already activated the function does nothing.\n" @@ -1942,7 +1966,7 @@ DefineEngineFunction(activatePackage, void, ( String packageName ),, Namespace::activatePackage(name); } -DefineEngineFunction(deactivatePackage, void, ( String packageName ),, +DefineEngineFunction(deactivatePackage, void, (String packageName), , "@brief Deactivates a previously activated package.\n\n" "The package is deactivated by removing its namespace linkages to any function or method. " "If there are any packages above this one in the stack they are deactivated as well. " @@ -1953,16 +1977,16 @@ DefineEngineFunction(deactivatePackage, void, ( String packageName ),, Namespace::deactivatePackage(name); } -DefineEngineFunction(getPackageList, const char*, (),, +DefineEngineFunction(getPackageList, const char*, (), , "@brief Returns a space delimited list of the active packages in stack order.\n\n" "@ingroup Packages\n") { - if( Namespace::getActivePackagesCount() == 0 ) + if (Namespace::getActivePackagesCount() == 0) return ""; // Determine size of return buffer dsize_t buffersize = 0; - for( U32 i = 0; i < Namespace::getActivePackagesCount(); ++i ) + for (U32 i = 0; i < Namespace::getActivePackagesCount(); ++i) { buffersize += dStrlen(Namespace::getActivePackage(i)) + 1; } @@ -1970,7 +1994,7 @@ DefineEngineFunction(getPackageList, const char*, (),, U32 maxBufferSize = buffersize + 1; char* returnBuffer = Con::getReturnBuffer(maxBufferSize); U32 returnLen = 0; - for( U32 i = 0; i < Namespace::getActivePackagesCount(); ++i ) + for (U32 i = 0; i < Namespace::getActivePackagesCount(); ++i) { dSprintf(returnBuffer + returnLen, maxBufferSize - returnLen, "%s ", Namespace::getActivePackage(i)); returnLen = dStrlen(returnBuffer); diff --git a/Engine/source/console/consoleInternal.h b/Engine/source/console/consoleInternal.h index 35ebff800..d673bb39c 100644 --- a/Engine/source/console/consoleInternal.h +++ b/Engine/source/console/consoleInternal.h @@ -24,22 +24,21 @@ #define _CONSOLEINTERNAL_H_ #ifndef _STRINGFUNCTIONS_H_ - #include "core/strings/stringFunctions.h" +#include "core/strings/stringFunctions.h" #endif #ifndef _STRINGTABLE_H_ - #include "core/stringTable.h" +#include "core/stringTable.h" #endif #ifndef _CONSOLETYPES_H - #include "console/consoleTypes.h" +#include "console/consoleTypes.h" #endif #ifndef _CONSOLEOBJECT_H_ - #include "console/simObject.h" +#include "console/simObject.h" #endif #ifndef _DATACHUNKER_H_ - #include "core/dataChunker.h" +#include "core/dataChunker.h" #endif - /// @ingroup console_system Console System /// @{ @@ -55,222 +54,222 @@ class AbstractClassRep; /// Namespaces are used for dispatching calls in the console system. class Namespace { - enum { - MaxActivePackages = 512, + enum { + MaxActivePackages = 512, + }; + + static U32 mNumActivePackages; + static U32 mOldNumActivePackages; + static StringTableEntry mActivePackages[MaxActivePackages]; + +public: + StringTableEntry mName; + StringTableEntry mPackage; + + Namespace *mParent; + Namespace *mNext; + AbstractClassRep *mClassRep; + U32 mRefCountToParent; + + const char* mUsage; + + /// Script defined usage strings need to be cleaned up. This + /// field indicates whether or not the usage was set from script. + bool mCleanUpUsage; + + /// A function entry in the namespace. + struct Entry + { + enum + { + ScriptCallbackType = -3, + GroupMarker = -2, + InvalidFunctionType = -1, + ConsoleFunctionType, + StringCallbackType, + IntCallbackType, + FloatCallbackType, + VoidCallbackType, + BoolCallbackType }; - static U32 mNumActivePackages; - static U32 mOldNumActivePackages; - static StringTableEntry mActivePackages[MaxActivePackages]; + /// Link back to the namespace to which the entry belongs. + Namespace* mNamespace; - public: - StringTableEntry mName; + /// Next function entry in the hashtable link chain of the namespace. + Entry* mNext; + + /// Name of this function. + StringTableEntry mFunctionName; + + /// + S32 mType; + + /// Min number of arguments expected by this function. + S32 mMinArgs; + + /// Max number of arguments expected by this function. If zero, + /// function takes an arbitrary number of arguments. + S32 mMaxArgs; + + /// Name of the package to which this function belongs. StringTableEntry mPackage; - Namespace *mParent; - Namespace *mNext; - AbstractClassRep *mClassRep; - U32 mRefCountToParent; - + /// Whether this function is included only in TORQUE_TOOLS builds. + bool mToolOnly; + + /// Usage string for documentation. const char* mUsage; - - /// Script defined usage strings need to be cleaned up. This - /// field indicates whether or not the usage was set from script. - bool mCleanUpUsage; - /// A function entry in the namespace. - struct Entry - { - enum - { - ScriptCallbackType = -3, - GroupMarker = -2, - InvalidFunctionType = -1, - ConsoleFunctionType, - StringCallbackType, - IntCallbackType, - FloatCallbackType, - VoidCallbackType, - BoolCallbackType - }; + /// Extended console function information. + ConsoleFunctionHeader* mHeader; - /// Link back to the namespace to which the entry belongs. - Namespace* mNamespace; - - /// Next function entry in the hashtable link chain of the namespace. - Entry* mNext; - - /// Name of this function. - StringTableEntry mFunctionName; - - /// - S32 mType; - - /// Min number of arguments expected by this function. - S32 mMinArgs; - - /// Max number of arguments expected by this function. If zero, - /// function takes an arbitrary number of arguments. - S32 mMaxArgs; - - /// Name of the package to which this function belongs. - StringTableEntry mPackage; - - /// Whether this function is included only in TORQUE_TOOLS builds. - bool mToolOnly; + /// The compiled script code if this is a script function. + CodeBlock* mCode; - /// Usage string for documentation. - const char* mUsage; - - /// Extended console function information. - ConsoleFunctionHeader* mHeader; + /// The offset in the compiled script code at which this function begins. + U32 mFunctionOffset; - /// The compiled script code if this is a script function. - CodeBlock* mCode; - - /// The offset in the compiled script code at which this function begins. - U32 mFunctionOffset; + /// If it's a script function, this is the line of the declaration in code. + /// @note 0 for functions read from legacy DSOs that have no line number information. + U32 mFunctionLineNumber; - /// If it's a script function, this is the line of the declaration in code. - /// @note 0 for functions read from legacy DSOs that have no line number information. - U32 mFunctionLineNumber; - - union CallbackUnion { - StringCallback mStringCallbackFunc; - IntCallback mIntCallbackFunc; - VoidCallback mVoidCallbackFunc; - FloatCallback mFloatCallbackFunc; - BoolCallback mBoolCallbackFunc; - const char *mGroupName; - const char *mCallbackName; - } cb; - - Entry(); - - /// - void clear(); + union CallbackUnion { + StringCallback mStringCallbackFunc; + IntCallback mIntCallbackFunc; + VoidCallback mVoidCallbackFunc; + FloatCallback mFloatCallbackFunc; + BoolCallback mBoolCallbackFunc; + const char *mGroupName; + const char *mCallbackName; + } cb; - /// - ConsoleValueRef execute( S32 argc, ConsoleValueRef* argv, ExprEvalState* state ); - - /// Return a one-line documentation text string for the function. - String getBriefDescription( String* outRemainingDocText = NULL ) const; - - /// Get the auto-doc string for this function. This string does not included prototype information. - String getDocString() const; - - /// Return a string describing the arguments the function takes including default argument values. - String getArgumentsString() const; + Entry(); - /// Return a full prototype string for the function including return type, function name, - /// and arguments. - String getPrototypeString() const; - }; - - Entry* mEntryList; + /// + void clear(); - Entry** mHashTable; - - U32 mHashSize; - U32 mHashSequence; ///< @note The hash sequence is used by the autodoc console facility - /// as a means of testing reference state. + /// + ConsoleValueRef execute(S32 argc, ConsoleValueRef* argv, ExprEvalState* state); - Namespace(); - ~Namespace(); + /// Return a one-line documentation text string for the function. + String getBriefDescription(String* outRemainingDocText = NULL) const; - void addFunction( StringTableEntry name, CodeBlock* cb, U32 functionOffset, const char* usage = NULL, U32 lineNumber = 0 ); - void addCommand( StringTableEntry name, StringCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, IntCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, FloatCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, VoidCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, BoolCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + /// Get the auto-doc string for this function. This string does not included prototype information. + String getDocString() const; - void addScriptCallback( const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL ); + /// Return a string describing the arguments the function takes including default argument values. + String getArgumentsString() const; - void markGroup(const char* name, const char* usage); - char * lastUsage; + /// Return a full prototype string for the function including return type, function name, + /// and arguments. + String getPrototypeString() const; + }; - /// Returns true if this namespace represents an engine defined - /// class and is not just a script defined class namespace. - bool isClass() const { return mClassRep && mClassRep->getNameSpace() == this; } + Entry* mEntryList; - void getEntryList(VectorPtr *); + Entry** mHashTable; - /// Return the name of this namespace. - StringTableEntry getName() const { return mName; } + U32 mHashSize; + U32 mHashSequence; ///< @note The hash sequence is used by the autodoc console facility + /// as a means of testing reference state. - /// Return the superordinate namespace to this namespace. Symbols are inherited from - /// this namespace. - Namespace* getParent() const { return mParent; } + Namespace(); + ~Namespace(); - /// Return the topmost package in the parent hierarchy of this namespace - /// that still refers to the same namespace. If packages are active and - /// adding to this namespace, then they will be linked in-between the namespace - /// they are adding to and its real parent namespace. - Namespace* getPackageRoot() - { - Namespace* walk = this; - while( walk->mParent && walk->mParent->mName == mName ) - walk = walk->mParent; + void addFunction(StringTableEntry name, CodeBlock* cb, U32 functionOffset, const char* usage = NULL, U32 lineNumber = 0); + void addCommand(StringTableEntry name, StringCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, IntCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, FloatCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, VoidCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, BoolCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); - return walk; - } + void addScriptCallback(const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL); - /// Return the package in which this namespace is defined. - StringTableEntry getPackage() const { return mPackage; } + void markGroup(const char* name, const char* usage); + char * lastUsage; - /// Increase the count on the reference that this namespace - /// holds to its parent. - /// @note Must not be called on namespaces coming from packages. - void incRefCountToParent() - { - AssertFatal( mPackage == NULL, "Namespace::incRefCountToParent - Must not be called on a namespace coming from a package!" ); - mRefCountToParent ++; - } + /// Returns true if this namespace represents an engine defined + /// class and is not just a script defined class namespace. + bool isClass() const { return mClassRep && mClassRep->getNameSpace() == this; } - /// Decrease the count on the reference that this namespace - /// holds to its parent. - /// @note Must not be called on namespaces coming from packages. - void decRefCountToParent() - { - unlinkClass( NULL ); - } + void getEntryList(VectorPtr *); - Entry *lookup(StringTableEntry name); - Entry *lookupRecursive(StringTableEntry name); - Entry *createLocalEntry(StringTableEntry name); - void buildHashTable(); - void clearEntries(); - bool classLinkTo(Namespace *parent); - bool unlinkClass(Namespace *parent); - void getUniqueEntryLists( Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList ); + /// Return the name of this namespace. + StringTableEntry getName() const { return mName; } - const char *tabComplete(const char *prevText, S32 baseLen, bool fForward); + /// Return the superordinate namespace to this namespace. Symbols are inherited from + /// this namespace. + Namespace* getParent() const { return mParent; } - static U32 mCacheSequence; - static DataChunker mCacheAllocator; - static DataChunker mAllocator; - static void trashCache(); - static Namespace *mNamespaceList; - static Namespace *mGlobalNamespace; + /// Return the topmost package in the parent hierarchy of this namespace + /// that still refers to the same namespace. If packages are active and + /// adding to this namespace, then they will be linked in-between the namespace + /// they are adding to and its real parent namespace. + Namespace* getPackageRoot() + { + Namespace* walk = this; + while (walk->mParent && walk->mParent->mName == mName) + walk = walk->mParent; - static void init(); - static void shutdown(); - static Namespace *global(); + return walk; + } - static Namespace *find(StringTableEntry name, StringTableEntry package=NULL); + /// Return the package in which this namespace is defined. + StringTableEntry getPackage() const { return mPackage; } - static void activatePackage(StringTableEntry name); - static void deactivatePackage(StringTableEntry name); - static void deactivatePackageStack(StringTableEntry name); - static void dumpClasses( bool dumpScript = true, bool dumpEngine = true ); - static void dumpFunctions( bool dumpScript = true, bool dumpEngine = true ); - static void printNamespaceEntries(Namespace * g, bool dumpScript = true, bool dumpEngine = true); - static void unlinkPackages(); - static void relinkPackages(); - static bool isPackage(StringTableEntry name); - static U32 getActivePackagesCount(); - static StringTableEntry getActivePackage(U32 index); + /// Increase the count on the reference that this namespace + /// holds to its parent. + /// @note Must not be called on namespaces coming from packages. + void incRefCountToParent() + { + AssertFatal(mPackage == NULL, "Namespace::incRefCountToParent - Must not be called on a namespace coming from a package!"); + mRefCountToParent++; + } + + /// Decrease the count on the reference that this namespace + /// holds to its parent. + /// @note Must not be called on namespaces coming from packages. + void decRefCountToParent() + { + unlinkClass(NULL); + } + + Entry *lookup(StringTableEntry name); + Entry *lookupRecursive(StringTableEntry name); + Entry *createLocalEntry(StringTableEntry name); + void buildHashTable(); + void clearEntries(); + bool classLinkTo(Namespace *parent); + bool unlinkClass(Namespace *parent); + void getUniqueEntryLists(Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList); + + const char *tabComplete(const char *prevText, S32 baseLen, bool fForward); + + static U32 mCacheSequence; + static DataChunker mCacheAllocator; + static DataChunker mAllocator; + static void trashCache(); + static Namespace *mNamespaceList; + static Namespace *mGlobalNamespace; + + static void init(); + static void shutdown(); + static Namespace *global(); + + static Namespace *find(StringTableEntry name, StringTableEntry package = NULL); + + static void activatePackage(StringTableEntry name); + static void deactivatePackage(StringTableEntry name); + static void deactivatePackageStack(StringTableEntry name); + static void dumpClasses(bool dumpScript = true, bool dumpEngine = true); + static void dumpFunctions(bool dumpScript = true, bool dumpEngine = true); + static void printNamespaceEntries(Namespace * g, bool dumpScript = true, bool dumpEngine = true); + static void unlinkPackages(); + static void relinkPackages(); + static bool isPackage(StringTableEntry name); + static U32 getActivePackagesCount(); + static StringTableEntry getActivePackage(U32 index); }; typedef VectorPtr::iterator NamespaceEntryListIterator; @@ -292,10 +291,10 @@ public: /// The optional notification signal called when /// a value is assigned to this variable. NotifySignal *notify; - + /// Usage doc string. const char* mUsage; - + /// Whether this is a constant that cannot be assigned to. bool mIsConstant; @@ -309,16 +308,16 @@ public: mIsConstant = false; value.init(); } - + Entry(StringTableEntry name); ~Entry(); - + Entry *mNext; - + void reset() { name = NULL; value.cleanup(); - if ( notify ) + if (notify) delete notify; } @@ -339,63 +338,63 @@ public: void setIntValue(U32 val) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setIntValue(val); // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } void setFloatValue(F32 val) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setFloatValue(val); // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } void setStringStackPtrValue(StringStackPtr newValue) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setStringStackPtrValue(newValue); - - + + // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } void setStringValue(const char *newValue) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setStringValue(newValue); - - + + // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } }; @@ -407,9 +406,9 @@ public: S32 count; Entry **data; FreeListChunker< Entry > mChunker; - - HashTableData( Dictionary* owner ) - : owner( owner ), size( 0 ), count( 0 ), data( NULL ) {} + + HashTableData(Dictionary* owner) + : owner(owner), size(0), count(0), data(NULL) {} }; HashTableData* hashTable; @@ -426,13 +425,13 @@ public: Entry *lookup(StringTableEntry name); Entry *add(StringTableEntry name); - void setState(ExprEvalState *state, Dictionary* ref=NULL); + void setState(ExprEvalState *state, Dictionary* ref = NULL); void remove(Entry *); void reset(); - void exportVariables( const char *varString, const char *fileName, bool append ); - void exportVariables( const char *varString, Vector *names, Vector *values ); - void deleteVariables( const char *varString ); + void exportVariables(const char *varString, const char *fileName, bool append); + void exportVariables(const char *varString, Vector *names, Vector *values); + void deleteVariables(const char *varString); void setVariable(StringTableEntry name, const char *value); const char *getVariable(StringTableEntry name, bool *valid = NULL); @@ -449,19 +448,19 @@ public: } /// @see Con::addVariable - Entry* addVariable( const char *name, - S32 type, - void *dataPtr, - const char* usage ); + Entry* addVariable(const char *name, + S32 type, + void *dataPtr, + const char* usage); /// @see Con::removeVariable bool removeVariable(StringTableEntry name); /// @see Con::addVariableNotify - void addVariableNotify( const char *name, const Con::NotifyDelegate &callback ); + void addVariableNotify(const char *name, const Con::NotifyDelegate &callback); /// @see Con::removeVariableNotify - void removeVariableNotify( const char *name, const Con::NotifyDelegate &callback ); + void removeVariableNotify(const char *name, const Con::NotifyDelegate &callback); /// Return the best tab completion for prevText, with the length /// of the pre-tab string in baseLen. @@ -520,15 +519,15 @@ public: /// Puts a reference to an existing stack frame /// on the top of the stack. void pushFrameRef(S32 stackIndex); - + U32 getStackDepth() const { return mStackDepth; } - + Dictionary& getCurrentFrame() { - return *( stack[ mStackDepth - 1 ] ); + return *(stack[mStackDepth - 1]); } /// @} diff --git a/Engine/source/console/simDictionary.cpp b/Engine/source/console/simDictionary.cpp index ce923ac49..b733d9fcc 100644 --- a/Engine/source/console/simDictionary.cpp +++ b/Engine/source/console/simDictionary.cpp @@ -45,7 +45,7 @@ SimNameDictionary::~SimNameDictionary() void SimNameDictionary::insert(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; SimObject* checkForDup = find(obj->objectName); @@ -55,47 +55,47 @@ void SimNameDictionary::insert(SimObject* obj) Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - if(!hashTable) + if (!hashTable) { hashTable = new SimObject *[DefaultTableSize]; hashTableSize = DefaultTableSize; hashEntryCount = 0; - - dMemset( hashTable, 0, sizeof( *hashTable ) * DefaultTableSize ); + + dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize); } - + S32 idx = HashPointer(obj->objectName) % hashTableSize; obj->nextNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; - + // Rehash if necessary. - if( hashEntryCount > hashTableSize ) + if (hashEntryCount > hashTableSize) { // Allocate new table. - + U32 newHashTableSize = hashTableSize * 2 + 1; - SimObject** newHashTable = new SimObject *[ newHashTableSize ]; - dMemset( newHashTable, 0, sizeof( newHashTable[ 0 ] ) * newHashTableSize ); - + SimObject** newHashTable = new SimObject *[newHashTableSize]; + dMemset(newHashTable, 0, sizeof(newHashTable[0]) * newHashTableSize); + // Move entries over. - for( U32 i = 0; i < hashTableSize; ++ i ) - for( SimObject* object = hashTable[ i ]; object != NULL; ) + for (U32 i = 0; i < hashTableSize; ++i) + for (SimObject* object = hashTable[i]; object != NULL; ) { SimObject* next = object->nextNameObject; - idx = HashPointer( object->objectName ) % newHashTableSize; - object->nextNameObject = newHashTable[ idx ]; - newHashTable[ idx ] = object; - + idx = HashPointer(object->objectName) % newHashTableSize; + object->nextNameObject = newHashTable[idx]; + newHashTable[idx] = object; + object = next; } - + // Switch tables. - - delete [] hashTable; + + delete[] hashTable; hashTable = newHashTable; hashTableSize = newHashTableSize; } @@ -109,16 +109,16 @@ SimObject* SimNameDictionary::find(StringTableEntry name) { #ifndef USE_NEW_SIMDICTIONARY // NULL is a valid lookup - it will always return NULL - if(!hashTable) + if (!hashTable) return NULL; - + Mutex::lockMutex(mutex); S32 idx = HashPointer(name) % hashTableSize; SimObject *walk = hashTable[idx]; - while(walk) + while (walk) { - if(walk->objectName == name) + if (walk->objectName == name) { Mutex::unlockMutex(mutex); return walk; @@ -129,28 +129,28 @@ SimObject* SimNameDictionary::find(StringTableEntry name) Mutex::unlockMutex(mutex); return NULL; #else - Mutex::lockMutex(mutex); - StringDictDef::iterator it = root.find(name); - SimObject* f = (it == root.end() ? NULL : it->second); - Mutex::unlockMutex(mutex); - return f; + Mutex::lockMutex(mutex); + StringDictDef::iterator it = root.find(name); + SimObject* f = (it == root.end() ? NULL : it->second); + Mutex::unlockMutex(mutex); + return f; #endif } void SimNameDictionary::remove(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; - while(*walk) + while (*walk) { - if(*walk == obj) + if (*walk == obj) { *walk = obj->nextNameObject; - obj->nextNameObject = (SimObject*)-1; + obj->nextNameObject = nullptr; hashEntryCount--; Mutex::unlockMutex(mutex); @@ -164,7 +164,7 @@ void SimNameDictionary::remove(SimObject* obj) root.erase(name); #endif Mutex::unlockMutex(mutex); -} +} //---------------------------------------------------------------------------- @@ -174,8 +174,8 @@ SimManagerNameDictionary::SimManagerNameDictionary() hashTable = new SimObject *[DefaultTableSize]; hashTableSize = DefaultTableSize; hashEntryCount = 0; - - dMemset( hashTable, 0, sizeof( hashTable[ 0 ] ) * hashTableSize ); + + dMemset(hashTable, 0, sizeof(hashTable[0]) * hashTableSize); #endif mutex = Mutex::createMutex(); } @@ -190,7 +190,7 @@ SimManagerNameDictionary::~SimManagerNameDictionary() void SimManagerNameDictionary::insert(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; Mutex::lockMutex(mutex); @@ -199,34 +199,34 @@ void SimManagerNameDictionary::insert(SimObject* obj) obj->nextManagerNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; - + // Rehash if necessary. - if( hashEntryCount > hashTableSize ) + if (hashEntryCount > hashTableSize) { // Allocate new table. - + U32 newHashTableSize = hashTableSize * 2 + 1; - SimObject** newHashTable = new SimObject *[ newHashTableSize ]; - dMemset( newHashTable, 0, sizeof( newHashTable[ 0 ] ) * newHashTableSize ); - + SimObject** newHashTable = new SimObject *[newHashTableSize]; + dMemset(newHashTable, 0, sizeof(newHashTable[0]) * newHashTableSize); + // Move entries over. - for( U32 i = 0; i < hashTableSize; ++ i ) - for( SimObject* object = hashTable[ i ]; object != NULL; ) + for (U32 i = 0; i < hashTableSize; ++i) + for (SimObject* object = hashTable[i]; object != NULL; ) { SimObject* next = object->nextManagerNameObject; - idx = HashPointer( object->objectName ) % newHashTableSize; - object->nextManagerNameObject = newHashTable[ idx ]; - newHashTable[ idx ] = object; - + idx = HashPointer(object->objectName) % newHashTableSize; + object->nextManagerNameObject = newHashTable[idx]; + newHashTable[idx] = object; + object = next; } - + // Switch tables. - - delete [] hashTable; + + delete[] hashTable; hashTable = newHashTable; hashTableSize = newHashTableSize; } @@ -245,9 +245,9 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) #ifndef USE_NEW_SIMDICTIONARY S32 idx = HashPointer(name) % hashTableSize; SimObject *walk = hashTable[idx]; - while(walk) + while (walk) { - if(walk->objectName == name) + if (walk->objectName == name) { Mutex::unlockMutex(mutex); return walk; @@ -267,19 +267,19 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) void SimManagerNameDictionary::remove(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; #ifndef USE_NEW_SIMDICTIONARY Mutex::lockMutex(mutex); SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; - while(*walk) + while (*walk) { - if(*walk == obj) + if (*walk == obj) { *walk = obj->nextManagerNameObject; - obj->nextManagerNameObject = (SimObject*)-1; + obj->nextManagerNameObject = nullptr; hashEntryCount--; Mutex::unlockMutex(mutex); @@ -293,7 +293,7 @@ void SimManagerNameDictionary::remove(SimObject* obj) root.erase(name); #endif Mutex::unlockMutex(mutex); -} +} //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- @@ -301,7 +301,7 @@ void SimManagerNameDictionary::remove(SimObject* obj) SimIdDictionary::SimIdDictionary() { #ifndef USE_NEW_SIMDICTIONARY - dMemset( table, 0, sizeof( table[ 0 ] ) * DefaultTableSize ); + dMemset(table, 0, sizeof(table[0]) * DefaultTableSize); #endif mutex = Mutex::createMutex(); } @@ -322,7 +322,7 @@ void SimIdDictionary::insert(SimObject* obj) #ifndef USE_NEW_SIMDICTIONARY S32 idx = obj->getId() & TableBitMask; obj->nextIdObject = table[idx]; - AssertFatal( obj->nextIdObject != obj, "SimIdDictionary::insert - Creating Infinite Loop linking to self!" ); + AssertFatal(obj->nextIdObject != obj, "SimIdDictionary::insert - Creating Infinite Loop linking to self!"); table[idx] = obj; #else root[obj->getId()] = obj; @@ -336,9 +336,9 @@ SimObject* SimIdDictionary::find(S32 id) #ifndef USE_NEW_SIMDICTIONARY S32 idx = id & TableBitMask; SimObject *walk = table[idx]; - while(walk) + while (walk) { - if(walk->getId() == U32(id)) + if (walk->getId() == U32(id)) { Mutex::unlockMutex(mutex); return walk; @@ -364,9 +364,9 @@ void SimIdDictionary::remove(SimObject* obj) Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY SimObject **walk = &table[obj->getId() & TableBitMask]; - while(*walk && *walk != obj) + while (*walk && *walk != obj) walk = &((*walk)->nextIdObject); - if(*walk) + if (*walk) *walk = obj->nextIdObject; #else root.erase(obj->getId()); diff --git a/Engine/source/console/simFieldDictionary.cpp b/Engine/source/console/simFieldDictionary.cpp index 7cf3deb94..f68a8689b 100644 --- a/Engine/source/console/simFieldDictionary.cpp +++ b/Engine/source/console/simFieldDictionary.cpp @@ -36,20 +36,20 @@ SimFieldDictionary::Entry *SimFieldDictionary::smFreeList = NULL; static Chunker fieldChunker; -U32 SimFieldDictionary::getHashValue( StringTableEntry slotName ) +U32 SimFieldDictionary::getHashValue(StringTableEntry slotName) { - return HashPointer( slotName ) % HashTableSize; + return HashPointer(slotName) % HashTableSize; } -U32 SimFieldDictionary::getHashValue( const String& fieldName ) +U32 SimFieldDictionary::getHashValue(const String& fieldName) { - return getHashValue( StringTable->insert( fieldName ) ); + return getHashValue(StringTable->insert(fieldName)); } -SimFieldDictionary::Entry *SimFieldDictionary::addEntry( U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value ) +SimFieldDictionary::Entry *SimFieldDictionary::addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value) { Entry* ret; - if(smFreeList) + if (smFreeList) { ret = smFreeList; smFreeList = ret->next; @@ -57,14 +57,14 @@ SimFieldDictionary::Entry *SimFieldDictionary::addEntry( U32 bucket, StringTable else ret = fieldChunker.alloc(); - ret->next = mHashTable[ bucket ]; - ret->slotName = slotName; - ret->type = type; - ret->value = value; + ret->next = mHashTable[bucket]; + ret->slotName = slotName; + ret->type = type; + ret->value = value; - mHashTable[ bucket ] = ret; - mNumFields ++; - mVersion ++; + mHashTable[bucket] = ret; + mNumFields++; + mVersion++; return ret; } @@ -74,37 +74,37 @@ void SimFieldDictionary::freeEntry(SimFieldDictionary::Entry *ent) ent->next = smFreeList; smFreeList = ent; - mNumFields --; + mNumFields--; } SimFieldDictionary::SimFieldDictionary() -: mNumFields( 0 ), - mVersion( 0 ) + : mNumFields(0), + mVersion(0) { - dMemset( mHashTable, 0, sizeof( mHashTable ) ); + dMemset(mHashTable, 0, sizeof(mHashTable)); } SimFieldDictionary::~SimFieldDictionary() { - for(U32 i = 0; i < HashTableSize; i++) + for (U32 i = 0; i < HashTableSize; i++) { - for(Entry *walk = mHashTable[i]; walk;) + for (Entry *walk = mHashTable[i]; walk;) { Entry *temp = walk; walk = temp->next; - if( temp->value ) + if (temp->value) dFree(temp->value); freeEntry(temp); } } - AssertFatal( mNumFields == 0, "Incorrect count on field dictionary" ); + AssertFatal(mNumFields == 0, "Incorrect count on field dictionary"); } void SimFieldDictionary::setFieldType(StringTableEntry slotName, const char *typeString) { - ConsoleBaseType *cbt = ConsoleBaseType::getTypeByName( typeString ); + ConsoleBaseType *cbt = ConsoleBaseType::getTypeByName(typeString); setFieldType(slotName, cbt); } @@ -117,11 +117,11 @@ void SimFieldDictionary::setFieldType(StringTableEntry slotName, const U32 typeI void SimFieldDictionary::setFieldType(StringTableEntry slotName, ConsoleBaseType *type) { // If the field exists on the object, set the type - U32 bucket = getHashValue( slotName ); + U32 bucket = getHashValue(slotName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) { - if( walk->slotName == slotName ) + if (walk->slotName == slotName) { // Found and type assigned, let's bail walk->type = type; @@ -130,15 +130,15 @@ void SimFieldDictionary::setFieldType(StringTableEntry slotName, ConsoleBaseType } // Otherwise create the field, and set the type. Assign a null value. - addEntry( bucket, slotName, type ); + addEntry(bucket, slotName, type); } U32 SimFieldDictionary::getFieldType(StringTableEntry slotName) const { - U32 bucket = getHashValue( slotName ); + U32 bucket = getHashValue(slotName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) - if( walk->slotName == slotName ) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) + if (walk->slotName == slotName) return walk->type ? walk->type->getTypeID() : TypeString; return TypeString; @@ -146,27 +146,27 @@ U32 SimFieldDictionary::getFieldType(StringTableEntry slotName) const SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(const String &fieldName) const { - U32 bucket = getHashValue( fieldName ); + U32 bucket = getHashValue(fieldName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) { - if( fieldName.equal(walk->slotName, String::NoCase) ) + if (fieldName.equal(walk->slotName, String::NoCase)) return walk; } return NULL; } -SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField( StringTableEntry fieldName) const +SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(StringTableEntry fieldName) const { - U32 bucket = getHashValue( fieldName ); + U32 bucket = getHashValue(fieldName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) { - if( walk->slotName == fieldName ) - { - return walk; - } + if (walk->slotName == fieldName) + { + return walk; + } } return NULL; @@ -177,17 +177,17 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va { U32 bucket = getHashValue(slotName); Entry **walk = &mHashTable[bucket]; - while(*walk && (*walk)->slotName != slotName) + while (*walk && (*walk)->slotName != slotName) walk = &((*walk)->next); Entry *field = *walk; - if( !value || !*value ) + if (!value || !*value) { - if(field) + if (field) { mVersion++; - if( field->value ) + if (field->value) dFree(field->value); *walk = field->next; @@ -196,15 +196,15 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va } else { - if(field) + if (field) { - if( field->value ) + if (field->value) dFree(field->value); field->value = dStrdup(value); } else - addEntry( bucket, slotName, 0, dStrdup( value ) ); + addEntry(bucket, slotName, 0, dStrdup(value)); } } @@ -212,8 +212,8 @@ const char *SimFieldDictionary::getFieldValue(StringTableEntry slotName) { U32 bucket = getHashValue(slotName); - for(Entry *walk = mHashTable[bucket];walk;walk = walk->next) - if(walk->slotName == slotName) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) + if (walk->slotName == slotName) return walk->value; return NULL; @@ -223,9 +223,9 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict) { mVersion++; - for(U32 i = 0; i < HashTableSize; i++) + for (U32 i = 0; i < HashTableSize; i++) { - for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) + for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next) { setFieldValue(walk->slotName, walk->value); setFieldType(walk->slotName, walk->type); @@ -233,7 +233,7 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict) } } -static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b) +static S32 QSORT_CALLBACK compareEntries(const void* a, const void* b) { SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a); SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b); @@ -245,17 +245,17 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop const AbstractClassRep::FieldList &list = obj->getFieldList(); Vector flist(__FILE__, __LINE__); - for(U32 i = 0; i < HashTableSize; i++) + for (U32 i = 0; i < HashTableSize; i++) { - for(Entry *walk = mHashTable[i];walk; walk = walk->next) + for (Entry *walk = mHashTable[i]; walk; walk = walk->next) { // make sure we haven't written this out yet: U32 i; - for(i = 0; i < list.size(); i++) - if(list[i].pFieldname == walk->slotName) + for (i = 0; i < list.size(); i++) + if (list[i].pFieldname == walk->slotName) break; - if(i != list.size()) + if (i != list.size()) continue; @@ -267,23 +267,23 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop } // Sort Entries to prevent version control conflicts - dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries); + dQsort(flist.address(), flist.size(), sizeof(Entry *), compareEntries); // Save them out - for(Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) + for (Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) { - U32 nBufferSize = (dStrlen( (*itr)->value ) * 2) + dStrlen( (*itr)->slotName ) + 16; - FrameTemp expandedBuffer( nBufferSize ); + U32 nBufferSize = (dStrlen((*itr)->value) * 2) + dStrlen((*itr)->slotName) + 16; + FrameTemp expandedBuffer(nBufferSize); - stream.writeTabs(tabStop+1); + stream.writeTabs(tabStop + 1); const char *typeName = (*itr)->type && (*itr)->type->getTypeID() != TypeString ? (*itr)->type->getTypeName() : ""; dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", (*itr)->slotName); - if ( (*itr)->value ) + if ((*itr)->value) expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value); dStrcat(expandedBuffer, "\";\r\n"); - stream.write(dStrlen(expandedBuffer),expandedBuffer); + stream.write(dStrlen(expandedBuffer), expandedBuffer); } } @@ -293,32 +293,32 @@ void SimFieldDictionary::printFields(SimObject *obj) char expandedBuffer[4096]; Vector flist(__FILE__, __LINE__); - for(U32 i = 0; i < HashTableSize; i++) + for (U32 i = 0; i < HashTableSize; i++) { - for(Entry *walk = mHashTable[i];walk; walk = walk->next) + for (Entry *walk = mHashTable[i]; walk; walk = walk->next) { // make sure we haven't written this out yet: U32 i; - for(i = 0; i < list.size(); i++) - if(list[i].pFieldname == walk->slotName) + for (i = 0; i < list.size(); i++) + if (list[i].pFieldname == walk->slotName) break; - if(i != list.size()) + if (i != list.size()) continue; flist.push_back(walk); } } - dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries); + dQsort(flist.address(), flist.size(), sizeof(Entry *), compareEntries); - for(Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) + for (Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) { const char* type = "string"; - if( ( *itr )->type ) - type = ( *itr )->type->getTypeClassName(); - - dSprintf( expandedBuffer, sizeof( expandedBuffer ), " %s %s = \"", type, ( *itr )->slotName ); - if ( (*itr)->value ) + if ((*itr)->type) + type = (*itr)->type->getTypeClassName(); + + dSprintf(expandedBuffer, sizeof(expandedBuffer), " %s %s = \"", type, (*itr)->slotName); + if ((*itr)->value) expandEscape(expandedBuffer + dStrlen(expandedBuffer), (*itr)->value); Con::printf("%s\"", expandedBuffer); } @@ -326,9 +326,9 @@ void SimFieldDictionary::printFields(SimObject *obj) SimFieldDictionary::Entry *SimFieldDictionary::operator[](U32 index) { - AssertFatal ( index < mNumFields, "out of range" ); + AssertFatal(index < mNumFields, "out of range"); - if ( index > mNumFields ) + if (index > mNumFields) return NULL; SimFieldDictionaryIterator itr(this); @@ -350,13 +350,13 @@ SimFieldDictionaryIterator::SimFieldDictionaryIterator(SimFieldDictionary * dict SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator++() { - if(!mDictionary) + if (!mDictionary) return(mEntry); - if(mEntry) + if (mEntry) mEntry = mEntry->next; - while(!mEntry && (mHashIndex < (SimFieldDictionary::HashTableSize-1))) + while (!mEntry && (mHashIndex < (SimFieldDictionary::HashTableSize - 1))) mEntry = mDictionary->mHashTable[++mHashIndex]; return(mEntry); @@ -386,14 +386,14 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va U32 bucket = getHashValue(slotName); Entry **walk = &mHashTable[bucket]; - while(*walk && (*walk)->slotName != slotName) + while (*walk && (*walk)->slotName != slotName) walk = &((*walk)->next); Entry *field = *walk; if (field) return; - addEntry( bucket, slotName, type, dStrdup( value ) ); + addEntry(bucket, slotName, type, dStrdup(value)); } // A variation of the stock SimFieldDictionary::assignFrom(), this method adds // and arguments. When true, prohibits the replacement of fields that already @@ -412,15 +412,15 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict, const char* filter if (filter_len == 0) { - for(U32 i = 0; i < HashTableSize; i++) - for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) + for (U32 i = 0; i < HashTableSize; i++) + for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next) setFieldValue(walk->slotName, walk->value, walk->type, no_replace); } else { - for(U32 i = 0; i < HashTableSize; i++) - for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) + for (U32 i = 0; i < HashTableSize; i++) + for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next) if (dStrncmp(walk->slotName, filter, filter_len) == 0) setFieldValue(walk->slotName, walk->value, walk->type, no_replace); } -} +} \ No newline at end of file diff --git a/Engine/source/console/simFieldDictionary.h b/Engine/source/console/simFieldDictionary.h index 4849be563..c89bd5b57 100644 --- a/Engine/source/console/simFieldDictionary.h +++ b/Engine/source/console/simFieldDictionary.h @@ -47,7 +47,7 @@ class SimFieldDictionary public: struct Entry { - Entry() : type( NULL ) {}; + Entry() : type(NULL) {}; StringTableEntry slotName; char *value; @@ -64,10 +64,10 @@ private: static Entry *smFreeList; void freeEntry(Entry *entry); - Entry* addEntry( U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value = 0 ); + Entry* addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value = 0); - static U32 getHashValue( StringTableEntry slotName ); - static U32 getHashValue( const String& fieldName ); + static U32 getHashValue(StringTableEntry slotName); + static U32 getHashValue(const String& fieldName); U32 mNumFields; @@ -88,7 +88,7 @@ public: const char *getFieldValue(StringTableEntry slotName); U32 getFieldType(StringTableEntry slotName) const; Entry *findDynamicField(const String &fieldName) const; - Entry *findDynamicField( StringTableEntry fieldName) const; + Entry *findDynamicField(StringTableEntry fieldName) const; void writeFields(SimObject *obj, Stream &strem, U32 tabStop); void printFields(SimObject *obj); void assignFrom(SimFieldDictionary *dict); @@ -112,4 +112,4 @@ public: }; -#endif // _SIMFIELDDICTIONARY_H_ +#endif // _SIMFIELDDICTIONARY_H_ \ No newline at end of file diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index c12a12f19..0583606b0 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -72,8 +72,8 @@ SimObject::SimObject() objectName = NULL; mOriginalName = NULL; mInternalName = NULL; - nextNameObject = (SimObject*)-1; - nextManagerNameObject = (SimObject*)-1; + nextNameObject = nullptr; + nextManagerNameObject = nullptr; nextIdObject = NULL; mFilename = NULL; @@ -86,6 +86,8 @@ SimObject::SimObject() mNotifyList = NULL; mFlags.set( ModStaticFields | ModDynamicFields ); + mProgenitorFile = StringTable->EmptyString(); + mFieldDictionary = NULL; mCanSaveFieldDictionary = true; @@ -122,10 +124,10 @@ SimObject::~SimObject() if( mCopySource ) mCopySource->unregisterReference( &mCopySource ); - AssertFatal(nextNameObject == (SimObject*)-1,avar( + AssertFatal(nextNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from dictionary: name %s, id %i", objectName, mId)); - AssertFatal(nextManagerNameObject == (SimObject*)-1,avar( + AssertFatal(nextManagerNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from manager dictionary: name %s, id %i", objectName,mId)); AssertFatal(mFlags.test(Added) == 0, "SimObject::object " diff --git a/Engine/source/gfx/bitmap/loaders/bitmapGif.cpp b/Engine/source/gfx/bitmap/loaders/bitmapGif.cpp deleted file mode 100644 index 56bf51cc6..000000000 --- a/Engine/source/gfx/bitmap/loaders/bitmapGif.cpp +++ /dev/null @@ -1,232 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/platform.h" - -#include "core/stream/fileStream.h" -#include "core/util/path.h" - -#include "gfx/bitmap/gBitmap.h" - -// This must come after our headers due to a conflicting definition of VoidPtr -#include "lungif/gif_lib.h" - - -using namespace Torque; - -static bool sReadGIF(Stream &stream, GBitmap *bitmap); -static bool sWriteGIF(GBitmap *bitmap, Stream &stream, U32 compressionLevel); - -static struct _privateRegisterGIF -{ - _privateRegisterGIF() - { - GBitmap::Registration reg; - - reg.extensions.push_back( "gif" ); - - reg.readFunc = sReadGIF; - reg.writeFunc = sWriteGIF; - - GBitmap::sRegisterFormat( reg ); - } -} sStaticRegisterGIF; - -//-------------------------------------- Replacement I/O for standard LIBjpeg -// functions. we don't wanna use -// FILE*'s... -static S32 gifReadDataFn(GifFileType *gifinfo, GifByteType *data, S32 length) -{ - Stream *stream = (Stream*)gifinfo->UserData; - AssertFatal(stream != NULL, "gifReadDataFn::No stream."); - int pos = stream->getPosition(); - if (stream->read(length, data)) - return length; - - if (stream->getStatus() == Stream::EOS) - return (stream->getPosition()-pos); - else - return 0; -} - - -//-------------------------------------- -#if 0 -// CodeReview - until we can write these, get rid of warning by disabling method. -static S32 gifWriteDataFn(GifFileType *gifinfo, GifByteType *data, S32 length) -{ - Stream *stream = (Stream*)gifinfo->UserData; - AssertFatal(stream != NULL, "gifWriteDataFn::No stream."); - if (stream->write(length, data)) - return length; - else - return 0; -} -#endif - -//-------------------------------------- -static bool sReadGIF( Stream &stream, GBitmap *bitmap ) -{ - PROFILE_SCOPE(sReadGIF); - GifFileType *gifinfo = DGifOpen( (void*)&stream, gifReadDataFn); - if (!gifinfo) - return false; - - GifRecordType recordType; - do - { - if (DGifGetRecordType(gifinfo, &recordType) == GIF_ERROR) - break; - - if (recordType == IMAGE_DESC_RECORD_TYPE) - { - if (DGifGetImageDesc(gifinfo) == GIF_ERROR) - break; - - GFXFormat format = (gifinfo->SBackGroundColor == 0 ) ? GFXFormatR8G8B8 : GFXFormatR8G8B8A8; - bitmap->allocateBitmap(gifinfo->SWidth, gifinfo->SHeight, false, format); - - // Assume no transparency until proven otherwise - bitmap->setHasTransparency(false); - - U32 gwidth = gifinfo->Image.Width ? gifinfo->Image.Width : bitmap->getWidth(); - U32 gheight= gifinfo->Image.Height ? gifinfo->Image.Height : bitmap->getHeight(); - U32 gifSize = gwidth * gheight; - U8 *data = new U8[gifSize]; - - if (DGifGetLine(gifinfo, data, gifSize) != GIF_ERROR) - { - // use the global or local color table ? - GifColorType *color = NULL; - if (gifinfo->Image.ColorMap) - color = gifinfo->Image.ColorMap->Colors; - else if (gifinfo->SColorMap) - color = gifinfo->SColorMap->Colors; - - if (color) - { - U8 *dst = bitmap->getAddress(gifinfo->Image.Left, gifinfo->Image.Top); - U8 *src = data; - U32 right = gifinfo->Image.Left + gwidth; - U32 bottom = gifinfo->Image.Top + gheight; - U32 next = (bitmap->getWidth() - gwidth) * bitmap->getBytesPerPixel(); - - if (format == GFXFormatR8G8B8A8) - { - for (U32 y=gifinfo->Image.Top; yImage.Left; xSBackGroundColor) - { - // this is a transparent pixel - dst[0] = 0; // red - dst[1] = 0; // green - dst[2] = 0; // blue - dst[3] = 0; // alpha - - bitmap->setHasTransparency(true); - } - else - { - dst[0] = color[*src].Red; - dst[1] = color[*src].Green; - dst[2] = color[*src].Blue; - dst[3] = 0; // alpha - } - dst += bitmap->getBytesPerPixel(); - } - dst += next; - } - } - else - { - for (U32 y=gifinfo->Image.Top; yImage.Left; xgetBytesPerPixel(); - } - dst += next; - } - } - delete [] data; - DGifCloseFile(gifinfo); - return true; - } - } - // failure - delete [] data; - break; - } - else if (recordType == EXTENSION_RECORD_TYPE) - { - GifByteType *extension; - S32 extCode; - - // Skip any extension blocks in file - if (DGifGetExtension(gifinfo, &extCode, &extension) != GIF_ERROR) - { - while (extension != NULL) - { - if (DGifGetExtensionNext(gifinfo, &extension) == GIF_ERROR) - { - return false; - } - } - } - else - { - return false; - } - } - - // There used to be a break right here. This caused the while condition to - // never get processed, and so it never looped through all the records in - // the GIF. I took a quick peek back at TGB and TGE histories and I am not - // sure where this change got made, but I can't figure out why the loading - // worked at all, ever, with that break in there. The only case I can think - // of is if the first record in the GIF was the bitmap data. - // [6/6/2007 Pat] - - }while (recordType != TERMINATE_RECORD_TYPE); - - - DGifCloseFile(gifinfo); - return true; -} - - -//-------------------------------------------------------------------------- -static bool sWriteGIF(GBitmap *bitmap, Stream &stream, U32 compressionLevel) -{ - TORQUE_UNUSED( bitmap ); - TORQUE_UNUSED( stream ); - TORQUE_UNUSED( compressionLevel ); - - return false; -} - - diff --git a/Engine/source/gfx/bitmap/loaders/bitmapMng.cpp b/Engine/source/gfx/bitmap/loaders/bitmapMng.cpp deleted file mode 100644 index 5caa67d93..000000000 --- a/Engine/source/gfx/bitmap/loaders/bitmapMng.cpp +++ /dev/null @@ -1,422 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "core/stream/stream.h" - -#include "gfx/bitmap/gBitmap.h" - -#include "core/color.h" - -#define MNG_NO_CMS -#define MNG_SUPPORT_READ -#define MNG_SUPPORT_WRITE -#define MNG_SUPPORT_DISPLAY -#define MNG_STORE_CHUNKS -#define MNG_ACCESS_CHUNKS - -#include "lmng/libmng.h" - - - -static bool sReadMNG(Stream &stream, GBitmap *bitmap); -static bool sWriteMNG(GBitmap *bitmap, Stream &stream, U32 compressionLevel); - -static struct _privateRegisterMNG -{ - _privateRegisterMNG() - { - GBitmap::Registration reg; - - reg.extensions.push_back( "jng" ); - reg.extensions.push_back( "mng" ); - - reg.readFunc = sReadMNG; - reg.writeFunc = sWriteMNG; - - GBitmap::sRegisterFormat( reg ); - } -} sStaticRegisterMNG; - - -typedef struct -{ - GBitmap* image; - Stream* stream; -} mngstuff; - -static mng_ptr mngMallocFn(mng_size_t size) -{ - mng_ptr data = dMalloc(size); - return dMemset(data, 0, size); -} - -static void mngFreeFn(mng_ptr p, mng_size_t size) -{ - dFree(p); -} - -static mng_bool mngOpenDataFn(mng_handle mng) -{ - return MNG_TRUE; -} - -static mng_bool mngCloseDataFn(mng_handle mng) -{ - return MNG_TRUE; -} - -static mng_bool mngReadDataFn(mng_handle mng, mng_ptr data, mng_uint32 length, mng_uint32 *bytesread) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - AssertFatal(mymng->stream != NULL, "No stream?"); - - bool success = mymng->stream->read(length, data); - *bytesread = length; // stupid hack - - AssertFatal(success, "MNG read catastrophic error!"); - if(success) - return MNG_TRUE; - else - return MNG_FALSE; -} - -#if 0 -// CodeReview - until we can write these, get rid of warning by disabling method. -static mng_bool mngWriteDataFn(mng_handle mng, mng_ptr data, mng_uint32 length, mng_uint32 *iWritten) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - AssertFatal(mymng->stream != NULL, "No stream?"); - - bool success = mymng->stream->write(length, data); - *iWritten = length; // stupid hack - - AssertFatal(success, "MNG write catastrophic error!"); - if(success) - return MNG_TRUE; - else - return MNG_FALSE; -} -#endif - -static mng_bool mngProcessHeaderFn(mng_handle mng, mng_uint32 width, mng_uint32 height) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - - GFXFormat format; - mng_uint8 colorType = mng_get_colortype(mng); - mng_uint8 alphaDepth = mng_get_alphadepth(mng); - switch(colorType) - { - case MNG_COLORTYPE_GRAY: - case MNG_COLORTYPE_JPEGGRAY: - format = GFXFormatR8G8B8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - break; - - case MNG_COLORTYPE_INDEXED: - if(alphaDepth >= 1) - { - format = GFXFormatR8G8B8A8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - } - else - { - format = GFXFormatR8G8B8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - } - - case MNG_COLORTYPE_RGB: - case MNG_COLORTYPE_JPEGCOLOR: - if(alphaDepth >= 1) - { - format = GFXFormatR8G8B8A8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - } - else - { - format = GFXFormatR8G8B8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - } - break; - - case MNG_COLORTYPE_RGBA: - case MNG_COLORTYPE_JPEGCOLORA: - format = GFXFormatR8G8B8A8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - break; - - default: - // This case should never get hit, however it resolves a compiler - // warning - format = GFXFormat_FIRST; - AssertISV( false, "Unknown color format in bitmap MNG Loading" ); - } - - mymng->image->allocateBitmap(width, height, false, format); - return MNG_TRUE; -} - -static mng_ptr mngCanvasLineFn(mng_handle mng, mng_uint32 line) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - return (mng_ptr) mymng->image->getAddress(0, line); -} - -static mng_bool mngRefreshFn(mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h) -{ - return MNG_TRUE; -} - -static mng_uint32 mngGetTicksFn(mng_handle mng) -{ - return 0; -} - -static mng_bool mngSetTimerFn(mng_handle mng, mng_uint32 msecs) -{ - return MNG_TRUE; -} - -static mng_bool mngFatalErrorFn(mng_handle mng, mng_int32 code, mng_int8 severity, mng_chunkid chunktype, mng_uint32 chunkseq, mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - mng_cleanup(&mng); - - AssertISV(false, avar("Error reading MNG file:\n %s", (const char*)text)); - return MNG_FALSE; -} - -static bool sReadMNG(Stream &stream, GBitmap *bitmap) -{ - PROFILE_SCOPE(sReadMNG); - mngstuff mnginfo; - dMemset(&mnginfo, 0, sizeof(mngstuff)); - - mng_handle mng = mng_initialize(&mnginfo, mngMallocFn, mngFreeFn, MNG_NULL); - if(mng == NULL) - return false; - - // setup the callbacks - mng_setcb_errorproc(mng, mngFatalErrorFn); - mng_setcb_openstream(mng, mngOpenDataFn); - mng_setcb_closestream(mng, mngCloseDataFn); - mng_setcb_readdata(mng, mngReadDataFn); - mng_setcb_processheader(mng, mngProcessHeaderFn); - mng_setcb_getcanvasline(mng, mngCanvasLineFn); - mng_setcb_refresh(mng, mngRefreshFn); - mng_setcb_gettickcount(mng, mngGetTicksFn); - mng_setcb_settimer(mng, mngSetTimerFn); - - mnginfo.image = bitmap; - mnginfo.stream = &stream; - - mng_read(mng); - mng_display(mng); - - // hacks :( - // libmng doesn't support returning data in gray/gray alpha format, - // so we grab as RGB/RGBA and just cut off the g and b - mng_uint8 colorType = mng_get_colortype(mng); - switch(colorType) - { - case MNG_COLORTYPE_GRAY: - case MNG_COLORTYPE_JPEGGRAY: - { - GBitmap temp(*bitmap); - bitmap->deleteImage(); - bitmap->allocateBitmap(temp.getWidth(), temp.getHeight(), false, GFXFormatA8); - - // force getColor to read in in the same color value for each channel - // since the gray colortype has the real alpha in the first channel - temp.setFormat( GFXFormatA8 ); - - ColorI color; - for(U32 row = 0; row < bitmap->getHeight(); row++) - { - for(U32 col = 0; col < bitmap->getWidth(); col++) - { - temp.getColor(col, row, color); - bitmap->setColor(col, row, color); - } - } - } - - break; - } - - mng_cleanup(&mng); - - // Check this bitmap for transparency - bitmap->checkForTransparency(); - - return true; -} - -static bool sWriteMNG(GBitmap *bitmap, Stream &stream, U32 compressionLevel) -{ - TORQUE_UNUSED( bitmap ); - TORQUE_UNUSED( stream ); - TORQUE_UNUSED( compressionLevel ); - - return false; -#if 0 - // ONLY RGB bitmap writing supported at this time! - AssertFatal(getFormat() == GFXFormatR8G8B8 || getFormat() == GFXFormatR8G8B8A8 || getFormat() == GFXFormatA8, "GBitmap::writeMNG: ONLY RGB bitmap writing supported at this time."); - if(getFormat() != GFXFormatR8G8B8 && getFormat() != GFXFormatR8G8B8A8 && getFormat() != GFXFormatA8) - return (false); - - // maximum image size allowed - #define MAX_HEIGHT 4096 - if(getHeight() >= MAX_HEIGHT) - return false; - - mngstuff mnginfo; - dMemset(&mnginfo, 0, sizeof(mngstuff)); - mng_handle mng = mng_initialize(&mnginfo, mngMallocFn, mngFreeFn, MNG_NULL); - if(mng == NULL) { - return false; - } - - // setup the callbacks - mng_setcb_openstream(mng, mngOpenDataFn); - mng_setcb_closestream(mng, mngCloseDataFn); - mng_setcb_writedata(mng, mngWriteDataFn); - - // create the file in memory - mng_create(mng); - - mng_putchunk_defi(mng, 0, 0, 0, MNG_FALSE, 0, 0, MNG_FALSE, 0, getWidth(), 0, getHeight()); - - mnginfo.image = (GBitmap*)this; - mnginfo.stream = &stream; - - switch(getFormat()) { - case GFXFormatA8: - mng_putchunk_ihdr(mng, getWidth(), getHeight(), - MNG_BITDEPTH_8, - MNG_COLORTYPE_GRAY, - MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, - MNG_INTERLACE_NONE); - - // not implemented in lib yet - //mng_putimgdata_ihdr(mng, getWidth(), getHeight(), - // MNG_COLORTYPE_GRAY, - // MNG_BITDEPTH_8, - // MNG_COMPRESSION_DEFLATE, - // MNG_FILTER_ADAPTIVE, - // MNG_INTERLACE_NONE, - // MNG_CANVAS_GRAY8, mngCanvasLineFn); - break; - case GFXFormatR8G8B8: - mng_putchunk_ihdr(mng, getWidth(), getHeight(), - MNG_BITDEPTH_8, - MNG_COLORTYPE_RGB, - MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, - MNG_INTERLACE_NONE); - - // not implemented in lib yet - //mng_putimgdata_ihdr(mng, getWidth(), getHeight(), - // MNG_COLORTYPE_RGB, - // MNG_BITDEPTH_8, - // MNG_COMPRESSION_DEFLATE, - // MNG_FILTER_ADAPTIVE, - // MNG_INTERLACE_NONE, - // MNG_CANVAS_RGB8, mngCanvasLineFn); - break; - case GFXFormatR8G8B8A8: - mng_putchunk_ihdr(mng, getWidth(), getHeight(), - MNG_BITDEPTH_8, - MNG_COLORTYPE_RGBA, - MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, - MNG_INTERLACE_NONE); - - // not implemented in lib yet - //mng_putimgdata_ihdr(mng, getWidth(), getHeight(), - // MNG_COLORTYPE_RGBA, - // MNG_BITDEPTH_8, - // MNG_COMPRESSION_DEFLATE, - // MNG_FILTER_ADAPTIVE, - // MNG_INTERLACE_NONE, - // MNG_CANVAS_RGBA8, mngCanvasLineFn); - break; - } - - - // below is a hack until libmng is mature enough to handle this itself - //----------------------------------------------------------------------------- - - - U8 *tmpbuffer = new U8[this->byteSize + getHeight()]; - if(tmpbuffer == 0) - { - mng_cleanup(&mng); - return false; - } - - // transfer data, add filterbyte - U32 effwdt = getWidth() * this->bytesPerPixel; - for(U32 Row = 0; Row < getHeight(); Row++) - { - // first Byte in each scanline is filterbyte: currently 0 -> no filter - tmpbuffer[Row * (effwdt + 1)] = 0; - - // copy the scanline - dMemcpy(tmpbuffer + Row * (effwdt + 1) + 1, getAddress(0, Row), effwdt); - } - - // compress data with zlib - U8 *dstbuffer = new U8[this->byteSize + getHeight()]; - if(dstbuffer == 0) - { - delete [] tmpbuffer; - mng_cleanup(&mng); - return false; - } - - U32 dstbufferSize = this->byteSize + getHeight(); - if(Z_OK != compress2((Bytef*)dstbuffer,(uLongf*)&dstbufferSize, (const Bytef*)tmpbuffer, dstbufferSize, 9)) - { - delete [] tmpbuffer; - delete [] dstbuffer; - mng_cleanup(&mng); - return false; - } - - mng_putchunk_idat(mng, dstbufferSize, (mng_ptr*)dstbuffer); - - - //----------------------------------------------------------------------------- - - - mng_putchunk_iend(mng); - - delete [] tmpbuffer; - delete [] dstbuffer; - - mng_write(mng); - mng_cleanup(&mng); - - return true; -#endif -} diff --git a/Engine/source/gui/containers/guiDragAndDropCtrl.cpp b/Engine/source/gui/containers/guiDragAndDropCtrl.cpp index 027fda6c8..a4aebe34c 100644 --- a/Engine/source/gui/containers/guiDragAndDropCtrl.cpp +++ b/Engine/source/gui/containers/guiDragAndDropCtrl.cpp @@ -152,14 +152,24 @@ ConsoleDocClass( GuiDragAndDropControl, "@ingroup GuiUtil" ); +IMPLEMENT_CALLBACK(GuiDragAndDropControl, onControlDragCancelled, void, (), (), + "Called when the we cancel out of the drag and drop action.\n" + "@see GuiDragAndDropControl::onControlDragCancelled"); //----------------------------------------------------------------------------- +GuiDragAndDropControl::GuiDragAndDropControl() : mDeleteOnMouseUp(true), mUseWholeCanvas(false) +{ + +} void GuiDragAndDropControl::initPersistFields() { addField( "deleteOnMouseUp", TypeBool, Offset( mDeleteOnMouseUp, GuiDragAndDropControl ), "If true, the control deletes itself when the left mouse button is released.\n\n" "If at this point, the drag&drop control still contains its payload, it will be deleted along with the control." ); + + addField("useWholeCanvas", TypeBool, Offset(mUseWholeCanvas, GuiDragAndDropControl), + "If true, the control can be tested against ANY control active on the canvas instead of just the direct parent.\n\n"); Parent::initPersistFields(); } @@ -226,8 +236,10 @@ void GuiDragAndDropControl::onMouseUp(const GuiEvent& event) mouseUnlock(); GuiControl* target = findDragTarget( event.mousePoint, "onControlDropped" ); - if( target ) - target->onControlDropped_callback( dynamic_cast< GuiControl* >( at( 0 ) ), getDropPoint() ); + if (target) + target->onControlDropped_callback(dynamic_cast(at(0)), getDropPoint()); + else + onControlDragCancelled_callback(); if( mDeleteOnMouseUp ) deleteObject(); @@ -239,6 +251,13 @@ GuiControl* GuiDragAndDropControl::findDragTarget( Point2I mousePoint, const cha { // If there are any children and we have a parent. GuiControl* parent = getParent(); + + if (mUseWholeCanvas) + { + parent->setVisible(false); + parent = getRoot(); + } + if (size() && parent) { mVisible = false; @@ -252,6 +271,10 @@ GuiControl* GuiDragAndDropControl::findDragTarget( Point2I mousePoint, const cha dropControl = dropControl->getParent(); } } + + if(mUseWholeCanvas) + parent->setVisible(true); + return NULL; } diff --git a/Engine/source/gui/containers/guiDragAndDropCtrl.h b/Engine/source/gui/containers/guiDragAndDropCtrl.h index a8ef0e7b3..a9806a7ee 100644 --- a/Engine/source/gui/containers/guiDragAndDropCtrl.h +++ b/Engine/source/gui/containers/guiDragAndDropCtrl.h @@ -53,6 +53,8 @@ class GuiDragAndDropControl : public GuiControl /// If true, the control deletes itself when the left mouse button is released. bool mDeleteOnMouseUp; + bool mUseWholeCanvas; + /// Controls may want to react when they are dragged over, entered or exited. SimObjectPtr mLastTarget; @@ -65,7 +67,7 @@ class GuiDragAndDropControl : public GuiControl public: - GuiDragAndDropControl() {} + GuiDragAndDropControl(); void startDragging(Point2I offset = Point2I(0, 0)); @@ -81,6 +83,8 @@ class GuiDragAndDropControl : public GuiControl DECLARE_DESCRIPTION( "A special control that implements drag&drop behavior.\n" "The control will notify other controls as it moves across the canvas.\n" "Content can be attached through dynamic fields or child objects." ); + + DECLARE_CALLBACK(void, onControlDragCancelled, ()); }; #endif \ No newline at end of file diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 1c6343f04..9d45147e1 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -36,9 +36,7 @@ #include "gui/editor/editorFunctions.h" #endif #include "console/engineAPI.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/entity.h" -#endif IMPLEMENT_CONOBJECT(GuiTreeViewCtrl); @@ -647,20 +645,6 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf) bool GuiTreeViewCtrl::Item::isParent() const { -#ifdef TORQUE_EXPERIMENTAL_EC - //We might have a special case with entities - //So if our entity either has children, or has some component with the EditorInspect interface, we return true - if (mInspectorInfo.mObject) - { - Entity* e = dynamic_cast(mInspectorInfo.mObject.getObject()); - if (e) - { - if (e->size() > 0 || e->getComponentCount() != 0) - return true; - } - } -#endif - if(mState.test(VirtualParent)) { if( !isInspectorData() ) @@ -2517,6 +2501,19 @@ const char * GuiTreeViewCtrl::getItemValue(S32 itemId) //----------------------------------------------------------------------------- +S32 GuiTreeViewCtrl::getItemAtPosition(Point2I position) +{ + BitSet32 hitFlags = 0; + Item* item; + + if (_hitTest(position, item, hitFlags)) + return item->mId; + else + return -1; +} + +//----------------------------------------------------------------------------- + bool GuiTreeViewCtrl::editItem( S32 itemId, const char* newText, const char* newValue ) { Item* item = getItem( itemId ); @@ -3790,7 +3787,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) if( !item->isInspectorData() && item->mState.test(Item::VirtualParent) ) onVirtualParentExpand(item); -#ifdef TORQUE_EXPERIMENTAL_EC //Slightly hacky, but I'm not sure of a better setup until we get major update to the editors //We check if our object is an entity, and if it is, we call a 'onInspect' function. //This function is pretty much a special notifier to the entity so if it has any behaviors that do special @@ -3810,7 +3806,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) } } } -#endif mFlags.set( RebuildVisible ); scrollVisible(item); @@ -4558,12 +4553,10 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item ) if ( !pItem ) continue; -#ifdef TORQUE_EXPERIMENTAL_EC //A bit hackish, but we make a special exception here for items that are named 'Components', as they're merely //virtual parents to act as a container to an Entity's components if (pItem->mScriptInfo.mText == StringTable->insert("Components")) continue; -#endif SimObject *pObj = pItem->getObject(); @@ -4628,11 +4621,10 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate) // Go through our items and purge those that have disappeared from // the set. -#ifdef TORQUE_EXPERIMENTAL_EC + //Entities will be a special case here, if we're an entity, skip this step if (dynamic_cast(srcObj)) return true; -#endif for( Item* ptr = item->mChild; ptr != NULL; ) { @@ -5571,3 +5563,11 @@ DefineEngineMethod( GuiTreeViewCtrl, clearFilterText, void, (),, { object->clearFilterText(); } + +DefineEngineMethod(GuiTreeViewCtrl, getItemAtPosition, S32, (Point2I position), (Point2I::Zero), + "Get the tree item at the passed in position.\n\n" + "@param position The position to check for what item is below it.\n" + "@return The id of the item under the position.") +{ + return object->getItemAtPosition(position); +} \ No newline at end of file diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.h b/Engine/source/gui/controls/guiTreeViewCtrl.h index 91f842b3d..686e3ea61 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.h +++ b/Engine/source/gui/controls/guiTreeViewCtrl.h @@ -513,6 +513,8 @@ class GuiTreeViewCtrl : public GuiArrayCtrl bool editItem( S32 itemId, const char* newText, const char* newValue ); bool markItem( S32 itemId, bool mark ); + + S32 getItemAtPosition(Point2I position); bool isItemSelected( S32 itemId ); diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 82c0475f0..5202e57bf 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -276,8 +276,6 @@ bool GuiCanvas::onAdd() // Define the menu bar for this canvas (if any) Con::executef(this, "onCreateMenu"); - Sim::findObject("PlatformGenericMenubar", mMenuBarCtrl); - return parentRet; } @@ -302,21 +300,39 @@ void GuiCanvas::setMenuBar(SimObject *obj) Parent::removeObject( oldMenuBar ); // set new menubar - if( mMenuBarCtrl ) - Parent::addObject(mMenuBarCtrl); + if (mMenuBarCtrl) + { + //Add a wrapper control so that the menubar sizes correctly + GuiControlProfile* profile; + Sim::findObject("GuiModelessDialogProfile", profile); + + if (!profile) + { + Con::errorf("GuiCanvas::setMenuBar: Unable to find the GuiModelessDialogProfile profile!"); + return; + } + + GuiControl* menuBackground = new GuiControl(); + menuBackground->registerObject(); + + menuBackground->setControlProfile(profile); + + menuBackground->addObject(mMenuBarCtrl); + + Parent::addObject(menuBackground); + } // update window accelerator keys if( oldMenuBar != mMenuBarCtrl ) { - StringTableEntry ste = StringTable->insert("menubar"); - GuiMenuBar* menu = NULL; - menu = !oldMenuBar ? NULL : dynamic_cast(oldMenuBar->findObjectByInternalName( ste, true)); - if( menu ) - menu->removeWindowAcceleratorMap( *getPlatformWindow()->getInputGenerator() ); + GuiMenuBar* oldMenu = dynamic_cast(oldMenuBar); + GuiMenuBar* newMenu = dynamic_cast(mMenuBarCtrl); - menu = !mMenuBarCtrl ? NULL : dynamic_cast(mMenuBarCtrl->findObjectByInternalName( ste, true)); - if( menu ) - menu->buildWindowAcceleratorMap( *getPlatformWindow()->getInputGenerator() ); + if(oldMenu) + oldMenu->removeWindowAcceleratorMap(*getPlatformWindow()->getInputGenerator()); + + if(newMenu) + newMenu->buildWindowAcceleratorMap(*getPlatformWindow()->getInputGenerator()); } } @@ -1633,27 +1649,26 @@ void GuiCanvas::maintainSizing() Point2I newPos = screenRect.point; // if menubar is active displace content gui control - if( mMenuBarCtrl && (ctrl == getContentControl()) ) - { - const SimObject *menu = mMenuBarCtrl->findObjectByInternalName( StringTable->insert("menubar"), true); + if (mMenuBarCtrl && (ctrl == getContentControl())) + { + /*const SimObject *menu = mMenuBarCtrl->findObjectByInternalName( StringTable->insert("menubar"), true); - if( !menu ) - continue; + if( !menu ) + continue; - AssertFatal( dynamic_cast(menu), ""); + AssertFatal( dynamic_cast(menu), "");*/ - const U32 yOffset = static_cast(menu)->getExtent().y; - newPos.y += yOffset; - newExt.y -= yOffset; + const U32 yOffset = static_cast(mMenuBarCtrl)->mMenubarHeight; + newPos.y += yOffset; + newExt.y -= yOffset; } - if(pos != newPos || ext != newExt) + if (pos != newPos || ext != newExt) { ctrl->resize(newPos, newExt); resetUpdateRegions(); } } - } void GuiCanvas::setupFences() diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index 7775b8af0..b193bfbf1 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -210,6 +210,7 @@ public: virtual void onRemove(); void setMenuBar(SimObject *obj); + SimObject* getMenuBar() { return mMenuBarCtrl; } static void initPersistFields(); @@ -334,6 +335,9 @@ public: /// Returns the point, in screenspace, at which the cursor is located. virtual Point2I getCursorPos(); + /// Returns the point, in local coordinates, at which the cursor is located + virtual Point2I getCursorPosLocal() { return Point2I(S32(mCursorPt.x), S32(mCursorPt.y)); } + /// Enable/disable rendering of the cursor. /// @param state True if we should render cursor virtual void showCursor(bool state); diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 77ab67365..4551d03e8 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -29,11 +29,10 @@ #include "gui/containers/guiScrollCtrl.h" #include "gui/editor/inspector/customField.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "gui/editor/inspector/entityGroup.h" #include "gui/editor/inspector/mountingGroup.h" #include "gui/editor/inspector/componentGroup.h" -#endif +#include "T3D/components/component.h" IMPLEMENT_CONOBJECT(GuiInspector); @@ -55,7 +54,8 @@ GuiInspector::GuiInspector() mOverDivider( false ), mMovingDivider( false ), mHLField( NULL ), - mShowCustomFields( true ) + mShowCustomFields( true ), + mComponentGroupTargetId(-1) { mPadding = 1; } @@ -589,10 +589,16 @@ void GuiInspector::refresh() mGroups.push_back(general); addObject(general); -#ifdef TORQUE_EXPERIMENTAL_EC //Entity inspector group if (mTargets.first()->getClassRep()->isSubclassOf("Entity")) { + //Put the GameObject group before everything that'd be gameobject-effecting, for orginazational purposes + GuiInspectorGroup *gameObject = new GuiInspectorGroup("GameObject", this); + + gameObject->registerObject(); + mGroups.push_back(gameObject); + addObject(gameObject); + GuiInspectorEntityGroup *components = new GuiInspectorEntityGroup("Components", this); if (components != NULL) { @@ -601,6 +607,32 @@ void GuiInspector::refresh() addObject(components); } + Entity* selectedEntity = dynamic_cast(mTargets.first().getObject()); + + U32 compCount = selectedEntity->getComponentCount(); + //Now, add the component groups + for (U32 c = 0; c < compCount; ++c) + { + Component* comp = selectedEntity->getComponent(c); + + String compName; + if (comp->getFriendlyName() != StringTable->EmptyString()) + compName = comp->getFriendlyName(); + else + compName = comp->getComponentName(); + + StringBuilder captionString; + captionString.format("%s [%i]", compName.c_str(), comp->getId()); + + GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(captionString.data(), this, comp); + if (compGroup != NULL) + { + compGroup->registerObject(); + mGroups.push_back(compGroup); + addObject(compGroup); + } + } + //Mounting group override GuiInspectorGroup *mounting = new GuiInspectorMountingGroup("Mounting", this); if (mounting != NULL) @@ -611,21 +643,6 @@ void GuiInspector::refresh() } } - if (mTargets.first()->getClassRep()->isSubclassOf("Component")) - { - //Build the component field groups as the component describes it - Component* comp = dynamic_cast(mTargets.first().getPointer()); - - if (comp->getComponentFieldCount() > 0) - { - GuiInspectorComponentGroup *compGroup = new GuiInspectorComponentGroup("Component Fields", this); - compGroup->registerObject(); - mGroups.push_back(compGroup); - addObject(compGroup); - } - } -#endif - // Create the inspector groups for static fields. for( TargetVector::iterator iter = mTargets.begin(); iter != mTargets.end(); ++ iter ) diff --git a/Engine/source/gui/editor/guiInspector.h b/Engine/source/gui/editor/guiInspector.h index f5b00a796..1896b55dc 100644 --- a/Engine/source/gui/editor/guiInspector.h +++ b/Engine/source/gui/editor/guiInspector.h @@ -89,6 +89,9 @@ public: else return nullptr; } + + S32 getComponentGroupTargetId() { return mComponentGroupTargetId; } + void setComponentGroupTargetId(S32 compId) { mComponentGroupTargetId = compId; } /// Return the number of objects being inspected by this GuiInspector. U32 getNumInspectObjects() const { return mTargets.size(); } @@ -146,6 +149,8 @@ protected: /// Objects being inspected by this GuiInspector. TargetVector mTargets; + + S32 mComponentGroupTargetId; F32 mDividerPos; S32 mDividerMargin; diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index 688531a87..fc9623498 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -142,24 +142,11 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char "@see GuiTickCtrl\n\n" ); -IMPLEMENT_CALLBACK( GuiMenuBar, onSubmenuSelect, void, ( S32 submenuId, const char* submenuText ),( submenuId, submenuText ), - "@brief Called whenever a submenu is selected.\n\n" - "@param submenuId Id of the selected submenu\n" - "@param submenuText Text of the selected submenu\n\n" - "@tsexample\n" - "GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText)\n" - "{\n" - " // Code to run when the callback occurs\n" - "}\n" - "@endtsexample\n\n" - "@see GuiTickCtrl\n\n" -); - //------------------------------------------------------------------------------ // console methods //------------------------------------------------------------------------------ -DefineEngineMethod( GuiMenuBar, clearMenus, void, (),, +/*DefineEngineMethod( GuiMenuBar, clearMenus, void, (),, "@brief Clears all the menus from the menu bar.\n\n" "@tsexample\n" "// Inform the GuiMenuBar control to clear all menus from itself.\n" @@ -818,14 +805,14 @@ GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu) { U32 id = dAtoi(menu); for (U32 i = 0; i < mMenuList.size(); ++i) - if (id == mMenuList[i]->id) + if (id == mMenuList[i].id) return mMenuList[i]; return NULL; } else { for (U32 i = 0; i < mMenuList.size(); ++i) - if (!dStricmp(menu, mMenuList[i]->text)) + if (!dStricmp(menu, mMenuList[i].text)) return mMenuList[i]; return NULL; } @@ -1093,19 +1080,18 @@ void GuiMenuBar::clearSubmenuItems(MenuItem *menuitem) while(menuitem->submenu->firstMenuItem) removeSubmenuItem(menuitem, menuitem->submenu->firstMenuItem); } - +*/ //------------------------------------------------------------------------------ // initialization, input and render methods //------------------------------------------------------------------------------ GuiMenuBar::GuiMenuBar() { - mMenuList.clear(); + //mMenuList.clear(); menuBarDirty = true; mouseDownMenu = NULL; mouseOverMenu = NULL; mCurAcceleratorIndex = 0; - mBackground = NULL; mPadding = 0; mCheckmarkBitmapIndex = 0; // Default to the first image in the bitmap array for the check mark @@ -1114,21 +1100,28 @@ GuiMenuBar::GuiMenuBar() mVerticalMargin = 1; // Default number of pixels on the top and bottom of a menu's text mBitmapMargin = 2; // Default number of pixels between a menu's bitmap and text + mMenubarHeight = 20; + // Added: mouseDownSubmenu = NULL; mouseOverSubmenu = NULL; - mSubmenuBackground = NULL; - mSubmenuTextList = NULL; - mMouseOverCounter = 0; - mCountMouseOver = false; - mMouseHoverAmount = 30; + + mMouseInMenu = false; + setProcessTicks(false); } +void GuiMenuBar::onRemove() +{ + Parent::onRemove(); +} + void GuiMenuBar::initPersistFields() { addField("padding", TypeS32, Offset( mPadding, GuiMenuBar ),"Extra padding to add to the bounds of the control.\n"); + addField("menubarHeight", TypeS32, Offset(mMenubarHeight, GuiMenuBar), "Sets the height of the menubar when attached to the canvas.\n"); + Parent::initPersistFields(); } @@ -1153,52 +1146,75 @@ bool GuiMenuBar::onWake() return true; } -GuiMenuBar::Menu *GuiMenuBar::findHitMenu(Point2I mousePoint) +void GuiMenuBar::addObject(SimObject* object) +{ + PopupMenu* popup = dynamic_cast(object); + + if (!popup) + { + //if it's not a popup, handle it normally + Parent::addObject(object); + } + else + { + //otherwise, if it IS a popup, don't add it as a child object, but instead just insert it as a menu entry + insert(object, -1); + } +} + +GuiMenuBar::MenuEntry *GuiMenuBar::findHitMenu(Point2I mousePoint) { Point2I pos = globalToLocalCoord(mousePoint); for (U32 i = 0; i < mMenuList.size(); ++i) - if (mMenuList[i]->visible && mMenuList[i]->bounds.pointInRect(pos)) - return mMenuList[i]; + { + if (mMenuList[i].visible && mMenuList[i].bounds.pointInRect(pos)) + return &mMenuList[i]; + } + return NULL; } void GuiMenuBar::onPreRender() { + setHeight(mMenubarHeight); + Parent::onPreRender(); - if(menuBarDirty) + if (menuBarDirty) { menuBarDirty = false; U32 curX = mPadding; for (U32 i = 0; i < mMenuList.size(); ++i) { - if (!mMenuList[i]->visible) + if (!mMenuList[i].visible) continue; - // Bounds depends on if there is a bitmap to be drawn or not - if (mMenuList[i]->bitmapIndex == -1) - { - // Text only - mMenuList[i]->bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2)); - - } else - { - // Will the bitmap and text be draw? - if (!mMenuList[i]->drawBitmapOnly) + // Bounds depends on if there is a bitmap to be drawn or not + if (mMenuList[i].bitmapIndex == -1) { + // Text only + mMenuList[i].bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i].text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2)); + + } + else + { + // Will the bitmap and text be draw? + if (!mMenuList[i].drawBitmapOnly) + { // Draw the bitmap and the text RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); - mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); + mMenuList[i].bounds.set(curX, 0, bitmapBounds[mMenuList[i].bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i].text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); - } else - { + } + else + { // Only the bitmap will be drawn RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); - mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); + mMenuList[i].bounds.set(curX, 0, bitmapBounds[mMenuList[i].bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); + } } - } - curX += mMenuList[i]->bounds.extent.x; + curX += mMenuList[i].bounds.extent.x; } mouseOverMenu = NULL; mouseDownMenu = NULL; @@ -1207,12 +1223,12 @@ void GuiMenuBar::onPreRender() void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event) { - Menu *hit = findHitMenu(event.mousePoint); + MenuEntry *hit = findHitMenu(event.mousePoint); if(hit && hit != mouseDownMenu) { // gotta close out the current menu... - mTextList->setSelectedCell(Point2I(-1, -1)); - closeMenu(); + mouseDownMenu->popupMenu->hidePopup(); + mouseOverMenu = mouseDownMenu = hit; setUpdate(); onAction(); @@ -1221,87 +1237,63 @@ void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event) void GuiMenuBar::onMouseMove(const GuiEvent &event) { - Menu *hit = findHitMenu(event.mousePoint); - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) - mMouseOverCounter = 0; - if(!mCountMouseOver) - { - // We've never started the counter, so start it. - if(hit) - mCountMouseOver = true; - } + MenuEntry *hit = findHitMenu(event.mousePoint); - mouseOverMenu = hit; + if (mouseDownMenu != nullptr && hit != nullptr) + { + //we have a standing click, so just update and go + mouseDownMenu = mouseOverMenu = hit; setUpdate(); + onAction(); + + return; } + + mouseOverMenu = hit; + setUpdate(); +} + +void GuiMenuBar::onMouseEnter(const GuiEvent &event) +{ + onMouseInMenu_callback(true); + mMouseInMenu = true; } void GuiMenuBar::onMouseLeave(const GuiEvent &event) { if(mouseOverMenu) setUpdate(); - mouseOverMenu = NULL; - // As we've left the control, don't track how long the mouse has been - // within it. - if(mCountMouseOver && mMouseOverCounter >= mMouseHoverAmount) - { - onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu - } - mCountMouseOver = false; - mMouseOverCounter = 0; + mouseOverMenu = NULL; + mMouseInMenu = false; } void GuiMenuBar::onMouseDragged(const GuiEvent &event) { - Menu *hit = findHitMenu(event.mousePoint); - - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) - mMouseOverCounter = 0; - if(!mCountMouseOver) - { - // We've never started the counter, so start it. - if(hit) - mCountMouseOver = true; - } - - mouseOverMenu = hit; - mouseDownMenu = hit; - setUpdate(); - onAction(); - } } void GuiMenuBar::onMouseDown(const GuiEvent &event) +{ +} + +void GuiMenuBar::onMouseUp(const GuiEvent &event) { mouseDownMenu = mouseOverMenu = findHitMenu(event.mousePoint); setUpdate(); onAction(); } -void GuiMenuBar::onMouseUp(const GuiEvent &event) -{ - mouseDownMenu = NULL; - setUpdate(); -} - void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) { - RectI ctrlRect(offset, getExtent()); + Point2I extent = getExtent(); + + RectI ctrlRect(offset, extent); GFXDrawUtil* drawUtil = GFX->getDrawUtil(); //if opaque, fill the update rect with the fill color if (mProfile->mOpaque) - drawUtil->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor); + drawUtil->drawRectFill(RectI(offset, extent), mProfile->mFillColor); //if there's a border, draw the border if (mProfile->mBorder) @@ -1309,63 +1301,65 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) for (U32 i = 0; i < mMenuList.size(); ++i) { - if (!mMenuList[i]->visible) + if (!mMenuList[i].visible) continue; + ColorI fontColor = mProfile->mFontColor; - RectI bounds = mMenuList[i]->bounds; + RectI bounds = mMenuList[i].bounds; bounds.point += offset; - + Point2I start; - start.x = mMenuList[i]->bounds.point.x + mHorizontalMargin; - start.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - mProfile->mFont->getHeight()) / 2; + start.x = mMenuList[i].bounds.point.x + mHorizontalMargin; + start.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - mProfile->mFont->getHeight()) / 2; - // Draw the border - if (mMenuList[i]->drawBorder) - { - RectI highlightBounds = bounds; - highlightBounds.inset(1,1); - if (mMenuList[i] == mouseDownMenu) - renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL ); - else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) - renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); - } + // Draw the border + if (mMenuList[i].drawBorder) + { + RectI highlightBounds = bounds; + highlightBounds.inset(1, 1); + if (&mMenuList[i] == mouseDownMenu) + renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); + else if (&mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) + renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); + } - // Do we draw a bitmap? - if (mMenuList[i]->bitmapIndex != -1) - { - S32 index = mMenuList[i]->bitmapIndex * 3; - if (mMenuList[i] == mouseDownMenu) + // Do we draw a bitmap? + if (mMenuList[i].bitmapIndex != -1) + { + S32 index = mMenuList[i].bitmapIndex * 3; + if (&mMenuList[i] == mouseDownMenu) ++index; - else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) + else if (&mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) index += 2; RectI rect = mProfile->mBitmapArrayRects[index]; - Point2I bitmapstart(start); - bitmapstart.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - rect.extent.y) / 2; + Point2I bitmapstart(start); + bitmapstart.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - rect.extent.y) / 2; drawUtil->clearBitmapModulation(); - drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect); + drawUtil->drawBitmapSR(mProfile->mTextureObject, offset + bitmapstart, rect); - // Should we also draw the text? - if (!mMenuList[i]->drawBitmapOnly) - { + // Should we also draw the text? + if (!mMenuList[i].drawBitmapOnly) + { start.x += mBitmapMargin; - drawUtil->setBitmapModulation( fontColor ); - drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } - } else - { - drawUtil->setBitmapModulation( fontColor ); - drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } + drawUtil->setBitmapModulation(fontColor); + drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i].text, mProfile->mFontColors); + } + } + else + { + drawUtil->setBitmapModulation(fontColor); + drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i].text, mProfile->mFontColors); + } } - renderChildControls( offset, updateRect ); + renderChildControls(offset, updateRect); } -void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator ) +void GuiMenuBar::buildWindowAcceleratorMap(WindowInputGenerator &inputGenerator) { // ok, accelerator map is cleared... // add all our keys: @@ -1373,20 +1367,21 @@ void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator for (U32 i = 0; i < mMenuList.size(); ++i) { - for (MenuItem *item = mMenuList[i]->firstMenuItem; item; item = item->nextMenuItem) + for (U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if(!item->accelerator) + if (!mMenuList[i].popupMenu->mMenuItems[item].accelerator) { - item->accelerator = 0; + mMenuList[i].popupMenu->mMenuItems[item].accelerator = 0; continue; } - EventDescriptor accelEvent; - ActionMap::createEventDescriptor(item->accelerator, &accelEvent); - - //now we have a modifier, and a key, add them to the canvas - inputGenerator.addAcceleratorKey( this, item->cmd, accelEvent.eventCode, accelEvent.flags); - item->acceleratorIndex = mCurAcceleratorIndex; + EventDescriptor accelEvent; + ActionMap::createEventDescriptor(mMenuList[i].popupMenu->mMenuItems[item].accelerator, &accelEvent); + + //now we have a modifier, and a key, add them to the canvas + inputGenerator.addAcceleratorKey(this, mMenuList[i].popupMenu->mMenuItems[item].cmd, accelEvent.eventCode, accelEvent.flags); + + mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex = mCurAcceleratorIndex; mCurAcceleratorIndex++; } } @@ -1403,591 +1398,133 @@ void GuiMenuBar::acceleratorKeyPress(U32 index) // and find the item that corresponds to the accelerator index for (U32 i = 0; i < mMenuList.size(); ++i) { - if (!mMenuList[i]->visible) + if (!mMenuList[i].visible) continue; - for (MenuItem *item = mMenuList[i]->firstMenuItem; item; item = item->nextMenuItem) + for(U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if(item->acceleratorIndex == index) + if(mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex == index) { // first, call the script callback for menu selection: - onMenuSelect_callback(mMenuList[i]->id, mMenuList[i]->text); - - if(item->visible) - menuItemSelected(mMenuList[i], item); + onMenuSelect_callback(mMenuList[i].popupMenu->getId(), mMenuList[i].text); return; } } } } -//------------------------------------------------------------------------------ -// Menu display class methods -//------------------------------------------------------------------------------ - -GuiMenuBackgroundCtrl::GuiMenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl *textList) -{ - mMenuBarCtrl = ctrl; - mTextList = textList; -} - -void GuiMenuBackgroundCtrl::onMouseDown(const GuiEvent &event) -{ - mTextList->setSelectedCell(Point2I(-1,-1)); - mMenuBarCtrl->closeMenu(); -} - -void GuiMenuBackgroundCtrl::onMouseMove(const GuiEvent &event) -{ - GuiCanvas *root = getRoot(); - GuiControl *ctrlHit = root->findHitControl(event.mousePoint, mLayer - 1); - if(ctrlHit == mMenuBarCtrl) // see if the current mouse over menu is right... - mMenuBarCtrl->checkMenuMouseMove(event); -} - -void GuiMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event) -{ - GuiCanvas *root = getRoot(); - GuiControl *ctrlHit = root->findHitControl(event.mousePoint, mLayer - 1); - if(ctrlHit == mMenuBarCtrl) // see if the current mouse over menu is right... - mMenuBarCtrl->checkMenuMouseMove(event); -} - -GuiMenuTextListCtrl::GuiMenuTextListCtrl(GuiMenuBar *ctrl) -{ - mMenuBarCtrl = ctrl; - isSubMenu = false; // Added -} - -void GuiMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver) -{ - if(dStrcmp(mList[cell.y].text + 3, "-\t")) // Was: dStrcmp(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag - Parent::onRenderCell(offset, cell, selected, mouseOver); - else - { - S32 yp = offset.y + mCellSize.y / 2; - GFX->getDrawUtil()->drawLine(offset.x, yp, offset.x + mCellSize.x, yp, ColorI(128,128,128)); - GFX->getDrawUtil()->drawLine(offset.x, yp+1, offset.x + mCellSize.x, yp+1, ColorI(255,255,255)); - } - // now see if there's a bitmap... - U8 idx = mList[cell.y].text[0]; - if(idx != 1) - { - // there's a bitmap... - U32 index = U32(idx - 2) * 3; - if(!mList[cell.y].active) - index += 2; - else if(selected || mouseOver) - index ++; - - RectI rect = mProfile->mBitmapArrayRects[index]; - Point2I off = mMenuBarCtrl->maxBitmapSize - rect.extent; - off /= 2; - - GFX->getDrawUtil()->clearBitmapModulation(); - GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, offset + off, rect); - } - - // Check if this is a submenu - idx = mList[cell.y].text[1]; - if(idx != 1) - { - // This is a submenu, so draw an arrow - S32 left = offset.x + mCellSize.x - 12; - S32 right = left + 8; - S32 top = mCellSize.y / 2 + offset.y - 4; - S32 bottom = top + 8; - S32 middle = top + 4; - - PrimBuild::begin( GFXTriangleList, 3 ); - if( selected || mouseOver ) - PrimBuild::color( mProfile->mFontColorHL ); - else - PrimBuild::color( mProfile->mFontColor ); - - PrimBuild::vertex2i( left, top ); - PrimBuild::vertex2i( right, middle ); - PrimBuild::vertex2i( left, bottom ); - PrimBuild::end(); - } -} - -bool GuiMenuTextListCtrl::onKeyDown(const GuiEvent &event) -{ - //if the control is a dead end, don't process the input: - if ( !mVisible || !mActive || !mAwake ) - return false; - - //see if the key down is a or not - if ( event.modifier == 0 ) - { - if ( event.keyCode == KEY_RETURN ) - { - mMenuBarCtrl->closeMenu(); - return true; - } - else if ( event.keyCode == KEY_ESCAPE ) - { - mSelectedCell.set( -1, -1 ); - mMenuBarCtrl->closeMenu(); - return true; - } - } - - //otherwise, pass the event to it's parent - return Parent::onKeyDown(event); -} - -void GuiMenuTextListCtrl::onMouseDown(const GuiEvent &event) -{ - Parent::onMouseDown(event); -} - -void GuiMenuTextListCtrl::onMouseUp(const GuiEvent &event) -{ - Parent::onMouseUp(event); - mMenuBarCtrl->closeMenu(); -} - -void GuiMenuTextListCtrl::onCellHighlighted(Point2I cell) -{ - // If this text list control is part of a submenu, then don't worry about - // passing this along - if(!isSubMenu) - { - RectI globalbounds(getBounds()); - Point2I globalpoint = localToGlobalCoord(globalbounds.point); - globalbounds.point = globalpoint; - mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize); - } -} - -//------------------------------------------------------------------------------ -// Submenu display class methods -//------------------------------------------------------------------------------ - -GuiSubmenuBackgroundCtrl::GuiSubmenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl *textList) : GuiMenuBackgroundCtrl(ctrl, textList) -{ -} - -void GuiSubmenuBackgroundCtrl::onMouseDown(const GuiEvent &event) -{ - mTextList->setSelectedCell(Point2I(-1,-1)); - mMenuBarCtrl->closeMenu(); -} - -bool GuiSubmenuBackgroundCtrl::pointInControl(const Point2I& parentCoordPoint) -{ - S32 xt = parentCoordPoint.x - getLeft(); - S32 yt = parentCoordPoint.y - getTop(); - - if(findHitControl(Point2I(xt,yt)) == this) - return false; - else - return true; -// return xt >= 0 && yt >= 0 && xt < getWidth() && yt < getHeight(); -} - -//------------------------------------------------------------------------------ - -void GuiMenuBar::menuItemSelected(GuiMenuBar::Menu *menu, GuiMenuBar::MenuItem *item) -{ - if(item->enabled) - onMenuItemSelect_callback(menu->id, menu->text, item->id, item->text); -} - void GuiMenuBar::onSleep() { - if(mBackground) // a menu is up? - { - mTextList->setSelectedCell(Point2I(-1, -1)); - closeMenu(); - } Parent::onSleep(); } -void GuiMenuBar::closeMenu() -{ - // First close any open submenu - closeSubmenu(); - - // Get the selection from the text list: - S32 selectionIndex = mTextList->getSelectedCell().y; - - // Pop the background: - if( getRoot() ) - getRoot()->popDialogControl(mBackground); - else - return; - - // Kill the popup: - mBackground->deleteObject(); - mBackground = NULL; - - // Now perform the popup action: - if ( selectionIndex != -1 ) - { - MenuItem *list = mouseDownMenu->firstMenuItem; - - while(selectionIndex && list) - { - list = list->nextMenuItem; - selectionIndex--; - } - if(list) - menuItemSelected(mouseDownMenu, list); - } - mouseDownMenu = NULL; -} - -// Called when a menu item is highlighted by the mouse -void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize) -{ - S32 selstore = selectionIndex; - - // Now perform the popup action: - if ( selectionIndex != -1 ) - { - MenuItem *list = mouseDownMenu->firstMenuItem; - - while(selectionIndex && list) - { - list = list->nextMenuItem; - selectionIndex--; - } - - if(list) - { - // If the highlighted item has changed... - if(mouseOverSubmenu != list) - { - closeSubmenu(); - mouseOverSubmenu = NULL; - - // Check if this is a submenu. If so, open the submenu. - if(list->isSubmenu) - { - // If there are submenu items, then open the submenu - if(list->submenu->firstMenuItem) - { - mouseOverSubmenu = list; - onSubmenuAction(selstore, bounds, cellSize); - } - } - } - } - } -} - //------------------------------------------------------------------------------ void GuiMenuBar::onAction() { if(!mouseDownMenu) return; - // first, call the script callback for menu selection: - onMenuSelect_callback(mouseDownMenu->id, mouseDownMenu->text); - - MenuItem *visWalk = mouseDownMenu->firstMenuItem; - while(visWalk) - { - if(visWalk->visible) - break; - visWalk = visWalk->nextMenuItem; - } - if(!visWalk) - { - mouseDownMenu = NULL; - return; - } - - mTextList = new GuiMenuTextListCtrl(this); - mTextList->setControlProfile(mProfile); - - mBackground = new GuiMenuBackgroundCtrl(this, mTextList); - - GuiCanvas *root = getRoot(); - Point2I windowExt = root->getExtent(); - - mBackground->resize( Point2I(0,0), root->getExtent()); - S32 textWidth = 0, width = 0; - S32 acceleratorWidth = 0; - - GFont *font = mProfile->mFont; - - for(MenuItem *walk = mouseDownMenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - S32 iTextWidth = font->getStrWidth(walk->text); - S32 iAcceleratorWidth = walk->accelerator ? font->getStrWidth(walk->accelerator) : 0; - - if(iTextWidth > textWidth) - textWidth = iTextWidth; - if(iAcceleratorWidth > acceleratorWidth) - acceleratorWidth = iAcceleratorWidth; - } - width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; - - mTextList->setCellSize(Point2I(width, font->getHeight()+2)); - mTextList->clearColumnOffsets(); - mTextList->addColumnOffset(-1); // add an empty column in for the bitmap index. - mTextList->addColumnOffset(maxBitmapSize.x + 1); - mTextList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); - - U32 entryCount = 0; - - for(MenuItem *walk = mouseDownMenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - char buf[512]; - - // If this menu item is a submenu, then set the isSubmenu to 2 to indicate - // an arrow should be drawn. Otherwise set the isSubmenu normally. - char isSubmenu = 1; - if(walk->isSubmenu) - isSubmenu = 2; - - char bitmapIndex = 1; - if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) - bitmapIndex = walk->bitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, walk->text, walk->accelerator ? walk->accelerator : ""); - mTextList->addEntry(entryCount, buf); - - if(!walk->enabled) - mTextList->setEntryActive(entryCount, false); - - entryCount++; - } - Point2I menuPoint = localToGlobalCoord(mouseDownMenu->bounds.point); - menuPoint.y += mouseDownMenu->bounds.extent.y; // Used to have this at the end: + 2; - - GuiControl *ctrl = new GuiControl; - RectI ctrlBounds( menuPoint, mTextList->getExtent() + Point2I(6, 6)); - - ctrl->setControlProfile(mProfile); - mTextList->setPosition( mTextList->getPosition() + Point2I(3,3) ); - - // Make sure the menu doesn't go beyond the Canvas' bottom edge. - if((ctrlBounds.point.y + ctrlBounds.extent.y) > windowExt.y) - { - // Pop the menu above the menu bar - Point2I menuBar = localToGlobalCoord(mouseDownMenu->bounds.point); - ctrlBounds.point.y = menuBar.y - ctrl->getHeight(); - } - - ctrl->resize(ctrlBounds.point, ctrlBounds.extent); - //mTextList->setPosition(Point2I(3,3)); - - mTextList->registerObject(); - mBackground->registerObject(); - ctrl->registerObject(); - - mBackground->addObject( ctrl ); - ctrl->addObject( mTextList ); - - root->pushDialogControl(mBackground, mLayer + 1); - mTextList->setFirstResponder(); -} - -//------------------------------------------------------------------------------ -// Performs an action when a menu item that is a submenu is selected/highlighted -void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize) -{ - if(!mouseOverSubmenu) - return; + mouseDownMenu->popupMenu->hidePopup(); // first, call the script callback for menu selection: - onSubmenuSelect_callback(mouseOverSubmenu->id, mouseOverSubmenu->text); + onMenuSelect_callback(mouseDownMenu->popupMenu->getId(), mouseDownMenu->text); - MenuItem *visWalk = mouseOverSubmenu->submenu->firstMenuItem; - while(visWalk) - { - if(visWalk->visible) - break; - visWalk = visWalk->nextMenuItem; - } - if(!visWalk) - { - mouseOverSubmenu = NULL; - return; - } - - mSubmenuTextList = new GuiMenuTextListCtrl(this); - mSubmenuTextList->setControlProfile(mProfile); - mSubmenuTextList->isSubMenu = true; // Indicate that this text list is part of a submenu - - mSubmenuBackground = new GuiSubmenuBackgroundCtrl(this, mSubmenuTextList); + mouseDownMenu->popupMenu->mMenuBarCtrl = this; GuiCanvas *root = getRoot(); - Point2I windowExt = root->getExtent(); - - mSubmenuBackground->resize( Point2I(0,0), root->getExtent()); - S32 textWidth = 0, width = 0; - S32 acceleratorWidth = 0; - - GFont *font = mProfile->mFont; - - for(MenuItem *walk = mouseOverSubmenu->submenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - S32 iTextWidth = font->getStrWidth(walk->text); - S32 iAcceleratorWidth = walk->accelerator ? font->getStrWidth(walk->accelerator) : 0; - - if(iTextWidth > textWidth) - textWidth = iTextWidth; - if(iAcceleratorWidth > acceleratorWidth) - acceleratorWidth = iAcceleratorWidth; - } - width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; - - mSubmenuTextList->setCellSize(Point2I(width, font->getHeight()+3)); - mSubmenuTextList->clearColumnOffsets(); - mSubmenuTextList->addColumnOffset(-1); // add an empty column in for the bitmap index. - mSubmenuTextList->addColumnOffset(maxBitmapSize.x + 1); - mSubmenuTextList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); - - U32 entryCount = 0; - - for(MenuItem *walk = mouseOverSubmenu->submenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - char buf[512]; - - // Can't have submenus within submenus. - char isSubmenu = 1; - - char bitmapIndex = 1; - if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) - bitmapIndex = walk->bitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, walk->text, walk->accelerator ? walk->accelerator : ""); - mSubmenuTextList->addEntry(entryCount, buf); - - if(!walk->enabled) - mSubmenuTextList->setEntryActive(entryCount, false); - - entryCount++; - } - Point2I menuPoint = bounds.point; //localToGlobalCoord(bounds.point); - menuPoint.x += bounds.extent.x; - menuPoint.y += cellSize.y * selectionIndex - 6; - - GuiControl *ctrl = new GuiControl; - RectI ctrlBounds(menuPoint, mSubmenuTextList->getExtent() + Point2I(6, 6)); - ctrl->setControlProfile(mProfile); - mSubmenuTextList->setPosition( getPosition() + Point2I(3,3)); - - // Make sure the menu doesn't go beyond the Canvas' bottom edge. - if((ctrlBounds.point.y + ctrlBounds.extent.y ) > windowExt.y) - { - // Pop the menu above the menu bar - ctrlBounds.point.y -= mSubmenuTextList->getHeight() - cellSize.y - 6 - 3; - } - - // And the same for the right edge - if((ctrlBounds.point.x + ctrlBounds.extent.x) > windowExt.x) - { - // Pop the submenu to the left of the menu - ctrlBounds.point.x -= mSubmenuTextList->getWidth() + cellSize.x + 6; - } - ctrl->resize(ctrlBounds.point, ctrlBounds.extent); - - //mSubmenuTextList->setPosition(Point2I(3,3)); - - mSubmenuTextList->registerObject(); - mSubmenuBackground->registerObject(); - ctrl->registerObject(); - - mSubmenuBackground->addObject( ctrl ); - ctrl->addObject( mSubmenuTextList ); - - root->pushDialogControl(mSubmenuBackground, mLayer + 1); - mSubmenuTextList->setFirstResponder(); -} - -// Close down the submenu controls -void GuiMenuBar::closeSubmenu() -{ - if(!mSubmenuBackground || !mSubmenuTextList) - return; - - // Get the selection from the text list: - S32 selectionIndex = mSubmenuTextList->getSelectedCell().y; - - // Pop the background: - if( getRoot() ) - getRoot()->popDialogControl(mSubmenuBackground); - - // Kill the popup: - mSubmenuBackground->deleteObject(); - mSubmenuBackground = NULL; - mSubmenuTextList = NULL; - - // Now perform the popup action: - if ( selectionIndex != -1 ) - { - MenuItem *list = NULL; - if(mouseOverSubmenu) - { - list = mouseOverSubmenu->submenu->firstMenuItem; - - while(selectionIndex && list) - { - list = list->nextMenuItem; - selectionIndex--; - } - } - if(list) - menuItemSelected(list->submenuParentMenu, list); - } - mouseOverSubmenu = NULL; -} - -// Find if the mouse pointer is within a menu item -GuiMenuBar::MenuItem *GuiMenuBar::findHitMenuItem(Point2I mousePoint) -{ - -// for(Menu *walk = menuList; walk; walk = walk->nextMenu) -// if(walk->visible && walk->bounds.pointInRect(pos)) -// return walk; - return NULL; -} - -// Checks if the mouse has been moved to a new menu item -void GuiMenuBar::checkSubmenuMouseMove(const GuiEvent &event) -{ - MenuItem *hit = findHitMenuItem(event.mousePoint); - if(hit && hit != mouseOverSubmenu) - { - // gotta close out the current menu... - mSubmenuTextList->setSelectedCell(Point2I(-1, -1)); -// closeSubmenu(); - setUpdate(); - } + Point2I pos = Point2I(mouseDownMenu->bounds.point.x, mouseDownMenu->bounds.point.y + mouseDownMenu->bounds.extent.y); + mouseDownMenu->popupMenu->showPopup(root, pos.x, pos.y); } // Process a tick void GuiMenuBar::processTick() { - // If we are to track a tick, then do so. - if(mCountMouseOver) - { - // If we're at a particular number of ticks, notify the script function - if(mMouseOverCounter < mMouseHoverAmount) - { - ++mMouseOverCounter; + if(mMouseInMenu) + onMouseInMenu_callback(true); +} - } else if(mMouseOverCounter == mMouseHoverAmount) - { - ++mMouseOverCounter; - onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu - } +void GuiMenuBar::insert(SimObject* pObject, S32 pos) +{ + PopupMenu* menu = dynamic_cast(pObject); + if (menu == nullptr) + return; + + MenuEntry newMenu; + newMenu.pos = pos >= mMenuList.size() || pos == -1 ? pos = mMenuList.size() : pos; + newMenu.drawBitmapOnly = false; + newMenu.drawBorder = true; + newMenu.bitmapIndex = -1; + newMenu.text = menu->barTitle; + newMenu.visible = true; + newMenu.popupMenu = menu; + + if (pos >= mMenuList.size() || pos == -1) + mMenuList.push_back(newMenu); + else + mMenuList.insert(pos, newMenu); +} + +PopupMenu* GuiMenuBar::getMenu(U32 index) +{ + if (index >= mMenuList.size()) + return nullptr; + + return mMenuList[index].popupMenu; +} + +PopupMenu* GuiMenuBar::findMenu(StringTableEntry barTitle) +{ + for (U32 i = 0; i < mMenuList.size(); i++) + { + if (mMenuList[i].text == barTitle) + return mMenuList[i].popupMenu; + } + + return nullptr; +} + +//----------------------------------------------------------------------------- +// Console Methods +//----------------------------------------------------------------------------- +DefineConsoleMethod(GuiMenuBar, attachToCanvas, void, (const char *canvas, S32 pos), , "(GuiCanvas, pos)") +{ + GuiCanvas* canv = dynamic_cast(Sim::findObject(canvas)); + if (canv) + { + canv->setMenuBar(object); } } + +DefineConsoleMethod(GuiMenuBar, removeFromCanvas, void, (), , "()") +{ + GuiCanvas* canvas = object->getRoot(); + + if(canvas) + canvas->setMenuBar(nullptr); +} + +DefineConsoleMethod(GuiMenuBar, getMenuCount, S32, (), , "()") +{ + return object->getMenuListCount(); +} + +DefineConsoleMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)") +{ + return object->getMenu(index)->getId(); +} + +//----------------------------------------------------------------------------- +DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType(), -1), "(object, pos) insert object at position") +{ + object->insert(pObject, pos); +} + +DefineConsoleMethod(GuiMenuBar, findMenu, S32, (StringTableEntry barTitle), (""), "(barTitle)") +{ + PopupMenu* menu = object->findMenu(barTitle); + + if (menu) + return menu->getId(); + else + return 0; +} diff --git a/Engine/source/gui/editor/guiMenuBar.h b/Engine/source/gui/editor/guiMenuBar.h index a41455a16..054be37cc 100644 --- a/Engine/source/gui/editor/guiMenuBar.h +++ b/Engine/source/gui/editor/guiMenuBar.h @@ -23,119 +23,43 @@ #ifndef _GUIMENUBAR_H_ #define _GUIMENUBAR_H_ -#ifndef _GUITEXTLISTCTRL_H_ -#include "gui/controls/guiTextListCtrl.h" -#endif #ifndef _GUITICKCTRL_H_ #include "gui/shiny/guiTickCtrl.h" #endif +#ifndef _POPUPMENU_H_ +#include "gui/editor/popupMenu.h" +#endif + class GuiMenuBar; -class GuiMenuTextListCtrl; class WindowInputGenerator; -class GuiMenuBackgroundCtrl : public GuiControl -{ - typedef GuiControl Parent; - -protected: - GuiMenuBar *mMenuBarCtrl; - GuiMenuTextListCtrl *mTextList; -public: - GuiMenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl* textList); - void onMouseDown(const GuiEvent &event); - void onMouseMove(const GuiEvent &event); - void onMouseDragged(const GuiEvent &event); -}; - -class GuiSubmenuBackgroundCtrl : public GuiMenuBackgroundCtrl -{ - typedef GuiMenuBackgroundCtrl Parent; - -public: - GuiSubmenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl* textList); - bool pointInControl(const Point2I & parentCoordPoint); - void onMouseDown(const GuiEvent &event); -}; - //------------------------------------------------------------------------------ - -class GuiMenuTextListCtrl : public GuiTextListCtrl -{ - private: - typedef GuiTextListCtrl Parent; - - protected: - GuiMenuBar *mMenuBarCtrl; - - public: - bool isSubMenu; // Indicates that this text list is in a submenu - - GuiMenuTextListCtrl(); // for inheritance - GuiMenuTextListCtrl(GuiMenuBar *ctrl); - - // GuiControl overloads: - bool onKeyDown(const GuiEvent &event); - void onMouseDown(const GuiEvent &event); - void onMouseUp(const GuiEvent &event); - void onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver); - - virtual void onCellHighlighted(Point2I cell); // Added -}; - -//------------------------------------------------------------------------------ - class GuiMenuBar : public GuiTickCtrl // Was: GuiControl { typedef GuiTickCtrl Parent; // Was: GuiControl Parent; public: - struct Menu; + struct MenuEntry + { + U32 pos; + RectI bounds; - struct MenuItem // an individual item in a pull-down menu - { - char *text; // the text of the menu item - U32 id; // a script-assigned identifier - char *accelerator; // the keyboard accelerator shortcut for the menu item - U32 acceleratorIndex; // index of this accelerator - bool enabled; // true if the menu item is selectable - bool visible; // true if the menu item is visible - S32 bitmapIndex; // index of the bitmap in the bitmap array - S32 checkGroup; // the group index of the item visa vi check marks - - // only one item in the group can be checked. - MenuItem *nextMenuItem; // next menu item in the linked list - - bool isSubmenu; // This menu item has a submenu that will be displayed - - Menu* submenuParentMenu; // For a submenu, this is the parent menu - Menu* submenu; - String cmd; - }; - - struct Menu - { - char *text; - U32 id; - RectI bounds; bool visible; - S32 bitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) - bool drawBitmapOnly; // Draw only the bitmap and not the text - bool drawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) + S32 bitmapIndex; + bool drawBitmapOnly; - Menu *nextMenu; - MenuItem *firstMenuItem; - }; - - GuiMenuBackgroundCtrl *mBackground; - GuiMenuTextListCtrl *mTextList; - - GuiSubmenuBackgroundCtrl *mSubmenuBackground; // Background for a submenu - GuiMenuTextListCtrl *mSubmenuTextList; // Text list for a submenu + bool drawBorder; - Vector mMenuList; - Menu *mouseDownMenu; - Menu *mouseOverMenu; + StringTableEntry text; + PopupMenu* popupMenu; + }; + + Vector mMenuList; + + MenuEntry *mouseDownMenu; + MenuEntry *mouseOverMenu; MenuItem* mouseDownSubmenu; // Stores the menu item that is a submenu that has been selected MenuItem* mouseOverSubmenu; // Stores the menu item that is a submenu that has been highlighted @@ -151,59 +75,26 @@ public: S32 mVerticalMargin; // Top and bottom margin around the text of each menu S32 mBitmapMargin; // Margin between a menu's bitmap and text - // Used to keep track of the amount of ticks that the mouse is hovering - // over a menu. - S32 mMouseOverCounter; - bool mCountMouseOver; - S32 mMouseHoverAmount; + U32 mMenubarHeight; + + bool mMouseInMenu; GuiMenuBar(); + + void onRemove(); bool onWake(); void onSleep(); - // internal menu handling functions - // these are used by the script manipulation functions to add/remove/change menu items - static Menu* sCreateMenu(const char *menuText, U32 menuId); - void addMenu(Menu *menu, S32 pos = -1); - void addMenu(const char *menuText, U32 menuId); - Menu *findMenu(const char *menu); // takes either a menu text or a string id - static MenuItem *findMenuItem(Menu *menu, const char *menuItem); // takes either a menu text or a string id - void removeMenu(Menu *menu); - static void removeMenuItem(Menu *menu, MenuItem *menuItem); - static MenuItem* addMenuItem(Menu *menu, const char *text, U32 id, const char *accelerator, S32 checkGroup, const char *cmd); - static MenuItem* addMenuItem(Menu *menu, MenuItem *menuItem); - static void clearMenuItems(Menu *menu); - void clearMenus(); + virtual void addObject(SimObject* object); - void attachToMenuBar(Menu* menu, S32 pos = -1); - void removeFromMenuBar(Menu* menu); - - // Methods to deal with submenus - static MenuItem* findSubmenuItem(Menu *menu, const char *menuItem, const char *submenuItem); - static MenuItem* findSubmenuItem(MenuItem *menuItem, const char *submenuItem); - static void addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text, U32 id, const char *accelerator, S32 checkGroup); - static void addSubmenuItem(Menu *menu, MenuItem *submenu, MenuItem *newMenuItem ); - static void removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem); - static void clearSubmenuItems(MenuItem *menuitem); - void onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize); - void closeSubmenu(); - void checkSubmenuMouseMove(const GuiEvent &event); - MenuItem *findHitMenuItem(Point2I mousePoint); - - void highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse - - // display/mouse functions - - Menu *findHitMenu(Point2I mousePoint); - - // Called when the GUI theme changes and a bitmap arrary may need updating - // void onThemeChange(); + MenuEntry *findHitMenu(Point2I mousePoint); void onPreRender(); void onRender(Point2I offset, const RectI &updateRect); void checkMenuMouseMove(const GuiEvent &event); void onMouseMove(const GuiEvent &event); + void onMouseEnter(const GuiEvent &event); void onMouseLeave(const GuiEvent &event); void onMouseDown(const GuiEvent &event); void onMouseDragged(const GuiEvent &event); @@ -215,18 +106,22 @@ public: void removeWindowAcceleratorMap( WindowInputGenerator &inputGenerator ); void acceleratorKeyPress(U32 index); - virtual void menuItemSelected(Menu *menu, MenuItem *item); - // Added to support 'ticks' void processTick(); + void insert(SimObject* pObject, S32 pos); + static void initPersistFields(); + U32 getMenuListCount() { return mMenuList.size(); } + + PopupMenu* getMenu(U32 index); + PopupMenu* findMenu(StringTableEntry barTitle); + DECLARE_CONOBJECT(GuiMenuBar); DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu )); DECLARE_CALLBACK( void, onMenuSelect, ( S32 menuId, const char* menuText )); DECLARE_CALLBACK( void, onMenuItemSelect, ( S32 menuId, const char* menuText, S32 menuItemId, const char* menuItemText )); - DECLARE_CALLBACK( void, onSubmenuSelect, ( S32 submenuId, const char* submenuText )); }; #endif diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index 36e693203..d03a8bec1 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -25,20 +25,32 @@ #include "gfx/primBuilder.h" #include "gui/core/guiCanvas.h" -GuiPopupMenuBackgroundCtrl::GuiPopupMenuBackgroundCtrl(GuiPopupMenuTextListCtrl *textList) +GuiPopupMenuBackgroundCtrl::GuiPopupMenuBackgroundCtrl() { - mTextList = textList; - mTextList->mBackground = this; + mMenuBarCtrl = nullptr; } void GuiPopupMenuBackgroundCtrl::onMouseDown(const GuiEvent &event) { - mTextList->setSelectedCell(Point2I(-1, -1)); + +} + +void GuiPopupMenuBackgroundCtrl::onMouseUp(const GuiEvent &event) +{ + clearPopups(); + + //Pass along the event just in case we clicked over a menu item. We don't want to eat the input for it. + if (mMenuBarCtrl) + mMenuBarCtrl->onMouseUp(event); + close(); } void GuiPopupMenuBackgroundCtrl::onMouseMove(const GuiEvent &event) { + //It's possible we're trying to pan through a menubar while a popup is displayed. Pass along our event to the menubar for good measure + if (mMenuBarCtrl) + mMenuBarCtrl->onMouseMove(event); } void GuiPopupMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event) @@ -47,27 +59,66 @@ void GuiPopupMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event) void GuiPopupMenuBackgroundCtrl::close() { - getRoot()->removeObject(this); + if(getRoot()) + getRoot()->removeObject(this); + + mMenuBarCtrl = nullptr; +} + +S32 GuiPopupMenuBackgroundCtrl::findPopupMenu(PopupMenu* menu) +{ + S32 menuId = -1; + + for (U32 i = 0; i < mPopups.size(); i++) + { + if (mPopups[i]->getId() == menu->getId()) + return i; + } + + return menuId; +} + +void GuiPopupMenuBackgroundCtrl::clearPopups() +{ + for (U32 i = 0; i < mPopups.size(); i++) + { + mPopups[i]->mTextList->setSelectedCell(Point2I(-1, -1)); + mPopups[i]->mTextList->mPopup->hidePopup(); + } } GuiPopupMenuTextListCtrl::GuiPopupMenuTextListCtrl() { isSubMenu = false; // Added - mMenu = NULL; - mMenuBar = NULL; - mPopup = NULL; + + mMenuBar = nullptr; + mPopup = nullptr; + + mLastHighlightedMenuIdx = -1; } void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver) { - if (dStrcmp(mList[cell.y].text + 3, "-\t")) // Was: dStrcmp(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag - Parent::onRenderCell(offset, cell, selected, mouseOver); - else + //check if we're a real entry, or if it's a divider + if (mPopup->mMenuItems[cell.y].isSpacer) { S32 yp = offset.y + mCellSize.y / 2; - GFX->getDrawUtil()->drawLine(offset.x, yp, offset.x + mCellSize.x, yp, ColorI(128, 128, 128)); - GFX->getDrawUtil()->drawLine(offset.x, yp + 1, offset.x + mCellSize.x, yp + 1, ColorI(255, 255, 255)); + GFX->getDrawUtil()->drawLine(offset.x + 5, yp, offset.x + mCellSize.x - 5, yp, ColorI(128, 128, 128)); } + else + { + if (dStrcmp(mList[cell.y].text + 3, "-\t")) // Was: dStrcmp(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag + { + Parent::onRenderCell(offset, cell, selected, mouseOver); + } + else + { + S32 yp = offset.y + mCellSize.y / 2; + GFX->getDrawUtil()->drawLine(offset.x, yp, offset.x + mCellSize.x, yp, ColorI(128, 128, 128)); + GFX->getDrawUtil()->drawLine(offset.x, yp + 1, offset.x + mCellSize.x, yp + 1, ColorI(255, 255, 255)); + } + } + // now see if there's a bitmap... U8 idx = mList[cell.y].text[0]; if (idx != 1) @@ -101,16 +152,22 @@ void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool s S32 bottom = top + 8; S32 middle = top + 4; - PrimBuild::begin(GFXTriangleList, 3); - if (selected || mouseOver) - PrimBuild::color(mProfile->mFontColorHL); - else - PrimBuild::color(mProfile->mFontColor); + //PrimBuild::begin(GFXTriangleList, 3); - PrimBuild::vertex2i(left, top); + ColorI color = ColorI::BLACK; + if (selected || mouseOver) + color = mProfile->mFontColorHL; + else + color = mProfile->mFontColor; + + GFX->getDrawUtil()->drawLine(Point2I(left, top), Point2I(right, middle), color); + GFX->getDrawUtil()->drawLine(Point2I(right, middle), Point2I(left, bottom), color); + GFX->getDrawUtil()->drawLine(Point2I(left, bottom), Point2I(left, top), color); + + /*PrimBuild::vertex2i(left, top); PrimBuild::vertex2i(right, middle); PrimBuild::vertex2i(left, bottom); - PrimBuild::end(); + PrimBuild::end();*/ } } @@ -153,17 +210,12 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event) if (selectionIndex != -1) { - GuiMenuBar::MenuItem *list = mMenu->firstMenuItem; + MenuItem *item = &mPopup->mMenuItems[selectionIndex]; - while (selectionIndex && list) + if (item) { - list = list->nextMenuItem; - selectionIndex--; - } - if (list) - { - if (list->enabled) - dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), list->text ? list->text : "")); + if (item->enabled) + dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->text.isNotEmpty() ? item->text : "")); } } @@ -181,4 +233,23 @@ void GuiPopupMenuTextListCtrl::onCellHighlighted(Point2I cell) Point2I globalpoint = localToGlobalCoord(globalbounds.point); globalbounds.point = globalpoint; } + + S32 selectionIndex = cell.y; + + if (selectionIndex != -1 && mLastHighlightedMenuIdx != selectionIndex) + { + mLastHighlightedMenuIdx = selectionIndex; + + mPopup->hidePopupSubmenus(); + } + + if (selectionIndex != -1) + { + MenuItem *list = &mPopup->mMenuItems[selectionIndex]; + + if (list->isSubmenu && list->subMenu != nullptr) + { + list->subMenu->showPopup(getRoot(), getPosition().x + mCellSize.x, getPosition().y + (selectionIndex * mCellSize.y)); + } + } } \ No newline at end of file diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.h b/Engine/source/gui/editor/guiPopupMenuCtrl.h index c26fa855d..54632a009 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.h +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.h @@ -42,6 +42,7 @@ class GuiPopupMenuBackgroundCtrl; class GuiPopupMenuTextListCtrl : public GuiTextListCtrl { friend class GuiPopupMenuBackgroundCtrl; + friend class PopupMenu; private: typedef GuiTextListCtrl Parent; @@ -51,10 +52,12 @@ private: public: bool isSubMenu; // Indicates that this text list is in a submenu Point2I maxBitmapSize; - GuiMenuBar::Menu* mMenu; + GuiMenuBar* mMenuBar; PopupMenu* mPopup; + S32 mLastHighlightedMenuIdx; + GuiPopupMenuTextListCtrl(); // GuiControl overloads: @@ -70,16 +73,21 @@ class GuiPopupMenuBackgroundCtrl : public GuiControl { typedef GuiControl Parent; -protected: - GuiPopupMenuTextListCtrl *mTextList; - public: - GuiPopupMenuBackgroundCtrl(GuiPopupMenuTextListCtrl* textList); + GuiPopupMenuBackgroundCtrl(); void onMouseDown(const GuiEvent &event); + void onMouseUp(const GuiEvent &event); void onMouseMove(const GuiEvent &event); void onMouseDragged(const GuiEvent &event); void close(); + + void clearPopups(); + + S32 findPopupMenu(PopupMenu* menu); + + Vector mPopups; + GuiMenuBar* mMenuBarCtrl; }; #endif \ No newline at end of file diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 481544851..f04ef371a 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -926,8 +926,8 @@ void GuiShapeEdPreview::handleMouseDown(const GuiEvent& event, GizmoMode mode) } } - if ( mode == RotateMode ) - mRenderCameraAxes = true; + //if ( mode == RotateMode ) + // mRenderCameraAxes = true; } void GuiShapeEdPreview::handleMouseUp(const GuiEvent& event, GizmoMode mode) @@ -941,8 +941,8 @@ void GuiShapeEdPreview::handleMouseUp(const GuiEvent& event, GizmoMode mode) mGizmo->on3DMouseUp( mLastEvent ); } - if ( mode == RotateMode ) - mRenderCameraAxes = false; + //if ( mode == RotateMode ) + // mRenderCameraAxes = false; } void GuiShapeEdPreview::handleMouseMove(const GuiEvent& event, GizmoMode mode) @@ -1164,6 +1164,19 @@ void GuiShapeEdPreview::computeSceneBounds(Box3F& bounds) { if ( mModel ) mModel->computeBounds( mCurrentDL, bounds ); + + if (bounds.getExtents().x < POINT_EPSILON || bounds.getExtents().y < POINT_EPSILON || bounds.getExtents().z < POINT_EPSILON) + { + bounds.set(Point3F::Zero); + + //We probably don't have any actual meshes in this model, so compute using the bones if we have them + for (S32 i = 0; i < mModel->getShape()->nodes.size(); i++) + { + Point3F nodePos = mModel->mNodeTransforms[i].getPosition(); + + bounds.extend(nodePos); + } + } } void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) diff --git a/Engine/source/gui/editor/inspector/componentGroup.cpp b/Engine/source/gui/editor/inspector/componentGroup.cpp index 7d6d30eaa..6e16db173 100644 --- a/Engine/source/gui/editor/inspector/componentGroup.cpp +++ b/Engine/source/gui/editor/inspector/componentGroup.cpp @@ -38,10 +38,11 @@ ConsoleDocClass(GuiInspectorComponentGroup, "@internal" ); -GuiInspectorComponentGroup::GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent) +GuiInspectorComponentGroup::GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent, Component* targetComponent) : GuiInspectorGroup(groupName, parent) { /*mNeedScroll=false;*/ + mTargetComponent = targetComponent; }; bool GuiInspectorComponentGroup::onAdd() @@ -89,15 +90,277 @@ bool GuiInspectorComponentGroup::inspectGroup() GuiRolloutCtrl *pArrayRollout = NULL; bool bGrabItems = false; - Component* comp = dynamic_cast(getInspector()->getInspectObject(0)); - //if this isn't a component, what are we even doing here? - if (!comp) + if (!mTargetComponent) return false; - for (U32 i = 0; i < comp->getComponentFieldCount(); i++) + mParent->setComponentGroupTargetId(mTargetComponent->getId()); + + //first, relevent static fields + AbstractClassRep::FieldList& fieldList = mTargetComponent->getClassRep()->mFieldList; + for (AbstractClassRep::FieldList::iterator itr = fieldList.begin(); + itr != fieldList.end(); ++itr) { - ComponentField* field = comp->getComponentField(i); + AbstractClassRep::Field* field = &(*itr); + if (field->type == AbstractClassRep::StartGroupFieldType) + { + // If we're dealing with general fields, always set grabItems to true (to skip them) + if (bNoGroup == true) + bGrabItems = true; + else if (dStricmp(field->pGroupname, mCaption) == 0) + bGrabItems = true; + continue; + } + else if (field->type == AbstractClassRep::EndGroupFieldType) + { + // If we're dealing with general fields, always set grabItems to false (to grab them) + if (bNoGroup == true) + bGrabItems = false; + else if (dStricmp(field->pGroupname, mCaption) == 0) + bGrabItems = false; + continue; + } + + // Skip field if it has the HideInInspectors flag set. + if (field->flag.test(AbstractClassRep::FIELD_HideInInspectors)) + continue; + + if (field->pFieldname == StringTable->insert("locked") || field->pFieldname == StringTable->insert("class") + || field->pFieldname == StringTable->insert("internalName")) + continue; + + if (/*(bGrabItems == true || (bNoGroup == true && bGrabItems == false)) &&*/ itr->type != AbstractClassRep::DeprecatedFieldType) + { + if (bNoGroup == true && bGrabItems == true) + continue; + + if (field->type == AbstractClassRep::StartArrayFieldType) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Beginning array '%s'", + field->pFieldname); +#endif + + // Starting an array... + // Create a rollout for the Array, give it the array's name. + GuiRolloutCtrl *arrayRollout = new GuiRolloutCtrl(); + GuiControlProfile *arrayRolloutProfile = dynamic_cast(Sim::findObject("GuiInspectorRolloutProfile0")); + + arrayRollout->setControlProfile(arrayRolloutProfile); + //arrayRollout->mCaption = StringTable->insert( String::ToString( "%s (%i)", field->pGroupname, field->elementCount ) ); + arrayRollout->setCaption(field->pGroupname); + //arrayRollout->setMargin( 14, 0, 0, 0 ); + arrayRollout->registerObject(); + + GuiStackControl *arrayStack = new GuiStackControl(); + arrayStack->registerObject(); + arrayStack->freeze(true); + arrayRollout->addObject(arrayStack); + + // Allocate a rollout for each element-count in the array + // Give it the element count name. + for (U32 i = 0; i < field->elementCount; i++) + { + GuiRolloutCtrl *elementRollout = new GuiRolloutCtrl(); + GuiControlProfile *elementRolloutProfile = dynamic_cast(Sim::findObject("GuiInspectorRolloutProfile0")); + + char buf[256]; + dSprintf(buf, 256, " [%i]", i); + + elementRollout->setControlProfile(elementRolloutProfile); + elementRollout->setCaption(buf); + //elementRollout->setMargin( 14, 0, 0, 0 ); + elementRollout->registerObject(); + + GuiStackControl *elementStack = new GuiStackControl(); + elementStack->registerObject(); + elementRollout->addObject(elementStack); + elementRollout->instantCollapse(); + + arrayStack->addObject(elementRollout); + } + + pArrayRollout = arrayRollout; + pArrayStack = arrayStack; + arrayStack->freeze(false); + pArrayRollout->instantCollapse(); + mStack->addObject(arrayRollout); + + bMakingArray = true; + continue; + } + else if (field->type == AbstractClassRep::EndArrayFieldType) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Ending array '%s'", + field->pFieldname); +#endif + + bMakingArray = false; + continue; + } + + if (bMakingArray) + { + // Add a GuiInspectorField for this field, + // for every element in the array... + for (U32 i = 0; i < pArrayStack->size(); i++) + { + FrameTemp intToStr(64); + dSprintf(intToStr, 64, "%d", i); + + // The array stack should have a rollout for each element + // as children... + GuiRolloutCtrl *pRollout = dynamic_cast(pArrayStack->at(i)); + // And the each of those rollouts should have a stack for + // fields... + GuiStackControl *pStack = dynamic_cast(pRollout->at(0)); + + // And we add a new GuiInspectorField to each of those stacks... + GuiInspectorField *fieldGui = constructField(field->type); + if (fieldGui == NULL) + fieldGui = new GuiInspectorField(); + + fieldGui->init(mParent, this); + StringTableEntry caption = field->pFieldname; + fieldGui->setInspectorField(field, caption, intToStr); + + if (fieldGui->registerObject()) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Adding array element '%s[%i]'", + field->pFieldname, i); +#endif + + mChildren.push_back(fieldGui); + pStack->addObject(fieldGui); + } + else + delete fieldGui; + } + + continue; + } + + // This is weird, but it should work for now. - JDD + // We are going to check to see if this item is an array + // if so, we're going to construct a field for each array element + if (field->elementCount > 1) + { + // Make a rollout control for this array + // + GuiRolloutCtrl *rollout = new GuiRolloutCtrl(); + rollout->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorRolloutProfile0"); + rollout->setCaption(String::ToString("%s (%i)", field->pFieldname, field->elementCount)); + rollout->setMargin(14, 0, 0, 0); + rollout->registerObject(); + mArrayCtrls.push_back(rollout); + + // Put a stack control within the rollout + // + GuiStackControl *stack = new GuiStackControl(); + stack->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorStackProfile"); + stack->registerObject(); + stack->freeze(true); + rollout->addObject(stack); + + mStack->addObject(rollout); + + // Create each field and add it to the stack. + // + for (S32 nI = 0; nI < field->elementCount; nI++) + { + FrameTemp intToStr(64); + dSprintf(intToStr, 64, "%d", nI); + + // Construct proper ValueName[nI] format which is "ValueName0" for index 0, etc. + + String fieldName = String::ToString("%s%d", field->pFieldname, nI); + + // If the field already exists, just update it + GuiInspectorField *fieldGui = findField(fieldName); + if (fieldGui != NULL) + { + fieldGui->updateValue(); + continue; + } + + bNewItems = true; + + fieldGui = constructField(field->type); + if (fieldGui == NULL) + fieldGui = new GuiInspectorField(); + + fieldGui->init(mParent, this); + StringTableEntry caption = StringTable->insert(String::ToString(" [%i]", nI)); + fieldGui->setInspectorField(field, caption, intToStr); + + fieldGui->setTargetObject(mTargetComponent); + + if (fieldGui->registerObject()) + { + mChildren.push_back(fieldGui); + stack->addObject(fieldGui); + } + else + delete fieldGui; + } + + stack->freeze(false); + stack->updatePanes(); + rollout->instantCollapse(); + } + else + { + // If the field already exists, just update it + GuiInspectorField *fieldGui = findField(field->pFieldname); + if (fieldGui != NULL) + { + fieldGui->updateValue(); + continue; + } + + bNewItems = true; + + fieldGui = constructField(field->type); + if (fieldGui == NULL) + fieldGui = new GuiInspectorField(); + + fieldGui->init(mParent, this); + fieldGui->setInspectorField(field); + + fieldGui->setTargetObject(mTargetComponent); + + if (fieldGui->registerObject()) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Adding field '%s'", + field->pFieldname); +#endif + fieldGui->setValue(mTargetComponent->getDataField(field->pFieldname, NULL)); + + mChildren.push_back(fieldGui); + mStack->addObject(fieldGui); + } + else + { + SAFE_DELETE(fieldGui); + } + } + } + } + + for (U32 i = 0; i < mTargetComponent->getComponentFieldCount(); i++) + { + ComponentField* field = mTargetComponent->getComponentField(i); + + //first and foremost, nab the field type and check if it's a custom field or not. + //If it's not a custom field, proceed below, if it is, hand it off to script to be handled by the component + if (field->mFieldType == -1) + { + Con::executef(this, "onConstructComponentField", mTargetComponent, field->mFieldName); + continue; + } bNewItems = true; @@ -107,10 +370,12 @@ bool GuiInspectorComponentGroup::inspectGroup() fieldGui->init(mParent, this); - AbstractClassRep::Field *refField; + fieldGui->setTargetObject(mTargetComponent); + + AbstractClassRep::Field *refField = NULL; //check dynamics - SimFieldDictionary* fieldDictionary = comp->getFieldDictionary(); + SimFieldDictionary* fieldDictionary = mTargetComponent->getFieldDictionary(); SimFieldDictionaryIterator itr(fieldDictionary); while (*itr) @@ -196,6 +461,14 @@ void GuiInspectorComponentGroup::onMouseMove(const GuiEvent &event) { //mParent->mOverDivider = false; } + +void GuiInspectorComponentGroup::onRightMouseUp(const GuiEvent &event) +{ + //mParent->mOverDivider = false; + if (isMethod("onRightMouseUp")) + Con::executef(this, "onRightMouseUp", event.mousePoint); +} + ConsoleMethod(GuiInspectorComponentGroup, inspectGroup, bool, 2, 2, "Refreshes the dynamic fields in the inspector.") { return object->inspectGroup(); @@ -250,3 +523,8 @@ ConsoleMethod(GuiInspectorComponentGroup, addDynamicField, void, 2, 2, "obj.addD ConsoleMethod(GuiInspectorComponentGroup, removeDynamicField, void, 3, 3, "") { } + +DefineConsoleMethod(GuiInspectorComponentGroup, getComponent, S32, (), ,"") +{ + return object->getComponent()->getId(); +} diff --git a/Engine/source/gui/editor/inspector/componentGroup.h b/Engine/source/gui/editor/inspector/componentGroup.h index 34b748c98..f41c11b09 100644 --- a/Engine/source/gui/editor/inspector/componentGroup.h +++ b/Engine/source/gui/editor/inspector/componentGroup.h @@ -34,12 +34,14 @@ private: typedef GuiInspectorGroup Parent; GuiControl* mAddCtrl; + Component* mTargetComponent; + Vector tempFields; public: DECLARE_CONOBJECT(GuiInspectorComponentGroup); GuiInspectorComponentGroup() { /*mNeedScroll=false;*/ }; - GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent); + GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent, Component* targetComponent); //----------------------------------------------------------------------------- // inspectGroup is overridden in GuiInspectorComponentGroup to inspect an @@ -50,6 +52,7 @@ public: virtual void updateAllFields(); void onMouseMove(const GuiEvent &event); + virtual void onRightMouseUp(const GuiEvent &event); // For scriptable dynamic field additions void addDynamicField(); @@ -61,6 +64,9 @@ public: virtual SimFieldDictionary::Entry* findDynamicFieldInDictionary(StringTableEntry fieldName); AbstractClassRep::Field* findObjectBehaviorField(Component* target, String fieldName); + + Component* getComponent() { return mTargetComponent; } + protected: // create our inner controls when we add virtual bool createContent(); diff --git a/Engine/source/gui/editor/inspector/dynamicGroup.cpp b/Engine/source/gui/editor/inspector/dynamicGroup.cpp index 78d8c4bd8..3d9879919 100644 --- a/Engine/source/gui/editor/inspector/dynamicGroup.cpp +++ b/Engine/source/gui/editor/inspector/dynamicGroup.cpp @@ -26,9 +26,7 @@ #include "gui/editor/inspector/dynamicField.h" #include "console/engineAPI.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/component.h" -#endif IMPLEMENT_CONOBJECT(GuiInspectorDynamicGroup); @@ -126,7 +124,6 @@ bool GuiInspectorDynamicGroup::inspectGroup() SimFieldDictionary * fieldDictionary = target->getFieldDictionary(); for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr) { -#ifdef TORQUE_EXPERIMENTAL_EC if (target->getClassRep()->isSubclassOf("Component")) { Component* compTarget = dynamic_cast(target); @@ -135,7 +132,7 @@ bool GuiInspectorDynamicGroup::inspectGroup() if (compField) continue; } -#endif + if( i == 0 ) { flist.increment(); diff --git a/Engine/source/gui/editor/inspector/variableField.h b/Engine/source/gui/editor/inspector/variableField.h index 39ba2e2b8..8bb382a58 100644 --- a/Engine/source/gui/editor/inspector/variableField.h +++ b/Engine/source/gui/editor/inspector/variableField.h @@ -57,6 +57,7 @@ public: protected: StringTableEntry mVariableName; + StringTableEntry mSetCallbackName; SimObject* mOwnerObject; }; diff --git a/Engine/source/gui/editor/inspector/variableGroup.cpp b/Engine/source/gui/editor/inspector/variableGroup.cpp index 2d03f7483..83e4f3c32 100644 --- a/Engine/source/gui/editor/inspector/variableGroup.cpp +++ b/Engine/source/gui/editor/inspector/variableGroup.cpp @@ -151,6 +151,9 @@ bool GuiInspectorVariableGroup::inspectGroup() fieldGui->setInspectorField(NULL, mFields[i]->mFieldLabel); fieldGui->setDocs(mFields[i]->mFieldDescription); + if(mFields[i]->mSetCallbackName != StringTable->EmptyString()) + fieldGui->setSpecialEditCallbackName(mFields[i]->mSetCallbackName); + /*if (mFields[i]->mSetCallbackName != StringTable->EmptyString()) { fieldGui->on.notify() diff --git a/Engine/source/gui/editor/inspector/variableInspector.cpp b/Engine/source/gui/editor/inspector/variableInspector.cpp index 6e673bc34..115e48b83 100644 --- a/Engine/source/gui/editor/inspector/variableInspector.cpp +++ b/Engine/source/gui/editor/inspector/variableInspector.cpp @@ -167,6 +167,10 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c fieldTypeMask = TypeColorF; else if (newField.mFieldTypeName == StringTable->insert("ease")) fieldTypeMask = TypeEaseF; + else if (newField.mFieldTypeName == StringTable->insert("command")) + fieldTypeMask = TypeCommand; + else if (newField.mFieldTypeName == StringTable->insert("filename")) + fieldTypeMask = TypeStringFilename; else fieldTypeMask = -1; @@ -191,7 +195,10 @@ void GuiVariableInspector::addCallbackField(const char* name, const char* label, void GuiVariableInspector::clearFields() { + mGroups.clear(); mFields.clear(); + clear(); + update(); } diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp new file mode 100644 index 000000000..0e5db18da --- /dev/null +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -0,0 +1,506 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "gui/editor/popupMenu.h" +#include "console/consoleTypes.h" +#include "console/engineAPI.h" +#include "gui/core/guiCanvas.h" +#include "core/util/safeDelete.h" +#include "gui/editor/guiPopupMenuCtrl.h" +#include "gui/editor/guiMenuBar.h" + +static U32 sMaxPopupGUID = 0; +PopupMenuEvent PopupMenu::smPopupMenuEvent; +bool PopupMenu::smSelectionEventHandled = false; + +/// Event class used to remove popup menus from the event notification in a safe way +class PopUpNotifyRemoveEvent : public SimEvent +{ +public: + void process(SimObject *object) + { + PopupMenu::smPopupMenuEvent.remove((PopupMenu *)object, &PopupMenu::handleSelectEvent); + } +}; + +//----------------------------------------------------------------------------- +// Constructor/Destructor +//----------------------------------------------------------------------------- +PopupMenu::PopupMenu() +{ + bitmapIndex = -1; + + barTitle = StringTable->EmptyString(); + + mMenuBarCtrl = nullptr; + mTextList = nullptr; + + isSubmenu = false; +} + +PopupMenu::~PopupMenu() +{ + PopupMenu::smPopupMenuEvent.remove(this, &PopupMenu::handleSelectEvent); +} + +IMPLEMENT_CONOBJECT(PopupMenu); + +ConsoleDocClass( PopupMenu, + "@brief PopupMenu represents a system menu.\n\n" + "You can add menu items to the menu, but there is no torque object associated " + "with these menu items, they exist only in a platform specific manner.\n\n" + "@note Internal use only\n\n" + "@internal" +); + +//----------------------------------------------------------------------------- +void PopupMenu::initPersistFields() +{ + Parent::initPersistFields(); + + addField("barTitle", TypeCaseString, Offset(barTitle, PopupMenu), ""); +} + +//----------------------------------------------------------------------------- +bool PopupMenu::onAdd() +{ + if(! Parent::onAdd()) + return false; + + Con::executef(this, "onAdd"); + return true; +} + +void PopupMenu::onRemove() +{ + Con::executef(this, "onRemove"); + + Parent::onRemove(); +} + +//----------------------------------------------------------------------------- +void PopupMenu::onMenuSelect() +{ + Con::executef(this, "onMenuSelect"); +} + +//----------------------------------------------------------------------------- +void PopupMenu::handleSelectEvent(U32 popID, U32 command) +{ +} + +//----------------------------------------------------------------------------- +bool PopupMenu::onMessageReceived(StringTableEntry queue, const char* event, const char* data) +{ + return Con::executef(this, "onMessageReceived", queue, event, data); +} + +bool PopupMenu::onMessageObjectReceived(StringTableEntry queue, Message *msg ) +{ + return Con::executef(this, "onMessageReceived", queue, Con::getIntArg(msg->getId())); +} + +////////////////////////////////////////////////////////////////////////// +// Platform Menu Data +////////////////////////////////////////////////////////////////////////// +GuiMenuBar* PopupMenu::getMenuBarCtrl() +{ + return mMenuBarCtrl; +} + +////////////////////////////////////////////////////////////////////////// +// Public Methods +////////////////////////////////////////////////////////////////////////// +S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd) +{ + String titleString = title; + + MenuItem newItem; + newItem.id = pos; + newItem.text = titleString; + newItem.cmd = cmd; + + if (titleString.isEmpty() || titleString == String("-")) + newItem.isSpacer = true; + else + newItem.isSpacer = false; + + if (accelerator[0]) + newItem.accelerator = dStrdup(accelerator); + else + newItem.accelerator = NULL; + + newItem.visible = true; + newItem.isChecked = false; + newItem.acceleratorIndex = 0; + newItem.enabled = !newItem.isSpacer; + + newItem.isSubmenu = false; + newItem.subMenu = nullptr; + newItem.subMenuParentMenu = nullptr; + + mMenuItems.push_back(newItem); + + return pos; +} + +S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) +{ + S32 itemPos = insertItem(pos, title, "", ""); + + mMenuItems[itemPos].isSubmenu = true; + mMenuItems[itemPos].subMenu = submenu; + mMenuItems[itemPos].subMenuParentMenu = this; + + submenu->isSubmenu = true; + + return itemPos; +} + +bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, const char* cmd) +{ + String titleString = title; + + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (mMenuItems[i].text == titleString) + { + mMenuItems[i].id = pos; + mMenuItems[i].cmd = cmd; + + if (accelerator && accelerator[0]) + mMenuItems[i].accelerator = dStrdup(accelerator); + else + mMenuItems[i].accelerator = NULL; + return true; + } + } + + return false; +} + +void PopupMenu::removeItem(S32 itemPos) +{ + if (mMenuItems.size() < itemPos || itemPos < 0) + return; + + mMenuItems.erase(itemPos); +} + +////////////////////////////////////////////////////////////////////////// +void PopupMenu::enableItem(S32 pos, bool enable) +{ + if (mMenuItems.size() < pos || pos < 0) + return; + + mMenuItems[pos].enabled = enable; +} + +void PopupMenu::checkItem(S32 pos, bool checked) +{ + if (mMenuItems.size() < pos || pos < 0) + return; + + if (checked && mMenuItems[pos].checkGroup != -1) + { + // first, uncheck everything in the group: + for (U32 i = 0; i < mMenuItems.size(); i++) + if (mMenuItems[i].checkGroup == mMenuItems[pos].checkGroup && mMenuItems[i].isChecked) + mMenuItems[i].isChecked = false; + } + + mMenuItems[pos].isChecked; +} + +void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) +{ + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (mMenuItems[i].id >= firstPos && mMenuItems[i].id <= lastPos) + { + mMenuItems[i].isChecked = false; + } + } +} + +bool PopupMenu::isItemChecked(S32 pos) +{ + if (mMenuItems.size() < pos || pos < 0) + return false; + + return mMenuItems[pos].isChecked; +} + +U32 PopupMenu::getItemCount() +{ + return mMenuItems.size(); +} + +////////////////////////////////////////////////////////////////////////// +bool PopupMenu::canHandleID(U32 id) +{ + return true; +} + +bool PopupMenu::handleSelect(U32 command, const char *text /* = NULL */) +{ + return dAtob(Con::executef(this, "onSelectItem", Con::getIntArg(command), text ? text : "")); +} + +////////////////////////////////////////////////////////////////////////// +void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) +{ + if (owner == NULL) + return; + + GuiControl* editorGui; + Sim::findObject("EditorGui", editorGui); + + if (editorGui) + { + GuiPopupMenuBackgroundCtrl* backgroundCtrl; + Sim::findObject("PopUpMenuControl", backgroundCtrl); + + GuiControlProfile* profile; + Sim::findObject("GuiMenubarProfile", profile); + + if (!profile) + return; + + if (mTextList == nullptr) + { + mTextList = new GuiPopupMenuTextListCtrl(); + mTextList->registerObject(); + mTextList->setControlProfile(profile); + + mTextList->mPopup = this; + mTextList->mMenuBar = getMenuBarCtrl(); + } + + if (!backgroundCtrl) + { + backgroundCtrl = new GuiPopupMenuBackgroundCtrl(); + + backgroundCtrl->registerObject("PopUpMenuControl"); + } + + if (!backgroundCtrl || !mTextList) + return; + + if (!isSubmenu) + { + //if we're a 'parent' menu, then tell the background to clear out all existing other popups + + backgroundCtrl->clearPopups(); + } + + //find out if we're doing a first-time add + S32 popupIndex = backgroundCtrl->findPopupMenu(this); + + if (popupIndex == -1) + { + backgroundCtrl->addObject(mTextList); + backgroundCtrl->mPopups.push_back(this); + } + + mTextList->mBackground = backgroundCtrl; + + owner->pushDialogControl(backgroundCtrl, 10); + + //Set the background control's menubar, if any, and if it's not already set + if(backgroundCtrl->mMenuBarCtrl == nullptr) + backgroundCtrl->mMenuBarCtrl = getMenuBarCtrl(); + + backgroundCtrl->setExtent(editorGui->getExtent()); + + mTextList->clear(); + + S32 textWidth = 0, width = 0; + S32 acceleratorWidth = 0; + GFont *font = profile->mFont; + + Point2I maxBitmapSize = Point2I(0, 0); + + S32 numBitmaps = profile->mBitmapArrayRects.size(); + if (numBitmaps) + { + RectI *bitmapBounds = profile->mBitmapArrayRects.address(); + for (S32 i = 0; i < numBitmaps; i++) + { + if (bitmapBounds[i].extent.x > maxBitmapSize.x) + maxBitmapSize.x = bitmapBounds[i].extent.x; + if (bitmapBounds[i].extent.y > maxBitmapSize.y) + maxBitmapSize.y = bitmapBounds[i].extent.y; + } + } + + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (!mMenuItems[i].visible) + continue; + + S32 iTextWidth = font->getStrWidth(mMenuItems[i].text.c_str()); + S32 iAcceleratorWidth = mMenuItems[i].accelerator ? font->getStrWidth(mMenuItems[i].accelerator) : 0; + + if (iTextWidth > textWidth) + textWidth = iTextWidth; + if (iAcceleratorWidth > acceleratorWidth) + acceleratorWidth = iAcceleratorWidth; + } + + width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; + + mTextList->setCellSize(Point2I(width, font->getHeight() + 2)); + mTextList->clearColumnOffsets(); + mTextList->addColumnOffset(-1); // add an empty column in for the bitmap index. + mTextList->addColumnOffset(maxBitmapSize.x + 1); + mTextList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); + + U32 entryCount = 0; + + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (!mMenuItems[i].visible) + continue; + + char buf[512]; + + // If this menu item is a submenu, then set the isSubmenu to 2 to indicate + // an arrow should be drawn. Otherwise set the isSubmenu normally. + char isSubmenu = 1; + if (mMenuItems[i].isSubmenu) + isSubmenu = 2; + + char bitmapIndex = 1; + if (mMenuItems[i].bitmapIndex >= 0 && (mMenuItems[i].bitmapIndex * 3 <= profile->mBitmapArrayRects.size())) + bitmapIndex = mMenuItems[i].bitmapIndex + 2; + + dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, mMenuItems[i].text.c_str(), mMenuItems[i].accelerator ? mMenuItems[i].accelerator : ""); + mTextList->addEntry(entryCount, buf); + + if (!mMenuItems[i].enabled) + mTextList->setEntryActive(entryCount, false); + + entryCount++; + } + + Point2I pos = Point2I::Zero; + + if (x == -1 && y == -1) + pos = owner->getCursorPos(); + else + pos = Point2I(x, y); + + mTextList->setPosition(pos); + + //nudge in if we'd overshoot the screen + S32 widthDiff = (mTextList->getPosition().x + mTextList->getExtent().x) - backgroundCtrl->getWidth(); + if (widthDiff > 0) + { + Point2I popupPos = mTextList->getPosition(); + mTextList->setPosition(popupPos.x - widthDiff, popupPos.y); + } + + mTextList->setHidden(false); + } +} + +void PopupMenu::hidePopup() +{ + if (mTextList) + { + mTextList->setHidden(true); + } + + hidePopupSubmenus(); +} + +void PopupMenu::hidePopupSubmenus() +{ + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (mMenuItems[i].subMenu != nullptr) + mMenuItems[i].subMenu->hidePopup(); + } +} + +//----------------------------------------------------------------------------- +// Console Methods +//----------------------------------------------------------------------------- +DefineConsoleMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd), ("", "", ""), "(pos[, title][, accelerator][, cmd])") +{ + return object->insertItem(pos, title, accelerator, cmd); +} + +DefineConsoleMethod(PopupMenu, removeItem, void, (S32 pos), , "(pos)") +{ + object->removeItem(pos); +} + +DefineConsoleMethod(PopupMenu, insertSubMenu, S32, (S32 pos, String title, String subMenu), , "(pos, title, subMenu)") +{ + PopupMenu *mnu = dynamic_cast(Sim::findObject(subMenu)); + if(mnu == NULL) + { + Con::errorf("PopupMenu::insertSubMenu - Invalid PopupMenu object specified for submenu"); + return -1; + } + return object->insertSubMenu(pos, title, mnu); +} + +DefineConsoleMethod(PopupMenu, setItem, bool, (S32 pos, const char * title, const char * accelerator, const char *cmd), (""), "(pos, title[, accelerator][, cmd])") +{ + return object->setItem(pos, title, accelerator, cmd); +} + +//----------------------------------------------------------------------------- + +DefineConsoleMethod(PopupMenu, enableItem, void, (S32 pos, bool enabled), , "(pos, enabled)") +{ + object->enableItem(pos, enabled); +} + +DefineConsoleMethod(PopupMenu, checkItem, void, (S32 pos, bool checked), , "(pos, checked)") +{ + object->checkItem(pos, checked); +} + +DefineConsoleMethod(PopupMenu, checkRadioItem, void, (S32 firstPos, S32 lastPos, S32 checkPos), , "(firstPos, lastPos, checkPos)") +{ + object->checkRadioItem(firstPos, lastPos, checkPos); +} + +DefineConsoleMethod(PopupMenu, isItemChecked, bool, (S32 pos), , "(pos)") +{ + return object->isItemChecked(pos); +} + +DefineConsoleMethod(PopupMenu, getItemCount, S32, (), , "()") +{ + return object->getItemCount(); +} + +//----------------------------------------------------------------------------- +DefineConsoleMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") +{ + GuiCanvas *pCanvas = dynamic_cast(Sim::findObject(canvasName)); + object->showPopup(pCanvas, x, y); +} diff --git a/Engine/source/platform/menus/popupMenu.h b/Engine/source/gui/editor/popupMenu.h similarity index 69% rename from Engine/source/platform/menus/popupMenu.h rename to Engine/source/gui/editor/popupMenu.h index 8d1239972..9a6dd0821 100644 --- a/Engine/source/platform/menus/popupMenu.h +++ b/Engine/source/gui/editor/popupMenu.h @@ -19,17 +19,43 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- +#ifndef _POPUPMENU_H_ +#define _POPUPMENU_H_ + #include "console/simBase.h" #include "core/util/tVector.h" #include "util/messaging/dispatcher.h" #include "gui/core/guiCanvas.h" -#ifndef _POPUPMENU_H_ -#define _POPUPMENU_H_ +class PopupMenu; +class GuiMenuBar; +class GuiPopupMenuTextListCtrl; +class GuiPopupMenuBackgroundCtrl; -// Forward ref used by the platform code -struct PlatformPopupMenuData; -class MenuBar; +struct MenuItem // an individual item in a pull-down menu +{ + String text; // the text of the menu item + U32 id; // a script-assigned identifier + char *accelerator; // the keyboard accelerator shortcut for the menu item + U32 acceleratorIndex; // index of this accelerator + bool enabled; // true if the menu item is selectable + bool visible; // true if the menu item is visible + S32 bitmapIndex; // index of the bitmap in the bitmap array + S32 checkGroup; // the group index of the item visa vi check marks - + // only one item in the group can be checked. + + bool isSubmenu; // This menu item has a submenu that will be displayed + + bool isChecked; + + bool isSpacer; + + bool isMenubarEntry; + + PopupMenu* subMenuParentMenu; // For a submenu, this is the parent menu + PopupMenu* subMenu; + String cmd; +}; // PopupMenu represents a menu. // You can add menu items to the menu, but there is no torque object associated @@ -37,30 +63,32 @@ class MenuBar; class PopupMenu : public SimObject, public virtual Dispatcher::IMessageListener { typedef SimObject Parent; - - friend class MenuBar; - -private: - /// Used by MenuBar to attach the menu to the menu bar. Do not use anywhere else. - void attachToMenuBar(GuiCanvas *owner, S32 pos); + friend class GuiMenuBar; + friend class GuiPopupMenuTextListCtrl; + friend class GuiPopupMenuBackgroundCtrl; protected: - PlatformPopupMenuData *mData; - - SimSet *mSubmenus; - SimObjectPtr mCanvas; + Vector mMenuItems; - StringTableEntry mBarTitle; + GuiMenuBar* mMenuBarCtrl; - U32 mPopupGUID; - - bool mIsPopup; + StringTableEntry barTitle; + + RectI bounds; + bool visible; + + S32 bitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) + bool drawBitmapOnly; // Draw only the bitmap and not the text + bool drawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) + + bool isSubmenu; + + //This is the gui control that renders our popup + GuiPopupMenuTextListCtrl *mTextList; public: PopupMenu(); virtual ~PopupMenu(); - void createPlatformPopupMenuData(); - void deletePlatformPopupMenuData(); DECLARE_CONOBJECT(PopupMenu); @@ -72,15 +100,6 @@ public: static PopupMenuEvent smPopupMenuEvent; static bool smSelectionEventHandled; /// Set to true if any menu or submenu handles a selection event - /// Creates the platform specific menu object, a peer to this object. - /// The platform menu *must* exist before calling any method that manipulates - /// menu items or displays the menu. - /// implementd on a per-platform basis. - void createPlatformMenu(); - - void setBarTitle(const char * val) { mBarTitle = StringTable->insert(val, true); } - StringTableEntry getBarTitle() const { return mBarTitle; } - /// pass NULL for @p title to insert a separator /// returns the menu item's ID, or -1 on failure. /// implementd on a per-platform basis. @@ -118,39 +137,7 @@ public: /// Returns the number of items in the menu. U32 getItemCount(); - /// Returns the popup GUID - U32 getPopupGUID() { return mPopupGUID; } - //----------------------------------------------------------------------------- - // New code should not use these methods directly, use the menu bar instead. - // - // They remain for compatibility with old code and will be changing/going away - // once the existing code is moved over to the menu bar. - //----------------------------------------------------------------------------- - - /// Places this menu in the menu bar of the application's main window. - /// @param owner The GuiCanvas that owns the PlatformWindow that this call is associated with - /// @param pos The relative position at which to place the menu. - /// @param title The name of the menu - void attachToMenuBar(GuiCanvas *owner, S32 pos, const char *title); - - /// Removes this menu from the menu bar. - void removeFromMenuBar(); - - //----------------------------------------------------------------------------- - - /// Called when the menu has been attached to the menu bar - void onAttachToMenuBar(GuiCanvas *canvas, S32 pos, const char *title); - - /// Called when the menu has been removed from the menu bar - void onRemoveFromMenuBar(GuiCanvas *canvas); - - /// Returns the position index of this menu on the bar. - S32 getPosOnMenuBar(); - - /// Returns true if this menu is attached to the menu bar - bool isAttachedToMenuBar() { return mCanvas != NULL; } - /// Displays this menu as a popup menu and blocks until the user has selected /// an item. /// @param canvas the owner to show this popup associated with @@ -159,6 +146,9 @@ public: /// implemented on a per-platform basis. void showPopup(GuiCanvas *owner, S32 x = -1, S32 y = -1); + void hidePopup(); + void hidePopupSubmenus(); + /// Returns true iff this menu contains an item that matches @p iD. /// implemented on a per-platform basis. /// TODO: factor out common code @@ -184,6 +174,11 @@ public: virtual bool onMessageReceived(StringTableEntry queue, const char* event, const char* data ); virtual bool onMessageObjectReceived(StringTableEntry queue, Message *msg ); + + bool isVisible() { return visible; } + void setVisible(bool isVis) { visible = isVis; } + + GuiMenuBar* getMenuBarCtrl(); }; #endif // _POPUPMENU_H_ diff --git a/Engine/source/gui/worldEditor/terrainEditor.cpp b/Engine/source/gui/worldEditor/terrainEditor.cpp index cf0429417..59d8adaca 100644 --- a/Engine/source/gui/worldEditor/terrainEditor.cpp +++ b/Engine/source/gui/worldEditor/terrainEditor.cpp @@ -2857,14 +2857,21 @@ DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , " //------------------------------------------------------------------------------ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage ) { - if (!mActiveTerrain) + +#define AUTOPAINT_UNDO + + if (!mActiveTerrain) return; S32 mat = getPaintMaterialIndex(); if (mat == -1) return; - - mUndoSel = new Selection; + + + #ifndef AUTOPAINT_UNDO + mUndoSel = new Selection; + #endif + U32 terrBlocks = mActiveTerrain->getBlockSize(); for (U32 y = 0; y < terrBlocks; y++) @@ -2906,19 +2913,23 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope))) continue; - gi.mMaterialChanged = true; - mUndoSel->add(gi); + gi.mMaterialChanged = true; + #ifndef AUTOPAINT_UNDO + mUndoSel->add(gi); + #endif gi.mMaterial = mat; setGridInfo(gi); } } + #ifndef AUTOPAINT_UNDO if(mUndoSel->size()) submitUndo( mUndoSel ); else delete mUndoSel; - mUndoSel = 0; + #endif + scheduleMaterialUpdate(); } diff --git a/Engine/source/gui/worldEditor/tools/editorTool.cpp b/Engine/source/gui/worldEditor/tools/editorTool.cpp new file mode 100644 index 000000000..1af6c5421 --- /dev/null +++ b/Engine/source/gui/worldEditor/tools/editorTool.cpp @@ -0,0 +1,136 @@ +#include "editorTool.h" + +IMPLEMENT_CONOBJECT(EditorTool); + +EditorTool::EditorTool() +{ + mWorldEditor = NULL; + + mUseMouseDown = true; + mUseMouseUp = true; + mUseMouseMove = true; + + mUseRightMouseDown = false; + mUseRightMouseUp = false; + mUseRightMouseMove = false; + + mUseMiddleMouseDown = true; + mUseMiddleMouseUp = true; + mUseMiddleMouseMove = true; + + mUseKeyInput = true; +} + +bool EditorTool::onAdd() +{ + return Parent::onAdd(); +} + +void EditorTool::onRemove() +{ + Parent::onRemove(); +} + +//Called when the tool is activated on the World Editor +void EditorTool::onActivated(WorldEditor* editor) +{ + mWorldEditor = editor; + Con::executef(this, "onActivated"); +} + +//Called when the tool is deactivated on the World Editor +void EditorTool::onDeactivated() +{ + mWorldEditor = NULL; + Con::executef(this, "onDeactivated"); +} + +// +bool EditorTool::onMouseMove(const Gui3DMouseEvent &e) +{ + if (!mUseMouseDown) + return false; + + Con::executef(this, "onMouseMove", e.mousePoint); + return true; +} +bool EditorTool::onMouseDown(const Gui3DMouseEvent &e) +{ + if (!mUseMouseDown) + return false; + + Con::executef(this, "onMouseDown", e.mousePoint); + return true; +} +bool EditorTool::onMouseDragged(const Gui3DMouseEvent &e) +{ + Con::executef(this, "onMouseDragged", e.mousePoint); + return true; +} +bool EditorTool::onMouseUp(const Gui3DMouseEvent &e) +{ + if (!mUseMouseDown) + return false; + + Con::executef(this, "onMouseUp", e.mousePoint); + return true; +} + +// +bool EditorTool::onRightMouseDown(const Gui3DMouseEvent &e) +{ + if (!mUseRightMouseDown) + return false; + + Con::executef(this, "onRightMouseDown", e.mousePoint); + return true; +} +bool EditorTool::onRightMouseDragged(const Gui3DMouseEvent &e) +{ + Con::executef(this, "onRightMouseDragged", e.mousePoint); + return true; +} +bool EditorTool::onRightMouseUp(const Gui3DMouseEvent &e) +{ + if (!mUseRightMouseDown) + return false; + + Con::executef(this, "onRightMouseUp", e.mousePoint); + return true; +} + +// +bool EditorTool::onMiddleMouseDown(const Gui3DMouseEvent &e) +{ + if (!mUseMiddleMouseDown) + return false; + + Con::executef(this, "onMiddleMouseDown", e.mousePoint); + return true; +} +bool EditorTool::onMiddleMouseDragged(const Gui3DMouseEvent &e) +{ + Con::executef(this, "onMiddleMouseDragged", e.mousePoint); + return true; +} +bool EditorTool::onMiddleMouseUp(const Gui3DMouseEvent &e) +{ + if (!mUseMiddleMouseDown) + return false; + + Con::executef(this, "onMiddleMouseUp", e.mousePoint); + return true; +} + +// +bool EditorTool::onInputEvent(const InputEventInfo &e) +{ + if (!mUseKeyInput) + return false; + + Con::executef(this, "onKeyPress", e.ascii, e.modifier); + return true; +} + +// +void render(SceneRenderState *); \ No newline at end of file diff --git a/Engine/source/gui/worldEditor/tools/editorTool.h b/Engine/source/gui/worldEditor/tools/editorTool.h new file mode 100644 index 000000000..4b872fe6b --- /dev/null +++ b/Engine/source/gui/worldEditor/tools/editorTool.h @@ -0,0 +1,88 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _EDITOR_TOOL_ +#define _EDITOR_TOOL_ + +#ifndef _WORLDEDITOR_H_ +#include "gui/worldEditor/worldEditor.h" +#endif + +class EditorTool : public SimObject +{ + typedef SimObject Parent; + +protected: + WorldEditor* mWorldEditor; + bool mUseMouseDown; + bool mUseMouseUp; + bool mUseMouseMove; + + bool mUseRightMouseDown; + bool mUseRightMouseUp; + bool mUseRightMouseMove; + + bool mUseMiddleMouseDown; + bool mUseMiddleMouseUp; + bool mUseMiddleMouseMove; + + bool mUseKeyInput; + +public: + EditorTool(); + ~EditorTool(){} + + DECLARE_CONOBJECT(EditorTool); + + bool onAdd(); + void onRemove(); + + //Called when the tool is activated on the World Editor + virtual void onActivated(WorldEditor*); + + //Called when the tool is deactivated on the World Editor + virtual void onDeactivated(); + + // + virtual bool onMouseMove(const Gui3DMouseEvent &); + virtual bool onMouseDown(const Gui3DMouseEvent &); + virtual bool onMouseDragged(const Gui3DMouseEvent &); + virtual bool onMouseUp(const Gui3DMouseEvent &); + + // + virtual bool onRightMouseDown(const Gui3DMouseEvent &); + virtual bool onRightMouseDragged(const Gui3DMouseEvent &); + virtual bool onRightMouseUp(const Gui3DMouseEvent &); + + // + virtual bool onMiddleMouseDown(const Gui3DMouseEvent &); + virtual bool onMiddleMouseDragged(const Gui3DMouseEvent &); + virtual bool onMiddleMouseUp(const Gui3DMouseEvent &); + + // + virtual bool onInputEvent(const InputEventInfo &); + + // + virtual void render(){} +}; + +#endif \ No newline at end of file diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index d4c4c55ab..7846ec094 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -49,6 +49,7 @@ #include "math/mEase.h" #include "T3D/tsStatic.h" +#include "tools/editorTool.h" IMPLEMENT_CONOBJECT( WorldEditor ); @@ -1823,6 +1824,8 @@ WorldEditor::WorldEditor() mUseGroupCenter = true; mFadeIcons = true; mFadeIconsDist = 8.f; + + mActiveEditorTool = nullptr; } WorldEditor::~WorldEditor() @@ -1915,6 +1918,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event) setCursor(PlatformCursorController::curArrow); mHitObject = NULL; + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseMove(event)) + return; + // mUsingAxisGizmo = false; @@ -1943,6 +1950,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event) void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event) { + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDown(event)) + return; + mMouseDown = true; mMouseDragged = false; mPerformedDragCopy = false; @@ -2010,6 +2021,10 @@ void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event) void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event ) { + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseUp(event)) + return; + const bool wasUsingAxisGizmo = mUsingAxisGizmo; mMouseDown = false; @@ -2165,6 +2180,10 @@ void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event ) void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event) { + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDragged(event)) + return; + if ( !mMouseDown ) return; @@ -2400,6 +2419,9 @@ void WorldEditor::renderScene( const RectI &updateRect ) GFXDEBUGEVENT_SCOPE( Editor_renderScene, ColorI::RED ); smRenderSceneSignal.trigger(this); + + if (mActiveEditorTool != nullptr) + mActiveEditorTool->render(); // Grab this before anything here changes it. Frustum frustum; @@ -3190,6 +3212,19 @@ void WorldEditor::resetSelectedScale() //------------------------------------------------------------------------------ +void WorldEditor::setEditorTool(EditorTool* newTool) +{ + if (mActiveEditorTool) + mActiveEditorTool->onDeactivated(); + + mActiveEditorTool = newTool; + + if (mActiveEditorTool) + mActiveEditorTool->onActivated(this); +} + +//------------------------------------------------------------------------------ + ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)") { object->ignoreObjClass(argc, argv); @@ -4175,3 +4210,15 @@ DefineEngineMethod( WorldEditor, createConvexShapeFrom, ConvexShape*, ( SceneObj return shape; } + +DefineEngineMethod(WorldEditor, setEditorTool, void, (EditorTool* newEditorTool), (nullAsType()), + "Sets the active Editor Tool for the world editor.") +{ + object->setEditorTool(newEditorTool); +} + +DefineEngineMethod(WorldEditor, getActiveEditorTool, EditorTool*, (),, + "Gets the active Editor Tool for the world editor.") +{ + return object->getActiveEditorTool(); +} diff --git a/Engine/source/gui/worldEditor/worldEditor.h b/Engine/source/gui/worldEditor/worldEditor.h index fb125daf5..5bdd8f0f2 100644 --- a/Engine/source/gui/worldEditor/worldEditor.h +++ b/Engine/source/gui/worldEditor/worldEditor.h @@ -58,7 +58,7 @@ class SceneObject; class WorldEditorSelection; - +class EditorTool; /// class WorldEditor : public EditTSCtrl @@ -285,6 +285,9 @@ class WorldEditor : public EditTSCtrl ClassInfo::Entry * getClassEntry(const SimObject * obj); bool addClassEntry(ClassInfo::Entry * entry); + + EditorTool* mActiveEditorTool; + // persist field data public: @@ -411,6 +414,9 @@ class WorldEditor : public EditTSCtrl DECLARE_CONOBJECT(WorldEditor); static Signal smRenderSceneSignal; + + void setEditorTool(EditorTool*); + EditorTool* getActiveEditorTool() { return mActiveEditorTool; } }; typedef WorldEditor::DropType WorldEditorDropType; diff --git a/Engine/source/gui/worldEditor/worldEditorSelection.cpp b/Engine/source/gui/worldEditor/worldEditorSelection.cpp index eaaeb4c43..00311adea 100644 --- a/Engine/source/gui/worldEditor/worldEditorSelection.cpp +++ b/Engine/source/gui/worldEditor/worldEditorSelection.cpp @@ -23,7 +23,7 @@ #include "gui/worldEditor/worldEditorSelection.h" #include "gui/worldEditor/worldEditor.h" #include "scene/sceneObject.h" - +#include "T3D/entity.h" IMPLEMENT_CONOBJECT( WorldEditorSelection ); @@ -410,26 +410,34 @@ void WorldEditorSelection::rotate(const EulerF & rot, const Point3F & center) // single selections will rotate around own axis, multiple about world if(size() == 1) { - SceneObject* object = dynamic_cast< SceneObject* >( at( 0 ) ); - if( object ) + Entity* eO = dynamic_cast< Entity* >(at(0)); + if (eO) { - MatrixF mat = object->getTransform(); + eO->setTransform(eO->getPosition(), eO->getRotation() + RotationF(rot)); + } + else + { + SceneObject* object = dynamic_cast(at(0)); + if (object) + { + MatrixF mat = object->getTransform(); - Point3F pos; - mat.getColumn(3, &pos); + Point3F pos; + mat.getColumn(3, &pos); - // get offset in obj space - Point3F offset = pos - center; - MatrixF wMat = object->getWorldTransform(); - wMat.mulV(offset); + // get offset in obj space + Point3F offset = pos - center; + MatrixF wMat = object->getWorldTransform(); + wMat.mulV(offset); - // - MatrixF transform(EulerF(0,0,0), -offset); - transform.mul(MatrixF(rot)); - transform.mul(MatrixF(EulerF(0,0,0), offset)); - mat.mul(transform); + // + MatrixF transform(EulerF(0, 0, 0), -offset); + transform.mul(MatrixF(rot)); + transform.mul(MatrixF(EulerF(0, 0, 0), offset)); + mat.mul(transform); - object->setTransform(mat); + object->setTransform(mat); + } } } else diff --git a/Engine/source/lighting/advanced/advancedLightManager.cpp b/Engine/source/lighting/advanced/advancedLightManager.cpp index 0b14a12a4..3c851cf81 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightManager.cpp @@ -39,6 +39,9 @@ #include "gfx/gfxCardProfile.h" #include "gfx/gfxTextureProfile.h" +#ifndef TORQUE_BASIC_LIGHTING +F32 AdvancedLightManager::smProjectedShadowFilterDistance = 40.0f; +#endif ImplementEnumType( ShadowType, "\n\n" diff --git a/Engine/source/lighting/advanced/advancedLightManager.h b/Engine/source/lighting/advanced/advancedLightManager.h index ac03bad48..ca747d8a0 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.h +++ b/Engine/source/lighting/advanced/advancedLightManager.h @@ -97,6 +97,10 @@ public: LightShadowMap* findShadowMapForObject( SimObject *object ); +#ifndef TORQUE_BASIC_LIGHTING + static F32 getShadowFilterDistance() { return smProjectedShadowFilterDistance; } +#endif + protected: // LightManager @@ -138,6 +142,12 @@ protected: LightingShaderConstants* getLightingShaderConstants(GFXShaderConstBuffer* shader); +#ifndef TORQUE_BASIC_LIGHTING + /// This is used to determine the distance + /// at which the shadow filtering PostEffect + /// will be enabled for ProjectedShadow. + static F32 smProjectedShadowFilterDistance; +#endif }; #endif // _ADVANCEDLIGHTMANAGER_H_ diff --git a/Engine/source/lighting/common/projectedShadow.cpp b/Engine/source/lighting/common/projectedShadow.cpp index 1ad88cd10..2f4657018 100644 --- a/Engine/source/lighting/common/projectedShadow.cpp +++ b/Engine/source/lighting/common/projectedShadow.cpp @@ -43,7 +43,11 @@ #include "materials/materialFeatureTypes.h" #include "console/console.h" #include "postFx/postEffect.h" -#include "lighting/basic/basicLightManager.h" +#ifdef TORQUE_BASIC_LIGHTING +#include "lighting/basic/basicLightManager.h" +#else +#include "lighting/advanced/advancedLightManager.h" +#endif #include "lighting/shadowMap/shadowMatHook.h" #include "materials/materialManager.h" #include "lighting/shadowMap/lightShadowMap.h" @@ -529,8 +533,12 @@ void ProjectedShadow::_renderToTexture( F32 camDist, const TSRenderState &rdata mRenderTarget->resolve(); GFX->popActiveRenderTarget(); - // If we're close enough then filter the shadow. - if ( camDist < BasicLightManager::getShadowFilterDistance() ) + // If we're close enough then filter the shadow. +#ifdef TORQUE_BASIC_LIGHTING + if (camDist < BasicLightManager::getShadowFilterDistance()) +#else + if (camDist < AdvancedLightManager::getShadowFilterDistance()) +#endif { if ( !smShadowFilter ) { diff --git a/Engine/source/lighting/shadowMap/shadowMapManager.cpp b/Engine/source/lighting/shadowMap/shadowMapManager.cpp index 0b58abc37..7b801cc41 100644 --- a/Engine/source/lighting/shadowMap/shadowMapManager.cpp +++ b/Engine/source/lighting/shadowMap/shadowMapManager.cpp @@ -41,6 +41,9 @@ GFX_ImplementTextureProfile(ShadowMapTexProfile, MODULE_BEGIN( ShadowMapManager ) +#ifndef TORQUE_BASIC_LIGHTING + MODULE_SHUTDOWN_AFTER(Scene) +#endif MODULE_INIT { diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index fad915888..6d9bc3b35 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -252,14 +252,29 @@ MatrixF RotationF::asMatrixF() const MatrixF returnMat; if (mRotationType == Euler) { - returnMat.set(EulerF(x, y, z)); + MatrixF imat, xmat, ymat, zmat; + xmat.set(EulerF(x, 0, 0)); + ymat.set(EulerF(0.0f, y, 0.0f)); + zmat.set(EulerF(0, 0, z)); + imat.mul(zmat, xmat); + returnMat.mul(imat, ymat); } else { AngAxisF aa; aa.set(Point3F(x, y, z), w); - aa.setMatrix(&returnMat); + MatrixF tempMat; + aa.setMatrix(&tempMat); + + EulerF eul = tempMat.toEuler(); + + MatrixF imat, xmat, ymat, zmat; + xmat.set(EulerF(eul.x, 0, 0)); + ymat.set(EulerF(0.0f, eul.y, 0.0f)); + zmat.set(EulerF(0, 0, eul.z)); + imat.mul(zmat, xmat); + returnMat.mul(imat, ymat); } return returnMat; @@ -310,7 +325,7 @@ TEST(Maths, RotationF_Calculations) }; #endif -DefineConsoleStaticMethod(rotation, Add, RotationF, (RotationF a, RotationF b), , +DefineConsoleFunction(AddRotation, RotationF, (RotationF a, RotationF b), , "Adds two rotations together.\n" "@param a Rotation one." "@param b Rotation two." @@ -320,7 +335,7 @@ DefineConsoleStaticMethod(rotation, Add, RotationF, (RotationF a, RotationF b), return a + b; } -DefineConsoleStaticMethod(rotation, Subtract, RotationF, (RotationF a, RotationF b), , +DefineConsoleFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , "Subtracts two rotations.\n" "@param a Rotation one." "@param b Rotation two." @@ -330,7 +345,7 @@ DefineConsoleStaticMethod(rotation, Subtract, RotationF, (RotationF a, RotationF return a - b; } -DefineConsoleStaticMethod(rotation, Interpolate, RotationF, (RotationF a, RotationF b, F32 factor), , +DefineConsoleFunction(InterpolateRotation, RotationF, (RotationF a, RotationF b, F32 factor), , "Interpolates between two rotations.\n" "@param a Rotation one." "@param b Rotation two." @@ -343,7 +358,7 @@ DefineConsoleStaticMethod(rotation, Interpolate, RotationF, (RotationF a, Rotati return result; } -DefineConsoleStaticMethod(rotation, LookAt, RotationF, (Point3F origin, Point3F target, Point3F up), +DefineConsoleFunction(RotationLookAt, RotationF, (Point3F origin, Point3F target, Point3F up), (Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)), "Provides a rotation orientation to look at a target from a given position.\n" "@param origin Position of the object doing the looking." @@ -357,11 +372,55 @@ DefineConsoleStaticMethod(rotation, LookAt, RotationF, (Point3F origin, Point3F return result; } -DefineConsoleStaticMethod(rotation, getDirection, Point3F, (RotationF rot),, -"Takes the angles of the provided rotation and returns a direction vector.\n" -"@param rot Our rotation." -"@returns v Direction vector result." -"@ingroup Math") +DefineConsoleFunction(setRotationRightVector, RotationF, (RotationF rot, VectorF rightVec), , + "Sets the right vector of the rotation.\n" + "@param Starting rotation." + "@param New up vector." + "@returns New rotation with the set right vector." + "@ingroup Math") +{ + rot.asMatrixF().setColumn(0, rightVec); + return rot; +} + +DefineConsoleFunction(setRotationUpVector, RotationF, (RotationF rot, VectorF upVec), , + "Sets the up vector of the rotation.\n" + "@param Starting rotation." + "@param New up vector." + "@returns New rotation with the set up vector." + "@ingroup Math") +{ + rot.asMatrixF().setColumn(2, upVec); + return rot; +} + +DefineConsoleFunction(getRotationForwardVector, VectorF, (RotationF rot), , + "Get the forward vector of a rotation.\n" + "@ingroup Math") +{ + return rot.asMatrixF().getForwardVector(); +} + +DefineConsoleFunction(getRotationRightVector, VectorF, (RotationF rot), , + "Gets the right vector of a rotation.\n" + "@param Our rotation." + "@ingroup Math") +{ + return rot.asMatrixF().getRightVector(); +} + +DefineConsoleFunction(getRotationUpVector, VectorF, (RotationF rot), , + "Gets the up vector of a rotation.\n" + "@param Our rotation." + "@ingroup Math") +{ + return rot.asMatrixF().getUpVector(); +} + +DefineConsoleFunction(getRotationDirection, Point3F, (RotationF rot),, + "Gets the direction from the rotation's angles.\n" + "@param Our rotation." + "@ingroup Math") { return rot.getDirection(); } diff --git a/Engine/source/module/moduleDefinition.h b/Engine/source/module/moduleDefinition.h index 2ebb3f99a..42deff44d 100644 --- a/Engine/source/module/moduleDefinition.h +++ b/Engine/source/module/moduleDefinition.h @@ -166,6 +166,8 @@ public: inline void setAssetTagsManifest( const char* pTagsAssetManifest ) { if ( checkUnlocked() ) { mAssetTagsManifest = StringTable->insert(pTagsAssetManifest); } } inline StringTableEntry getAssetTagsManifest( void ) const { return mAssetTagsManifest; } inline typeModuleAssetsVector& getModuleAssets( void ) { return mModuleAssets; } + void addDeclaredAsset(AssetDefinition* asset) { mModuleAssets.push_back(asset); } + /// Module location. inline void setModulePath( const char* pModulePath ) { if ( checkUnlocked() ) { mModulePath = StringTable->insert(pModulePath); } } diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index 67a89e3e1..fa53728b7 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -70,7 +70,8 @@ S32 QSORT_CALLBACK moduleDefinitionVersionIdSort( const void* a, const void* b ) ModuleManager::ModuleManager() : mEnforceDependencies(true), mEchoInfo(true), - mDatabaseLocks( 0 ) + mDatabaseLocks( 0 ), + mIgnoreLoadedGroups(false) { // Set module extension. dStrcpy( mModuleExtension, MODULE_MANAGER_MODULE_DEFINITION_EXTENSION ); @@ -1300,6 +1301,106 @@ StringTableEntry ModuleManager::copyModule( ModuleDefinition* pSourceModuleDefin //----------------------------------------------------------------------------- +bool ModuleManager::renameModule(ModuleDefinition* pSourceModuleDefinition, const char* pNewModuleName) +{ + // Sanity! + AssertFatal(pSourceModuleDefinition != NULL, "Cannot copy module using a NULL source module definition."); + AssertFatal(pNewModuleName != NULL, "Cannot rename a module using a NULL module name."); + + // Fetch the source module Id. + StringTableEntry sourceModuleId = pSourceModuleDefinition->getModuleId(); + + // Is the source module definition registered with this module manager? + if (pSourceModuleDefinition->getModuleManager() != this) + { + // No, so warn. + Con::warnf("Module Manager: Cannot rename module Id '%s' as it is not registered with this module manager.", sourceModuleId); + return StringTable->EmptyString(); + } + + TamlModuleIdUpdateVisitor moduleIdUpdateVisitor; + moduleIdUpdateVisitor.setModuleIdFrom(sourceModuleId); + moduleIdUpdateVisitor.setModuleIdTo(pNewModuleName); + + Vector files; + + const char* pExtension = (const char*)"Taml"; + const U32 extensionLength = dStrlen(pExtension); + + Vector directories; + + StringTableEntry modulePath = pSourceModuleDefinition->getModulePath(); + + // Find directories. + if (!Platform::dumpDirectories(modulePath, directories, -1)) + { + // Warn. + Con::warnf("Module Manager: Cannot rename module Id '%s' in directory '%s' as sub-folder scanning/renaming failed.", + sourceModuleId, modulePath); + return false; + } + + // Iterate directories. + for (Vector::iterator basePathItr = directories.begin(); basePathItr != directories.end(); ++basePathItr) + { + // Fetch base path. + StringTableEntry basePath = *basePathItr; + + // Find files. + files.clear(); + if (!Platform::dumpPath(basePath, files, 0)) + { + // Warn. + Con::warnf("Module Manager: Cannot rename module Id '%s' in directory '%s' as sub-folder scanning/renaming failed.", + sourceModuleId, modulePath); + return false; + } + + // Iterate files. + for (Vector::iterator fileItr = files.begin(); fileItr != files.end(); ++fileItr) + { + // Fetch file info. + Platform::FileInfo* pFileInfo = fileItr; + + // Fetch filename. + const char* pFilename = pFileInfo->pFileName; + + // Find filename length. + const U32 filenameLength = dStrlen(pFilename); + + // Skip if extension is longer than filename. + if (extensionLength >= filenameLength) + continue; + + // Skip if extension not found. + if (dStricmp(pFilename + filenameLength - extensionLength, pExtension) != 0) + continue; + + char parseFileBuffer[1024]; + dSprintf(parseFileBuffer, sizeof(parseFileBuffer), "%s/%s", pFileInfo->pFullPath, pFilename); + + // Parse file. + if (!mTaml.parse(parseFileBuffer, moduleIdUpdateVisitor)) + { + // Warn. + Con::warnf("Module Manager: Failed to parse file '%s' whilst renaming module Id '%s' in directory '%s'.", + parseFileBuffer, sourceModuleId, modulePath); + return false; + } + } + } + + // Info. + if (mEchoInfo) + { + Con::printf("Module Manager: Finished renaming module Id '%s' to '%s'.", sourceModuleId, pNewModuleName); + } + + return true; +} + +//----------------------------------------------------------------------------- + bool ModuleManager::synchronizeDependencies( ModuleDefinition* pRootModuleDefinition, const char* pTargetDependencyPath ) { // Sanity! @@ -1986,7 +2087,7 @@ bool ModuleManager::registerModule( const char* pModulePath, const char* pModule } // Is the module group already loaded? - if ( findGroupLoaded( moduleGroup ) != NULL ) + if ( findGroupLoaded( moduleGroup ) != NULL && !mIgnoreLoadedGroups) { // Yes, so warn. Con::warnf( "Module Manager: Found module: '%s' but it is in a module group '%s' which has already been loaded.", diff --git a/Engine/source/module/moduleManager.h b/Engine/source/module/moduleManager.h index 9c7125610..60b81a5f3 100644 --- a/Engine/source/module/moduleManager.h +++ b/Engine/source/module/moduleManager.h @@ -120,6 +120,7 @@ private: char mModuleExtension[256]; Taml mTaml; SimSet mNotificationListeners; + bool mIgnoreLoadedGroups; // Module definition entry. struct ModuleDefinitionEntry : public typeModuleDefinitionVector @@ -161,6 +162,7 @@ public: bool scanModules( const char* pPath, const bool rootOnly = false ); /// Module unregister. + bool registerModule(const char* pModulePath, const char* pModuleFile); bool unregisterModule( const char* pModuleId, const U32 versionId ); /// Module (un)loading. @@ -179,6 +181,9 @@ public: StringTableEntry copyModule( ModuleDefinition* pSourceModuleDefinition, const char* pTargetModuleId, const char* pTargetPath, const bool useVersionPathing ); bool synchronizeDependencies( ModuleDefinition* pRootModuleDefinition, const char* pTargetDependencyPath ); + /// Editing modules + bool renameModule(ModuleDefinition* pSourceModuleDefinition, const char* pNewModuleName); + /// Module updates. inline bool isModuleMergeAvailable( void ) const { return Platform::isFile( getModuleMergeFilePath() ); } bool canMergeModules( const char* pMergeSourcePath ); @@ -188,10 +193,11 @@ public: void addListener( SimObject* pListener ); void removeListener( SimObject* pListener ); + void setIgnoreLoadedGroups(bool doIgnore) { mIgnoreLoadedGroups = doIgnore; } + private: void clearDatabase( void ); bool removeModuleDefinition( ModuleDefinition* pModuleDefinition ); - bool registerModule( const char* pModulePath, const char* pModuleFile ); void raiseModulePreLoadNotifications( ModuleDefinition* pModuleDefinition ); void raiseModulePostLoadNotifications( ModuleDefinition* pModuleDefinition ); diff --git a/Engine/source/module/moduleManager_ScriptBinding.h b/Engine/source/module/moduleManager_ScriptBinding.h index dc560d29a..8abc8aab5 100644 --- a/Engine/source/module/moduleManager_ScriptBinding.h +++ b/Engine/source/module/moduleManager_ScriptBinding.h @@ -46,6 +46,16 @@ DefineEngineMethod(ModuleManager, scanModules, bool, (const char* pRootPath, boo //----------------------------------------------------------------------------- +DefineEngineMethod(ModuleManager, registerModule, bool, (const char* pModulePath, const char* pModuleFile), ("", ""), + "Register the specified module.\n" + "@param moduleId The module Id to register.\n" + "@param versionId The version Id to register.\n" + "@return Whether the module was registered or not.\n") +{ + // Unregister the module. + return object->registerModule(pModulePath, pModuleFile); +} + DefineEngineMethod(ModuleManager, unregisterModule, bool, (const char* pModuleId, bool versionId), ("", false), "Unregister the specified module.\n" "@param moduleId The module Id to unregister.\n" @@ -246,6 +256,30 @@ DefineEngineMethod(ModuleManager, copyModule, String, (const char* sourceModuleD //----------------------------------------------------------------------------- +DefineEngineMethod(ModuleManager, renameModule, bool, (const char* sourceModuleDefinition, const char* pNewModuleName), +("", ""), +"Rename a module.\n" +"@param sourceModuleDefinition The module definition to rename.\n" +"@param pNewModuleName The new name the module should have.\n" +"@return Weither the rename was successful or not.\n") +{ + // Find the source module definition. + ModuleDefinition* pSourceModuleDefinition = dynamic_cast(Sim::findObject(sourceModuleDefinition)); + + // Was the module definition found? + if (pSourceModuleDefinition == NULL) + { + // No, so warn. + Con::warnf("ModuleManager::renameModule() - Could not find source module definition '%s'.", sourceModuleDefinition); + return ""; + } + + // Copy module. + return object->renameModule(pSourceModuleDefinition, pNewModuleName); +} + +//----------------------------------------------------------------------------- + DefineEngineMethod(ModuleManager, synchronizeDependencies, bool, (const char* rootModuleDefinition, const char* pTargetDependencyFolder), ("", ""), "Synchronize the module dependencies of a module definition to a target dependency folder.\n" "@param rootModuleDefinition The module definition used to determine dependencies.\n" @@ -342,3 +376,14 @@ DefineEngineMethod(ModuleManager, removeListener, void, (const char* listenerObj object->removeListener( pListener ); } + +//----------------------------------------------------------------------------- + +DefineEngineMethod(ModuleManager, ignoreLoadedGroups, void, (bool doIgnore), (false), + "Sets if the Module Manager should ingore laoded groups.\n" + "@param doIgnore Whether we should or should not ignore loaded groups.\n" + "@return No return value.\n") +{ + // Check whether the merge modules can current happen or not. + return object->setIgnoreLoadedGroups(doIgnore); +} \ No newline at end of file diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index 21e1e3d0b..f364ed0ce 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -82,635 +82,637 @@ //----------------------------------------------------------------------------- -IMPLEMENT_CONOBJECT( Taml ); +IMPLEMENT_CONOBJECT(Taml); //----------------------------------------------------------------------------- -StringTableEntry tamlRefIdName = StringTable->insert( "TamlId" ); -StringTableEntry tamlRefToIdName = StringTable->insert( "TamlRefId" ); -StringTableEntry tamlNamedObjectName = StringTable->insert( "Name" ); +StringTableEntry tamlRefIdName = StringTable->insert("TamlId"); +StringTableEntry tamlRefToIdName = StringTable->insert("TamlRefId"); +StringTableEntry tamlNamedObjectName = StringTable->insert("Name"); //----------------------------------------------------------------------------- typedef Taml::TamlFormatMode _TamlFormatMode; -ImplementEnumType( _TamlFormatMode, +ImplementEnumType(_TamlFormatMode, "") - { Taml::XmlFormat, "xml" }, - { Taml::BinaryFormat, "binary" }//, - //{ Taml::JSONFormat, "json" } -EndImplementEnumType; - -//----------------------------------------------------------------------------- - -Taml::TamlFormatMode Taml::getFormatModeEnum(const char* label) { - // Search for Mnemonic. - for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) - { - if( dStricmp(__TamlFormatMode::_sEnumTable[i].getName(), label) == 0) - return (TamlFormatMode)__TamlFormatMode::_sEnumTable[i].getInt(); - } + Taml::XmlFormat, "xml" +}, +{ Taml::BinaryFormat, "binary" }//, + //{ Taml::JSONFormat, "json" } + EndImplementEnumType; - // Warn. - Con::warnf( "Taml::getFormatModeEnum() - Invalid format of '%s'.", label ); + //----------------------------------------------------------------------------- - return Taml::InvalidFormat; -} + Taml::TamlFormatMode Taml::getFormatModeEnum(const char* label) + { + // Search for Mnemonic. + for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) + { + if (dStricmp(__TamlFormatMode::_sEnumTable[i].getName(), label) == 0) + return (TamlFormatMode)__TamlFormatMode::_sEnumTable[i].getInt(); + } -//----------------------------------------------------------------------------- + // Warn. + Con::warnf("Taml::getFormatModeEnum() - Invalid format of '%s'.", label); -const char* Taml::getFormatModeDescription(const Taml::TamlFormatMode formatMode) -{ - // Search for Mnemonic. - for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) - { - if( __TamlFormatMode::_sEnumTable[i].getInt() == (S32)formatMode ) - return __TamlFormatMode::_sEnumTable[i].getName(); - } + return Taml::InvalidFormat; + } - // Warn. - Con::warnf( "Taml::getFormatModeDescription() - Invalid format mode." ); + //----------------------------------------------------------------------------- - return StringTable->EmptyString(); -} + const char* Taml::getFormatModeDescription(const Taml::TamlFormatMode formatMode) + { + // Search for Mnemonic. + for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) + { + if (__TamlFormatMode::_sEnumTable[i].getInt() == (S32)formatMode) + return __TamlFormatMode::_sEnumTable[i].getName(); + } -//----------------------------------------------------------------------------- + // Warn. + Con::warnf("Taml::getFormatModeDescription() - Invalid format mode."); -// The string-table-entries are set to string literals below because Taml is used in a static scope and the string-table cannot currently be used like that. -Taml::Taml() : - mFormatMode(XmlFormat), - mJSONStrict( true ), - mBinaryCompression(true), - mWriteDefaults(false), - mAutoFormatXmlExtension("taml"), - mAutoFormat(true), - mProgenitorUpdate(true), - mAutoFormatBinaryExtension("baml"), - mAutoFormatJSONExtension("json") -{ - // Reset the file-path buffer. - mFilePathBuffer[0] = 0; -} + return StringTable->EmptyString(); + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::initPersistFields() -{ - // Call parent. - Parent::initPersistFields(); + // The string-table-entries are set to string literals below because Taml is used in a static scope and the string-table cannot currently be used like that. + Taml::Taml() : + mFormatMode(XmlFormat), + mJSONStrict(true), + mBinaryCompression(true), + mWriteDefaults(false), + mAutoFormatXmlExtension("taml"), + mAutoFormat(true), + mProgenitorUpdate(true), + mAutoFormatBinaryExtension("baml"), + mAutoFormatJSONExtension("json") + { + // Reset the file-path buffer. + mFilePathBuffer[0] = 0; + } - addField("Format", TYPEID<_TamlFormatMode>(), Offset(mFormatMode, Taml), "The read/write format that should be used."); - addField("JSONStrict", TypeBool, Offset(mBinaryCompression, Taml), "Whether to write JSON that is strictly compatible with RFC4627 or not.\n"); - addField("BinaryCompression", TypeBool, Offset(mBinaryCompression, Taml), "Whether ZIP compression is used on binary formatting or not.\n"); - addField("WriteDefaults", TypeBool, Offset(mWriteDefaults, Taml), "Whether to write static fields that are at their default or not.\n"); - addField("ProgenitorUpdate", TypeBool, Offset(mProgenitorUpdate, Taml), "Whether to update each type instances file-progenitor or not.\n"); - addField("AutoFormat", TypeBool, Offset(mAutoFormat, Taml), "Whether the format type is automatically determined by the filename extension or not.\n"); - addField("AutoFormatXmlExtension", TypeString, Offset(mAutoFormatXmlExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the XML format.\n"); - addField("AutoFormatBinaryExtension", TypeString, Offset(mAutoFormatBinaryExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the BINARY format.\n"); - addField("AutoFormatJSONExtension", TypeString, Offset(mAutoFormatJSONExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the JSON format.\n"); -} + //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + void Taml::initPersistFields() + { + // Call parent. + Parent::initPersistFields(); -bool Taml::onAdd() -{ - // Call parent. - if ( !Parent::onAdd() ) - return false; + addField("Format", TYPEID<_TamlFormatMode>(), Offset(mFormatMode, Taml), "The read/write format that should be used."); + addField("JSONStrict", TypeBool, Offset(mBinaryCompression, Taml), "Whether to write JSON that is strictly compatible with RFC4627 or not.\n"); + addField("BinaryCompression", TypeBool, Offset(mBinaryCompression, Taml), "Whether ZIP compression is used on binary formatting or not.\n"); + addField("WriteDefaults", TypeBool, Offset(mWriteDefaults, Taml), "Whether to write static fields that are at their default or not.\n"); + addField("ProgenitorUpdate", TypeBool, Offset(mProgenitorUpdate, Taml), "Whether to update each type instances file-progenitor or not.\n"); + addField("AutoFormat", TypeBool, Offset(mAutoFormat, Taml), "Whether the format type is automatically determined by the filename extension or not.\n"); + addField("AutoFormatXmlExtension", TypeString, Offset(mAutoFormatXmlExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the XML format.\n"); + addField("AutoFormatBinaryExtension", TypeString, Offset(mAutoFormatBinaryExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the BINARY format.\n"); + addField("AutoFormatJSONExtension", TypeString, Offset(mAutoFormatJSONExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the JSON format.\n"); + } - // Set JSON strict mode. - mJSONStrict = Con::getBoolVariable( TAML_JSON_STRICT_VARIBLE, true ); + //----------------------------------------------------------------------------- - // Reset the compilation. - resetCompilation(); + bool Taml::onAdd() + { + // Call parent. + if (!Parent::onAdd()) + return false; - return true; -} + // Set JSON strict mode. + mJSONStrict = Con::getBoolVariable(TAML_JSON_STRICT_VARIBLE, true); -//----------------------------------------------------------------------------- + // Reset the compilation. + resetCompilation(); -void Taml::onRemove() -{ - // Reset the compilation. - resetCompilation(); + return true; + } - // Call parent. - Parent::onRemove(); -} + //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + void Taml::onRemove() + { + // Reset the compilation. + resetCompilation(); -bool Taml::write( SimObject* pSimObject, const char* pFilename ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_Write); + // Call parent. + Parent::onRemove(); + } - // Sanity! - AssertFatal( pSimObject != NULL, "Cannot write a NULL object." ); - AssertFatal( pFilename != NULL, "Cannot write to a NULL filename." ); + //----------------------------------------------------------------------------- - // Expand the file-name into the file-path buffer. - Con::expandToolScriptFilename( mFilePathBuffer, sizeof(mFilePathBuffer), pFilename ); + bool Taml::write(SimObject* pSimObject, const char* pFilename) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_Write); - FileStream stream; + // Sanity! + AssertFatal(pSimObject != NULL, "Cannot write a NULL object."); + AssertFatal(pFilename != NULL, "Cannot write to a NULL filename."); - // File opened? - if ( !stream.open( mFilePathBuffer, Torque::FS::File::Write ) ) - { - // No, so warn. - Con::warnf("Taml::writeFile() - Could not open filename '%s' for write.", mFilePathBuffer ); - return false; - } + // Expand the file-name into the file-path buffer. + Con::expandToolScriptFilename(mFilePathBuffer, sizeof(mFilePathBuffer), pFilename); - // Get the file auto-format mode. - const TamlFormatMode formatMode = getFileAutoFormatMode( mFilePathBuffer ); + FileStream stream; - // Reset the compilation. - resetCompilation(); + // File opened? + if (!stream.open(mFilePathBuffer, Torque::FS::File::Write)) + { + // No, so warn. + Con::warnf("Taml::writeFile() - Could not open filename '%s' for write.", mFilePathBuffer); + return false; + } - // Write object. - const bool status = write( stream, pSimObject, formatMode ); + // Get the file auto-format mode. + const TamlFormatMode formatMode = getFileAutoFormatMode(mFilePathBuffer); - // Close file. - stream.close(); + // Reset the compilation. + resetCompilation(); - // Reset the compilation. - resetCompilation(); + // Write object. + const bool status = write(stream, pSimObject, formatMode); - return status; -} + // Close file. + stream.close(); -//----------------------------------------------------------------------------- + // Reset the compilation. + resetCompilation(); -SimObject* Taml::read( const char* pFilename ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_Read); + return status; + } - // Sanity! - AssertFatal( pFilename != NULL, "Cannot read from a NULL filename." ); + //----------------------------------------------------------------------------- - // Expand the file-name into the file-path buffer. - Con::expandToolScriptFilename( mFilePathBuffer, sizeof(mFilePathBuffer), pFilename ); + SimObject* Taml::read(const char* pFilename) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_Read); - FileStream stream; + // Sanity! + AssertFatal(pFilename != NULL, "Cannot read from a NULL filename."); - // File opened? - if ( !stream.open( mFilePathBuffer, Torque::FS::File::Read ) ) - { - // No, so warn. - Con::warnf("Taml::read() - Could not open filename '%s' for read.", mFilePathBuffer ); - return NULL; - } + // Expand the file-name into the file-path buffer. + Con::expandToolScriptFilename(mFilePathBuffer, sizeof(mFilePathBuffer), pFilename); - // Get the file auto-format mode. - const TamlFormatMode formatMode = getFileAutoFormatMode( mFilePathBuffer ); + FileStream stream; - // Reset the compilation. - resetCompilation(); + // File opened? + if (!stream.open(mFilePathBuffer, Torque::FS::File::Read)) + { + // No, so warn. + Con::warnf("Taml::read() - Could not open filename '%s' for read.", mFilePathBuffer); + return NULL; + } - // Write object. - SimObject* pSimObject = read( stream, formatMode ); + // Get the file auto-format mode. + const TamlFormatMode formatMode = getFileAutoFormatMode(mFilePathBuffer); - // Close file. - stream.close(); + // Reset the compilation. + resetCompilation(); - // Reset the compilation. - resetCompilation(); + // Write object. + SimObject* pSimObject = read(stream, formatMode); - // Did we generate an object? - if ( pSimObject == NULL ) - { - // No, so warn. - Con::warnf( "Taml::read() - Failed to load an object from the file '%s'.", mFilePathBuffer ); - } - else - { - pSimObject->onPostAdd(); - } + // Close file. + stream.close(); - return pSimObject; -} + // Reset the compilation. + resetCompilation(); -//----------------------------------------------------------------------------- + // Did we generate an object? + if (pSimObject == NULL) + { + // No, so warn. + Con::warnf("Taml::read() - Failed to load an object from the file '%s'.", mFilePathBuffer); + } + else + { + pSimObject->onPostAdd(); + } -bool Taml::write( FileStream& stream, SimObject* pSimObject, const TamlFormatMode formatMode ) -{ - // Sanity! - AssertFatal( pSimObject != NULL, "Cannot write a NULL object." ); + return pSimObject; + } - // Compile nodes. - TamlWriteNode* pRootNode = compileObject( pSimObject ); + //----------------------------------------------------------------------------- - // Format appropriately. - switch( formatMode ) - { - /// Xml. - case XmlFormat: - { - // Create writer. - TamlXmlWriter writer( this ); - // Write. - return writer.write( stream, pRootNode ); - } + bool Taml::write(FileStream& stream, SimObject* pSimObject, const TamlFormatMode formatMode) + { + // Sanity! + AssertFatal(pSimObject != NULL, "Cannot write a NULL object."); - /// Binary. - case BinaryFormat: - { - // Create writer. - TamlBinaryWriter writer( this ); + // Compile nodes. + TamlWriteNode* pRootNode = compileObject(pSimObject); - // Write. - return writer.write( stream, pRootNode, mBinaryCompression ); - } + // Format appropriately. + switch (formatMode) + { + /// Xml. + case XmlFormat: + { + // Create writer. + TamlXmlWriter writer(this); + // Write. + return writer.write(stream, pRootNode); + } - /// JSON. - case JSONFormat: - { - // Create writer. - //TamlJSONWriter writer( this ); + /// Binary. + case BinaryFormat: + { + // Create writer. + TamlBinaryWriter writer(this); - // Write. - //return writer.write( stream, pRootNode ); - return NULL; - } + // Write. + return writer.write(stream, pRootNode, mBinaryCompression); + } - /// Invalid. - case InvalidFormat: - { - // Warn. - Con::warnf("Taml::write() - Cannot write, invalid format."); + /// JSON. + case JSONFormat: + { + // Create writer. + //TamlJSONWriter writer( this ); + + // Write. + //return writer.write( stream, pRootNode ); + return NULL; + } + + /// Invalid. + case InvalidFormat: + { + // Warn. + Con::warnf("Taml::write() - Cannot write, invalid format."); + return false; + } + } + + // Warn. + Con::warnf("Taml::write() - Unknown format."); + return false; + } + + //----------------------------------------------------------------------------- + + SimObject* Taml::read(FileStream& stream, const TamlFormatMode formatMode) + { + // Format appropriately. + switch (formatMode) + { + /// Xml. + case XmlFormat: + { + // Create reader. + TamlXmlReader reader(this); + + // Read. + return reader.read(stream); + } + + /// Binary. + case BinaryFormat: + { + // Create reader. + TamlBinaryReader reader(this); + + // Read. + return reader.read(stream); + } + + /// JSON. + case JSONFormat: + { + // Create reader. + //TamlJSONReader reader( this ); + + // Read. + //return reader.read( stream ); + return NULL; + } + + /// Invalid. + case InvalidFormat: + { + // Warn. + Con::warnf("Taml::read() - Cannot read, invalid format."); + return NULL; + } + } + + // Warn. + Con::warnf("Taml::read() - Unknown format."); + return NULL; + } + + //----------------------------------------------------------------------------- + + bool Taml::parse(const char* pFilename, TamlVisitor& visitor) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_Parse); + + // Sanity! + AssertFatal(pFilename != NULL, "Taml::parse() - Cannot parse a NULL filename."); + + // Fetch format mode. + const TamlFormatMode formatMode = getFileAutoFormatMode(pFilename); + + // Handle format mode appropriately. + switch (formatMode) + { + case XmlFormat: + { + // Parse with the visitor. + TamlXmlParser parser; + + // Are property changes needed but not supported? + if (visitor.wantsPropertyChanges() && !parser.canChangeProperty()) + { + // Yes, so warn. + Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename); return false; - } - } + } - // Warn. - Con::warnf("Taml::write() - Unknown format."); - return false; -} + return parser.accept(pFilename, visitor); + } -//----------------------------------------------------------------------------- + case JSONFormat: + { + // Parse with the visitor. + /*TamlJSONParser parser; -SimObject* Taml::read( FileStream& stream, const TamlFormatMode formatMode ) -{ - // Format appropriately. - switch( formatMode ) - { - /// Xml. - case XmlFormat: - { - // Create reader. - TamlXmlReader reader( this ); + // Are property changes needed but not supported? + if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() ) + { + // Yes, so warn. + Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename ); + return false; + } - // Read. - return reader.read( stream ); - } + return parser.accept( pFilename, visitor ); */ + return false; + } - /// Binary. - case BinaryFormat: - { - // Create reader. - TamlBinaryReader reader( this ); + case BinaryFormat: + default: + break; + } - // Read. - return reader.read( stream ); - } + // Warn. + Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a required parser is not available.", getFormatModeDescription(formatMode), pFilename); + return false; + } - /// JSON. - case JSONFormat: - { - // Create reader. - //TamlJSONReader reader( this ); + //----------------------------------------------------------------------------- - // Read. - //return reader.read( stream ); - return NULL; - } - - /// Invalid. - case InvalidFormat: - { - // Warn. - Con::warnf("Taml::read() - Cannot read, invalid format."); - return NULL; - } - } + void Taml::resetCompilation(void) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_ResetCompilation); - // Warn. - Con::warnf("Taml::read() - Unknown format."); - return NULL; -} + // Clear compiled nodes. + for (typeNodeVector::iterator itr = mCompiledNodes.begin(); itr != mCompiledNodes.end(); ++itr) + { + // Fetch node. + TamlWriteNode* pNode = (*itr); -//----------------------------------------------------------------------------- + // Reset node. + pNode->resetNode(); -bool Taml::parse( const char* pFilename, TamlVisitor& visitor ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_Parse); + // Delete node. + delete pNode; + } + mCompiledNodes.clear(); - // Sanity! - AssertFatal( pFilename != NULL, "Taml::parse() - Cannot parse a NULL filename." ); + // Clear compiled objects. + mCompiledObjects.clear(); - // Fetch format mode. - const TamlFormatMode formatMode = getFileAutoFormatMode( pFilename ); + // Reset master node Id. + mMasterNodeId = 0; + } - // Handle format mode appropriately. - switch( formatMode ) - { - case XmlFormat: - { - // Parse with the visitor. - TamlXmlParser parser; + //----------------------------------------------------------------------------- - // Are property changes needed but not supported? - if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() ) - { - // Yes, so warn. - Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename ); - return false; - } + Taml::TamlFormatMode Taml::getFileAutoFormatMode(const char* pFilename) + { + // Sanity! + AssertFatal(pFilename != NULL, "Taml::getFileAutoFormatMode() - Cannot auto-format using a NULL filename."); - return parser.accept( pFilename, visitor ); - } + // Is auto-format active? + if (mAutoFormat) + { + // Yes, so fetch the extension lengths. + const U32 xmlExtensionLength = dStrlen(mAutoFormatXmlExtension); + const U32 binaryExtensionLength = dStrlen(mAutoFormatBinaryExtension); + const U32 jsonExtensionLength = dStrlen(mAutoFormatJSONExtension); - case JSONFormat: - { - // Parse with the visitor. - /*TamlJSONParser parser; + // Fetch filename length. + const U32 filenameLength = dStrlen(pFilename); - // Are property changes needed but not supported? - if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() ) - { - // Yes, so warn. - Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename ); - return false; - } + // Fetch end of filename, + const char* pEndOfFilename = pFilename + filenameLength; - return parser.accept( pFilename, visitor ); */ - return false; - } - - case BinaryFormat: - default: - break; - } - - // Warn. - Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a required parser is not available.", getFormatModeDescription(formatMode), pFilename ); - return false; -} - -//----------------------------------------------------------------------------- - -void Taml::resetCompilation( void ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_ResetCompilation); - - // Clear compiled nodes. - for( typeNodeVector::iterator itr = mCompiledNodes.begin(); itr != mCompiledNodes.end(); ++itr ) - { - // Fetch node. - TamlWriteNode* pNode = (*itr); - - // Reset node. - pNode->resetNode(); - - // Delete node. - delete pNode; - } - mCompiledNodes.clear(); - - // Clear compiled objects. - mCompiledObjects.clear(); - - // Reset master node Id. - mMasterNodeId = 0; -} - -//----------------------------------------------------------------------------- - -Taml::TamlFormatMode Taml::getFileAutoFormatMode( const char* pFilename ) -{ - // Sanity! - AssertFatal( pFilename != NULL, "Taml::getFileAutoFormatMode() - Cannot auto-format using a NULL filename." ); - - // Is auto-format active? - if ( mAutoFormat ) - { - // Yes, so fetch the extension lengths. - const U32 xmlExtensionLength = dStrlen( mAutoFormatXmlExtension ); - const U32 binaryExtensionLength = dStrlen( mAutoFormatBinaryExtension ); - const U32 jsonExtensionLength = dStrlen( mAutoFormatJSONExtension ); - - // Fetch filename length. - const U32 filenameLength = dStrlen( pFilename ); - - // Fetch end of filename, - const char* pEndOfFilename = pFilename + filenameLength; - - // Check for the XML format. - if ( xmlExtensionLength <= filenameLength && dStricmp( pEndOfFilename - xmlExtensionLength, mAutoFormatXmlExtension ) == 0 ) + // Check for the XML format. + if (xmlExtensionLength <= filenameLength && dStricmp(pEndOfFilename - xmlExtensionLength, mAutoFormatXmlExtension) == 0) return Taml::XmlFormat; - // Check for the Binary format. - if ( binaryExtensionLength <= filenameLength && dStricmp( pEndOfFilename - xmlExtensionLength, mAutoFormatBinaryExtension ) == 0 ) - return Taml::BinaryFormat; + // Check for the Binary format. + if (binaryExtensionLength <= filenameLength && dStricmp(pEndOfFilename - xmlExtensionLength, mAutoFormatBinaryExtension) == 0) + return Taml::BinaryFormat; - // Check for the XML format. - if ( jsonExtensionLength <= filenameLength && dStricmp( pEndOfFilename - jsonExtensionLength, mAutoFormatJSONExtension ) == 0 ) + // Check for the XML format. + if (jsonExtensionLength <= filenameLength && dStricmp(pEndOfFilename - jsonExtensionLength, mAutoFormatJSONExtension) == 0) return Taml::JSONFormat; - } + } - // Use the explicitly specified format mode. - return mFormatMode; -} + // Use the explicitly specified format mode. + return mFormatMode; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -TamlWriteNode* Taml::compileObject( SimObject* pSimObject, const bool forceId ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileObject); + TamlWriteNode* Taml::compileObject(SimObject* pSimObject, const bool forceId) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileObject); - // Sanity! - AssertFatal( pSimObject != NULL, "Taml::compileObject() - Cannot compile a NULL object." ); + // Sanity! + AssertFatal(pSimObject != NULL, "Taml::compileObject() - Cannot compile a NULL object."); - // Fetch object Id. - const SimObjectId objectId = pSimObject->getId(); + // Fetch object Id. + const SimObjectId objectId = pSimObject->getId(); - // Find a previously compiled node. - typeCompiledHash::Iterator compiledItr = mCompiledObjects.find( objectId ); + // Find a previously compiled node. + typeCompiledHash::Iterator compiledItr = mCompiledObjects.find(objectId); - // Have we already compiled this? - if ( compiledItr != mCompiledObjects.end() ) - { - // Yes, so sanity! - AssertFatal( mCompiledNodes.size() != 0, "Taml::compileObject() - Found a compiled node at the root." ); + // Have we already compiled this? + if (compiledItr != mCompiledObjects.end()) + { + // Yes, so sanity! + AssertFatal(mCompiledNodes.size() != 0, "Taml::compileObject() - Found a compiled node at the root."); - // Yes, so fetch node. - TamlWriteNode* compiledNode = compiledItr->value; + // Yes, so fetch node. + TamlWriteNode* compiledNode = compiledItr->value; - // Is a reference Id already present? - if ( compiledNode->mRefId == 0 ) - { + // Is a reference Id already present? + if (compiledNode->mRefId == 0) + { // No, so allocate one. compiledNode->mRefId = ++mMasterNodeId; - } + } - // Create write node. - TamlWriteNode* pNewNode = new TamlWriteNode(); - pNewNode->set( pSimObject ); + // Create write node. + TamlWriteNode* pNewNode = new TamlWriteNode(); + pNewNode->set(pSimObject); - // Set reference node. - pNewNode->mRefToNode = compiledNode; + // Set reference node. + pNewNode->mRefToNode = compiledNode; - // Push new node. - mCompiledNodes.push_back( pNewNode ); + // Push new node. + mCompiledNodes.push_back(pNewNode); - return pNewNode; - } + return pNewNode; + } - // No, so create write node. - TamlWriteNode* pNewNode = new TamlWriteNode(); - pNewNode->set( pSimObject ); + // No, so create write node. + TamlWriteNode* pNewNode = new TamlWriteNode(); + pNewNode->set(pSimObject); - // Is an Id being forced for this object? - if ( forceId ) - { - // Yes, so allocate one. - pNewNode->mRefId = ++mMasterNodeId; - } + // Is an Id being forced for this object? + if (forceId) + { + // Yes, so allocate one. + pNewNode->mRefId = ++mMasterNodeId; + } - // Push new node. - mCompiledNodes.push_back( pNewNode ); + // Push new node. + mCompiledNodes.push_back(pNewNode); - // Insert compiled object. - mCompiledObjects.insertUnique( objectId, pNewNode ); + // Insert compiled object. + mCompiledObjects.insertUnique(objectId, pNewNode); - // Are there any Taml callbacks? - if ( pNewNode->mpTamlCallbacks != NULL ) - { - // Yes, so call it. - tamlPreWrite( pNewNode->mpTamlCallbacks ); - } + // Are there any Taml callbacks? + if (pNewNode->mpTamlCallbacks != NULL) + { + // Yes, so call it. + tamlPreWrite(pNewNode->mpTamlCallbacks); + } - // Compile static and dynamic fields. - compileStaticFields( pNewNode ); - compileDynamicFields( pNewNode ); + // Compile static and dynamic fields. + compileStaticFields(pNewNode); + compileDynamicFields(pNewNode); - // Compile children. - compileChildren( pNewNode ); + // Compile children. + compileChildren(pNewNode); - // Compile custom state. - compileCustomState( pNewNode ); + // Compile custom state. + compileCustomState(pNewNode); - // Are there any Taml callbacks? - if ( pNewNode->mpTamlCallbacks != NULL ) - { - // Yes, so call it. - tamlPostWrite( pNewNode->mpTamlCallbacks ); - } + // Are there any Taml callbacks? + if (pNewNode->mpTamlCallbacks != NULL) + { + // Yes, so call it. + tamlPostWrite(pNewNode->mpTamlCallbacks); + } - return pNewNode; -} + return pNewNode; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::compileStaticFields( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileStaticFields); + void Taml::compileStaticFields(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileStaticFields); - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile static fields on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile static fields on a node with no object." ); + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile static fields on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile static fields on a node with no object."); - // Fetch object. - SimObject* pSimObject = pTamlWriteNode->mpSimObject; + // Fetch object. + SimObject* pSimObject = pTamlWriteNode->mpSimObject; - // Fetch field list. - const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); + // Fetch field list. + const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); - // Fetch field count. - const U32 fieldCount = fieldList.size(); + // Fetch field count. + const U32 fieldCount = fieldList.size(); - // Iterate fields. - U8 arrayDepth = 0; - TamlCustomNode* currentArrayNode; - for( U32 index = 0; index < fieldCount; ++index ) - { - // Fetch field. - const AbstractClassRep::Field* pField = &fieldList[index]; + // Iterate fields. + U8 arrayDepth = 0; + TamlCustomNode* currentArrayNode; + for (U32 index = 0; index < fieldCount; ++index) + { + // Fetch field. + const AbstractClassRep::Field* pField = &fieldList[index]; - // Ignore if field not appropriate. - if( pField->type == AbstractClassRep::DeprecatedFieldType || + // Ignore if field not appropriate. + if (pField->type == AbstractClassRep::DeprecatedFieldType || pField->type == AbstractClassRep::StartGroupFieldType || - pField->type == AbstractClassRep::EndGroupFieldType ) + pField->type == AbstractClassRep::EndGroupFieldType) continue; - if( pField->type == AbstractClassRep::StartArrayFieldType ) - { - TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; - currentArrayNode = pCustomNodes.addNode(pField->pGroupname); - for(U16 idx = 0; idx < pField->elementCount; idx++) - currentArrayNode->addNode(pField->pFieldname); - arrayDepth++; - continue; - } + if (pField->type == AbstractClassRep::StartArrayFieldType) + { + TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; + currentArrayNode = pCustomNodes.addNode(pField->pGroupname); + for (U16 idx = 0; idx < pField->elementCount; idx++) + currentArrayNode->addNode(pField->pFieldname); + arrayDepth++; + continue; + } - if( pField->type == AbstractClassRep::EndArrayFieldType ) - { - arrayDepth--; - continue; - } + if (pField->type == AbstractClassRep::EndArrayFieldType) + { + arrayDepth--; + continue; + } - if(arrayDepth == 0 && pField->elementCount > 1) - { - TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; - char* niceFieldName = const_cast(pField->pFieldname); - niceFieldName[0] = dToupper(niceFieldName[0]); - String str_niceFieldName = String(niceFieldName); - currentArrayNode = pCustomNodes.addNode(str_niceFieldName + "s"); - for(U16 idx = 0; idx < pField->elementCount; idx++) - currentArrayNode->addNode(str_niceFieldName); - } + if (arrayDepth == 0 && pField->elementCount > 1) + { + TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; + char* niceFieldName = const_cast(pField->pFieldname); + niceFieldName[0] = dToupper(niceFieldName[0]); + String str_niceFieldName = String(niceFieldName); + currentArrayNode = pCustomNodes.addNode(str_niceFieldName + "s"); + for (U16 idx = 0; idx < pField->elementCount; idx++) + currentArrayNode->addNode(str_niceFieldName); + } - // Fetch fieldname. - StringTableEntry fieldName = StringTable->insert( pField->pFieldname ); + // Fetch fieldname. + StringTableEntry fieldName = StringTable->insert(pField->pFieldname); - // Fetch element count. - const U32 elementCount = pField->elementCount; + // Fetch element count. + const U32 elementCount = pField->elementCount; - // Skip if the field should not be written. - // For now, we only deal with non-array fields. - if ( elementCount == 1 && - pField->setDataFn != NULL && - ( !getWriteDefaults() && pField->writeDataFn( pSimObject, fieldName ) == false) ) + // Skip if the field should not be written. + // For now, we only deal with non-array fields. + if (elementCount == 1 && + pField->setDataFn != NULL && + (!getWriteDefaults() && pField->writeDataFn(pSimObject, fieldName) == false)) continue; - // Iterate elements. - for( U32 elementIndex = 0; elementIndex < elementCount; ++elementIndex ) - { + // Iterate elements. + for (U32 elementIndex = 0; elementIndex < elementCount; ++elementIndex) + { char indexBuffer[8]; - dSprintf( indexBuffer, 8, "%d", elementIndex ); + dSprintf(indexBuffer, 8, "%d", elementIndex); // Fetch object field value. const char* pFieldValue = pSimObject->getPrefixedDataField(fieldName, indexBuffer); - if(!pFieldValue) + if (!pFieldValue) pFieldValue = StringTable->EmptyString(); - if(pField->type == TypeBool) + if (pField->type == TypeBool) pFieldValue = dAtob(pFieldValue) ? "true" : "false"; - U32 nBufferSize = dStrlen( pFieldValue ) + 1; - FrameTemp valueCopy( nBufferSize ); - dStrcpy( (char *)valueCopy, pFieldValue ); + U32 nBufferSize = dStrlen(pFieldValue) + 1; + FrameTemp valueCopy(nBufferSize); + dStrcpy((char *)valueCopy, pFieldValue); // Skip if field should not be written. if (!pSimObject->writeField(fieldName, valueCopy)) - continue; + continue; // Reassign field value. pFieldValue = valueCopy; @@ -719,660 +721,660 @@ void Taml::compileStaticFields( TamlWriteNode* pTamlWriteNode ) char fnBuf[1024]; if ((S32)pField->type == TypeFilename) { - Con::collapseScriptFilename( fnBuf, 1024, pFieldValue ); - pFieldValue = fnBuf; + Con::collapseScriptFilename(fnBuf, 1024, pFieldValue); + pFieldValue = fnBuf; } // Save field/value. - if(arrayDepth > 0 || pField->elementCount > 1) + if (arrayDepth > 0 || pField->elementCount > 1) currentArrayNode->getChildren()[elementIndex]->addField(fieldName, pFieldValue); else { - TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair( fieldName, pFieldValue ); - pTamlWriteNode->mFields.push_back( pFieldValuePair ); + TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(fieldName, pFieldValue); + pTamlWriteNode->mFields.push_back(pFieldValuePair); } - } - } -} + } + } + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -static S32 QSORT_CALLBACK compareFieldEntries(const void* a,const void* b) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompareFieldEntries); + static S32 QSORT_CALLBACK compareFieldEntries(const void* a, const void* b) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompareFieldEntries); - SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a); - SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b); - return dStricmp(fa->slotName, fb->slotName); -} + SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a); + SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b); + return dStricmp(fa->slotName, fb->slotName); + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::compileDynamicFields( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileDynamicFields); + void Taml::compileDynamicFields(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileDynamicFields); - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile dynamic fields on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile dynamic fields on a node with no object." ); + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile dynamic fields on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile dynamic fields on a node with no object."); - // Fetch object. - SimObject* pSimObject = pTamlWriteNode->mpSimObject; + // Fetch object. + SimObject* pSimObject = pTamlWriteNode->mpSimObject; - // Fetch field dictionary. - SimFieldDictionary* pFieldDictionary = pSimObject->getFieldDictionary(); + // Fetch field dictionary. + SimFieldDictionary* pFieldDictionary = pSimObject->getFieldDictionary(); - // Ignore if not writing dynamic fields. - if ( !pFieldDictionary || !pSimObject->getCanSaveDynamicFields() ) - return; + // Ignore if not writing dynamic fields. + if (!pFieldDictionary || !pSimObject->getCanSaveDynamicFields()) + return; - // Fetch field list. - const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); + // Fetch field list. + const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); - // Fetch field count. - const U32 fieldCount = fieldList.size(); + // Fetch field count. + const U32 fieldCount = fieldList.size(); - Vector dynamicFieldList(__FILE__, __LINE__); + Vector dynamicFieldList(__FILE__, __LINE__); - // Ensure the dynamic field doesn't conflict with static field. - for( U32 hashIndex = 0; hashIndex < SimFieldDictionary::HashTableSize; ++hashIndex ) - { - for( SimFieldDictionary::Entry* pEntry = pFieldDictionary->mHashTable[hashIndex]; pEntry; pEntry = pEntry->next ) - { + // Ensure the dynamic field doesn't conflict with static field. + for (U32 hashIndex = 0; hashIndex < SimFieldDictionary::HashTableSize; ++hashIndex) + { + for (SimFieldDictionary::Entry* pEntry = pFieldDictionary->mHashTable[hashIndex]; pEntry; pEntry = pEntry->next) + { // Iterate static fields. U32 fieldIndex; - for( fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex ) + for (fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex) { - if( fieldList[fieldIndex].pFieldname == pEntry->slotName) - break; + if (fieldList[fieldIndex].pFieldname == pEntry->slotName) + break; } // Skip if found. - if( fieldIndex != (U32)fieldList.size() ) - continue; + if (fieldIndex != (U32)fieldList.size()) + continue; // Skip if not writing field. - if ( !pSimObject->writeField( pEntry->slotName, pEntry->value) ) - continue; + if (!pSimObject->writeField(pEntry->slotName, pEntry->value)) + continue; - dynamicFieldList.push_back( pEntry ); - } - } + dynamicFieldList.push_back(pEntry); + } + } - // Sort Entries to prevent version control conflicts - if ( dynamicFieldList.size() > 1 ) - dQsort(dynamicFieldList.address(), dynamicFieldList.size(), sizeof(SimFieldDictionary::Entry*), compareFieldEntries); + // Sort Entries to prevent version control conflicts + if (dynamicFieldList.size() > 1) + dQsort(dynamicFieldList.address(), dynamicFieldList.size(), sizeof(SimFieldDictionary::Entry*), compareFieldEntries); - // Save the fields. - for( Vector::iterator entryItr = dynamicFieldList.begin(); entryItr != dynamicFieldList.end(); ++entryItr ) - { - // Fetch entry. - SimFieldDictionary::Entry* pEntry = *entryItr; + // Save the fields. + for (Vector::iterator entryItr = dynamicFieldList.begin(); entryItr != dynamicFieldList.end(); ++entryItr) + { + // Fetch entry. + SimFieldDictionary::Entry* pEntry = *entryItr; - // Save field/value. - TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair( pEntry->slotName, pEntry->value ); - pTamlWriteNode->mFields.push_back( pFieldValuePair ); - } -} + // Save field/value. + TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(pEntry->slotName, pEntry->value); + pTamlWriteNode->mFields.push_back(pFieldValuePair); + } + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::compileChildren( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileChildren); + void Taml::compileChildren(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileChildren); - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile children on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile children on a node with no object." ); + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile children on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile children on a node with no object."); - // Fetch object. - SimObject* pSimObject = pTamlWriteNode->mpSimObject; + // Fetch object. + SimObject* pSimObject = pTamlWriteNode->mpSimObject; - // Fetch the Taml children. - TamlChildren* pChildren = dynamic_cast( pSimObject ); + // Fetch the Taml children. + TamlChildren* pChildren = dynamic_cast(pSimObject); - // Finish if object does not contain Taml children. - if ( pChildren == NULL || pChildren->getTamlChildCount() == 0 ) - return; + // Finish if object does not contain Taml children. + if (pChildren == NULL || pChildren->getTamlChildCount() == 0) + return; - // Create children vector. - pTamlWriteNode->mChildren = new typeNodeVector(); + // Create children vector. + pTamlWriteNode->mChildren = new typeNodeVector(); - // Fetch the child count. - const U32 childCount = pChildren->getTamlChildCount(); + // Fetch the child count. + const U32 childCount = pChildren->getTamlChildCount(); - // Iterate children. - for ( U32 childIndex = 0; childIndex < childCount; childIndex++ ) - { - // Compile object. - TamlWriteNode* pChildTamlWriteNode = compileObject( pChildren->getTamlChild(childIndex) ); + // Iterate children. + for (U32 childIndex = 0; childIndex < childCount; childIndex++) + { + // Compile object. + TamlWriteNode* pChildTamlWriteNode = compileObject(pChildren->getTamlChild(childIndex)); - // Save node. - pTamlWriteNode->mChildren->push_back( pChildTamlWriteNode ); - } -} + // Save node. + pTamlWriteNode->mChildren->push_back(pChildTamlWriteNode); + } + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::compileCustomState( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileCustomProperties); + void Taml::compileCustomState(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileCustomProperties); - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile custom state on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile custom state on a node with no object." ); + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile custom state on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile custom state on a node with no object."); - // Fetch the custom node on the write node. - TamlCustomNodes& customNodes = pTamlWriteNode->mCustomNodes; + // Fetch the custom node on the write node. + TamlCustomNodes& customNodes = pTamlWriteNode->mCustomNodes; - // Are there any Taml callbacks? - if ( pTamlWriteNode->mpTamlCallbacks != NULL ) - { - // Yes, so call it. - tamlCustomWrite( pTamlWriteNode->mpTamlCallbacks, customNodes ); - } + // Are there any Taml callbacks? + if (pTamlWriteNode->mpTamlCallbacks != NULL) + { + // Yes, so call it. + tamlCustomWrite(pTamlWriteNode->mpTamlCallbacks, customNodes); + } - // Fetch custom nodes. - const TamlCustomNodeVector& nodes = customNodes.getNodes(); + // Fetch custom nodes. + const TamlCustomNodeVector& nodes = customNodes.getNodes(); - // Finish if no custom nodes to process. - if ( nodes.size() == 0 ) - return; - - // Iterate custom properties. - for( TamlCustomNodeVector::const_iterator customNodesItr = nodes.begin(); customNodesItr != nodes.end(); ++customNodesItr ) - { - // Fetch the custom node. - TamlCustomNode* pCustomNode = *customNodesItr; + // Finish if no custom nodes to process. + if (nodes.size() == 0) + return; - // Compile custom node state. - compileCustomNodeState( pCustomNode ); - } -} + // Iterate custom properties. + for (TamlCustomNodeVector::const_iterator customNodesItr = nodes.begin(); customNodesItr != nodes.end(); ++customNodesItr) + { + // Fetch the custom node. + TamlCustomNode* pCustomNode = *customNodesItr; -//----------------------------------------------------------------------------- + // Compile custom node state. + compileCustomNodeState(pCustomNode); + } + } -void Taml::compileCustomNodeState( TamlCustomNode* pCustomNode ) -{ - // Sanity! - AssertFatal( pCustomNode != NULL, "Taml: Cannot compile NULL custom node state." ); + //----------------------------------------------------------------------------- - // Fetch children. - const TamlCustomNodeVector& children = pCustomNode->getChildren(); + void Taml::compileCustomNodeState(TamlCustomNode* pCustomNode) + { + // Sanity! + AssertFatal(pCustomNode != NULL, "Taml: Cannot compile NULL custom node state."); - // Fetch proxy object. - SimObject* pProxyObject = pCustomNode->getProxyObject(false); + // Fetch children. + const TamlCustomNodeVector& children = pCustomNode->getChildren(); - // Do we have a proxy object? - if ( pProxyObject != NULL ) - { - // Yes, so sanity! - AssertFatal( children.size() == 0, "Taml: Cannot compile a proxy object on a custom node that has children." ); + // Fetch proxy object. + SimObject* pProxyObject = pCustomNode->getProxyObject(false); - // Yes, so compile it. - // NOTE: We force an Id for custom compiled objects so we guarantee an Id. The reason for this is fairly - // weak in that the XML parser currently has no way of distinguishing between a compiled object node - // and a custom node. If the node has an Id or an Id-Ref then it's obviously an object and should be parsed as such. - pCustomNode->setWriteNode( compileObject( pProxyObject, true ) ); - return; - } + // Do we have a proxy object? + if (pProxyObject != NULL) + { + // Yes, so sanity! + AssertFatal(children.size() == 0, "Taml: Cannot compile a proxy object on a custom node that has children."); - // Finish if no children. - if ( children.size() == 0 ) - return; + // Yes, so compile it. + // NOTE: We force an Id for custom compiled objects so we guarantee an Id. The reason for this is fairly + // weak in that the XML parser currently has no way of distinguishing between a compiled object node + // and a custom node. If the node has an Id or an Id-Ref then it's obviously an object and should be parsed as such. + pCustomNode->setWriteNode(compileObject(pProxyObject, true)); + return; + } - // Iterate children. - for( TamlCustomNodeVector::const_iterator childItr = children.begin(); childItr != children.end(); ++childItr ) - { - // Fetch shape node. - TamlCustomNode* pChildNode = *childItr; + // Finish if no children. + if (children.size() == 0) + return; - // Compile the child. - compileCustomNodeState( pChildNode ); - } -} + // Iterate children. + for (TamlCustomNodeVector::const_iterator childItr = children.begin(); childItr != children.end(); ++childItr) + { + // Fetch shape node. + TamlCustomNode* pChildNode = *childItr; -//----------------------------------------------------------------------------- + // Compile the child. + compileCustomNodeState(pChildNode); + } + } -SimObject* Taml::createType( StringTableEntry typeName, const Taml* pTaml, const char* pProgenitorSuffix ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CreateType); + //----------------------------------------------------------------------------- - typedef HashTable typeClassHash; - static typeClassHash mClassMap; + SimObject* Taml::createType(StringTableEntry typeName, const Taml* pTaml, const char* pProgenitorSuffix) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CreateType); - // Sanity! - AssertFatal( typeName != NULL, "Taml: Type cannot be NULL" ); + typedef HashTable typeClassHash; + static typeClassHash mClassMap; - // Find type. - typeClassHash::Iterator typeItr = mClassMap.find( typeName ); + // Sanity! + AssertFatal(typeName != NULL, "Taml: Type cannot be NULL"); - // Found type? - if ( typeItr == mClassMap.end() ) - { - // No, so find type. - AbstractClassRep* pClassRep = AbstractClassRep::getClassList(); - while( pClassRep ) - { + // Find type. + typeClassHash::Iterator typeItr = mClassMap.find(typeName); + + // Found type? + if (typeItr == mClassMap.end()) + { + // No, so find type. + AbstractClassRep* pClassRep = AbstractClassRep::getClassList(); + while (pClassRep) + { // Is this the type? - if( dStricmp( pClassRep->getClassName(), typeName ) == 0 ) + if (dStricmp(pClassRep->getClassName(), typeName) == 0) { - // Yes, so insert it. - typeItr = mClassMap.insertUnique( typeName, pClassRep ); - break; + // Yes, so insert it. + typeItr = mClassMap.insertUnique(typeName, pClassRep); + break; } // Next type. pClassRep = pClassRep->getNextClass(); - } + } - // Did we find the type? - if ( typeItr == mClassMap.end() ) - { + // Did we find the type? + if (typeItr == mClassMap.end()) + { // No, so warn and fail. - Con::warnf( "Taml: Failed to create type '%s' as such a registered type could not be found.", typeName ); + Con::warnf("Taml: Failed to create type '%s' as such a registered type could not be found.", typeName); return NULL; - } - } + } + } - // Create the object. - ConsoleObject* pConsoleObject = typeItr->value->create(); + // Create the object. + ConsoleObject* pConsoleObject = typeItr->value->create(); - // NOTE: It is important that we don't register the object here as many objects rely on the fact that - // fields are set prior to the object being registered. Registering here will invalid those assumptions. + // NOTE: It is important that we don't register the object here as many objects rely on the fact that + // fields are set prior to the object being registered. Registering here will invalid those assumptions. - // Fetch the SimObject. - SimObject* pSimObject = dynamic_cast( pConsoleObject ); + // Fetch the SimObject. + SimObject* pSimObject = dynamic_cast(pConsoleObject); - // Was it a SimObject? - if ( pSimObject == NULL ) - { - // No, so warn. - Con::warnf( "Taml: Failed to create type '%s' as it is not a SimObject.", typeName ); + // Was it a SimObject? + if (pSimObject == NULL) + { + // No, so warn. + Con::warnf("Taml: Failed to create type '%s' as it is not a SimObject.", typeName); - // Destroy object and fail. - delete pConsoleObject; - return NULL; - } + // Destroy object and fail. + delete pConsoleObject; + return NULL; + } - // Are we updating the file-progenitor? - if ( pTaml->getProgenitorUpdate() ) - { - // Yes, so do we have a progenitor suffix? - if ( pProgenitorSuffix == NULL ) - { + // Are we updating the file-progenitor? + if (pTaml->getProgenitorUpdate()) + { + // Yes, so do we have a progenitor suffix? + if (pProgenitorSuffix == NULL) + { // No, so just set it to the progenitor file. - pSimObject->setProgenitorFile( pTaml->getFilePathBuffer() ); - } - else - { + pSimObject->setProgenitorFile(pTaml->getFilePathBuffer()); + } + else + { // Yes, so format the progenitor buffer. char progenitorBuffer[2048]; - dSprintf( progenitorBuffer, sizeof(progenitorBuffer), "%s,%s", pTaml->getFilePathBuffer(), pProgenitorSuffix ); + dSprintf(progenitorBuffer, sizeof(progenitorBuffer), "%s,%s", pTaml->getFilePathBuffer(), pProgenitorSuffix); // Set the progenitor file. - pSimObject->setProgenitorFile( progenitorBuffer ); - } - } + pSimObject->setProgenitorFile(progenitorBuffer); + } + } - return pSimObject; -} + return pSimObject; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -bool Taml::generateTamlSchema() -{ - // Fetch any TAML Schema file reference. - const char* pTamlSchemaFile = Con::getVariable( TAML_SCHEMA_VARIABLE ); + bool Taml::generateTamlSchema() + { + // Fetch any TAML Schema file reference. + const char* pTamlSchemaFile = Con::getVariable(TAML_SCHEMA_VARIABLE); - // Do we have a schema file reference? - if ( pTamlSchemaFile == NULL || *pTamlSchemaFile == 0 ) - { - // No, so warn. - Con::warnf( "Taml::generateTamlSchema() - Cannot write a TAML schema as no schema variable is set ('%s').", TAML_SCHEMA_VARIABLE ); - return false; - } + // Do we have a schema file reference? + if (pTamlSchemaFile == NULL || *pTamlSchemaFile == 0) + { + // No, so warn. + Con::warnf("Taml::generateTamlSchema() - Cannot write a TAML schema as no schema variable is set ('%s').", TAML_SCHEMA_VARIABLE); + return false; + } - // Expand the file-name into the file-path buffer. - char filePathBuffer[1024]; - Con::expandToolScriptFilename( filePathBuffer, sizeof(filePathBuffer), pTamlSchemaFile ); + // Expand the file-name into the file-path buffer. + char filePathBuffer[1024]; + Con::expandToolScriptFilename(filePathBuffer, sizeof(filePathBuffer), pTamlSchemaFile); - FileStream stream; + FileStream stream; - // File opened? - /*if ( !stream.open( filePathBuffer, Torque::FS::File::Write ) ) - { - // No, so warn. - Con::warnf("Taml::GenerateTamlSchema() - Could not open filename '%s' for write.", filePathBuffer ); - return false; - }*/ + // File opened? + /*if ( !stream.open( filePathBuffer, Torque::FS::File::Write ) ) + { + // No, so warn. + Con::warnf("Taml::GenerateTamlSchema() - Could not open filename '%s' for write.", filePathBuffer ); + return false; + }*/ - // Create document. - TiXmlDocument schemaDocument; + // Create document. + TiXmlDocument schemaDocument; - // Add declaration. - TiXmlDeclaration schemaDeclaration( "1.0", "iso-8859-1", "no" ); - schemaDocument.InsertEndChild( schemaDeclaration ); + // Add declaration. + TiXmlDeclaration schemaDeclaration("1.0", "iso-8859-1", "no"); + schemaDocument.InsertEndChild(schemaDeclaration); - // Add schema element. - TiXmlElement* pSchemaElement = new TiXmlElement( "xs:schema" ); - pSchemaElement->SetAttribute( "xmlns:xs", "http://www.w3.org/2001/XMLSchema" ); - schemaDocument.LinkEndChild( pSchemaElement ); + // Add schema element. + TiXmlElement* pSchemaElement = new TiXmlElement("xs:schema"); + pSchemaElement->SetAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema"); + schemaDocument.LinkEndChild(pSchemaElement); - // Fetch class-rep root. - AbstractClassRep* pRootType = AbstractClassRep::getClassList(); + // Fetch class-rep root. + AbstractClassRep* pRootType = AbstractClassRep::getClassList(); - // Fetch SimObject class rep. - AbstractClassRep* pSimObjectType = AbstractClassRep::findClassRep( "SimObject" ); - // Sanity! - AssertFatal( pSimObjectType != NULL, "Taml::GenerateTamlSchema() - Could not find SimObject class rep." ); + // Fetch SimObject class rep. + AbstractClassRep* pSimObjectType = AbstractClassRep::findClassRep("SimObject"); + // Sanity! + AssertFatal(pSimObjectType != NULL, "Taml::GenerateTamlSchema() - Could not find SimObject class rep."); - // Reset scratch state. - char buffer[1024]; - HashTable childGroups; + // Reset scratch state. + char buffer[1024]; + HashTable childGroups; - // ************************************************************* - // Generate console type elements. - // ************************************************************* + // ************************************************************* + // Generate console type elements. + // ************************************************************* - // Vector2. - TiXmlComment* pVector2Comment = new TiXmlComment( "Vector2 Console Type" ); - pSchemaElement->LinkEndChild( pVector2Comment ); - TiXmlElement* pVector2TypeElement = new TiXmlElement( "xs:simpleType" ); - pVector2TypeElement->SetAttribute( "name", "Vector2_ConsoleType" ); - pSchemaElement->LinkEndChild( pVector2TypeElement ); - TiXmlElement* pVector2ElementA = new TiXmlElement( "xs:restriction" ); - pVector2ElementA->SetAttribute( "base", "xs:string" ); - pVector2TypeElement->LinkEndChild( pVector2ElementA ); - TiXmlElement* pVector2ElementB = new TiXmlElement( "xs:pattern" ); - pVector2ElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pVector2ElementA->LinkEndChild( pVector2ElementB ); + // Vector2. + TiXmlComment* pVector2Comment = new TiXmlComment("Vector2 Console Type"); + pSchemaElement->LinkEndChild(pVector2Comment); + TiXmlElement* pVector2TypeElement = new TiXmlElement("xs:simpleType"); + pVector2TypeElement->SetAttribute("name", "Vector2_ConsoleType"); + pSchemaElement->LinkEndChild(pVector2TypeElement); + TiXmlElement* pVector2ElementA = new TiXmlElement("xs:restriction"); + pVector2ElementA->SetAttribute("base", "xs:string"); + pVector2TypeElement->LinkEndChild(pVector2ElementA); + TiXmlElement* pVector2ElementB = new TiXmlElement("xs:pattern"); + pVector2ElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pVector2ElementA->LinkEndChild(pVector2ElementB); - // Point2F. - TiXmlComment* pPoint2FComment = new TiXmlComment( "Point2F Console Type" ); - pSchemaElement->LinkEndChild( pPoint2FComment ); - TiXmlElement* pPoint2FTypeElement = new TiXmlElement( "xs:simpleType" ); - pPoint2FTypeElement->SetAttribute( "name", "Point2F_ConsoleType" ); - pSchemaElement->LinkEndChild( pPoint2FTypeElement ); - TiXmlElement* pPoint2FElementA = new TiXmlElement( "xs:restriction" ); - pPoint2FElementA->SetAttribute( "base", "xs:string" ); - pPoint2FTypeElement->LinkEndChild( pPoint2FElementA ); - TiXmlElement* pPoint2FElementB = new TiXmlElement( "xs:pattern" ); - pPoint2FElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pPoint2FElementA->LinkEndChild( pPoint2FElementB ); + // Point2F. + TiXmlComment* pPoint2FComment = new TiXmlComment("Point2F Console Type"); + pSchemaElement->LinkEndChild(pPoint2FComment); + TiXmlElement* pPoint2FTypeElement = new TiXmlElement("xs:simpleType"); + pPoint2FTypeElement->SetAttribute("name", "Point2F_ConsoleType"); + pSchemaElement->LinkEndChild(pPoint2FTypeElement); + TiXmlElement* pPoint2FElementA = new TiXmlElement("xs:restriction"); + pPoint2FElementA->SetAttribute("base", "xs:string"); + pPoint2FTypeElement->LinkEndChild(pPoint2FElementA); + TiXmlElement* pPoint2FElementB = new TiXmlElement("xs:pattern"); + pPoint2FElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pPoint2FElementA->LinkEndChild(pPoint2FElementB); - // Point2I. - TiXmlComment* pPoint2IComment = new TiXmlComment( "Point2I Console Type" ); - pSchemaElement->LinkEndChild( pPoint2IComment ); - TiXmlElement* pPoint2ITypeElement = new TiXmlElement( "xs:simpleType" ); - pPoint2ITypeElement->SetAttribute( "name", "Point2I_ConsoleType" ); - pSchemaElement->LinkEndChild( pPoint2ITypeElement ); - TiXmlElement* pPoint2IElementA = new TiXmlElement( "xs:restriction" ); - pPoint2IElementA->SetAttribute( "base", "xs:string" ); - pPoint2ITypeElement->LinkEndChild( pPoint2IElementA ); - TiXmlElement* pPoint2IElementB = new TiXmlElement( "xs:pattern" ); - pPoint2IElementB->SetAttribute( "value", "[-]?[0-9]* [-]?[0-9]*" ); - pPoint2IElementA->LinkEndChild( pPoint2IElementB ); + // Point2I. + TiXmlComment* pPoint2IComment = new TiXmlComment("Point2I Console Type"); + pSchemaElement->LinkEndChild(pPoint2IComment); + TiXmlElement* pPoint2ITypeElement = new TiXmlElement("xs:simpleType"); + pPoint2ITypeElement->SetAttribute("name", "Point2I_ConsoleType"); + pSchemaElement->LinkEndChild(pPoint2ITypeElement); + TiXmlElement* pPoint2IElementA = new TiXmlElement("xs:restriction"); + pPoint2IElementA->SetAttribute("base", "xs:string"); + pPoint2ITypeElement->LinkEndChild(pPoint2IElementA); + TiXmlElement* pPoint2IElementB = new TiXmlElement("xs:pattern"); + pPoint2IElementB->SetAttribute("value", "[-]?[0-9]* [-]?[0-9]*"); + pPoint2IElementA->LinkEndChild(pPoint2IElementB); - // b2AABB. - TiXmlComment* pb2AABBComment = new TiXmlComment( "b2AABB Console Type" ); - pSchemaElement->LinkEndChild( pb2AABBComment ); - TiXmlElement* pb2AABBTypeElement = new TiXmlElement( "xs:simpleType" ); - pb2AABBTypeElement->SetAttribute( "name", "b2AABB_ConsoleType" ); - pSchemaElement->LinkEndChild( pb2AABBTypeElement ); - TiXmlElement* pb2AABBElementA = new TiXmlElement( "xs:restriction" ); - pb2AABBElementA->SetAttribute( "base", "xs:string" ); - pb2AABBTypeElement->LinkEndChild( pb2AABBElementA ); - TiXmlElement* pb2AABBElementB = new TiXmlElement( "xs:pattern" ); - pb2AABBElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pb2AABBElementA->LinkEndChild( pb2AABBElementB ); + // b2AABB. + TiXmlComment* pb2AABBComment = new TiXmlComment("b2AABB Console Type"); + pSchemaElement->LinkEndChild(pb2AABBComment); + TiXmlElement* pb2AABBTypeElement = new TiXmlElement("xs:simpleType"); + pb2AABBTypeElement->SetAttribute("name", "b2AABB_ConsoleType"); + pSchemaElement->LinkEndChild(pb2AABBTypeElement); + TiXmlElement* pb2AABBElementA = new TiXmlElement("xs:restriction"); + pb2AABBElementA->SetAttribute("base", "xs:string"); + pb2AABBTypeElement->LinkEndChild(pb2AABBElementA); + TiXmlElement* pb2AABBElementB = new TiXmlElement("xs:pattern"); + pb2AABBElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pb2AABBElementA->LinkEndChild(pb2AABBElementB); - // RectI. - TiXmlComment* pRectIComment = new TiXmlComment( "RectI Console Type" ); - pSchemaElement->LinkEndChild( pRectIComment ); - TiXmlElement* pRectITypeElement = new TiXmlElement( "xs:simpleType" ); - pRectITypeElement->SetAttribute( "name", "RectI_ConsoleType" ); - pSchemaElement->LinkEndChild( pRectITypeElement ); - TiXmlElement* pRectIElementA = new TiXmlElement( "xs:restriction" ); - pRectIElementA->SetAttribute( "base", "xs:string" ); - pRectITypeElement->LinkEndChild( pRectIElementA ); - TiXmlElement* pRectIElementB = new TiXmlElement( "xs:pattern" ); - pRectIElementB->SetAttribute( "value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*" ); - pRectIElementA->LinkEndChild( pRectIElementB ); + // RectI. + TiXmlComment* pRectIComment = new TiXmlComment("RectI Console Type"); + pSchemaElement->LinkEndChild(pRectIComment); + TiXmlElement* pRectITypeElement = new TiXmlElement("xs:simpleType"); + pRectITypeElement->SetAttribute("name", "RectI_ConsoleType"); + pSchemaElement->LinkEndChild(pRectITypeElement); + TiXmlElement* pRectIElementA = new TiXmlElement("xs:restriction"); + pRectIElementA->SetAttribute("base", "xs:string"); + pRectITypeElement->LinkEndChild(pRectIElementA); + TiXmlElement* pRectIElementB = new TiXmlElement("xs:pattern"); + pRectIElementB->SetAttribute("value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*"); + pRectIElementA->LinkEndChild(pRectIElementB); - // RectF. - TiXmlComment* pRectFComment = new TiXmlComment( "RectF Console Type" ); - pSchemaElement->LinkEndChild( pRectFComment ); - TiXmlElement* pRectFTypeElement = new TiXmlElement( "xs:simpleType" ); - pRectFTypeElement->SetAttribute( "name", "RectF_ConsoleType" ); - pSchemaElement->LinkEndChild( pRectFTypeElement ); - TiXmlElement* pRectFElementA = new TiXmlElement( "xs:restriction" ); - pRectFElementA->SetAttribute( "base", "xs:string" ); - pRectFTypeElement->LinkEndChild( pRectFElementA ); - TiXmlElement* pRectFElementB = new TiXmlElement( "xs:pattern" ); - pRectFElementB->SetAttribute( "value", "(\\b[-]?(b[0-9]+)?\\.)?[0-9]+\\b" ); - pRectFElementA->LinkEndChild( pRectFElementB ); + // RectF. + TiXmlComment* pRectFComment = new TiXmlComment("RectF Console Type"); + pSchemaElement->LinkEndChild(pRectFComment); + TiXmlElement* pRectFTypeElement = new TiXmlElement("xs:simpleType"); + pRectFTypeElement->SetAttribute("name", "RectF_ConsoleType"); + pSchemaElement->LinkEndChild(pRectFTypeElement); + TiXmlElement* pRectFElementA = new TiXmlElement("xs:restriction"); + pRectFElementA->SetAttribute("base", "xs:string"); + pRectFTypeElement->LinkEndChild(pRectFElementA); + TiXmlElement* pRectFElementB = new TiXmlElement("xs:pattern"); + pRectFElementB->SetAttribute("value", "(\\b[-]?(b[0-9]+)?\\.)?[0-9]+\\b"); + pRectFElementA->LinkEndChild(pRectFElementB); - // AssetId. - TiXmlComment* pAssetIdComment = new TiXmlComment("AssetId Console Type"); - pSchemaElement->LinkEndChild(pAssetIdComment); - TiXmlElement* pAssetIdTypeElement = new TiXmlElement("xs:simpleType"); - pAssetIdTypeElement->SetAttribute("name", "AssetId_ConsoleType"); - pSchemaElement->LinkEndChild(pAssetIdTypeElement); - TiXmlElement* pAssetIdElementA = new TiXmlElement("xs:restriction"); - pAssetIdElementA->SetAttribute("base", "xs:string"); - pAssetIdTypeElement->LinkEndChild(pAssetIdElementA); - TiXmlElement* pAssetIdElementB = new TiXmlElement("xs:pattern"); - dSprintf(buffer, sizeof(buffer), "(%s)?\\b[a-zA-Z0-9]+\\b%s\\b[a-zA-Z0-9]+\\b", ASSET_ID_FIELD_PREFIX, ASSET_SCOPE_TOKEN); - pAssetIdElementB->SetAttribute("value", buffer); - pAssetIdElementA->LinkEndChild(pAssetIdElementB); + // AssetId. + TiXmlComment* pAssetIdComment = new TiXmlComment("AssetId Console Type"); + pSchemaElement->LinkEndChild(pAssetIdComment); + TiXmlElement* pAssetIdTypeElement = new TiXmlElement("xs:simpleType"); + pAssetIdTypeElement->SetAttribute("name", "AssetId_ConsoleType"); + pSchemaElement->LinkEndChild(pAssetIdTypeElement); + TiXmlElement* pAssetIdElementA = new TiXmlElement("xs:restriction"); + pAssetIdElementA->SetAttribute("base", "xs:string"); + pAssetIdTypeElement->LinkEndChild(pAssetIdElementA); + TiXmlElement* pAssetIdElementB = new TiXmlElement("xs:pattern"); + dSprintf(buffer, sizeof(buffer), "(%s)?\\b[a-zA-Z0-9]+\\b%s\\b[a-zA-Z0-9]+\\b", ASSET_ID_FIELD_PREFIX, ASSET_SCOPE_TOKEN); + pAssetIdElementB->SetAttribute("value", buffer); + pAssetIdElementA->LinkEndChild(pAssetIdElementB); - // Color Enums. - TiXmlComment* pColorEnumsComment = new TiXmlComment( "Color Enums" ); - pSchemaElement->LinkEndChild( pColorEnumsComment ); - TiXmlElement* pColorEnumsTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorEnumsTypeElement->SetAttribute( "name", "Color_Enums" ); - pSchemaElement->LinkEndChild( pColorEnumsTypeElement ); - TiXmlElement* pColorEnumsRestrictionElement = new TiXmlElement( "xs:restriction" ); - pColorEnumsRestrictionElement->SetAttribute( "base", "xs:string" ); - pColorEnumsTypeElement->LinkEndChild( pColorEnumsRestrictionElement ); - const S32 ColorEnumsCount = StockColor::getCount(); - for( S32 index = 0; index < ColorEnumsCount; ++index ) - { - // Add enumeration element. - TiXmlElement* pColorEnumsAttributeEnumerationElement = new TiXmlElement( "xs:enumeration" ); - pColorEnumsAttributeEnumerationElement->SetAttribute( "value", StockColor::getColorItem(index)->getColorName() ); - pColorEnumsRestrictionElement->LinkEndChild( pColorEnumsAttributeEnumerationElement ); - } + // Color Enums. + TiXmlComment* pColorEnumsComment = new TiXmlComment("Color Enums"); + pSchemaElement->LinkEndChild(pColorEnumsComment); + TiXmlElement* pColorEnumsTypeElement = new TiXmlElement("xs:simpleType"); + pColorEnumsTypeElement->SetAttribute("name", "Color_Enums"); + pSchemaElement->LinkEndChild(pColorEnumsTypeElement); + TiXmlElement* pColorEnumsRestrictionElement = new TiXmlElement("xs:restriction"); + pColorEnumsRestrictionElement->SetAttribute("base", "xs:string"); + pColorEnumsTypeElement->LinkEndChild(pColorEnumsRestrictionElement); + const S32 ColorEnumsCount = StockColor::getCount(); + for (S32 index = 0; index < ColorEnumsCount; ++index) + { + // Add enumeration element. + TiXmlElement* pColorEnumsAttributeEnumerationElement = new TiXmlElement("xs:enumeration"); + pColorEnumsAttributeEnumerationElement->SetAttribute("value", StockColor::getColorItem(index)->getColorName()); + pColorEnumsRestrictionElement->LinkEndChild(pColorEnumsAttributeEnumerationElement); + } - // LinearColorF. - TiXmlComment* pColorFValuesComment = new TiXmlComment( "LinearColorF Values" ); - pSchemaElement->LinkEndChild( pColorFValuesComment ); - TiXmlElement* pColorFValuesTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorFValuesTypeElement->SetAttribute( "name", "ColorF_Values" ); - pSchemaElement->LinkEndChild( pColorFValuesTypeElement ); - TiXmlElement* pColorFValuesElementA = new TiXmlElement( "xs:restriction" ); - pColorFValuesElementA->SetAttribute( "base", "xs:string" ); - pColorFValuesTypeElement->LinkEndChild( pColorFValuesElementA ); - TiXmlElement* pColorFValuesElementB = new TiXmlElement( "xs:pattern" ); - pColorFValuesElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pColorFValuesElementA->LinkEndChild( pColorFValuesElementB ); + // LinearColorF. + TiXmlComment* pColorFValuesComment = new TiXmlComment("LinearColorF Values"); + pSchemaElement->LinkEndChild(pColorFValuesComment); + TiXmlElement* pColorFValuesTypeElement = new TiXmlElement("xs:simpleType"); + pColorFValuesTypeElement->SetAttribute("name", "ColorF_Values"); + pSchemaElement->LinkEndChild(pColorFValuesTypeElement); + TiXmlElement* pColorFValuesElementA = new TiXmlElement("xs:restriction"); + pColorFValuesElementA->SetAttribute("base", "xs:string"); + pColorFValuesTypeElement->LinkEndChild(pColorFValuesElementA); + TiXmlElement* pColorFValuesElementB = new TiXmlElement("xs:pattern"); + pColorFValuesElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pColorFValuesElementA->LinkEndChild(pColorFValuesElementB); - TiXmlComment* pColorFComment = new TiXmlComment( "LinearColorF Console Type" ); - pSchemaElement->LinkEndChild( pColorFComment ); - TiXmlElement* pColorFTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorFTypeElement->SetAttribute( "name", "ColorF_ConsoleType" ); - pSchemaElement->LinkEndChild( pColorFTypeElement ); - TiXmlElement* pColorFUnionElement = new TiXmlElement( "xs:union" ); - pColorFUnionElement->SetAttribute( "memberTypes", "ColorF_Values Color_Enums" ); - pColorFTypeElement->LinkEndChild( pColorFUnionElement ); + TiXmlComment* pColorFComment = new TiXmlComment("LinearColorF Console Type"); + pSchemaElement->LinkEndChild(pColorFComment); + TiXmlElement* pColorFTypeElement = new TiXmlElement("xs:simpleType"); + pColorFTypeElement->SetAttribute("name", "ColorF_ConsoleType"); + pSchemaElement->LinkEndChild(pColorFTypeElement); + TiXmlElement* pColorFUnionElement = new TiXmlElement("xs:union"); + pColorFUnionElement->SetAttribute("memberTypes", "ColorF_Values Color_Enums"); + pColorFTypeElement->LinkEndChild(pColorFUnionElement); - // ColorI. - TiXmlComment* pColorIValuesComment = new TiXmlComment( "ColorI Values" ); - pSchemaElement->LinkEndChild( pColorIValuesComment ); - TiXmlElement* pColorIValuesTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorIValuesTypeElement->SetAttribute( "name", "ColorI_Values" ); - pSchemaElement->LinkEndChild( pColorIValuesTypeElement ); - TiXmlElement* pColorIValuesElementA = new TiXmlElement( "xs:restriction" ); - pColorIValuesElementA->SetAttribute( "base", "xs:string" ); - pColorIValuesTypeElement->LinkEndChild( pColorIValuesElementA ); - TiXmlElement* pColorIValuesElementB = new TiXmlElement( "xs:pattern" ); - pColorIValuesElementB->SetAttribute( "value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*" ); - pColorIValuesElementA->LinkEndChild( pColorIValuesElementB ); + // ColorI. + TiXmlComment* pColorIValuesComment = new TiXmlComment("ColorI Values"); + pSchemaElement->LinkEndChild(pColorIValuesComment); + TiXmlElement* pColorIValuesTypeElement = new TiXmlElement("xs:simpleType"); + pColorIValuesTypeElement->SetAttribute("name", "ColorI_Values"); + pSchemaElement->LinkEndChild(pColorIValuesTypeElement); + TiXmlElement* pColorIValuesElementA = new TiXmlElement("xs:restriction"); + pColorIValuesElementA->SetAttribute("base", "xs:string"); + pColorIValuesTypeElement->LinkEndChild(pColorIValuesElementA); + TiXmlElement* pColorIValuesElementB = new TiXmlElement("xs:pattern"); + pColorIValuesElementB->SetAttribute("value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*"); + pColorIValuesElementA->LinkEndChild(pColorIValuesElementB); - TiXmlComment* pColorIComment = new TiXmlComment( "ColorI Console Type" ); - pSchemaElement->LinkEndChild( pColorIComment ); - TiXmlElement* pColorITypeElement = new TiXmlElement( "xs:simpleType" ); - pColorITypeElement->SetAttribute( "name", "ColorI_ConsoleType" ); - pSchemaElement->LinkEndChild( pColorITypeElement ); - TiXmlElement* pColorIUnionElement = new TiXmlElement( "xs:union" ); - pColorIUnionElement->SetAttribute( "memberTypes", "ColorI_Values Color_Enums" ); - pColorITypeElement->LinkEndChild( pColorIUnionElement ); + TiXmlComment* pColorIComment = new TiXmlComment("ColorI Console Type"); + pSchemaElement->LinkEndChild(pColorIComment); + TiXmlElement* pColorITypeElement = new TiXmlElement("xs:simpleType"); + pColorITypeElement->SetAttribute("name", "ColorI_ConsoleType"); + pSchemaElement->LinkEndChild(pColorITypeElement); + TiXmlElement* pColorIUnionElement = new TiXmlElement("xs:union"); + pColorIUnionElement->SetAttribute("memberTypes", "ColorI_Values Color_Enums"); + pColorITypeElement->LinkEndChild(pColorIUnionElement); - // ************************************************************* - // Generate engine type elements. - // ************************************************************* + // ************************************************************* + // Generate engine type elements. + // ************************************************************* - // Generate the engine type elements. - TiXmlComment* pComment = new TiXmlComment( "Type Elements" ); - pSchemaElement->LinkEndChild( pComment ); - for ( AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass() ) - { - // Add type. - TiXmlElement* pTypeElement = new TiXmlElement( "xs:element" ); - pTypeElement->SetAttribute( "name", pType->getClassName() ); - dSprintf( buffer, sizeof(buffer), "%s_Type", pType->getClassName() ); - pTypeElement->SetAttribute( "type", buffer ); - pSchemaElement->LinkEndChild( pTypeElement ); - } + // Generate the engine type elements. + TiXmlComment* pComment = new TiXmlComment("Type Elements"); + pSchemaElement->LinkEndChild(pComment); + for (AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass()) + { + // Add type. + TiXmlElement* pTypeElement = new TiXmlElement("xs:element"); + pTypeElement->SetAttribute("name", pType->getClassName()); + dSprintf(buffer, sizeof(buffer), "%s_Type", pType->getClassName()); + pTypeElement->SetAttribute("type", buffer); + pSchemaElement->LinkEndChild(pTypeElement); + } - // ************************************************************* - // Generate the engine complex types. - // ************************************************************* - for ( AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass() ) - { - // Add complex type comment. - dSprintf( buffer, sizeof(buffer), " %s Type ", pType->getClassName() ); - TiXmlComment* pComment = new TiXmlComment( buffer ); - pSchemaElement->LinkEndChild( pComment ); + // ************************************************************* + // Generate the engine complex types. + // ************************************************************* + for (AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass()) + { + // Add complex type comment. + dSprintf(buffer, sizeof(buffer), " %s Type ", pType->getClassName()); + TiXmlComment* pComment = new TiXmlComment(buffer); + pSchemaElement->LinkEndChild(pComment); - // Add complex type. - TiXmlElement* pComplexTypeElement = new TiXmlElement( "xs:complexType" ); - dSprintf( buffer, sizeof(buffer), "%s_Type", pType->getClassName() ); - pComplexTypeElement->SetAttribute( "name", buffer ); - pSchemaElement->LinkEndChild( pComplexTypeElement ); + // Add complex type. + TiXmlElement* pComplexTypeElement = new TiXmlElement("xs:complexType"); + dSprintf(buffer, sizeof(buffer), "%s_Type", pType->getClassName()); + pComplexTypeElement->SetAttribute("name", buffer); + pSchemaElement->LinkEndChild(pComplexTypeElement); - // Add sequence. - TiXmlElement* pSequenceElement = new TiXmlElement( "xs:sequence" ); - pComplexTypeElement->LinkEndChild( pSequenceElement ); + // Add sequence. + TiXmlElement* pSequenceElement = new TiXmlElement("xs:sequence"); + pComplexTypeElement->LinkEndChild(pSequenceElement); - // Fetch container child class. - AbstractClassRep* pContainerChildClass = pType->getContainerChildClass( true ); + // Fetch container child class. + AbstractClassRep* pContainerChildClass = pType->getContainerChildClass(true); - // Is the type allowed children? - if ( pContainerChildClass != NULL ) - { + // Is the type allowed children? + if (pContainerChildClass != NULL) + { // Yes, so add choice element. - TiXmlElement* pChoiceElement = new TiXmlElement( "xs:choice" ); - pChoiceElement->SetAttribute( "minOccurs", 0 ); - pChoiceElement->SetAttribute( "maxOccurs", "unbounded" ); - pSequenceElement->LinkEndChild( pChoiceElement ); + TiXmlElement* pChoiceElement = new TiXmlElement("xs:choice"); + pChoiceElement->SetAttribute("minOccurs", 0); + pChoiceElement->SetAttribute("maxOccurs", "unbounded"); + pSequenceElement->LinkEndChild(pChoiceElement); // Find child group. - HashTable::Iterator childGroupItr = childGroups.find( pContainerChildClass ); + HashTable::Iterator childGroupItr = childGroups.find(pContainerChildClass); // Does the group exist? - if ( childGroupItr == childGroups.end() ) + if (childGroupItr == childGroups.end()) { - // No, so format group name. - dSprintf( buffer, sizeof(buffer), "%s_ChildrenTypes", pContainerChildClass->getClassName() ); + // No, so format group name. + dSprintf(buffer, sizeof(buffer), "%s_ChildrenTypes", pContainerChildClass->getClassName()); - // Insert into child group hash. - childGroupItr = childGroups.insertUnique( pContainerChildClass, StringTable->insert( buffer ) ); + // Insert into child group hash. + childGroupItr = childGroups.insertUnique(pContainerChildClass, StringTable->insert(buffer)); - // Add the group. - TiXmlElement* pChildrenGroupElement = new TiXmlElement( "xs:group" ); - pChildrenGroupElement->SetAttribute( "name", buffer ); - pSchemaElement->LinkEndChild( pChildrenGroupElement ); + // Add the group. + TiXmlElement* pChildrenGroupElement = new TiXmlElement("xs:group"); + pChildrenGroupElement->SetAttribute("name", buffer); + pSchemaElement->LinkEndChild(pChildrenGroupElement); - // Add choice element. - TiXmlElement* pChildreGroupChoiceElement = new TiXmlElement( "xs:choice" ); - pChildrenGroupElement->LinkEndChild( pChildreGroupChoiceElement ); + // Add choice element. + TiXmlElement* pChildreGroupChoiceElement = new TiXmlElement("xs:choice"); + pChildrenGroupElement->LinkEndChild(pChildreGroupChoiceElement); - // Add choice members. - for ( AbstractClassRep* pChoiceType = pRootType; pChoiceType != NULL; pChoiceType = pChoiceType->getNextClass() ) - { - // Skip if not derived from the container child class. - if ( !pChoiceType->isClass( pContainerChildClass ) ) - continue; + // Add choice members. + for (AbstractClassRep* pChoiceType = pRootType; pChoiceType != NULL; pChoiceType = pChoiceType->getNextClass()) + { + // Skip if not derived from the container child class. + if (!pChoiceType->isClass(pContainerChildClass)) + continue; - // Add choice member. - TiXmlElement* pChildrenMemberElement = new TiXmlElement( "xs:element" ); - pChildrenMemberElement->SetAttribute( "name", pChoiceType->getClassName() ); - dSprintf( buffer, sizeof(buffer), "%s_Type", pChoiceType->getClassName() ); - pChildrenMemberElement->SetAttribute( "type", buffer ); - pChildreGroupChoiceElement->LinkEndChild( pChildrenMemberElement ); - } + // Add choice member. + TiXmlElement* pChildrenMemberElement = new TiXmlElement("xs:element"); + pChildrenMemberElement->SetAttribute("name", pChoiceType->getClassName()); + dSprintf(buffer, sizeof(buffer), "%s_Type", pChoiceType->getClassName()); + pChildrenMemberElement->SetAttribute("type", buffer); + pChildreGroupChoiceElement->LinkEndChild(pChildrenMemberElement); + } } // Reference the child group. - TiXmlElement* pChoiceGroupReferenceElement = new TiXmlElement( "xs:group" ); - pChoiceGroupReferenceElement->SetAttribute( "ref", childGroupItr->value ); - pChoiceGroupReferenceElement->SetAttribute( "minOccurs", 0 ); - pChoiceElement->LinkEndChild( pChoiceGroupReferenceElement ); - } + TiXmlElement* pChoiceGroupReferenceElement = new TiXmlElement("xs:group"); + pChoiceGroupReferenceElement->SetAttribute("ref", childGroupItr->value); + pChoiceGroupReferenceElement->SetAttribute("minOccurs", 0); + pChoiceElement->LinkEndChild(pChoiceGroupReferenceElement); + } - // Generate the custom Taml schema. - for ( AbstractClassRep* pCustomSchemaType = pType; pCustomSchemaType != NULL; pCustomSchemaType = pCustomSchemaType->getParentClass() ) - { + // Generate the custom Taml schema. + for (AbstractClassRep* pCustomSchemaType = pType; pCustomSchemaType != NULL; pCustomSchemaType = pCustomSchemaType->getParentClass()) + { // Fetch the types custom TAML schema function. AbstractClassRep::WriteCustomTamlSchema customSchemaFn = pCustomSchemaType->getCustomTamlSchema(); // Skip if no function avilable. - if ( customSchemaFn == NULL ) - continue; + if (customSchemaFn == NULL) + continue; // Call schema generation function. - customSchemaFn( pType, pSequenceElement ); - } + customSchemaFn(pType, pSequenceElement); + } - // Generate field attribute group. - TiXmlElement* pFieldAttributeGroupElement = new TiXmlElement( "xs:attributeGroup" ); - dSprintf( buffer, sizeof(buffer), "%s_Fields", pType->getClassName() ); - pFieldAttributeGroupElement->SetAttribute( "name", buffer ); - pSchemaElement->LinkEndChild( pFieldAttributeGroupElement ); + // Generate field attribute group. + TiXmlElement* pFieldAttributeGroupElement = new TiXmlElement("xs:attributeGroup"); + dSprintf(buffer, sizeof(buffer), "%s_Fields", pType->getClassName()); + pFieldAttributeGroupElement->SetAttribute("name", buffer); + pSchemaElement->LinkEndChild(pFieldAttributeGroupElement); - // Fetch field list. - const AbstractClassRep::FieldList& fields = pType->mFieldList; + // Fetch field list. + const AbstractClassRep::FieldList& fields = pType->mFieldList; - // Fetcj field count. - const S32 fieldCount = fields.size(); + // Fetcj field count. + const S32 fieldCount = fields.size(); - // Iterate static fields (in reverse as most types are organized from the root-fields up). - for( S32 index = fieldCount-1; index > 0; --index ) - { + // Iterate static fields (in reverse as most types are organized from the root-fields up). + for (S32 index = fieldCount - 1; index > 0; --index) + { // Fetch field. const AbstractClassRep::Field& field = fields[index]; // Skip if not a data field. - if( field.type == AbstractClassRep::DeprecatedFieldType || - field.type == AbstractClassRep::StartGroupFieldType || - field.type == AbstractClassRep::EndGroupFieldType ) - continue; + if (field.type == AbstractClassRep::DeprecatedFieldType || + field.type == AbstractClassRep::StartGroupFieldType || + field.type == AbstractClassRep::EndGroupFieldType) + continue; // Skip if the field root is not this type. - if ( pType->findFieldRoot( field.pFieldname ) != pType ) - continue; + if (pType->findFieldRoot(field.pFieldname) != pType) + continue; // Add attribute element. - TiXmlElement* pAttributeElement = new TiXmlElement( "xs:attribute" ); - pAttributeElement->SetAttribute( "name", field.pFieldname ); + TiXmlElement* pAttributeElement = new TiXmlElement("xs:attribute"); + pAttributeElement->SetAttribute("name", field.pFieldname); // Handle the console type appropriately. const S32 fieldType = (S32)field.type; @@ -1381,168 +1383,168 @@ bool Taml::generateTamlSchema() // Is the field an enumeration? if ( fieldType == TypeEnum ) { - // Yes, so add attribute type. - TiXmlElement* pAttributeSimpleTypeElement = new TiXmlElement( "xs:simpleType" ); - pAttributeElement->LinkEndChild( pAttributeSimpleTypeElement ); + // Yes, so add attribute type. + TiXmlElement* pAttributeSimpleTypeElement = new TiXmlElement( "xs:simpleType" ); + pAttributeElement->LinkEndChild( pAttributeSimpleTypeElement ); - // Add restriction element. - TiXmlElement* pAttributeRestrictionElement = new TiXmlElement( "xs:restriction" ); - pAttributeRestrictionElement->SetAttribute( "base", "xs:string" ); - pAttributeSimpleTypeElement->LinkEndChild( pAttributeRestrictionElement ); + // Add restriction element. + TiXmlElement* pAttributeRestrictionElement = new TiXmlElement( "xs:restriction" ); + pAttributeRestrictionElement->SetAttribute( "base", "xs:string" ); + pAttributeSimpleTypeElement->LinkEndChild( pAttributeRestrictionElement ); - // Yes, so fetch enumeration count. - const S32 enumCount = field.table->size; + // Yes, so fetch enumeration count. + const S32 enumCount = field.table->size; - // Iterate enumeration. - for( S32 index = 0; index < enumCount; ++index ) - { - // Add enumeration element. - TiXmlElement* pAttributeEnumerationElement = new TiXmlElement( "xs:enumeration" ); - pAttributeEnumerationElement->SetAttribute( "value", field.table->table[index].label ); - pAttributeRestrictionElement->LinkEndChild( pAttributeEnumerationElement ); - } + // Iterate enumeration. + for( S32 index = 0; index < enumCount; ++index ) + { + // Add enumeration element. + TiXmlElement* pAttributeEnumerationElement = new TiXmlElement( "xs:enumeration" ); + pAttributeEnumerationElement->SetAttribute( "value", field.table->table[index].label ); + pAttributeRestrictionElement->LinkEndChild( pAttributeEnumerationElement ); + } } else {*/ - // No, so assume it's a string type initially. - const char* pFieldTypeDescription = "xs:string"; + // No, so assume it's a string type initially. + const char* pFieldTypeDescription = "xs:string"; - // Handle known types. - if( fieldType == TypeF32 ) - { - pFieldTypeDescription = "xs:float"; - } - else if( fieldType == TypeS8 || fieldType == TypeS32 ) - { - pFieldTypeDescription = "xs:int"; - } - else if( fieldType == TypeBool || fieldType == TypeFlag ) - { - pFieldTypeDescription = "xs:boolean"; - } - else if( fieldType == TypePoint2F ) - { - pFieldTypeDescription = "Point2F_ConsoleType"; - } - else if( fieldType == TypePoint2I ) - { - pFieldTypeDescription = "Point2I_ConsoleType"; - } - else if( fieldType == TypeRectI ) - { - pFieldTypeDescription = "RectI_ConsoleType"; - } - else if( fieldType == TypeRectF ) - { - pFieldTypeDescription = "RectF_ConsoleType"; - } - else if( fieldType == TypeColorF ) - { - pFieldTypeDescription = "ColorF_ConsoleType"; - } - else if( fieldType == TypeColorI ) - { - pFieldTypeDescription = "ColorI_ConsoleType"; - } - else if (fieldType == TypeAssetId/* || - fieldType == TypeImageAssetPtr || - fieldType == TypeAnimationAssetPtr || - fieldType == TypeAudioAssetPtr*/) - { - pFieldTypeDescription = "AssetId_ConsoleType"; - } + // Handle known types. + if (fieldType == TypeF32) + { + pFieldTypeDescription = "xs:float"; + } + else if (fieldType == TypeS8 || fieldType == TypeS32) + { + pFieldTypeDescription = "xs:int"; + } + else if (fieldType == TypeBool || fieldType == TypeFlag) + { + pFieldTypeDescription = "xs:boolean"; + } + else if (fieldType == TypePoint2F) + { + pFieldTypeDescription = "Point2F_ConsoleType"; + } + else if (fieldType == TypePoint2I) + { + pFieldTypeDescription = "Point2I_ConsoleType"; + } + else if (fieldType == TypeRectI) + { + pFieldTypeDescription = "RectI_ConsoleType"; + } + else if (fieldType == TypeRectF) + { + pFieldTypeDescription = "RectF_ConsoleType"; + } + else if (fieldType == TypeColorF) + { + pFieldTypeDescription = "ColorF_ConsoleType"; + } + else if (fieldType == TypeColorI) + { + pFieldTypeDescription = "ColorI_ConsoleType"; + } + else if (fieldType == TypeAssetId/* || + fieldType == TypeImageAssetPtr || + fieldType == TypeAnimationAssetPtr || + fieldType == TypeAudioAssetPtr*/) + { + pFieldTypeDescription = "AssetId_ConsoleType"; + } - // Set attribute type. - pAttributeElement->SetAttribute( "type", pFieldTypeDescription ); + // Set attribute type. + pAttributeElement->SetAttribute("type", pFieldTypeDescription); //} - pAttributeElement->SetAttribute( "use", "optional" ); - pFieldAttributeGroupElement->LinkEndChild( pAttributeElement ); - } + pAttributeElement->SetAttribute("use", "optional"); + pFieldAttributeGroupElement->LinkEndChild(pAttributeElement); + } - // Is this the SimObject Type? - if ( pType == pSimObjectType ) - { + // Is this the SimObject Type? + if (pType == pSimObjectType) + { // Yes, so add reserved Taml field attributes here... // Add Taml "Name" attribute element. - TiXmlElement* pNameAttributeElement = new TiXmlElement( "xs:attribute" ); - pNameAttributeElement->SetAttribute( "name", tamlNamedObjectName ); - pNameAttributeElement->SetAttribute( "type", "xs:normalizedString" ); - pFieldAttributeGroupElement->LinkEndChild( pNameAttributeElement ); + TiXmlElement* pNameAttributeElement = new TiXmlElement("xs:attribute"); + pNameAttributeElement->SetAttribute("name", tamlNamedObjectName); + pNameAttributeElement->SetAttribute("type", "xs:normalizedString"); + pFieldAttributeGroupElement->LinkEndChild(pNameAttributeElement); // Add Taml "TamlId" attribute element. - TiXmlElement* pTamlIdAttributeElement = new TiXmlElement( "xs:attribute" ); - pTamlIdAttributeElement->SetAttribute( "name", tamlRefIdName ); - pTamlIdAttributeElement->SetAttribute( "type", "xs:nonNegativeInteger" ); - pFieldAttributeGroupElement->LinkEndChild( pTamlIdAttributeElement ); + TiXmlElement* pTamlIdAttributeElement = new TiXmlElement("xs:attribute"); + pTamlIdAttributeElement->SetAttribute("name", tamlRefIdName); + pTamlIdAttributeElement->SetAttribute("type", "xs:nonNegativeInteger"); + pFieldAttributeGroupElement->LinkEndChild(pTamlIdAttributeElement); // Add Taml "TamlRefId" attribute element. - TiXmlElement* pTamlRefIdAttributeElement = new TiXmlElement( "xs:attribute" ); - pTamlRefIdAttributeElement->SetAttribute( "name", tamlRefToIdName ); - pTamlRefIdAttributeElement->SetAttribute( "type", "xs:nonNegativeInteger" ); - pFieldAttributeGroupElement->LinkEndChild( pTamlRefIdAttributeElement ); - } + TiXmlElement* pTamlRefIdAttributeElement = new TiXmlElement("xs:attribute"); + pTamlRefIdAttributeElement->SetAttribute("name", tamlRefToIdName); + pTamlRefIdAttributeElement->SetAttribute("type", "xs:nonNegativeInteger"); + pFieldAttributeGroupElement->LinkEndChild(pTamlRefIdAttributeElement); + } - // Add attribute group types. - for ( AbstractClassRep* pAttributeGroupsType = pType; pAttributeGroupsType != NULL; pAttributeGroupsType = pAttributeGroupsType->getParentClass() ) - { - TiXmlElement* pFieldAttributeGroupRefElement = new TiXmlElement( "xs:attributeGroup" ); - dSprintf( buffer, sizeof(buffer), "%s_Fields", pAttributeGroupsType->getClassName() ); - pFieldAttributeGroupRefElement->SetAttribute( "ref", buffer ); - pComplexTypeElement->LinkEndChild( pFieldAttributeGroupRefElement ); - } + // Add attribute group types. + for (AbstractClassRep* pAttributeGroupsType = pType; pAttributeGroupsType != NULL; pAttributeGroupsType = pAttributeGroupsType->getParentClass()) + { + TiXmlElement* pFieldAttributeGroupRefElement = new TiXmlElement("xs:attributeGroup"); + dSprintf(buffer, sizeof(buffer), "%s_Fields", pAttributeGroupsType->getClassName()); + pFieldAttributeGroupRefElement->SetAttribute("ref", buffer); + pComplexTypeElement->LinkEndChild(pFieldAttributeGroupRefElement); + } - // Add "any" attribute element (dynamic fields). - TiXmlElement* pAnyAttributeElement = new TiXmlElement( "xs:anyAttribute" ); - pAnyAttributeElement->SetAttribute( "processContents", "skip" ); - pComplexTypeElement->LinkEndChild( pAnyAttributeElement ); - } + // Add "any" attribute element (dynamic fields). + TiXmlElement* pAnyAttributeElement = new TiXmlElement("xs:anyAttribute"); + pAnyAttributeElement->SetAttribute("processContents", "skip"); + pComplexTypeElement->LinkEndChild(pAnyAttributeElement); + } - // Write the schema document. - schemaDocument.SaveFile( filePathBuffer ); + // Write the schema document. + schemaDocument.SaveFile(filePathBuffer); - // Close file. - stream.close(); + // Close file. + stream.close(); - return true; -} + return true; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::WriteUnrestrictedCustomTamlSchema( const char* pCustomNodeName, const AbstractClassRep* pClassRep, TiXmlElement* pParentElement ) -{ - // Sanity! - AssertFatal( pCustomNodeName != NULL, "Taml::WriteDefaultCustomTamlSchema() - Node name cannot be NULL." ); - AssertFatal( pClassRep != NULL, "Taml::WriteDefaultCustomTamlSchema() - ClassRep cannot be NULL." ); - AssertFatal( pParentElement != NULL, "Taml::WriteDefaultCustomTamlSchema() - Parent Element cannot be NULL." ); + void Taml::WriteUnrestrictedCustomTamlSchema(const char* pCustomNodeName, const AbstractClassRep* pClassRep, TiXmlElement* pParentElement) + { + // Sanity! + AssertFatal(pCustomNodeName != NULL, "Taml::WriteDefaultCustomTamlSchema() - Node name cannot be NULL."); + AssertFatal(pClassRep != NULL, "Taml::WriteDefaultCustomTamlSchema() - ClassRep cannot be NULL."); + AssertFatal(pParentElement != NULL, "Taml::WriteDefaultCustomTamlSchema() - Parent Element cannot be NULL."); - char buffer[1024]; + char buffer[1024]; - // Add custom type element. - TiXmlElement* pCustomElement = new TiXmlElement( "xs:element" ); - dSprintf( buffer, sizeof(buffer), "%s.%s", pClassRep->getClassName(), pCustomNodeName ); - pCustomElement->SetAttribute( "name", buffer ); - pCustomElement->SetAttribute( "minOccurs", 0 ); - pCustomElement->SetAttribute( "maxOccurs", 1 ); - pParentElement->LinkEndChild( pCustomElement ); + // Add custom type element. + TiXmlElement* pCustomElement = new TiXmlElement("xs:element"); + dSprintf(buffer, sizeof(buffer), "%s.%s", pClassRep->getClassName(), pCustomNodeName); + pCustomElement->SetAttribute("name", buffer); + pCustomElement->SetAttribute("minOccurs", 0); + pCustomElement->SetAttribute("maxOccurs", 1); + pParentElement->LinkEndChild(pCustomElement); - // Add complex type element. - TiXmlElement* pComplexTypeElement = new TiXmlElement( "xs:complexType" ); - pCustomElement->LinkEndChild( pComplexTypeElement ); + // Add complex type element. + TiXmlElement* pComplexTypeElement = new TiXmlElement("xs:complexType"); + pCustomElement->LinkEndChild(pComplexTypeElement); - // Add choice element. - TiXmlElement* pChoiceElement = new TiXmlElement( "xs:choice" ); - pChoiceElement->SetAttribute( "minOccurs", 0 ); - pChoiceElement->SetAttribute( "maxOccurs", "unbounded" ); - pComplexTypeElement->LinkEndChild( pChoiceElement ); + // Add choice element. + TiXmlElement* pChoiceElement = new TiXmlElement("xs:choice"); + pChoiceElement->SetAttribute("minOccurs", 0); + pChoiceElement->SetAttribute("maxOccurs", "unbounded"); + pComplexTypeElement->LinkEndChild(pChoiceElement); - // Add sequence element. - TiXmlElement* pSequenceElement = new TiXmlElement( "xs:sequence" ); - pChoiceElement->LinkEndChild( pSequenceElement ); + // Add sequence element. + TiXmlElement* pSequenceElement = new TiXmlElement("xs:sequence"); + pChoiceElement->LinkEndChild(pSequenceElement); - // Add "any" element. - TiXmlElement* pAnyElement = new TiXmlElement( "xs:any" ); - pAnyElement->SetAttribute( "processContents", "skip" ); - pSequenceElement->LinkEndChild( pAnyElement ); -} + // Add "any" element. + TiXmlElement* pAnyElement = new TiXmlElement("xs:any"); + pAnyElement->SetAttribute("processContents", "skip"); + pSequenceElement->LinkEndChild(pAnyElement); + } \ No newline at end of file diff --git a/Engine/source/platform/menus/menuBar.cpp b/Engine/source/platform/menus/menuBar.cpp deleted file mode 100644 index cb70838a8..000000000 --- a/Engine/source/platform/menus/menuBar.cpp +++ /dev/null @@ -1,127 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/platform.h" -#include "platform/menus/menuBar.h" -#include "platform/menus/popupMenu.h" -#include "gui/core/guiCanvas.h" -#include "console/engineAPI.h" - -//----------------------------------------------------------------------------- -// Constructor/Destructor -//----------------------------------------------------------------------------- - -MenuBar::MenuBar() -{ - createPlatformPopupMenuData(); - - mCanvas = NULL; -} - -MenuBar::~MenuBar() -{ - removeFromCanvas(); - - deletePlatformPopupMenuData(); -} - -IMPLEMENT_CONOBJECT(MenuBar); - -ConsoleDocClass( MenuBar, - "@brief Used for rendering platform menu bars\n\n" - "Internal use only\n\n" - "@internal" -); - -//----------------------------------------------------------------------------- -// Public Methods -//----------------------------------------------------------------------------- - -void MenuBar::addObject(SimObject *obj) -{ - Parent::addObject(obj); - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::removeObject(SimObject *obj) -{ - Parent::removeObject(obj); - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::insertObject(SimObject *obj, S32 pos) -{ - Parent::addObject(obj); - - if(pos >= size()) - pos = size() - 1; - - if(pos < size()) - { - if(pos < 0) pos = 0; - Parent::reOrder(obj, at(pos)); - } - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::pushObject(SimObject *obj) -{ - Parent::pushObject(obj); - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::popObject() -{ - Parent::popObject(); - updateMenuBar(); -} - -bool MenuBar::reOrder(SimObject *obj, SimObject *target /*= 0*/) -{ - bool ret = Parent::reOrder(obj, target); - if(ret) - updateMenuBar(dynamic_cast(obj)); - return ret; -} - -//----------------------------------------------------------------------------- -// Console Methods -//----------------------------------------------------------------------------- - -DefineConsoleMethod(MenuBar, attachToCanvas, void, (const char *canvas, S32 pos), , "(GuiCanvas, pos)") -{ - object->attachToCanvas(dynamic_cast(Sim::findObject(canvas)), pos); -} - -DefineConsoleMethod(MenuBar, removeFromCanvas, void, (), , "()") -{ - object->removeFromCanvas(); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(MenuBar, insert, void, (SimObject* pObject, S32 pos), ,"(object, pos) insert object at position") -{ - - if(pObject) - object->insertObject(pObject, pos); -} diff --git a/Engine/source/platform/menus/popupMenu.cpp b/Engine/source/platform/menus/popupMenu.cpp deleted file mode 100644 index 7e8aad7ba..000000000 --- a/Engine/source/platform/menus/popupMenu.cpp +++ /dev/null @@ -1,269 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/menus/popupMenu.h" -#include "console/consoleTypes.h" -#include "console/engineAPI.h" -#include "gui/core/guiCanvas.h" -#include "core/util/safeDelete.h" - -static U32 sMaxPopupGUID = 0; -PopupMenuEvent PopupMenu::smPopupMenuEvent; -bool PopupMenu::smSelectionEventHandled = false; - -/// Event class used to remove popup menus from the event notification in a safe way -class PopUpNotifyRemoveEvent : public SimEvent -{ -public: - void process(SimObject *object) - { - PopupMenu::smPopupMenuEvent.remove((PopupMenu *)object, &PopupMenu::handleSelectEvent); - } -}; - -//----------------------------------------------------------------------------- -// Constructor/Destructor -//----------------------------------------------------------------------------- - -PopupMenu::PopupMenu() : mCanvas(NULL) -{ - createPlatformPopupMenuData(); - - mSubmenus = new SimSet; - mSubmenus->registerObject(); - - mBarTitle = StringTable->EmptyString(); - mIsPopup = false; - - mPopupGUID = sMaxPopupGUID++; -} - -PopupMenu::~PopupMenu() -{ - // This searches the menu bar so is safe to call for menus - // that aren't on it, since nothing will happen. - removeFromMenuBar(); - - SimSet::iterator i; - while((i = mSubmenus->begin()) != mSubmenus->end()) - { - (*i)->deleteObject(); - } - - mSubmenus->deleteObject(); - deletePlatformPopupMenuData(); - - PopupMenu::smPopupMenuEvent.remove(this, &PopupMenu::handleSelectEvent); -} - -IMPLEMENT_CONOBJECT(PopupMenu); - -ConsoleDocClass( PopupMenu, - "@brief PopupMenu represents a system menu.\n\n" - "You can add menu items to the menu, but there is no torque object associated " - "with these menu items, they exist only in a platform specific manner.\n\n" - "@note Internal use only\n\n" - "@internal" -); - - -//----------------------------------------------------------------------------- - -void PopupMenu::initPersistFields() -{ - addField("isPopup", TypeBool, Offset(mIsPopup, PopupMenu), "true if this is a pop-up/context menu. defaults to false."); - addField("barTitle", TypeCaseString, Offset(mBarTitle, PopupMenu), "the title of this menu when attached to a menu bar"); - - Parent::initPersistFields(); -} - -//----------------------------------------------------------------------------- - -bool PopupMenu::onAdd() -{ - if(! Parent::onAdd()) - return false; - - createPlatformMenu(); - - Con::executef(this, "onAdd"); - return true; -} - -void PopupMenu::onRemove() -{ - Con::executef(this, "onRemove"); - - Parent::onRemove(); -} - -//----------------------------------------------------------------------------- - -void PopupMenu::onMenuSelect() -{ - Con::executef(this, "onMenuSelect"); -} - -//----------------------------------------------------------------------------- - -void PopupMenu::handleSelectEvent(U32 popID, U32 command) -{ - if (popID == mPopupGUID && canHandleID(command)) - if (handleSelect(command)) - smSelectionEventHandled = true; -} - -//----------------------------------------------------------------------------- - -void PopupMenu::onAttachToMenuBar(GuiCanvas *canvas, S32 pos, const char *title) -{ - mCanvas = canvas; - - // Attached menus must be notified of menu events - smPopupMenuEvent.notify(this, &PopupMenu::handleSelectEvent); - - // Pass on to sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *mnu = dynamic_cast(*i); - if(mnu == NULL) - continue; - - mnu->onAttachToMenuBar(canvas, pos, title); - } - - // Call script - if(isProperlyAdded()) - Con::executef(this, "onAttachToMenuBar", Con::getIntArg(canvas ? canvas->getId() : 0), Con::getIntArg(pos), title); -} - -void PopupMenu::onRemoveFromMenuBar(GuiCanvas *canvas) -{ - mCanvas = NULL; - - // We are no longer interested in select events, remove ourselves from the notification list in a safe way - Sim::postCurrentEvent(this, new PopUpNotifyRemoveEvent()); - - // Pass on to sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *mnu = dynamic_cast(*i); - if(mnu == NULL) - continue; - - mnu->onRemoveFromMenuBar(canvas); - } - - // Call script - if(isProperlyAdded()) - Con::executef(this, "onRemoveFromMenuBar", Con::getIntArg(canvas ? canvas->getId() : 0)); -} - -//----------------------------------------------------------------------------- - -bool PopupMenu::onMessageReceived(StringTableEntry queue, const char* event, const char* data) -{ - return Con::executef(this, "onMessageReceived", queue, event, data); -} - - -bool PopupMenu::onMessageObjectReceived(StringTableEntry queue, Message *msg ) -{ - return Con::executef(this, "onMessageReceived", queue, Con::getIntArg(msg->getId())); -} - -//----------------------------------------------------------------------------- -// Console Methods -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd), ("", "", ""), "(pos[, title][, accelerator][, cmd])") -{ - return object->insertItem(pos, title, accelerator, cmd); -} - -DefineConsoleMethod(PopupMenu, removeItem, void, (S32 pos), , "(pos)") -{ - object->removeItem(pos); -} - -DefineConsoleMethod(PopupMenu, insertSubMenu, S32, (S32 pos, String title, String subMenu), , "(pos, title, subMenu)") -{ - PopupMenu *mnu = dynamic_cast(Sim::findObject(subMenu)); - if(mnu == NULL) - { - Con::errorf("PopupMenu::insertSubMenu - Invalid PopupMenu object specified for submenu"); - return -1; - } - return object->insertSubMenu(pos, title, mnu); -} - -DefineConsoleMethod(PopupMenu, setItem, bool, (S32 pos, const char * title, const char * accelerator, const char *cmd), (""), "(pos, title[, accelerator][, cmd])") -{ - return object->setItem(pos, title, accelerator, cmd); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, enableItem, void, (S32 pos, bool enabled), , "(pos, enabled)") -{ - object->enableItem(pos, enabled); -} - -DefineConsoleMethod(PopupMenu, checkItem, void, (S32 pos, bool checked), , "(pos, checked)") -{ - object->checkItem(pos, checked); -} - -DefineConsoleMethod(PopupMenu, checkRadioItem, void, (S32 firstPos, S32 lastPos, S32 checkPos), , "(firstPos, lastPos, checkPos)") -{ - object->checkRadioItem(firstPos, lastPos, checkPos); -} - -DefineConsoleMethod(PopupMenu, isItemChecked, bool, (S32 pos), , "(pos)") -{ - return object->isItemChecked(pos); -} - -DefineConsoleMethod(PopupMenu, getItemCount, S32, (), , "()") -{ - return object->getItemCount(); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, attachToMenuBar, void, (const char * canvasName, S32 pos, const char * title), , "(GuiCanvas, pos, title)") -{ - object->attachToMenuBar(dynamic_cast(Sim::findObject(canvasName)), pos, title); -} - -DefineConsoleMethod(PopupMenu, removeFromMenuBar, void, (), , "()") -{ - object->removeFromMenuBar(); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") -{ - GuiCanvas *pCanvas = dynamic_cast(Sim::findObject(canvasName)); - object->showPopup(pCanvas, x, y); -} diff --git a/Engine/source/platform/nativeDialogs/fileDialog.cpp b/Engine/source/platform/nativeDialogs/fileDialog.cpp index 09ed1c63e..ad8bdfafb 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.cpp +++ b/Engine/source/platform/nativeDialogs/fileDialog.cpp @@ -122,6 +122,7 @@ FileDialog::FileDialog() : mData() // Default to File Must Exist Open Dialog style mData.mStyle = FileDialogData::FDS_OPEN | FileDialogData::FDS_MUSTEXIST; mChangePath = false; + mForceRelativePath = true; } FileDialog::~FileDialog() @@ -151,6 +152,8 @@ void FileDialog::initPersistFields() addProtectedField("changePath", TypeBool, Offset(mChangePath, FileDialog), &setChangePath, &getChangePath, "True/False whether to set the working directory to the directory returned by the dialog."); + addField("forceRelativePath", TypeBool, Offset(mForceRelativePath, FileDialog), "True/False whether to the path returned is always made to be relative."); + Parent::initPersistFields(); } @@ -252,12 +255,14 @@ bool FileDialog::Execute() rootDir.replace("/", "\\"); #endif - if (mData.mStyle & FileDialogData::FDS_OPEN) + if (mData.mStyle & FileDialogData::FDS_OPEN && !(mData.mStyle & FileDialogData::FDS_BROWSEFOLDER)) result = NFD_OpenDialog(strippedFilters.c_str(), defaultPath.c_str(), &outPath); - else if (mData.mStyle & FileDialogData::FDS_SAVE) + else if (mData.mStyle & FileDialogData::FDS_SAVE && !(mData.mStyle & FileDialogData::FDS_BROWSEFOLDER)) result = NFD_SaveDialog(strippedFilters.c_str(), defaultPath.c_str(), &outPath); else if (mData.mStyle & FileDialogData::FDS_MULTIPLEFILES) result = NFD_OpenDialogMultiple(strippedFilters.c_str(), defaultPath.c_str(), &pathSet); + else if (mData.mStyle & FileDialogData::FDS_BROWSEFOLDER) + result = NFD_PickFolder(defaultPath.c_str(), &outPath); if (result == NFD_CANCEL) { @@ -265,7 +270,8 @@ bool FileDialog::Execute() } String resultPath = String(outPath).replace(rootDir, String("")); - resultPath = resultPath.replace(0, 1, String("")).c_str(); //kill '\\' prefix + if(resultPath[0] == '\\') + resultPath = resultPath.replace(0, 1, String("")).c_str(); //kill '\\' prefix resultPath = resultPath.replace(String("\\"), String("/")); // Did we select a file? @@ -278,7 +284,10 @@ bool FileDialog::Execute() if (mData.mStyle & FileDialogData::FDS_OPEN || mData.mStyle & FileDialogData::FDS_SAVE) { // Single file selection, do it the easy way - mData.mFile = Platform::makeRelativePathName(resultPath.c_str(), NULL); + if(mForceRelativePath) + mData.mFile = Platform::makeRelativePathName(resultPath.c_str(), NULL); + else + mData.mFile = resultPath.c_str(); } else if (mData.mStyle & FileDialogData::FDS_MULTIPLEFILES) { @@ -298,7 +307,11 @@ bool FileDialog::Execute() else { //nope, just one file, so set it as normal - setDataField(StringTable->insert("files"), "0", Platform::makeRelativePathName(resultPath.c_str(), NULL)); + if (mForceRelativePath) + setDataField(StringTable->insert("files"), "0", Platform::makeRelativePathName(resultPath.c_str(), NULL)); + else + setDataField(StringTable->insert("files"), "0", resultPath.c_str()); + setDataField(StringTable->insert("fileCount"), NULL, "1"); } } diff --git a/Engine/source/platform/nativeDialogs/fileDialog.h b/Engine/source/platform/nativeDialogs/fileDialog.h index b5b4ed618..7c08b51ae 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.h +++ b/Engine/source/platform/nativeDialogs/fileDialog.h @@ -106,6 +106,7 @@ protected: FileDialogData mData; ///< Stores platform agnostic information about the dialogs properties bool mChangePath; ///< Exposed ChangePath Property bool mBoolTranslator; ///< Internally used to translate boolean values into their respective bits of dialog style + bool mForceRelativePath; public: FileDialog(); diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 061b22942..a77d29474 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -1672,7 +1672,7 @@ Net::Error Net::send(NetSocket handleFd, const U8 *buffer, S32 bufferSize, S32 * if (outBytesWritten) { - *outBytesWritten = outBytesWritten < 0 ? 0 : bytesWritten; + *outBytesWritten = *outBytesWritten < 0 ? 0 : bytesWritten; } return PlatformNetState::getLastError(); diff --git a/Engine/source/platformSDL/menus/PlatformSDLPopupMenuData.h b/Engine/source/platformSDL/menus/PlatformSDLPopupMenuData.h deleted file mode 100644 index 4911f5c10..000000000 --- a/Engine/source/platformSDL/menus/PlatformSDLPopupMenuData.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef PLATFORM_SDL_POPUPMENU_DATA_H -#define PLATFORM_SDL_POPUPMENU_DATA_H - -#include "core/util/tDictionary.h" - -class GuiMenuBar; -struct EventDescriptor; -class PopupMenu; -class MenuBar; - -struct PlatformPopupMenuData -{ - MenuBar *mMenuBar; - GuiMenuBar::Menu *mMenuGui; - - static const U8 mCheckedBitmapIdx = 0; - static Map mMenuMap; - - PlatformPopupMenuData() - { - mMenuBar = NULL; - mMenuGui = NULL; - } - - ~PlatformPopupMenuData() - { - - } - - void insertAccelerator(EventDescriptor &desc, U32 id); - void removeAccelerator(U32 id); - void setAccelleratorEnabled(U32 id, bool enabled); -}; - -#endif //PLATFORM_SDL_POPUPMENU_DATA_H \ No newline at end of file diff --git a/Engine/source/platformSDL/menus/menuBarSDL.cpp b/Engine/source/platformSDL/menus/menuBarSDL.cpp deleted file mode 100644 index a0ddb2370..000000000 --- a/Engine/source/platformSDL/menus/menuBarSDL.cpp +++ /dev/null @@ -1,200 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/menus/menuBar.h" -#include "platform/menus/popupMenu.h" -#include "gui/core/guiCanvas.h" -#include "windowManager/platformWindowMgr.h" -#include "core/util/safeDelete.h" - -#include "windowManager/sdl/sdlWindow.h" -#include "gui/editor/guiMenuBar.h" - -#include "platformSDL/menus/PlatformSDLPopupMenuData.h" - -#include "platformSDL/menus/guiPlatformGenericMenuBar.h" - -#ifdef TORQUE_SDL - -//----------------------------------------------------------------------------- -// Platform Data -//----------------------------------------------------------------------------- - -// class PlatformMenuBarData -// { -// -// }; - -Map PlatformPopupMenuData::mMenuMap; - -IMPLEMENT_CONOBJECT(GuiPlatformGenericMenuBar); - -//----------------------------------------------------------------------------- -// MenuBar Methods -//----------------------------------------------------------------------------- - -void MenuBar::createPlatformPopupMenuData() -{ - mData = NULL; -} - -void MenuBar::deletePlatformPopupMenuData() -{ -// SAFE_DELETE(mData); -} - -//----------------------------------------------------------------------------- - -GuiPlatformGenericMenuBar* _FindMenuBarCtrl() -{ - GuiControl* control; - Sim::findObject("PlatformGenericMenubar", control); - AssertFatal(control, ""); - if( !control ) - return NULL; - - GuiPlatformGenericMenuBar* menuBar; - menuBar = dynamic_cast( control->findObjectByInternalName( StringTable->insert("menubar"), true) ); - AssertFatal(menuBar, ""); - return menuBar; -} - - -void MenuBar::updateMenuBar(PopupMenu *popupMenu /* = NULL */) -{ - //if(! isAttachedToCanvas()) - // return; - - if(!popupMenu) - return; - - GuiPlatformGenericMenuBar* menuBarGui = _FindMenuBarCtrl(); - popupMenu->mData->mMenuBar = this; - - String menuTitle = popupMenu->getBarTitle(); - - //Next, find out if we're still in the list of entries - SimSet::iterator itr = find(begin(), end(), popupMenu); - - GuiMenuBar::Menu* menuGui = menuBarGui->findMenu(menuTitle); - if (!menuGui) - { - //This is our first time setting this particular menu up, so we'll OK it. - if (itr == end()) - menuBarGui->attachToMenuBar(popupMenu->mData->mMenuGui); - else - menuBarGui->attachToMenuBar(popupMenu->mData->mMenuGui, itr - begin()); - } - else - { - //Not our first time through, so we're really updating it. - - //So, first, remove it from the menubar - menuBarGui->removeFromMenuBar(menuGui); - - //Next, find out if we're still in the list of entries - SimSet::iterator itr = find(begin(), end(), popupMenu); - - //if we're no longer in the list, we're pretty much done here - if (itr == end()) - return; - - //We're still here, so this is a valid menu for our current bar configuration, so add us back in. - menuBarGui->attachToMenuBar(menuGui, itr - begin()); - } -} - -//----------------------------------------------------------------------------- - -void MenuBar::attachToCanvas(GuiCanvas *owner, S32 pos) -{ - if(owner == NULL || isAttachedToCanvas()) - return; - - // This is set for popup menus in the onAttachToMenuBar() callback - mCanvas = owner; - - PlatformWindowSDL *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - // Setup the native menu bar - GuiMenuBar *hWindowMenu = static_cast( pWindow->getMenuHandle() ); - if( hWindowMenu == NULL && !Journal::IsPlaying() ) - hWindowMenu = _FindMenuBarCtrl(); - - if(hWindowMenu) - { - pWindow->setMenuHandle( hWindowMenu ); - GuiControl *base = hWindowMenu->getParent(); - - while( base->getParent() ) - { - base = base->getParent(); - } - - mCanvas->setMenuBar( base ); - } - - for (S32 i = 0; i < size(); ++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if (mnu == NULL) - { - Con::warnf("MenuBar::attachToMenuBar - Non-PopupMenu object in set"); - continue; - } - - if (mnu->isAttachedToMenuBar()) - mnu->removeFromMenuBar(); - - mnu->attachToMenuBar(owner, pos + i); - } - -} - -void MenuBar::removeFromCanvas() -{ - if (mCanvas == NULL || !isAttachedToCanvas()) - return; - - //_FindMenuBarCtrl()->clearMenus(); - - // Add the items - for (S32 i = 0; i < size(); ++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if (mnu == NULL) - { - Con::warnf("MenuBar::removeFromMenuBar - Non-PopupMenu object in set"); - continue; - } - - mnu->removeFromMenuBar(); - } - - mCanvas->setMenuBar(NULL); - - mCanvas = NULL; -} - -#endif diff --git a/Engine/source/platformSDL/menus/popupMenuSDL.cpp b/Engine/source/platformSDL/menus/popupMenuSDL.cpp deleted file mode 100644 index 788d7c88e..000000000 --- a/Engine/source/platformSDL/menus/popupMenuSDL.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#ifdef TORQUE_SDL - -#include "platform/menus/popupMenu.h" -#include "platform/menus/menuBar.h" -#include "console/consoleTypes.h" -#include "gui/core/guiCanvas.h" -#include "core/util/safeDelete.h" - -#include "sim/actionMap.h" -#include "platform/platformInput.h" - -#include "windowManager/sdl/sdlWindow.h" -#include "gui/editor/guiMenuBar.h" - -#include "platformSDL/menus/PlatformSDLPopupMenuData.h" -#include "console/engineAPI.h" - -#include "platformSDL/menus/guiPlatformGenericMenuBar.h" -#include "gui/editor/guiPopupMenuCtrl.h" - -////////////////////////////////////////////////////////////////////////// -// Platform Menu Data -////////////////////////////////////////////////////////////////////////// -GuiPlatformGenericMenuBar* findMenuBarCtrl() -{ - GuiControl* control; - Sim::findObject("PlatformGenericMenubar", control); - AssertFatal(control, ""); - if (!control) - return NULL; - - GuiPlatformGenericMenuBar* menuBar; - menuBar = dynamic_cast(control->findObjectByInternalName(StringTable->insert("menubar"), true)); - AssertFatal(menuBar, ""); - return menuBar; -} - -////////////////////////////////////////////////////////////////////////// - -void PlatformPopupMenuData::insertAccelerator(EventDescriptor &desc, U32 id) -{ - AssertFatal(0, ""); -} - -void PlatformPopupMenuData::removeAccelerator(U32 id) -{ - AssertFatal(0, ""); -} - -void PlatformPopupMenuData::setAccelleratorEnabled( U32 id, bool enabled ) -{ - AssertFatal(0, ""); -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::createPlatformPopupMenuData() -{ - mData = new PlatformPopupMenuData; -} - -void PopupMenu::deletePlatformPopupMenuData() -{ - SAFE_DELETE(mData); -} -void PopupMenu::createPlatformMenu() -{ - mData->mMenuGui = GuiMenuBar::sCreateMenu( getBarTitle(), getId() ); - PlatformPopupMenuData::mMenuMap[ mData->mMenuGui ] = this; -} - - -////////////////////////////////////////////////////////////////////////// -// Public Methods -////////////////////////////////////////////////////////////////////////// - -S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd) -{ - GuiMenuBar::MenuItem *item = GuiMenuBar::findMenuItem( mData->mMenuGui, title ); - - //We'll make a special exception for the spacer items - if(item && dStrcmp(title, "")) - { - setItem( pos, title, accelerator, cmd); - return pos; - } - - item = GuiMenuBar::addMenuItem( mData->mMenuGui, title, pos, accelerator, -1, cmd ); - item->submenuParentMenu = this->mData->mMenuGui; - - return pos; -} - -S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) -{ - GuiMenuBar::MenuItem *item = GuiMenuBar::addMenuItem( mData->mMenuGui, title, pos, "", -1, "" ); - item->isSubmenu = true; - item->submenu = submenu->mData->mMenuGui; - item->submenuParentMenu = this->mData->mMenuGui; - - return pos; -} - -bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, const char* cmd) -{ - GuiMenuBar::MenuItem *item = NULL; - - item = GuiMenuBar::findMenuItem( mData->mMenuGui, title ); - - if(item) - { - item->id = pos; - item->cmd = cmd; - if( accelerator && accelerator[0] ) - item->accelerator = dStrdup( accelerator ); - else - item->accelerator = NULL; - return true; - } - - return false; -} - -void PopupMenu::removeItem(S32 itemPos) -{ - GuiMenuBar::MenuItem *item = GuiMenuBar::findMenuItem( mData->mMenuGui, String::ToString(itemPos) ); - if(item) - { - GuiMenuBar::removeMenuItem( mData->mMenuGui, item); - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::enableItem( S32 pos, bool enable ) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - { - if( item->id == pos) - item->enabled = enable; - } -} - -void PopupMenu::checkItem(S32 pos, bool checked) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - if(item->id == pos) - break; - - if( !item ) - return; - - if(checked && item->checkGroup != -1) - { - // first, uncheck everything in the group: - for( GuiMenuBar::MenuItem *itemWalk = mData->mMenuGui->firstMenuItem; itemWalk; itemWalk = itemWalk->nextMenuItem ) - if( itemWalk->checkGroup == item->checkGroup && itemWalk->bitmapIndex == mData->mCheckedBitmapIdx ) - itemWalk->bitmapIndex = -1; - } - - item->bitmapIndex = checked ? mData->mCheckedBitmapIdx : -1; -} - -void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - { - if(item->id >= firstPos && item->id <= lastPos) - { - item->bitmapIndex = (item->id == checkPos) ? mData->mCheckedBitmapIdx : -1; - } - } -} - -bool PopupMenu::isItemChecked(S32 pos) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - if(item->id == pos) - return item->bitmapIndex == mData->mCheckedBitmapIdx; - - return false; -} - -U32 PopupMenu::getItemCount() -{ - int count = 0; - for( GuiMenuBar::MenuItem *item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - ++count; - - return count; -} - -////////////////////////////////////////////////////////////////////////// - -bool PopupMenu::canHandleID(U32 id) -{ - return true; -} - -bool PopupMenu::handleSelect(U32 command, const char *text /* = NULL */) -{ - return dAtob(Con::executef(this, "onSelectItem", Con::getIntArg(command), text ? text : "")); -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) -{ - if(owner == NULL) - return; - - GuiControl* editorGui; - Sim::findObject("EditorGui", editorGui); - - if (editorGui) - { - GuiPopupMenuTextListCtrl* textList; - GuiPopupMenuBackgroundCtrl* backgroundCtrl; - Sim::findObject("PopUpMenuControl", backgroundCtrl); - - GuiControlProfile* profile; - Sim::findObject("GuiMenubarProfile", profile); - - if (!profile) - return; - - if (!backgroundCtrl) - { - textList = new GuiPopupMenuTextListCtrl(); - - textList->registerObject(); - - backgroundCtrl = new GuiPopupMenuBackgroundCtrl(textList); - - backgroundCtrl->registerObject("PopUpMenuControl"); - - textList->setControlProfile(profile); - - backgroundCtrl->addObject(textList); - } - else - { - textList = dynamic_cast(backgroundCtrl->first()); - } - - if (!backgroundCtrl || !textList) - return; - - owner->pushDialogControl(backgroundCtrl, 10); - - backgroundCtrl->setExtent(editorGui->getExtent()); - - textList->clear(); - textList->mMenu = mData->mMenuGui; - textList->mMenuBar = findMenuBarCtrl(); - textList->mPopup = this; - - S32 textWidth = 0, width = 0; - S32 acceleratorWidth = 0; - GFont *font = profile->mFont; - - Point2I maxBitmapSize = Point2I(0, 0); - - S32 numBitmaps = profile->mBitmapArrayRects.size(); - if (numBitmaps) - { - RectI *bitmapBounds = profile->mBitmapArrayRects.address(); - for (S32 i = 0; i < numBitmaps; i++) - { - if (bitmapBounds[i].extent.x > maxBitmapSize.x) - maxBitmapSize.x = bitmapBounds[i].extent.x; - if (bitmapBounds[i].extent.y > maxBitmapSize.y) - maxBitmapSize.y = bitmapBounds[i].extent.y; - } - } - - for (GuiMenuBar::MenuItem *walk = mData->mMenuGui->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if (!walk->visible) - continue; - - S32 iTextWidth = font->getStrWidth(walk->text); - S32 iAcceleratorWidth = walk->accelerator ? font->getStrWidth(walk->accelerator) : 0; - - if (iTextWidth > textWidth) - textWidth = iTextWidth; - if (iAcceleratorWidth > acceleratorWidth) - acceleratorWidth = iAcceleratorWidth; - } - width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; - - textList->setCellSize(Point2I(width, font->getHeight() + 2)); - textList->clearColumnOffsets(); - textList->addColumnOffset(-1); // add an empty column in for the bitmap index. - textList->addColumnOffset(maxBitmapSize.x + 1); - textList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); - - U32 entryCount = 0; - - for (GuiMenuBar::MenuItem *walk = mData->mMenuGui->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if (!walk->visible) - continue; - - char buf[512]; - - // If this menu item is a submenu, then set the isSubmenu to 2 to indicate - // an arrow should be drawn. Otherwise set the isSubmenu normally. - char isSubmenu = 1; - if (walk->isSubmenu) - isSubmenu = 2; - - char bitmapIndex = 1; - if (walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= profile->mBitmapArrayRects.size())) - bitmapIndex = walk->bitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, walk->text, walk->accelerator ? walk->accelerator : ""); - textList->addEntry(entryCount, buf); - - if (!walk->enabled) - textList->setEntryActive(entryCount, false); - - entryCount++; - } - - Point2I pos = owner->getCursorPos(); - textList->setPosition(pos); - - //nudge in if we'd overshoot the screen - S32 widthDiff = (textList->getPosition().x + textList->getExtent().x) - backgroundCtrl->getWidth(); - if (widthDiff > 0) - { - Point2I popupPos = textList->getPosition(); - textList->setPosition(popupPos.x - widthDiff, popupPos.y); - } - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos, const char *title) -{ - if(owner == NULL || isAttachedToMenuBar()) - return; -} - -// New version of above for use by MenuBar class. Do not use yet. -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos) -{ - if(owner == NULL || isAttachedToMenuBar()) - return; - - //mData->mMenuBar = owner->setMenuBar(); -} - -void PopupMenu::removeFromMenuBar() -{ - if(isAttachedToMenuBar()) - return; -} - -S32 PopupMenu::getPosOnMenuBar() -{ - - return 0; -} - -#endif diff --git a/Engine/source/platformWin32/menus/menuBarWin32.cpp b/Engine/source/platformWin32/menus/menuBarWin32.cpp deleted file mode 100644 index dfa103161..000000000 --- a/Engine/source/platformWin32/menus/menuBarWin32.cpp +++ /dev/null @@ -1,177 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platformWin32/platformWin32.h" -#include "platform/menus/menuBar.h" -#include "platform/menus/popupMenu.h" -#include "gui/core/guiCanvas.h" -#include "windowManager/platformWindowMgr.h" -#include "windowManager/win32/win32Window.h" -#include "core/util/safeDelete.h" - -//----------------------------------------------------------------------------- -// Platform Data -//----------------------------------------------------------------------------- - -// class PlatformMenuBarData -// { -// -// }; - -//----------------------------------------------------------------------------- -// MenuBar Methods -//----------------------------------------------------------------------------- - -#ifndef TORQUE_SDL - -void MenuBar::createPlatformPopupMenuData() -{ -// mData = new PlatformMenuBarData; - - // [tom, 6/4/2007] Nothing currently needed for win32 - mData = NULL; -} - -void MenuBar::deletePlatformPopupMenuData() -{ -// SAFE_DELETE(mData); -} - -//----------------------------------------------------------------------------- - -void MenuBar::updateMenuBar(PopupMenu *menu /* = NULL */) -{ - if(! isAttachedToCanvas()) - return; - - if(menu == NULL) - { - // [tom, 6/4/2007] Kludgetastic - GuiCanvas *oldCanvas = mCanvas; - S32 pos = -1; - PopupMenu *mnu = dynamic_cast(at(0)); - if(mnu) - pos = mnu->getPosOnMenuBar(); - - removeFromCanvas(); - attachToCanvas(oldCanvas, pos); - - return; - } - - menu->removeFromMenuBar(); - SimSet::iterator itr = find(begin(), end(), menu); - if(itr == end()) - return; - - menu->attachToMenuBar(mCanvas, itr - begin()); - - Win32Window *pWindow = dynamic_cast(mCanvas->getPlatformWindow()); - if(pWindow == NULL) - return; - - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); -} - -//----------------------------------------------------------------------------- - -void MenuBar::attachToCanvas(GuiCanvas *owner, S32 pos) -{ - if(owner == NULL || isAttachedToCanvas()) - return; - - // This is set for popup menus in the onAttachToMenuBar() callback - mCanvas = owner; - - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - // Setup the native menu bar - HMENU hWindowMenu = pWindow->getMenuHandle(); - if(hWindowMenu == NULL && !Journal::IsPlaying()) - { - hWindowMenu = CreateMenu(); - if(hWindowMenu) - { - pWindow->setMenuHandle( hWindowMenu); - } - } - - // Add the items - for(S32 i = 0;i < size();++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if(mnu == NULL) - { - Con::warnf("MenuBar::attachToMenuBar - Non-PopupMenu object in set"); - continue; - } - - if(mnu->isAttachedToMenuBar()) - mnu->removeFromMenuBar(); - - mnu->attachToMenuBar(owner, pos + i); - } - - HWND hWindow = pWindow->getHWND(); - SetMenu(hWindow, hWindowMenu); - DrawMenuBar(hWindow); - -} - -void MenuBar::removeFromCanvas() -{ - if(mCanvas == NULL || ! isAttachedToCanvas()) - return; - - Win32Window *pWindow = dynamic_cast(mCanvas->getPlatformWindow()); - if(pWindow == NULL) - return; - - // Setup the native menu bar - HMENU hWindowMenu = pWindow->getMenuHandle(); - if(hWindowMenu == NULL) - return; - - // Add the items - for(S32 i = 0;i < size();++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if(mnu == NULL) - { - Con::warnf("MenuBar::removeFromMenuBar - Non-PopupMenu object in set"); - continue; - } - - mnu->removeFromMenuBar(); - } - - HWND hWindow = pWindow->getHWND(); - SetMenu(hWindow, NULL); - DrawMenuBar(hWindow); - - mCanvas = NULL; -} - -#endif diff --git a/Engine/source/platformWin32/menus/popupMenuWin32.cpp b/Engine/source/platformWin32/menus/popupMenuWin32.cpp deleted file mode 100644 index fc3170eeb..000000000 --- a/Engine/source/platformWin32/menus/popupMenuWin32.cpp +++ /dev/null @@ -1,746 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#ifndef TORQUE_SDL - -#include "platform/menus/popupMenu.h" -#include "platformWin32/platformWin32.h" -#include "console/engineAPI.h" -#include "console/consoleTypes.h" -#include "gui/core/guiCanvas.h" -#include "windowManager/platformWindowMgr.h" -#include "windowManager/win32/win32Window.h" -#include "core/util/safeDelete.h" - -#include "sim/actionMap.h" -#include "platform/platformInput.h" - -////////////////////////////////////////////////////////////////////////// -// Platform Menu Data -////////////////////////////////////////////////////////////////////////// - -struct PlatformPopupMenuData -{ - static U32 mLastPopupMenuID; - static const U32 PopupMenuIDRange; - - HMENU mMenu; - U32 mMenuID; - U32 mLastID; - - Win32Window::AcceleratorList mAccelerators; - Win32Window::AcceleratorList mDisabledAccelerators; - - PlatformPopupMenuData() - { - mMenu = NULL; - mMenuID = mLastPopupMenuID++; - mLastID = 0; - } - - ~PlatformPopupMenuData() - { - if(mMenu) - DestroyMenu(mMenu); - } - - void insertAccelerator(EventDescriptor &desc, U32 id); - void removeAccelerator(U32 id); - void setAccelleratorEnabled(U32 id, bool enabled); -}; - -U32 PlatformPopupMenuData::mLastPopupMenuID = 0; -const U32 PlatformPopupMenuData::PopupMenuIDRange = 100; - -////////////////////////////////////////////////////////////////////////// - -void PlatformPopupMenuData::insertAccelerator(EventDescriptor &desc, U32 id) -{ - if(desc.eventType != SI_KEY) - return; - - Win32Window::AcceleratorList::iterator i; - for(i = mAccelerators.begin();i != mAccelerators.end();++i) - { - if(i->mID == id) - { - // Update existing entry - i->mDescriptor.eventType = desc.eventType; - i->mDescriptor.eventCode = desc.eventCode; - i->mDescriptor.flags = desc.flags; - return; - } - - if(i->mDescriptor.eventType == desc.eventType && i->mDescriptor.eventCode == desc.eventCode && i->mDescriptor.flags == desc.flags) - { - // Already have a matching accelerator, don't add another one - return; - } - } - - Win32Window::Accelerator accel; - accel.mDescriptor = desc; - accel.mID = id; - mAccelerators.push_back(accel); -} - -void PlatformPopupMenuData::removeAccelerator(U32 id) -{ - Win32Window::AcceleratorList::iterator i; - for(i = mAccelerators.begin();i != mAccelerators.end();++i) - { - if(i->mID == id) - { - mAccelerators.erase(i); - return; - } - } -} - -void PlatformPopupMenuData::setAccelleratorEnabled( U32 id, bool enabled ) -{ - Win32Window::AcceleratorList *src = NULL; - Win32Window::AcceleratorList *dst = NULL; - - if ( enabled ) - { - src = &mDisabledAccelerators; - dst = &mAccelerators; - } - else - { - src = &mAccelerators; - dst = &mDisabledAccelerators; - } - - Win32Window::AcceleratorList::iterator i; - for ( i = src->begin(); i != src->end(); ++i ) - { - if ( i->mID == id ) - { - Win32Window::Accelerator tmp = *i; - src->erase( i ); - dst->push_back( tmp ); - return; - } - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::createPlatformPopupMenuData() -{ - mData = new PlatformPopupMenuData; -} - -void PopupMenu::deletePlatformPopupMenuData() -{ - SAFE_DELETE(mData); -} -void PopupMenu::createPlatformMenu() -{ - mData->mMenu = mIsPopup ? CreatePopupMenu() : CreateMenu(); - AssertFatal(mData->mMenu, "Unable to create menu"); - - MENUINFO mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.fMask = MIM_MENUDATA; - mi.dwMenuData = (ULONG_PTR)this; - SetMenuInfo(mData->mMenu, &mi); -} - -////////////////////////////////////////////////////////////////////////// -// Public Methods -////////////////////////////////////////////////////////////////////////// - -S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char *) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return -1; - - MENUITEMINFOA mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_ID|MIIM_TYPE; - mi.wID = (mData->mMenuID * PlatformPopupMenuData::PopupMenuIDRange) + mData->mLastID + 1; - mData->mLastID++; - if(title && *title) - mi.fType = MFT_STRING; - else - mi.fType = MFT_SEPARATOR; - - char buf[1024]; - if(accelerator && *accelerator) - { - dSprintf(buf, sizeof(buf), "%s\t%s", title, accelerator); - - if(isAttached) - pWindow->removeAccelerators(mData->mAccelerators); - - // Build entry for accelerator table - EventDescriptor accelDesc; - if(ActionMap::createEventDescriptor(accelerator, &accelDesc)) - mData->insertAccelerator(accelDesc, mi.wID); - else - Con::errorf("PopupMenu::insertItem - Could not create event descriptor for accelerator \"%s\"", accelerator); - - if(isAttached) - pWindow->addAccelerators(mData->mAccelerators); - } - else - dSprintf(buf, sizeof(buf), "%s", title); - - mi.dwTypeData = (LPSTR)buf; - - if(InsertMenuItemA(mData->mMenu, pos, TRUE, &mi)) - { - if(isAttached) - { - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } - return mi.wID; - } - - return -1; -} - -S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return -1; - - for(S32 i = 0;i < mSubmenus->size();i++) - { - if(submenu == (*mSubmenus)[i]) - { - Con::errorf("PopupMenu::insertSubMenu - Attempting to add submenu twice"); - return -1; - } - } - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_ID|MIIM_TYPE|MIIM_SUBMENU|MIIM_DATA; - mi.wID = (mData->mMenuID * PlatformPopupMenuData::PopupMenuIDRange) + mData->mLastID + 1; - if(title && *title) - mi.fType = MFT_STRING; - else - mi.fType = MFT_SEPARATOR; - mi.dwTypeData = (LPSTR)title; - mi.hSubMenu = submenu->mData->mMenu; - mi.dwItemData = (ULONG_PTR)submenu; - if(InsertMenuItemA(mData->mMenu, pos, TRUE, &mi)) - { - mSubmenus->addObject(submenu); - - if(isAttached) - { - pWindow->addAccelerators(submenu->mData->mAccelerators); - - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } - return mi.wID; - } - - return -1; -} - -bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, const char *) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return false; - - // Are we out of range? - if ( pos >= getItemCount() ) - return false; - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_TYPE; - - if(title && *title) - mi.fType = MFT_STRING; - else - mi.fType = MFT_SEPARATOR; - - char buf[1024]; - if(accelerator && *accelerator) - { - dSprintf(buf, sizeof(buf), "%s\t%s", title, accelerator); - - if(isAttached) - pWindow->removeAccelerators(mData->mAccelerators); - - // Build entry for accelerator table - EventDescriptor accelDesc; - if(ActionMap::createEventDescriptor(accelerator, &accelDesc)) - mData->insertAccelerator(accelDesc, pos); - else - Con::errorf("PopupMenu::setItem - Could not create event descriptor for accelerator \"%s\"", accelerator); - - if(isAttached) - pWindow->addAccelerators(mData->mAccelerators); - } - else - dSprintf(buf, sizeof(buf), "%s", title); - - mi.dwTypeData = (LPSTR)buf; - - if(SetMenuItemInfoA(mData->mMenu, pos, TRUE, &mi)) - { - if(isAttached) - { - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } - - return true; - } - - return false; -} - -void PopupMenu::removeItem(S32 itemPos) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return; - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_DATA|MIIM_ID; - if(GetMenuItemInfoA(mData->mMenu, itemPos, TRUE, &mi)) - { - bool submenu = false; - - // Update list of submenus if this is a submenu - if(mi.fMask & MIIM_DATA) - { - PopupMenu *mnu = (PopupMenu *)mi.dwItemData; - if( mnu != NULL ) - { - if(isAttached) - pWindow->removeAccelerators(mnu->mData->mAccelerators); - mSubmenus->removeObject(mnu); - - submenu = true; - } - } - - if(! submenu) - { - // Update accelerators if this has an accelerator and wasn't a sub menu - for(S32 i = 0;i < mData->mAccelerators.size();++i) - { - if(mData->mAccelerators[i].mID == mi.wID) - { - if(isAttached) - pWindow->removeAccelerators(mData->mAccelerators); - - mData->mAccelerators.erase(i); - - if(isAttached) - pWindow->addAccelerators(mData->mAccelerators); - - break; - } - } - } - } - else - return; - - RemoveMenu(mData->mMenu, itemPos, MF_BYPOSITION); - - if(isAttached) - { - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::enableItem( S32 pos, bool enable ) -{ - U32 flags = enable ? MF_ENABLED : MF_GRAYED; - EnableMenuItem( mData->mMenu, pos, MF_BYPOSITION|flags ); - - // Update accelerators. - - // NOTE: This really DOES need to happen. A disabled menu item - // should not still have an accelerator mapped to it. - // - // Unfortunately, the editors currently only set menu items - // enabled/disabled when the menu itself is selected which means our - // accelerators would be out of synch. - - /* - Win32Window *pWindow = mCanvas ? dynamic_cast( mCanvas->getPlatformWindow() ) : NULL; - bool isAttached = isAttachedToMenuBar(); - if ( isAttached && pWindow == NULL ) - return; - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_DATA|MIIM_ID; - if ( !GetMenuItemInfoA( mData->mMenu, pos, TRUE, &mi) ) - return; - - if ( isAttached ) - pWindow->removeAccelerators( mData->mAccelerators ); - - mData->setAccelleratorEnabled( mi.wID, enable ); - - if ( isAttached ) - pWindow->addAccelerators( mData->mAccelerators ); - */ -} - -void PopupMenu::checkItem(S32 pos, bool checked) -{ -// U32 flags = checked ? MF_CHECKED : MF_UNCHECKED; -// CheckMenuItem(mData->mMenu, pos, MF_BYPOSITION|flags); - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_STATE; - mi.fState = checked ? MFS_CHECKED : MFS_UNCHECKED; - SetMenuItemInfoA(mData->mMenu, pos, TRUE, &mi); -} - -void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) -{ - CheckMenuRadioItem(mData->mMenu, firstPos, lastPos, checkPos, MF_BYPOSITION); -} - -bool PopupMenu::isItemChecked(S32 pos) -{ - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_STATE; - if(GetMenuItemInfoA(mData->mMenu, pos, TRUE, &mi) && (mi.fState & MFS_CHECKED)) - return true; - return false; -} - -U32 PopupMenu::getItemCount() -{ - return GetMenuItemCount( mData->mMenu ); -} - -////////////////////////////////////////////////////////////////////////// - -bool PopupMenu::canHandleID(U32 id) -{ - for(S32 i = 0;i < mSubmenus->size();i++) - { - PopupMenu *subM = dynamic_cast((*mSubmenus)[i]); - if(subM == NULL) - continue; - - if(subM->canHandleID(id)) - return true; - } - - if(id >= mData->mMenuID * PlatformPopupMenuData::PopupMenuIDRange && - id < (mData->mMenuID+1) * PlatformPopupMenuData::PopupMenuIDRange) - { - return true; - } - - return false; -} - -bool PopupMenu::handleSelect(U32 command, const char *text /* = NULL */) -{ - // [tom, 8/20/2006] Pass off to a sub menu if it's for them - for(S32 i = 0;i < mSubmenus->size();i++) - { - PopupMenu *subM = dynamic_cast((*mSubmenus)[i]); - if(subM == NULL) - continue; - - if(subM->canHandleID(command)) - { - return subM->handleSelect(command, text); - } - } - - // [tom, 8/21/2006] Cheesey hack to find the position based on ID - char buf[512]; - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.dwTypeData = NULL; - - S32 numItems = GetMenuItemCount(mData->mMenu); - S32 pos = -1; - for(S32 i = 0;i < numItems;i++) - { - mi.fMask = MIIM_ID|MIIM_STRING|MIIM_STATE; - if(GetMenuItemInfoA(mData->mMenu, i, TRUE, &mi)) - { - if(mi.wID == command) - { - if(text == NULL) - { - mi.dwTypeData = buf; - mi.cch++; - GetMenuItemInfoA(mData->mMenu, i, TRUE, &mi); - - // [tom, 5/11/2007] Don't do anything if the menu item is disabled - if(mi.fState & MFS_DISABLED) - return false; - - text = StringTable->insert(mi.dwTypeData); - } - pos = i; - break; - } - } - } - - if(pos == -1) - { - Con::errorf("PopupMenu::handleSelect - Could not find menu item position for ID %d ... this shouldn't happen!", command); - return false; - } - - // [tom, 8/20/2006] Wasn't handled by a submenu, pass off to script - return dAtob(Con::executef(this, "onSelectItem", Con::getIntArg(pos), text ? text : "")); -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) -{ - if( owner == NULL ) - { - Con::warnf("PopupMenu::showPopup - Invalid canvas supplied!"); - return; - } - - // [tom, 6/4/2007] showPopup() blocks until the menu is closed by the user, - // so the canvas pointer is not needed beyond the scope of this function - // when working with context menus. Setting mCanvas here will cause undesired - // behavior in relation to the menu bar. - - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - HWND hWindow = pWindow->getHWND(); - POINT p; - if(x == -1 && y == -1) - GetCursorPos(&p); - else - { - p.x = x; - p.y = y; - ClientToScreen(hWindow, &p); - } - - winState.renderThreadBlocked = true; - U32 opt = (int)TrackPopupMenu(mData->mMenu, TPM_NONOTIFY|TPM_RETURNCMD, p.x, p.y, 0, hWindow, NULL); - if(opt > 0) - handleSelect(opt, NULL); - winState.renderThreadBlocked = false; -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos, const char *title) -{ - if(owner == NULL || isAttachedToMenuBar()) - return; - - // This is set for sub-menus in the onAttachToMenuBar() callback - mCanvas = owner; - - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - HMENU hWindowMenu = pWindow->getMenuHandle(); - if(hWindowMenu == NULL) - { - hWindowMenu = CreateMenu(); - if(hWindowMenu) - { - pWindow->setMenuHandle( hWindowMenu); - } - } - - MENUITEMINFOA mii; - - mii.cbSize = sizeof(MENUITEMINFOA); - - mii.fMask = MIIM_STRING|MIIM_DATA; - mii.dwTypeData = (LPSTR)title; - mii.fMask |= MIIM_ID; - mii.wID = mData->mMenuID; - mii.fMask |= MIIM_SUBMENU; - mii.hSubMenu = mData->mMenu; - mii.dwItemData = (ULONG_PTR)this; - - InsertMenuItemA(hWindowMenu, pos, TRUE, &mii); - - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - - pWindow->addAccelerators(mData->mAccelerators); - - // Add accelerators for sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *submenu = dynamic_cast(*i); - if(submenu == NULL) - continue; - - pWindow->addAccelerators(submenu->mData->mAccelerators); - } - - onAttachToMenuBar(owner, pos, title); -} - -// New version of above for use by MenuBar class. Do not use yet. -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos) -{ - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - //When playing a journal, the system menu is not actually shown - if (Journal::IsPlaying()) - { - onAttachToMenuBar(owner, pos, mBarTitle); - return; - } - - HMENU hWindowMenu = pWindow->getMenuHandle(); - - MENUITEMINFOA mii; - - mii.cbSize = sizeof(MENUITEMINFOA); - - mii.fMask = MIIM_STRING|MIIM_DATA; - mii.dwTypeData = (LPSTR)mBarTitle; - mii.fMask |= MIIM_ID; - mii.wID = mData->mMenuID; - mii.fMask |= MIIM_SUBMENU; - mii.hSubMenu = mData->mMenu; - mii.dwItemData = (ULONG_PTR)this; - - InsertMenuItemA(hWindowMenu, pos, TRUE, &mii); - - pWindow->addAccelerators(mData->mAccelerators); - - // Add accelerators for sub menus (have to do this here as it's platform specific) - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *submenu = dynamic_cast(*i); - if(submenu == NULL) - continue; - - pWindow->addAccelerators(submenu->mData->mAccelerators); - } - - onAttachToMenuBar(owner, pos, mBarTitle); -} - -void PopupMenu::removeFromMenuBar() -{ - S32 pos = getPosOnMenuBar(); - if(pos == -1) - return; - - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - if(pWindow == NULL) - return; - - HMENU hMenuHandle = pWindow->getMenuHandle(); - if(!hMenuHandle) - return; - - RemoveMenu(hMenuHandle, pos, MF_BYPOSITION); - - HWND hWindow = pWindow->getHWND(); - - DrawMenuBar(hWindow); - - pWindow->removeAccelerators(mData->mAccelerators); - - // Remove accelerators for sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *submenu = dynamic_cast(*i); - if(submenu == NULL) - continue; - - pWindow->removeAccelerators(submenu->mData->mAccelerators); - } - - onRemoveFromMenuBar(mCanvas); -} - -S32 PopupMenu::getPosOnMenuBar() -{ - if(mCanvas == NULL) - return -1; - - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - if(pWindow == NULL) - return -1; - - HMENU hMenuHandle = pWindow->getMenuHandle(); - S32 numItems = GetMenuItemCount(hMenuHandle); - S32 pos = -1; - for(S32 i = 0;i < numItems;i++) - { - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_DATA; - if(GetMenuItemInfoA(hMenuHandle, i, TRUE, &mi)) - { - if(mi.fMask & MIIM_DATA) - { - PopupMenu *mnu = (PopupMenu *)mi.dwItemData; - if(mnu == this) - { - pos = i; - break; - } - } - } - } - - return pos; -} - -#endif \ No newline at end of file diff --git a/Engine/source/scene/sceneManager.cpp b/Engine/source/scene/sceneManager.cpp index caa117e9a..aeca87092 100644 --- a/Engine/source/scene/sceneManager.cpp +++ b/Engine/source/scene/sceneManager.cpp @@ -38,6 +38,9 @@ #include "T3D/gameBase/gameConnection.h" #include "math/mathUtils.h" +#include "T3D/components/render/renderComponentInterface.h" +#include "T3D/systems/render/meshRenderSystem.h" + // For player object bounds workaround. #include "T3D/player.h" @@ -358,6 +361,8 @@ void SceneManager::_renderScene( SceneRenderState* state, U32 objectMask, SceneZ if( gEditingMission && state->isDiffusePass() ) objectMask = EDITOR_RENDER_TYPEMASK; + MeshRenderSystem::render(this, state); + // Update the zoning state and traverse zones. if( getZoneManager() ) @@ -740,7 +745,7 @@ DefineConsoleFunction( sceneDumpZoneStates, void, ( bool updateFirst ), ( true ) //----------------------------------------------------------------------------- -DefineConsoleFunction( sceneGetZoneOwner, SceneObject*, ( U32 zoneId ), ( true ), +DefineConsoleFunction( sceneGetZoneOwner, SceneObject*, ( U32 zoneId ),, "Return the SceneObject that contains the given zone.\n\n" "@param zoneId ID of zone.\n" "@return A SceneObject or NULL if the given @a zoneId is invalid.\n\n" diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index 550ee80b4..a6be00320 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -433,6 +433,64 @@ void SceneObject::setScale( const VectorF &scale ) setMaskBits( ScaleMask ); } +void SceneObject::setForwardVector(VectorF newForward, VectorF upVector) +{ + MatrixF mat = getTransform(); + + VectorF up(0.0f, 0.0f, 1.0f); + VectorF axisX; + VectorF axisY = newForward; + VectorF axisZ; + + if (upVector != VectorF::Zero) + up = upVector; + + // Validate and normalize input: + F32 lenSq; + lenSq = axisY.lenSquared(); + if (lenSq < 0.000001f) + { + axisY.set(0.0f, 1.0f, 0.0f); + Con::errorf("SceneObject::setForwardVector() - degenerate forward vector"); + } + else + { + axisY /= mSqrt(lenSq); + } + + + lenSq = up.lenSquared(); + if (lenSq < 0.000001f) + { + up.set(0.0f, 0.0f, 1.0f); + Con::errorf("SceneObject::setForwardVector() - degenerate up vector - too small"); + } + else + { + up /= mSqrt(lenSq); + } + + if (fabsf(mDot(up, axisY)) > 0.9999f) + { + Con::errorf("SceneObject::setForwardVector() - degenerate up vector - same as forward"); + // I haven't really tested this, but i think it generates something which should be not parallel to the previous vector: + F32 tmp = up.x; + up.x = -up.y; + up.y = up.z; + up.z = tmp; + } + + // construct the remaining axes: + mCross(axisY, up, &axisX); + mCross(axisX, axisY, &axisZ); + + mat.setColumn(0, axisX); + mat.setColumn(1, axisY); + mat.setColumn(2, axisZ); + + setTransform(mat); +} + //----------------------------------------------------------------------------- void SceneObject::resetWorldBox() @@ -1207,7 +1265,7 @@ DefineEngineMethod( SceneObject, getType, S32, (),, //----------------------------------------------------------------------------- DefineEngineMethod( SceneObject, mountObject, bool, - ( SceneObject* objB, S32 slot, TransformF txfm ), ( MatrixF::Identity ), + ( SceneObject* objB, S32 slot, TransformF txfm ), ( TransformF::Identity ), "@brief Mount objB to this object at the desired slot with optional transform.\n\n" "@param objB Object to mount onto us\n" @@ -1458,3 +1516,11 @@ DefineEngineMethod( SceneObject, isGlobalBounds, bool, (),, { return object->isGlobalBounds(); } + +DefineConsoleMethod(SceneObject, setForwardVector, void, (VectorF newForward, VectorF upVector), (VectorF(0, 0, 0), VectorF(0, 0, 1)), + "Sets the forward vector of a scene object, making it face Y+ along the new vector.\n" + "@param The new forward vector to set.\n" + "@param (Optional) The up vector to use to help orient the rotation.") +{ + object->setForwardVector(newForward, upVector); +} \ No newline at end of file diff --git a/Engine/source/scene/sceneObject.h b/Engine/source/scene/sceneObject.h index bf04ea4c4..549246c9e 100644 --- a/Engine/source/scene/sceneObject.h +++ b/Engine/source/scene/sceneObject.h @@ -504,6 +504,9 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce /// @param scale Scaling values virtual void setScale( const VectorF &scale ); + /// Sets the forward vector of the object + void setForwardVector(VectorF newForward, VectorF upVector = VectorF(0, 0, 1)); + /// This sets the render transform for this object /// @param mat New render transform virtual void setRenderTransform(const MatrixF &mat); diff --git a/Engine/source/scene/sceneRenderState.cpp b/Engine/source/scene/sceneRenderState.cpp index 325ba6a76..3dda18513 100644 --- a/Engine/source/scene/sceneRenderState.cpp +++ b/Engine/source/scene/sceneRenderState.cpp @@ -26,10 +26,8 @@ #include "renderInstance/renderPassManager.h" #include "math/util/matrixSet.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/render/renderComponentInterface.h" #include "T3D/components/component.h" -#endif //----------------------------------------------------------------------------- @@ -108,19 +106,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects ) object->prepRenderImage( this ); } -#ifdef TORQUE_EXPERIMENTAL_EC - U32 interfaceCount = RenderComponentInterface::all.size(); - for (U32 i = 0; i < RenderComponentInterface::all.size(); i++) - { - Component* comp = dynamic_cast(RenderComponentInterface::all[i]); - - if (comp->isClientObject() && comp->isActive()) - { - RenderComponentInterface::all[i]->prepRenderImage(this); - } - } -#endif - PROFILE_END(); // Render what the objects have batched. diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 88bcde89e..f96e02585 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -1868,7 +1868,7 @@ static ConsoleDocFragment _ActionMapbind2( "ActionMap", "bool bind( string device, string action, string flag, string deadZone, string scale, string command );"); -ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier spec, mod...], command )" +ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier, spec, mod...], command )" "@hide") { StringStackWrapper args(argc - 2, argv + 2); @@ -1917,7 +1917,7 @@ static ConsoleDocFragment _ActionMapbindObj2( "ActionMap", "bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );"); -ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec, mod...], command, object)" +ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier, spec, mod...], command, object)" "@hide") { SimObject* simObject = Sim::findObject(argv[argc - 1]); diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index dc3cea5f3..9a7618d08 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -499,3 +499,9 @@ void NetObject::removeScopeRef() } } #endif + +DefineEngineMethod(NetObject, clearScopeAlways, void, (), , + "@brief Clears the scope always flag on this object.\n\n") +{ + object->clearScopeAlways(); +} diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index a48e3743d..149825b98 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -27,7 +27,6 @@ #include "windowManager/sdl/sdlWindowMgr.h" #include "windowManager/sdl/sdlCursorController.h" #include "platformSDL/sdlInput.h" -#include "platform/menus/popupMenu.h" #include "platform/platformInput.h" #include "gfx/gfxDevice.h" diff --git a/Templates/BaseGame/game/core/CoreComponents.cs b/Templates/BaseGame/game/core/CoreComponents.cs new file mode 100644 index 000000000..5bdca8cd3 --- /dev/null +++ b/Templates/BaseGame/game/core/CoreComponents.cs @@ -0,0 +1,10 @@ + +function CoreComponentsModule::onCreate(%this) +{ + %classList = enumerateConsoleClasses( "Component" ); + + foreach$( %componentClass in %classList ) + { + echo("Native Component of type: " @ %componentClass); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/CoreComponents.module b/Templates/BaseGame/game/core/CoreComponents.module new file mode 100644 index 000000000..0636e3bb5 --- /dev/null +++ b/Templates/BaseGame/game/core/CoreComponents.module @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml new file mode 100644 index 000000000..8e60db364 --- /dev/null +++ b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/BaseGame/game/core/components/animationComponent.asset.taml b/Templates/BaseGame/game/core/components/animationComponent.asset.taml new file mode 100644 index 000000000..771d38e02 --- /dev/null +++ b/Templates/BaseGame/game/core/components/animationComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml similarity index 58% rename from Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml rename to Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml index e03081564..b615f2348 100644 --- a/Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml @@ -1,7 +1,8 @@ + description="Acts as a boon arm for a camera component." /> diff --git a/Templates/Full/game/scripts/server/components/collisionComponent.asset.taml b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml similarity index 57% rename from Templates/Full/game/scripts/server/components/collisionComponent.asset.taml rename to Templates/BaseGame/game/core/components/collisionComponent.asset.taml index 9796df18d..1a4f99a0d 100644 --- a/Templates/Full/game/scripts/server/components/collisionComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables an entity to collide with things." /> diff --git a/Templates/Full/game/scripts/server/components/game/camera.asset.taml b/Templates/BaseGame/game/core/components/game/camera.asset.taml similarity index 65% rename from Templates/Full/game/scripts/server/components/game/camera.asset.taml rename to Templates/BaseGame/game/core/components/game/camera.asset.taml index 5d00d1170..f59e429e2 100644 --- a/Templates/Full/game/scripts/server/components/game/camera.asset.taml +++ b/Templates/BaseGame/game/core/components/game/camera.asset.taml @@ -1,7 +1,9 @@ + description="Allows the component owner to operate as a camera." + scriptFile="core/components/game/camera.cs" /> diff --git a/Templates/Full/game/scripts/server/components/game/camera.cs b/Templates/BaseGame/game/core/components/game/camera.cs similarity index 56% rename from Templates/Full/game/scripts/server/components/game/camera.cs rename to Templates/BaseGame/game/core/components/game/camera.cs index 24363bd82..b6f510c9d 100644 --- a/Templates/Full/game/scripts/server/components/game/camera.cs +++ b/Templates/BaseGame/game/core/components/game/camera.cs @@ -100,97 +100,86 @@ function CameraComponent::onClientDisconnect(%this, %client) } } -//move to the editor later -GlobalActionMap.bind("keyboard", "alt c", "toggleEditorCam"); +/// +/// +/// -function switchCamera(%client, %newCamEntity) +function VRCameraComponent::onAdd(%this) { - if(!isObject(%client) || !isObject(%newCamEntity)) - return error("SwitchCamera: No client or target camera!"); - - %cam = %newCamEntity.getComponent(CameraComponent); - - if(!isObject(%cam)) - return error("SwitchCamera: Target camera doesn't have a camera behavior!"); - - //TODO: Cleanup clientOwner for previous camera! - if(%cam.clientOwner == 0 || %cam.clientOwner $= "") - %cam.clientOwner = 0; - - %cam.scopeToClient(%client); - %cam.setDirty(); - - %client.setCameraObject(%newCamEntity); - %client.setControlCameraFov(%cam.FOV); - - %client.camera = %newCamEntity; -} + %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", ""); -function buildEditorCamera() -{ - if(isObject("EditorCamera")) - return EditorCamera; - - %camObj = SGOManager.spawn("SpectatorObject", false); - - %camObj.name = "EditorCamera"; - - %client = ClientGroup.getObject(0); - - %camObj.getComponent(SpectatorControls).setupControls(%client); - - MissionCleanup.add(%camObj); - - return %camObj; -} + %test = %this.clientOwner; -//TODO: Move this somewhere else! -function toggleEditorCam(%val) -{ - if(!%val) - return; - - %client = ClientGroup.getObject(0); + %barf = ClientGroup.getCount(); - if(!isObject(%client.camera)) - return error("ToggleEditorCam: no existing camera!"); - - %editorCam = buildEditorCamera(); - - //if this is our first switch, just go to the editor camera - if(%client.lastCam $= "" || %client.camera.getId() != %editorCam.getId()) + %clientID = %this.getClientID(); + if(%clientID && !isObject(%clientID.camera)) { - if(%client.lastCam $= "") - { - //set up the position - %editorCam.position = %client.camera.position; - %editorCam.rotation = %client.camera.rotation; - } - - %client.lastCam = %client.camera; - %client.lastController = %client.getControlObject(); - switchCamera(%client, %editorCam); - switchControlObject(%client, %editorCam); - } - else - { - switchCamera(%client, %client.lastCam); - switchControlObject(%client, %client.lastController); - %client.lastCam = %editorCam; - %client.lastController = %editorCam; + %this.scopeToClient(%clientID); + %this.setDirty(); + + %clientID.setCameraObject(%this.owner); + %clientID.setControlCameraFov(%this.FOV); + + %clientID.camera = %this.owner; } + + %res = $pref::Video::mode; + %derp = 0; } -function serverCmdSetClientAspectRatio(%client, %width, %height) +function VRCameraComponent::onRemove(%this) { - echo("Client: " @ %client SPC "changing screen res to: " @ %width SPC %height); - %client.screenExtent = %width SPC %height; - %cam = %client.getCameraObject(); - - if(!isObject(%cam)) - return; - - %cameraComp = %cam.getComponent(CameraComponent); + %clientID = %this.getClientID(); + if(%clientID) + %clientID.clearCameraObject(); +} - %cameraComp.ScreenAspect = %width SPC %height; +function CameraComponent::onInspectorUpdate(%this) +{ + //if(%this.clientOwner) + //%this.clientOwner.setCameraObject(%this.owner); +} + +function VRCameraComponent::getClientID(%this) +{ + return ClientGroup.getObject(%this.clientOwner-1); +} + +function VRCameraComponent::isClientCamera(%this, %client) +{ + %clientID = ClientGroup.getObject(%this.clientOwner-1); + + if(%client.getID() == %clientID) + return true; + else + return false; +} + +function VRCameraComponent::onClientConnect(%this, %client) +{ + //if(%this.isClientCamera(%client) && !isObject(%client.camera)) + //{ + %this.scopeToClient(%client); + %this.setDirty(); + + %client.setCameraObject(%this.owner); + %client.setControlCameraFov(%this.FOV); + + %client.camera = %this.owner; + //} + //else + //{ + // echo("CONNECTED CLIENT IS NOT CAMERA OWNER!"); + //} +} + +function VRCameraComponent::onClientDisconnect(%this, %client) +{ + Parent::onClientDisconnect(%this, %client); + + if(isClientCamera(%client)){ + %this.clearScopeToClient(%client); + %client.clearCameraObject(); + } } \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/components/game/controlObject.asset.taml b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml similarity index 68% rename from Templates/Full/game/scripts/server/components/game/controlObject.asset.taml rename to Templates/BaseGame/game/core/components/game/controlObject.asset.taml index 2c9d48e1c..19515e833 100644 --- a/Templates/Full/game/scripts/server/components/game/controlObject.asset.taml +++ b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml @@ -1,7 +1,10 @@ + description="Allows the component owner to be controlled by a client." + scriptFile="core/components/game/controlObject.cs" /> diff --git a/Templates/Full/game/scripts/server/components/game/controlObject.cs b/Templates/BaseGame/game/core/components/game/controlObject.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/game/controlObject.cs rename to Templates/BaseGame/game/core/components/game/controlObject.cs diff --git a/Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml similarity index 68% rename from Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml rename to Templates/BaseGame/game/core/components/game/itemRotate.asset.taml index 8068b49f3..4c0c1bec4 100644 --- a/Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml +++ b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml @@ -1,7 +1,10 @@ + description="Rotates the entity around an axis, like an item pickup." + scriptFile="core/components/game/itemRotate.cs" /> diff --git a/Templates/Full/game/scripts/server/components/game/itemRotate.cs b/Templates/BaseGame/game/core/components/game/itemRotate.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/game/itemRotate.cs rename to Templates/BaseGame/game/core/components/game/itemRotate.cs diff --git a/Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml similarity index 62% rename from Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml rename to Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml index d181a86b4..8a597aca4 100644 --- a/Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml +++ b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml @@ -1,7 +1,10 @@ + description="When a client connects, it spawns a player object for them and attaches them to it." + scriptFile="core/components/game/playerSpawner.cs" /> diff --git a/Templates/Full/game/scripts/server/components/game/playerSpawner.cs b/Templates/BaseGame/game/core/components/game/playerSpawner.cs similarity index 78% rename from Templates/Full/game/scripts/server/components/game/playerSpawner.cs rename to Templates/BaseGame/game/core/components/game/playerSpawner.cs index fb6507d08..a7387eaf1 100644 --- a/Templates/Full/game/scripts/server/components/game/playerSpawner.cs +++ b/Templates/BaseGame/game/core/components/game/playerSpawner.cs @@ -29,32 +29,40 @@ function PlayerSpawner::onAdd(%this) %this.friendlyName = "Player Spawner"; %this.componentType = "Spawner"; - %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", string, "PlayerObject"); + %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject"); } function PlayerSpawner::onClientConnect(%this, %client) { - %playerObj = SGOManager.spawn(%this.GameObjectName); + %playerObj = spawnGameObject(%this.GameObjectName, false); if(!isObject(%playerObj)) return; %playerObj.position = %this.owner.position; - MissionCleanup.add(%playerObj); - - for(%b = 0; %b < %playerObj.getComponentCount(); %b++) - { - %comp = %playerObj.getComponentByIndex(%b); - - if(%comp.isMethod("onClientConnect")) - %comp.onClientConnect(%client); - } + %playerObj.notify("onClientConnect", %client); switchControlObject(%client, %playerObj); switchCamera(%client, %playerObj); - //%playerObj.getComponent(FPSControls).setupControls(%client); + %client.player = %playerObj; + %client.camera = %playerObj; + + %inventory = %playerObj.getComponent(InventoryController); + + if(isObject(%inventory)) + { + for(%i=0; %i<5; %i++) + { + %arrow = spawnGameObject(ArrowProjectile, false); + + %inventory.addItem(%arrow); + } + } + + %playerObj.position = %this.owner.position; + %playerObj.rotation = "0 0 0"; %this.clientCount++; } diff --git a/Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml similarity index 62% rename from Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml rename to Templates/BaseGame/game/core/components/input/fpsControls.asset.taml index 34f31f181..cd0440055 100644 --- a/Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml +++ b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml @@ -1,7 +1,9 @@ + description="First Person Shooter-type controls." /> diff --git a/Templates/Full/game/scripts/server/components/input/fpsControls.cs b/Templates/BaseGame/game/core/components/input/fpsControls.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/input/fpsControls.cs rename to Templates/BaseGame/game/core/components/input/fpsControls.cs diff --git a/Templates/Full/game/scripts/server/components/input/inputManager.cs b/Templates/BaseGame/game/core/components/input/inputManager.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/input/inputManager.cs rename to Templates/BaseGame/game/core/components/input/inputManager.cs diff --git a/Templates/BaseGame/game/core/components/meshComponent.asset.taml b/Templates/BaseGame/game/core/components/meshComponent.asset.taml new file mode 100644 index 000000000..b41de171a --- /dev/null +++ b/Templates/BaseGame/game/core/components/meshComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml similarity index 80% rename from Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml rename to Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml index d5174644b..417f409e0 100644 --- a/Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables an entity to move like a player object." /> diff --git a/Templates/BaseGame/game/core/components/soundComponent.asset.taml b/Templates/BaseGame/game/core/components/soundComponent.asset.taml new file mode 100644 index 000000000..a29bcc9ff --- /dev/null +++ b/Templates/BaseGame/game/core/components/soundComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml similarity index 59% rename from Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml rename to Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml index a261bb194..ff1d53cd8 100644 --- a/Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables a state machine on the entity." /> diff --git a/Templates/BaseGame/game/core/helperFunctions.cs b/Templates/BaseGame/game/core/helperFunctions.cs index 855b5164a..1b98f1ea5 100644 --- a/Templates/BaseGame/game/core/helperFunctions.cs +++ b/Templates/BaseGame/game/core/helperFunctions.cs @@ -202,7 +202,7 @@ function updateTSShapeLoadProgress(%progress, %msg) { // Check if the loading GUI is visible and use that instead of the // separate import progress GUI if possible - if ( isObject(LoadingGui) && LoadingGui.isAwake() ) + /* if ( isObject(LoadingGui) && LoadingGui.isAwake() ) { // Save/Restore load progress at the start/end of the import process if ( %progress == 0 ) @@ -245,7 +245,7 @@ function updateTSShapeLoadProgress(%progress, %msg) %textCtrl.setText(%msg); } - Canvas.repaint(33); + Canvas.repaint(33);*/ } /// A helper function which will return the ghosted client object @@ -952,3 +952,207 @@ function TestPManager::testObjectRemove(%doNotSave) TestPManager.removeObjectFromFile(AudioSim); } +//Game Object management +function findGameObject(%name) +{ + //find all GameObjectAssets + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) + return 0; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); + + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %assetName = AssetDatabase.getAssetName(%assetId); + + if(%assetName $= %name) + { + %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); + + %assetQuery.delete(); + return %gameObjectAsset; + } + } + + %assetQuery.delete(); + return 0; +} + +function spawnGameObject(%name, %addToMissionGroup) +{ + if(%addToMissionGroup $= "") + %addToMissionGroup = true; + + //First, check if this already exists in our GameObjectPool + if(isObject(GameObjectPool)) + { + %goCount = GameObjectPool.countKey(%name); + + //if we have some already in the pool, pull it out and use that + if(%goCount != 0) + { + %goIdx = GameObjectPool.getIndexFromKey(%name); + %go = GameObjectPool.getValue(%goIdx); + + %go.setHidden(false); + %go.setScopeAlways(); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%go); + else // clear instance on level exit + MissionCleanup.add(%go); + + //remove from the object pool's list + GameObjectPool.erase(%goIdx); + + return %go; + } + } + + //We have no existing pool, or no existing game objects of this type, so spawn a new one + + %gameObjectAsset = findGameObject(%name); + + if(isObject(%gameObjectAsset)) + { + %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%newSGOObject); + else // clear instance on level exit + MissionCleanup.add(%newSGOObject); + + return %newSGOObject; + } + + return 0; +} + +function saveGameObject(%name, %tamlPath, %scriptPath) +{ + %gameObjectAsset = findGameObject(%name); + + //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset + if(isObject(%gameObjectAsset)) + { + %assetID = %gameObjectAsset.getAssetId(); + + %gameObjectAsset.TAMLFilePath = %tamlPath; + %gameObjectAsset.scriptFilePath = %scriptPath; + + TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); + AssetDatabase.refreshAsset(%assetID); + } + else + { + //Doesn't exist, so make a new one + %gameObjectAsset = new GameObjectAsset() + { + assetName = %name @ "Asset"; + gameObjectName = %name; + TAMLFilePath = %tamlPath; + scriptFilePath = %scriptPath; + }; + + //Save it alongside the taml file + %path = filePath(%tamlPath); + + TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); + AssetDatabase.refreshAllAssets(true); + } +} + +//Allocates a number of a game object into a pool to be pulled from as needed +function allocateGameObjects(%name, %amount) +{ + //First, we need to make sure our pool exists + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + //Next, we loop and generate our game objects, and add them to the pool + for(%i=0; %i < %amount; %i++) + { + %go = spawnGameObject(%name, false); + + //When our object is in the pool, it's not "real", so we need to make sure + //that we don't ghost it to clients untill we actually spawn it. + %go.clearScopeAlways(); + + //We also hide it, so that we don't 'exist' in the scene until we spawn + %go.hidden = true; + + //Lastly, add us to the pool, with the key being our game object type + GameObjectPool.add(%name, %go); + } +} + +function Entity::delete(%this) +{ + //we want to intercept the delete call, and add it to our GameObjectPool + //if it's a game object + if(%this.gameObjectAsset !$= "") + { + %this.setHidden(true); + %this.clearScopeAlways(); + + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + GameObjectPool.add(%this.gameObjectAsset, %this); + + %missionSet = %this.getGroup(); + %missionSet.remove(%this); + } + else + { + %this.superClass.delete(); + } +} + +function clearGameObjectPool() +{ + if(isObject(GameObjectPool)) + { + %count = GameObjectPool.count(); + + for(%i=0; %i < %count; %i++) + { + %go = GameObjectPool.getValue(%i); + + %go.superClass.delete(); + } + + GameObjectPool.empty(); + } +} + +// +function switchCamera(%client, %newCamEntity) +{ + if(!isObject(%client) || !isObject(%newCamEntity)) + return error("SwitchCamera: No client or target camera!"); + + %cam = %newCamEntity.getComponent(CameraComponent); + + if(!isObject(%cam)) + return error("SwitchCamera: Target camera doesn't have a camera behavior!"); + + //TODO: Cleanup clientOwner for previous camera! + if(%cam.clientOwner == 0 || %cam.clientOwner $= "") + %cam.clientOwner = 0; + + %cam.scopeToClient(%client); + %cam.setDirty(); + + %client.setCameraObject(%newCamEntity); + %client.setControlCameraFov(%cam.FOV); + + %client.camera = %newCamEntity; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/main.cs b/Templates/BaseGame/game/core/main.cs index a8a396f41..8058c1f90 100644 --- a/Templates/BaseGame/game/core/main.cs +++ b/Templates/BaseGame/game/core/main.cs @@ -41,6 +41,12 @@ $Core::UnAvailableTexturePath = "core/images/unavailable"; $Core::WarningTexturePath = "core/images/warnMat"; $Core::CommonShaderPath = "core/shaders"; +ModuleDatabase.setModuleExtension("module"); + +//Core components +ModuleDatabase.scanModules( "core", false ); +ModuleDatabase.LoadExplicit( "CoreComponentsModule" ); + exec("./helperFunctions.cs"); // We need some of the default GUI profiles in order to get the canvas and diff --git a/Templates/BaseGame/game/data/clientServer/ClientServer.cs b/Templates/BaseGame/game/data/clientServer/ClientServer.cs index 3cf7aaa55..e8530f22e 100644 --- a/Templates/BaseGame/game/data/clientServer/ClientServer.cs +++ b/Templates/BaseGame/game/data/clientServer/ClientServer.cs @@ -46,7 +46,7 @@ function ClientServer::destroy( %this ) disconnect(); // Destroy the physics plugin. - physicsDestroy(); + //physicsDestroy(); sfxShutdown(); diff --git a/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs b/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs index c3a4a3e26..38709c971 100644 --- a/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs +++ b/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs @@ -132,6 +132,23 @@ function isNameUnique(%name) // function GameConnection::onDrop(%client, %reason) { + %entityIds = parseMissionGroupForIds("Entity", ""); + %entityCount = getWordCount(%entityIds); + + for(%i=0; %i < %entityCount; %i++) + { + %entity = getWord(%entityIds, %i); + + for(%e=0; %e < %entity.getCount(); %e++) + { + %child = %entity.getObject(%e); + if(%child.getClassName() $= "Entity") + %entityIds = %entityIds SPC %child.getID(); + } + + %entity.notify("onClientDisconnect", %client); + } + if($missionRunning) theLevelInfo.onClientLeaveGame(); diff --git a/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs b/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs index a598ee04f..e33f80711 100644 --- a/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs +++ b/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs @@ -131,6 +131,22 @@ function serverCmdMissionStartPhase3Ack(%client, %seq) %client.currentPhase = 3; // Server is ready to drop into the game + %entityIds = parseMissionGroupForIds("Entity", ""); + %entityCount = getWordCount(%entityIds); + + for(%i=0; %i < %entityCount; %i++) + { + %entity = getWord(%entityIds, %i); + + for(%e=0; %e < %entity.getCount(); %e++) + { + %child = %entity.getObject(%e); + if(%child.getCLassName() $= "Entity") + %entityIds = %entityIds SPC %child.getID(); + } + + %entity.notify("onClientConnect", %client); + } //Have any special game-play handling here if(theLevelInfo.isMethod("onClientEnterGame")) @@ -151,7 +167,7 @@ function serverCmdMissionStartPhase3Ack(%client, %seq) }; } - if (isDefined("$Game::DefaultCameraClass")) + //if (isDefined("$Game::DefaultCameraClass")) %client.camera = spawnObject("Camera", Observer); } diff --git a/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs b/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs index 4fd007b35..9f30ecf5d 100644 --- a/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs +++ b/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs @@ -25,11 +25,14 @@ function initServer() echo("\n--------- Initializing " @ $appName @ ": Server Scripts ---------"); //load prefs + + //Force-load the defaults just so we don't have any mistakes + exec( "data/clientServer/scripts/server/defaults.cs" ); + + //Then, if the user has saved preferences, we load those over-top the defaults %prefPath = getPrefpath(); if ( isFile( %prefPath @ "/serverPrefs.cs" ) ) exec( %prefPath @ "/serverPrefs.cs" ); - else - exec( "data/clientServer/scripts/server/defaults.cs" ); exec( "data/clientServer/scripts/server/audio.cs" ); exec( "data/clientServer/scripts/server/commands.cs" ); @@ -99,6 +102,11 @@ function createAndConnectToLocalServer( %serverType, %level ) { %conn.delete(); destroyServer(); + + MessageBoxOK("Error starting local server!", "There was an error when trying to connect to the local server."); + + if(isObject(MainMenuGui)) + Canvas.setContent(MainMenuGui); return false; } @@ -201,7 +209,7 @@ function destroyServer() // End any running levels and shut down the physics sim onServerDestroyed(); - physicsDestroy(); + //physicsDestroy(); // Delete all the server objects if (isObject(ServerGroup)) diff --git a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs index c5ae1e297..af260c27d 100644 --- a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs +++ b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs @@ -31,29 +31,29 @@ function ChooseLevelDlg::onWake( %this ) %this->LevelDescriptionLabel.visible = false; %this->LevelDescription.visible = false; - %count = LevelFilesList.count(); + %assetQuery = new AssetQuery(); + AssetDatabase.findAssetType(%assetQuery, "LevelAsset"); + + %count = %assetQuery.getCount(); - if(%count == 0) + if(%count == 0 && !IsDirectory("tools")) { //We have no levels found. Prompt the user to open the editor to the default level if the tools are present - if(IsDirectory("tools")) - { - MessageBoxYesNo("Error", "No levels were found in any modules. Do you want to load the editor and start a new level?", - "fastLoadWorldEdit(1);", - "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); - } - else - { - MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", - "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); - } - + MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", + "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); + + %assetQuery.delete(); return; } - for ( %i=0; %i < %count; %i++ ) - { - %file = LevelFilesList.getKey( %i ); + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %levelAsset = AssetDatabase.acquireAsset(%assetId); + + %file = %levelAsset.LevelFile; + if ( !isFile(%file @ ".mis") && !isFile(%file) ) continue; @@ -66,7 +66,7 @@ function ChooseLevelDlg::onWake( %this ) continue; } - %this.addMissionFile( %file ); + %this.addLevelAsset( %levelAsset ); } // Also add the new level mission as defined in the world editor settings @@ -218,6 +218,38 @@ function ChooseLevelDlg::addMissionFile( %this, %file ) CL_levelList.addRow( CL_levelList.rowCount(), %levelName TAB %file TAB %levelDesc TAB %levelPreview ); } +function ChooseLevelDlg::addLevelAsset( %this, %levelAsset ) +{ + %file = %levelAsset.LevelFile; + + /*%levelName = fileBase(%file); + %levelDesc = "A Torque level"; + + %LevelInfoObject = getLevelInfo(%file); + + if (%LevelInfoObject != 0) + { + if(%LevelInfoObject.levelName !$= "") + %levelName = %LevelInfoObject.levelName; + else if(%LevelInfoObject.name !$= "") + %levelName = %LevelInfoObject.name; + + if (%LevelInfoObject.desc0 !$= "") + %levelDesc = %LevelInfoObject.desc0; + + if (%LevelInfoObject.preview !$= "") + %levelPreview = %LevelInfoObject.preview; + + %LevelInfoObject.delete(); + }*/ + + %levelName = %levelAsset.friendlyName; + %levelDesc = %levelAsset.description; + %levelPreview = %levelAsset.levelPreviewImage; + + CL_levelList.addRow( CL_levelList.rowCount(), %levelName TAB %file TAB %levelDesc TAB %levelPreview ); +} + function ChooseLevelDlg::onSleep( %this ) { // This is set from the outside, only stays true for a single wake/sleep diff --git a/Templates/BaseGame/game/main.cs.in b/Templates/BaseGame/game/main.cs.in index 2ec150c0d..3eed267df 100644 --- a/Templates/BaseGame/game/main.cs.in +++ b/Templates/BaseGame/game/main.cs.in @@ -42,8 +42,11 @@ setNetPort(0); startFileChangeNotifications(); // If we have editors, initialize them here as well -if(isFile("tools/main.cs") && !$isDedicated) - exec("tools/main.cs"); +if (isToolBuild()) +{ + if(isFile("tools/main.cs") && !$isDedicated) + exec("tools/main.cs"); +} ModuleDatabase.setModuleExtension("module"); ModuleDatabase.scanModules( "data", false ); diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png new file mode 100644 index 000000000..381dcee84 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png new file mode 100644 index 000000000..3f83a2ff3 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png new file mode 100644 index 000000000..cbaf56990 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png new file mode 100644 index 000000000..6b285daae Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png new file mode 100644 index 000000000..ffeb015f1 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png new file mode 100644 index 000000000..7fdb61d1b Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png new file mode 100644 index 000000000..0e6c456a6 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/postEffectIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/postEffectIcon.png new file mode 100644 index 000000000..316cb2c83 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/postEffectIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png new file mode 100644 index 000000000..1a2433dea Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png new file mode 100644 index 000000000..f65bccb39 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/soundIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/soundIcon.png new file mode 100644 index 000000000..9705c33d8 Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/soundIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png new file mode 100644 index 000000000..95ef798ee Binary files /dev/null and b/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png differ diff --git a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml new file mode 100644 index 000000000..a442ab0a8 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui new file mode 100644 index 000000000..eb2bf15e6 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui @@ -0,0 +1,217 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(GameObjectCreator) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + selectedEntity = "20054"; + + new GuiWindowCtrl(CreateGameObjectWindow) { + text = "Create GameObject"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(GameObjectCreator);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 322"; + extent = "368 123"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(GameObjectCreateBtn) { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 92"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_importAssetWindow.ImportAssets();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 92"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(GameObjectCreator);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(GameObjectCreatorObjectName) { + text = "Game Object Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 60"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(GameObjectCreatorPkgBtn) { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_addModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(GameObjectModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + text = "Characters"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(GameObjectCreatorName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "116 60"; + extent = "234 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui new file mode 100644 index 000000000..e8f35a13a --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui @@ -0,0 +1,142 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_AddModule) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + Enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_addModuleWindow) { + text = "Create New Module"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "88 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ModuleName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Module Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "72 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addModuleWindow.CreateNewModule();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addModuleWindow.Close();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui new file mode 100644 index 000000000..48a48f5be --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui @@ -0,0 +1,142 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_AddPackage) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + Enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_addPackageWindow) { + text = "Create New Package"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "88 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "PackageName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Package Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "72 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addPackageWindow.CreateNewPackage();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addPackageWindow.Close();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui new file mode 100644 index 000000000..fd06f7561 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -0,0 +1,934 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + AddNewArtAssetPopup = "18801"; + AddNewAssetPopup = "18802"; + AddNewScriptAssetPopup = "18800"; + currentPreviewPage = "0"; + enabled = "1"; + importAssetFinalListArray = "20465"; + importAssetNewListArray = "20463"; + importAssetUnprocessedListArray = "20464"; + totalPages = "1"; + + new GuiWindowCtrl(AssetBrowser_addFilterWindow) { + text = "Create New Tag"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "321 334"; + extent = "381 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "64 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "tagName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Tag Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "52 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "64 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.createFilter( AssetBrowser_addFilterWindow-->tagName.getText() );AssetBrowser_addFilterWindow.setVisible(0);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "196 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addFilterWindow.setVisible(0);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiWindowCtrl(AssetBrowserWindow) { + text = "Asset Browser"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "AssetBrowser::hideDialog();"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "256 107"; + extent = "512 554"; + minExtent = "383 274"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(CreateAssetButton) { + text = "New"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "3 22"; + extent = "45 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ImportAssetButton) { + text = "Import"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "50 22"; + extent = "45 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiWindowCtrl(TagFilterWindow) { + text = "New Window"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + docking = "None"; + margin = "4 4 4 4"; + padding = "0 0 0 0"; + anchorTop = "0"; + anchorBottom = "0"; + anchorLeft = "0"; + anchorRight = "0"; + position = "129 62"; + extent = "161 250"; + minExtent = "161 86"; + horizSizing = "windowRelative"; + vertSizing = "windowRelative"; + profile = "ToolsGuiToolbarWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "VisibilityLayerWindow"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "2 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 9"; + extent = "159 238"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl(TagFilterList) { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "-2"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "3 1"; + extent = "153 16"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "theVisOptionsList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiSplitContainer() { + orientation = "Vertical"; + splitterSize = "2"; + splitPoint = "149 100"; + fixedPanel = "None"; + fixedSize = "356"; + docking = "None"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "3 42"; + extent = "505 509"; + minExtent = "64 64"; + horizSizing = "relative"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPanel() { + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 509"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "Panel1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 31"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "inspectorStyleRolloutDarkProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Filters"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "5 0"; + extent = "30 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconNew.png"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "113 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.viewTagsFilter();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Show assets grouped and filtered via tags."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconList.png"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "130 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.viewListFilter();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Views assets via module-oriented list tree."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 17"; + extent = "147 493"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 493"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiEditorScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiDefaultProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTreeViewCtrl(AssetBrowserFilterTree) { + tabSize = "16"; + textOffset = "2"; + fullRowSelect = "0"; + itemHeight = "21"; + destroyTreeOnSleep = "1"; + mouseDragging = "1"; + multipleSelections = "1"; + deleteObjectAllowed = "1"; + dragToItemAllowed = "1"; + clearAllOnSingleSelection = "1"; + showRoot = "1"; + useInspectorTooltips = "0"; + tooltipOnWidthOnly = "0"; + showObjectIds = "1"; + showClassNames = "1"; + showObjectNames = "1"; + showInternalNames = "1"; + showClassNameForUnnamedObjects = "0"; + compareToObjectID = "1"; + canRenameObjects = "1"; + renameInternal = "0"; + position = "1 1"; + extent = "145 294"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTreeViewProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "filterTree"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + }; + new GuiPanel() { + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "151 0"; + extent = "354 509"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "panel2"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 0"; + extent = "354 41"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "inspectorStyleRolloutDarkProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/new"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "42 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.createNewAsset();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Create New Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/delete"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "23 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showDeleteDialog();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(AssetBrowserSearchFilter) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + text = "\c2Filter..."; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "62 19"; + extent = "273 18"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserSearchFilterText"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(TagFilterButton) { + bitmap = "tools/gui/images/visible"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "4 19"; + extent = "20 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.toggleTagFilterPopup();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Assets"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "5 0"; + extent = "53 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/delete"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "337 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showDeleteDialog();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "1"; + position = "1 40"; + extent = "354 468"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl(AssetListPanel) { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "354 448"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiEditorScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiDefaultProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl() { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "0"; + position = "1 1"; + extent = "352 254"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiModelessDialogProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiControl() { + position = "0 0"; + extent = "352 4"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiDynamicCtrlArrayControl() { + colCount = "3"; + colSize = "100"; + rowCount = "2"; + rowSize = "124"; + rowSpacing = "2"; + colSpacing = "2"; + frozen = "0"; + autoCellSize = "1"; + fillRowFirst = "1"; + dynamicSize = "1"; + padding = "0 0 0 0"; + position = "3 4"; + extent = "352 250"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "materialSelection"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiContainer() { + docking = "Bottom"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 448"; + extent = "354 20"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "materialPreviewControlContainer"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "242 491"; + extent = "53 19"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "SelectButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "300 491"; + extent = "52 19"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.hideDialog();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui new file mode 100644 index 000000000..199ad91b8 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui @@ -0,0 +1,613 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetImportCtrl) { + position = "0 0"; + extent = "1440 900"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(ImportAssetOptionsWindow) { + text = "Import Options"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "633 358"; + extent = "346 409"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "271 377"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetOptionsWindow.saveAssetOptions();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 26"; + extent = "326 344"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(ImportOptionsList) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "309 64"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiWindowCtrl(ImportAssetConfigEditorWindow) { + text = "Import Options Config"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "562 251"; + extent = "376 503"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Configuration Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "10 26"; + extent = "100 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(AssetImportConfigName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "113 25"; + extent = "250 18"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "301 471"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.saveAssetOptionsConfig();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 50"; + extent = "356 414"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(ImportOptionsConfigList) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "339 64"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiWindowCtrl(ImportAssetWindow) { + text = "Import Assets"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "536 205"; + extent = "368 502"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 470"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetWindow.ImportAssets();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 470"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ImportAssetModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_addModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Module"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Import Options Config:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 56"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ImportAssetConfigList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "126 53"; + extent = "175 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "305 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.addNewConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconInformation.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "325 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.editConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Edit Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconDelete.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "346 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.deleteConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 82"; + extent = "348 381"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl(ImportingAssetList) { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "0"; + changeChildPosition = "1"; + position = "1 1"; + extent = "345 20"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui new file mode 100644 index 000000000..45d411f20 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui @@ -0,0 +1,147 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_editAsset) { + position = "0 0"; + extent = "1920 1080"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_editAssetWindow) { + text = "Asset Properties"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "1"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_editAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "710 375"; + extent = "500 329"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 21"; + extent = "498 283"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiInspector(AssetEditInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "481 101"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiInspectorProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Save"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "402 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_editAsset.saveAsset();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "450 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_editAsset);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui new file mode 100644 index 000000000..90ff639dd --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui @@ -0,0 +1,147 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_editModule) { + position = "0 0"; + extent = "1920 1080"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_editModuleWindow) { + text = "Module Properties"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "1"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_editModule);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "710 375"; + extent = "500 329"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 21"; + extent = "498 283"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiInspector(ModuleEditInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "481 101"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiInspectorProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Save"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "402 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_editModule.saveModule();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "450 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_editModule);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui new file mode 100644 index 000000000..09fcb997d --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui @@ -0,0 +1,237 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_newAsset) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(AssetBrowser_newAssetWindow) { + text = "Create Asset"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_newAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 140"; + extent = "368 450"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(NewAssetCreateBtn) { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "227 419"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "CreateNewAsset();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "295 419"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_newAssetWindow.onClose();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(NewAssetModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(NewAssetModuleBtn) { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_AddModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiControl(NewComponentAssetSettings) { + position = "12 120"; + extent = "344 107"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOn"; + vScrollBar = "alwaysOn"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "7 56"; + extent = "354 357"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(NewAssetPropertiesInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "337 338"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui new file mode 100644 index 000000000..65896dccc --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui @@ -0,0 +1,434 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_newComponentAsset) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(AssetBrowser_newComponentAssetWindow) { + text = "Create Component"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_newComponentAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 250"; + extent = "368 268"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "NewComponentModuleList"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_AddModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "NewComponentModuleBtn"; + class = "NewAssetModuleBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Component Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 83"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 83"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Parent Component:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 57"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ParentComponentList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 54"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "NewAssetTypeList.onSelected();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentFriendlyName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 109"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Friendly Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 109"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentGroup) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 134"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Component Group:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 134"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 159"; + extent = "203 64"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiMLTextEditCtrl(NewComponentDescription) { + lineSpacing = "2"; + allowColorChars = "0"; + maxChars = "-1"; + useURLMouseCursor = "0"; + position = "1 0"; + extent = "201 64"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTextCtrl() { + text = "Description:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 159"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 240"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "createNewComponentAsset();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 240"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_newComponentAsset);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui new file mode 100644 index 000000000..a1c4293ab --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui @@ -0,0 +1,144 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_SelectModule) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_SelectModuleWindow) { + text = "Select Module"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "39 34"; + extent = "217 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserModuleList"; + internalName = "ModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "260 32"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + class = "SelectPackage_NewAssetModuleBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_SelectModule);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_addModule);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui new file mode 100644 index 000000000..055763d35 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui @@ -0,0 +1,144 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_SelectPackage) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_SelectPackageWindow) { + text = "Select Package"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "39 34"; + extent = "217 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserPackageList"; + internalName = "PackageList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "260 32"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + class = "SelectPackage_NewAssetPackageBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_SelectPackage);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_addPackage);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.cs b/Templates/BaseGame/game/tools/assetBrowser/main.cs new file mode 100644 index 000000000..32ae4682f --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/main.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +if( !isObject( ToolsGuiDefaultNonModalProfile ) ) +new GuiControlProfile (ToolsGuiDefaultNonModalProfile : ToolsGuiDefaultProfile) +{ + modal = false; +}; + +function initializeAssetBrowser() +{ + echo(" % - Initializing Asset Browser"); + + exec("./guis/assetBrowser.gui"); + exec("./guis/addModuleWindow.gui"); + exec("./guis/gameObjectCreator.gui"); + exec("./guis/newAsset.gui"); + exec("./guis/newComponentAsset.gui"); + exec("./guis/editAsset.gui"); + exec("./guis/assetImport.gui"); + exec("./guis/selectModule.gui"); + exec("./guis/editModule.gui"); + + exec("./scripts/assetBrowser.cs"); + exec("./scripts/popupMenus.cs"); + exec("./scripts/addModuleWindow.cs"); + exec("./scripts/assetImport.cs"); + exec("./scripts/assetImportConfig.cs"); + exec("./scripts/gameObjectCreator.cs"); + exec("./scripts/newAsset.cs"); + exec("./scripts/editAsset.cs"); + exec("./scripts/editModule.cs"); + + exec("./scripts/fieldTypes.cs"); + + new ScriptObject( AssetBrowserPlugin ) + { + superClass = "EditorPlugin"; + }; + + Input::GetEventManager().subscribe( AssetBrowser, "BeginDropFiles" ); + Input::GetEventManager().subscribe( AssetBrowser, "DropFile" ); + Input::GetEventManager().subscribe( AssetBrowser, "EndDropFiles" ); + + AssetBrowser.buildPopupMenus(); +} + +function AssetBrowserPlugin::onWorldEditorStartup( %this ) +{ + // Add ourselves to the toolbar. + AssetBrowser.addToolbarButton(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs new file mode 100644 index 000000000..784ed7d63 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs @@ -0,0 +1,112 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function AssetBrowser_addModuleWindow::onGainFirstResponder(%this) +{ + %this-->moduleName.setFirstResponder(); +} + +function AssetBrowser_addModuleWindow::close() +{ + Canvas.popDialog(AssetBrowser_addModule); + eval(AssetBrowser_addModuleWindow.callbackFunction); +} + +function AssetBrowser_addModuleWindow::CreateNewModule(%this) +{ + %newModuleName = %this-->moduleName.getText(); + + if(%newModuleName $= "") + return; + + echo("Creating a new Module named: " @ %newModuleName); + + %moduleFilePath = "data/" @ %newModuleName; + %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module"; + %moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".cs"; + + %newModule = new ModuleDefinition() + { + ModuleId = %newModuleName; + versionId = 1; + ScriptFile = %newModuleName @ ".cs"; + CreateFunction="onCreate"; + DestroyFunction="onDestroy"; + Group = "Game"; + + new DeclaredAssets() + { + Extension = "asset.taml"; + Recurse = true; + }; + }; + + TAMLWrite(%newModule, %moduleDefinitionFilePath); + + //Now generate the script file for it + %file = new FileObject(); + + if(%file.openForWrite(%moduleScriptFilePath)) + { + %file.writeline("function " @ %newModuleName @ "::onCreate(%this)\n{\n\n}\n"); + %file.writeline("function " @ %newModuleName @ "::onDestroy(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //force a refresh of our modules list + ModuleDatabase.ignoreLoadedGroups(true); + ModuleDatabase.scanModules(); + %success = ModuleDatabase.loadExplicit(%newModuleName, 1); + ModuleDatabase.ignoreLoadedGroups(false); + + //force a reload of the Module lists + NewAssetModuleList.refresh(); + GameObjectModuleList.refresh(); + ImportAssetModuleList.refresh(); + + AssetBrowser.newModuleId = %newModuleName; + + Canvas.popDialog(AssetBrowser_addModule); + eval(AssetBrowser_addModuleWindow.callbackFunction); +} + +function AssetBrowserModuleList::onWake(%this) +{ + %this.refresh(); +} + +function AssetBrowserModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs new file mode 100644 index 000000000..90d999b8e --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs @@ -0,0 +1,110 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function AssetBrowser_addPackageWindow::onGainFirstResponder(%this) +{ + %this-->packageName.setFirstResponder(); +} + +function AssetBrowser_addPackageWindow::close() +{ + Canvas.popDialog(AssetBrowser_addPackage); + eval(AssetBrowser_addPackageWindow.callbackFunction); +} + +function AssetBrowser_addPackageWindow::CreateNewPackage(%this) +{ + %newPackageName = %this-->packageName.getText(); + + if(%newPackageName $= "") + return; + + echo("Creating a new package named: " @ %newPackageName); + + %moduleFilePath = "data/" @ %newPackageName; + %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".module"; + %moduleScriptFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".cs"; + + %newPackage = new ModuleDefinition() + { + ModuleId = %newPackageName; + versionId = 1; + ScriptFile = %newPackageName @ ".cs"; + CreateFunction="onCreate"; + DestroyFunction="onDestroy"; + Group = "Game"; + + new DeclaredAssets() + { + Extension = "asset.taml"; + Recurse = true; + }; + }; + + TAMLWrite(%newPackage, %moduleDefinitionFilePath); + + //Now generate the script file for it + %file = new FileObject(); + + if(%file.openForWrite(%moduleScriptFilePath)) + { + %file.writeline("function " @ %newPackageName @ "::onCreate(%this)\n{\n\n}\n"); + %file.writeline("function " @ %newPackageName @ "::onDestroy(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //force a refresh of our modules list + ModuleDatabase.ignoreLoadedGroups(true); + ModuleDatabase.scanModules(); + %success = ModuleDatabase.loadExplicit(%newPackageName, 1); + ModuleDatabase.ignoreLoadedGroups(false); + + //force a reload of the package lists + NewAssetPackageList.refresh(); + GameObjectPackageList.refresh(); + ImportAssetPackageList.refresh(); + + Canvas.popDialog(AssetBrowser_addPackage); + eval(AssetBrowser_addPackageWindow.callbackFunction); +} + +function AssetBrowserPackageList::onWake(%this) +{ + %this.refresh(); +} + +function AssetBrowserPackageList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs new file mode 100644 index 000000000..0979f219e --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs @@ -0,0 +1,1304 @@ + +new SimGroup(AssetBrowserPreviewCache); + +//AssetBrowser.addToolbarButton +function AssetBrowser::addToolbarButton(%this) +{ + %filename = expandFilename("tools/gui/images/iconOpen"); + %button = new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = AssetBrowserBtn; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "180 0"; + Extent = "25 19"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "AssetBrowser.ShowDialog();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Asset Browser"; + hovertime = "750"; + bitmap = %filename; + bitmapMode = "Centered"; + buttonType = "PushButton"; + groupNum = "0"; + useMouseEvents = "0"; + }; + ToolsToolbarArray.add(%button); + EWToolsToolbar.setExtent((25 + 8) * (ToolsToolbarArray.getCount()) + 12 SPC "33"); +} +// +function AssetBrowser::onAdd(%this) +{ + %this.isReImportingAsset = false; +} + +function AssetBrowser::onWake(%this) +{ + %this.importAssetNewListArray = new ArrayObject(); + %this.importAssetUnprocessedListArray = new ArrayObject(); + %this.importAssetFinalListArray = new ArrayObject(); +} + +//Drag-Drop functionality +function AssetBrowser::selectAsset( %this, %asset ) +{ + if(AssetBrowser.selectCallback !$= "") + { + // The callback function should be ready to intake the returned material + //eval("materialEd_previewMaterial." @ %propertyField @ " = " @ %value @ ";"); + if( AssetBrowser.returnType $= "name" ) + { + eval( "" @ AssetBrowser.selectCallback @ "(" @ %name @ ");"); + } + else + { + %command = "" @ AssetBrowser.selectCallback @ "(\"" @ %asset @ "\");"; + eval(%command); + } + } + else + { + //try just setting the asset + %this.changeAsset(); + } + + Inspector.refresh(); + + AssetBrowser.hideDialog(); +} + +function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %targetObj, %fieldName, %returnType) +{ + // Set the select callback + AssetBrowser.selectCallback = %selectCallback; + AssetBrowser.returnType = %returnType; + AssetBrowser.assetTypeFilter = %AssetTypeFilter; + AssetBrowser.fieldTargetObject = %targetObj; + AssetBrowser.fieldTargetName = %fieldName; + + Canvas.add(AssetBrowser); + AssetBrowser.setVisible(1); + AssetBrowserWindow.setVisible(1); + AssetBrowserWindow.selectWindow(); + + if(%selectCallback $= "") + { + //we're not in selection mode, so just hide the select button + %this-->SelectButton.setHidden(true); + } + else + { + %this-->SelectButton.setHidden(false); + } + + //AssetBrowser_importAssetWindow.setVisible(0); + //AssetBrowser_importAssetConfigWindow.setVisible(0); + AssetBrowser.loadFilters(); +} + +function AssetBrowser::hideDialog( %this ) +{ + AssetBrowser.setVisible(1); + AssetBrowserWindow.setVisible(1); + Canvas.popDialog(AssetBrowser_addModule); + Canvas.popDialog(ImportAssetWindow); + + Canvas.popDialog(AssetBrowser); +} + +function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName ) +{ + %assetDesc = AssetDatabase.acquireAsset(%asset); + %assetName = AssetDatabase.getAssetName(%asset); + %previewImage = "core/art/warnmat"; + + AssetPreviewArray.empty(); + + // it may seem goofy why the checkbox can't be instanciated inside the container + // reason being its because we need to store the checkbox ctrl in order to make changes + // on it later in the function. + + %previewSize = "80 80"; + %previewBounds = 20; + + %assetType = AssetDatabase.getAssetType(%asset); + + %container = new GuiControl(){ + profile = "ToolsGuiDefaultProfile"; + Position = "0 0"; + Extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24; + HorizSizing = "right"; + VertSizing = "bottom"; + isContainer = "1"; + assetName = %assetName; + moduleName = %moduleName; + assetType = %assetType; + }; + + %tooltip = %assetName; + + if(%assetType $= "ShapeAsset") + { + %previewButton = new GuiObjectView() + { + className = "AssetPreviewControl"; + internalName = %matName; + HorizSizing = "right"; + VertSizing = "bottom"; + Profile = "ToolsGuiDefaultProfile"; + position = "7 4"; + extent = %previewSize; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + renderMissionArea = "0"; + GizmoProfile = "GlobalGizmoProfile"; + cameraZRot = "0"; + forceFOV = "0"; + gridColor = "0 0 0 0"; + renderNodes = "0"; + renderObjBox = "0"; + renderMounts = "0"; + renderColMeshes = "0"; + selectedNode = "-1"; + sunDiffuse = "255 255 255 255"; + sunAmbient = "180 180 180 255"; + timeScale = "1.0"; + fixedDetail = "0"; + orbitNode = "0"; + + new GuiBitmapButtonCtrl() + { + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "0 0"; + extent = %previewSize; + Variable = ""; + buttonType = "ToggleButton"; + bitmap = "tools/materialEditor/gui/cubemapBtnBorder"; + groupNum = "0"; + text = ""; + }; + }; + + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + + %previewButton.setModel(%asset.fileName); + //%previewButton.refreshShape(); + //%previewButton.currentDL = 0; + //%previewButton.fitToShape(); + + break; + } + } + } + else + { + if(%assetType $= "ComponentAsset") + { + %assetPath = "data/" @ %moduleName @ "/components/" @ %assetName @ ".cs"; + %doubleClickCommand = "EditorOpenFileInTorsion( "@%assetPath@", 0 );"; + + %previewImage = "tools/assetBrowser/art/componentIcon"; + + %assetFriendlyName = %assetDesc.friendlyName; + %assetDesc = %assetDesc.description; + %tooltip = %assetFriendlyName @ "\n" @ %assetDesc; + } + else if(%assetType $= "GameObjectAsset") + { + %assetPath = "data/" @ %moduleName @ "/gameObjects/" @ %assetName @ ".cs"; + %doubleClickCommand = "EditorOpenFileInTorsion( "@%assetPath@", 0 );"; + + %previewImage = "tools/assetBrowser/art/gameObjectIcon"; + + %tooltip = %assetDesc.gameObjectName; + } + else if(%assetType $= "ImageAsset") + { + //nab the image and use it for the preview + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + %previewImage = %asset.imageFile; + break; + } + } + } + else if(%assetType $= "StateMachineAsset") + { + %previewImage = "tools/assetBrowser/art/stateMachineIcon"; + } + else if(%assetType $= "SoundAsset") + { + %previewImage = "tools/assetBrowser/art/soundIcon"; + } + else if(%assetType $= "LevelAsset") + { + %previewImage = "tools/assetBrowser/art/levelIcon"; + } + else if(%assetType $= "PostEffectAsset") + { + %previewImage = "tools/assetBrowser/art/postEffectIcon"; + } + else if(%assetType $= "GUIAsset") + { + %previewImage = "tools/assetBrowser/art/guiIcon"; + } + else if(%assetType $= "ScriptAsset") + { + if(%assetDesc.isServerSide) + %previewImage = "tools/assetBrowser/art/serverScriptIcon"; + else + %previewImage = "tools/assetBrowser/art/clientScriptIcon"; + } + else if(%assetType $= "MaterialAsset") + { + %previewImage = ""; + //nab the image and use it for the preview + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + %previewImage = %asset.materialDefinitionName.diffuseMap[0]; + break; + } + } + + if(%previewImage $= "") + %previewImage = "tools/assetBrowser/art/materialIcon"; + } + if(%assetType $= "ShapeAnimationAsset") + { + %previewImage = "tools/assetBrowser/art/animationIcon"; + } + + %previewButton = new GuiBitmapButtonCtrl() + { + className = "AssetPreviewControl"; + internalName = %assetName; + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "10 4"; + extent = %previewSize; + buttonType = "PushButton"; + bitmap = %previewImage; + Command = ""; + text = ""; + useStates = false; + + new GuiBitmapButtonCtrl() + { + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "0 0"; + extent = %previewSize; + Variable = ""; + buttonType = "toggleButton"; + bitmap = "tools/materialEditor/gui/cubemapBtnBorder"; + groupNum = "0"; + text = ""; + }; + }; + } + + %previewBorder = new GuiButtonCtrl(){ + class = "AssetPreviewButton"; + internalName = %assetName@"Border"; + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiThumbHighlightButtonProfile"; + position = "0 0"; + extent = %previewSize.x + %previewBounds SPC %previewSize.y + 24; + Variable = ""; + buttonType = "radioButton"; + tooltip = %tooltip; + Command = "AssetBrowser.updateSelection( $ThisControl.getParent().assetName, $ThisControl.getParent().moduleName );"; + altCommand = %doubleClickCommand; + groupNum = "0"; + useMouseEvents = true; + text = ""; + icon = %previewImage; + }; + + %previewNameCtrl = new GuiTextEditCtrl(){ + position = 0 SPC %previewSize.y + %previewBounds - 16; + profile = ToolsGuiTextEditCenterProfile; + extent = %previewSize.x + %previewBounds SPC 16; + text = %assetName; + originalAssetName = %assetName; //special internal field used in renaming assets + internalName = "AssetNameLabel"; + class = "AssetNameField"; + active = false; + }; + + %container.add(%previewButton); + %container.add(%previewBorder); + %container.add(%previewNameCtrl); + + // add to the gui control array + AssetBrowser-->materialSelection.add(%container); + + // add to the array object for reference later + AssetPreviewArray.add( %previewButton, %previewImage ); +} + +function AssetBrowser::loadImages( %this, %materialNum ) +{ + // this will save us from spinning our wheels in case we don't exist + /*if( !AssetBrowser.visible ) + return; + + // this schedule is here to dynamically load images + %previewButton = AssetPreviewArray.getKey(%materialNum); + %previewImage = AssetPreviewArray.getValue(%materialNum); + + if(%previewButton.getClassName() !$= "GuiObjectView") + { + %previewButton.setBitmap(%previewImage); + %previewButton.setText(""); + } + + %materialNum++; + + /*if( %materialNum < AssetPreviewArray.count() ) + { + %tempSchedule = %this.schedule(64, "loadImages", %materialNum); + MatEdScheduleArray.add( %tempSchedule, %materialNum ); + }*/ +} + +function AssetBrowser::loadFilters( %this ) +{ + AssetBrowser-->filterTree.clear(); + + AssetBrowser-->filterTree.buildIconTable(":tools/classIcons/prefab"); + + AssetBrowser-->filterTree.insertItem(0, "Assets"); + + //First, build our our list of active modules + %modulesList = ModuleDatabase.findModules(true); + + for(%i=0; %i < getWordCount(%modulesList); %i++) + { + %moduleName = getWord(%modulesList, %i).ModuleId; + + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1); + } + + //Next, go through and list the asset categories + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName $= "CoreComponentsModule") + continue; + + //first, see if this module Module is listed already + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1); + + %assetType = AssetDatabase.getAssetCategory(%assetId); + + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + if(%assetType $= "") + %assetType = "Misc"; + } + + if(AssetBrowser.assetTypeFilter !$= "" && AssetBrowser.assetTypeFilter !$= %assetType) + continue; + + %assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%moduleItemId, %assetType); + + if(%assetTypeId == 0) + %assetTypeId = AssetBrowser-->filterTree.insertItem(%moduleItemId, %assetType); + } + + AssetBrowser-->filterTree.buildVisibleTree(true); + + //special handling for selections + if(AssetBrowser.newModuleId !$= "") + { + AssetBrowser-->filterTree.clearSelection(); + %newModuleItem = AssetBrowser-->filterTree.findItemByName(AssetBrowser.newModuleId); + AssetBrowser-->filterTree.selectItem(%newModuleItem); + AssetBrowser.newModuleId = ""; + } + + %selectedItem = AssetBrowser-->filterTree.getSelectedItem(); + AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem); +} + +// create category and update current material if there is one +function AssetBrowser::createFilter( %this, %filter ) +{ + if( %filter $= %existingFilters ) + { + MessageBoxOK( "Error", "Can not create blank filter."); + return; + } + + for( %i = AssetBrowser.staticFilterObjects; %i < AssetBrowser-->filterArray.getCount() ; %i++ ) + { + %existingFilters = AssetBrowser-->filterArray.getObject(%i).getObject(0).filter; + if( %filter $= %existingFilters ) + { + MessageBoxOK( "Error", "Can not create two filters of the same name."); + return; + } + } + %container = new GuiControl(){ + profile = "ToolsGuiDefaultProfile"; + Position = "0 0"; + Extent = "128 18"; + HorizSizing = "right"; + VertSizing = "bottom"; + isContainer = "1"; + + new GuiCheckBoxCtrl(){ + Profile = "ToolsGuiCheckBoxListProfile"; + position = "5 1"; + Extent = "118 18"; + Command = ""; + groupNum = "0"; + buttonType = "ToggleButton"; + text = %filter @ " ( " @ MaterialFilterAllArray.countKey(%filter) @ " )"; + filter = %filter; + Command = "AssetBrowser.preloadFilter();"; + }; + }; + + AssetBrowser-->filterArray.add( %container ); + + // if selection exists, lets reselect it to refresh it + if( isObject(AssetBrowser.selectedMaterial) ) + AssetBrowser.updateSelection( AssetBrowser.selectedMaterial, AssetBrowser.selectedPreviewImagePath ); + + // material category text field to blank + AssetBrowser_addFilterWindow-->tagName.setText(""); +} + +function AssetBrowser::updateSelection( %this, %asset, %moduleName ) +{ + // the material selector will visually update per material information + // after we move away from the material. eg: if we remove a field from the material, + // the empty checkbox will still be there until you move fro and to the material again + + %isAssetBorder = 0; + eval("%isAssetBorder = isObject(AssetBrowser-->"@%asset@"Border);"); + if( %isAssetBorder ) + { + eval( "AssetBrowser-->"@%asset@"Border.setStateOn(1);"); + } + + %isAssetBorderPrevious = 0; + eval("%isAssetBorderPrevious = isObject(AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border);"); + if( %isAssetBorderPrevious ) + { + eval( "AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border.setStateOn(0);"); + } + + AssetBrowser.selectedMaterial = %asset; + AssetBrowser.selectedAsset = %moduleName@":"@%asset; + AssetBrowser.selectedAssetDef = AssetDatabase.acquireAsset(AssetBrowser.selectedAsset); + //AssetBrowser.selectedPreviewImagePath = %previewImagePath; + + %this.prevSelectedMaterialHL = %asset; +} + +// +//needs to be deleted with the persistence manager and needs to be blanked out of the matmanager +//also need to update instances... i guess which is the tricky part.... +function AssetBrowser::showDeleteDialog( %this ) +{ + %material = AssetBrowser.selectedMaterial; + %secondFilter = "MaterialFilterMappedArray"; + %secondFilterName = "Mapped"; + + for( %i = 0; %i < MaterialFilterUnmappedArray.count(); %i++ ) + { + if( MaterialFilterUnmappedArray.getValue(%i) $= %material ) + { + %secondFilter = "MaterialFilterUnmappedArray"; + %secondFilterName = "Unmapped"; + break; + } + } + + if( isObject( %material ) ) + { + MessageBoxYesNoCancel("Delete Material?", + "Are you sure you want to delete

" @ %material.getName() @ "

Material deletion won't take affect until the engine is quit.", + "AssetBrowser.deleteMaterial( " @ %material @ ", " @ %secondFilter @ ", " @ %secondFilterName @" );", + "", + "" ); + } +} + +function AssetBrowser::deleteMaterial( %this, %materialName, %secondFilter, %secondFilterName ) +{ + if( !isObject( %materialName ) ) + return; + + for( %i = 0; %i <= MaterialFilterAllArray.countValue( %materialName ); %i++) + { + %index = MaterialFilterAllArray.getIndexFromValue( %materialName ); + MaterialFilterAllArray.erase( %index ); + } + MaterialFilterAllArrayCheckbox.setText("All ( " @ MaterialFilterAllArray.count() - 1 @ " ) "); + + %checkbox = %secondFilter @ "Checkbox"; + for( %k = 0; %k <= %secondFilter.countValue( %materialName ); %k++) + { + %index = %secondFilter.getIndexFromValue( %materialName ); + %secondFilter.erase( %index ); + } + %checkbox.setText( %secondFilterName @ " ( " @ %secondFilter.count() - 1 @ " ) "); + + for( %i = 0; %materialName.getFieldValue("materialTag" @ %i) !$= ""; %i++ ) + { + %materialTag = %materialName.getFieldValue("materialTag" @ %i); + + for( %j = AssetBrowser.staticFilterObjects; %j < AssetBrowser-->filterArray.getCount() ; %j++ ) + { + if( %materialTag $= AssetBrowser-->filterArray.getObject(%j).getObject(0).filter ) + { + %count = getWord( AssetBrowser-->filterArray.getObject(%j).getObject(0).getText(), 2 ); + %count--; + AssetBrowser-->filterArray.getObject(%j).getObject(0).setText( %materialTag @ " ( "@ %count @ " )"); + } + } + + } + + UnlistedMaterials.add( "unlistedMaterials", %materialName ); + + if( %materialName.getFilename() !$= "" && + %materialName.getFilename() !$= "tools/gui/AssetBrowser.ed.gui" && + %materialName.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed.cs" ) + { + AssetBrowserPerMan.removeObjectFromFile(%materialName); + AssetBrowserPerMan.saveDirty(); + } + + AssetBrowser.preloadFilter(); +} + +function AssetBrowser::thumbnailCountUpdate(%this) +{ + $Pref::AssetBrowser::ThumbnailCountIndex = AssetBrowser-->materialPreviewCountPopup.getSelected(); + AssetBrowser.LoadFilter( AssetBrowser.currentFilter, AssetBrowser.currentStaticFilter ); +} + +function AssetBrowser::toggleTagFilterPopup(%this) +{ + if(TagFilterWindow.visible) + TagFilterWindow.visible = false; + else + TagFilterWindow.visible = true; + + return; + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + //check that we don't re-add it + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == -1 || %moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %module.moduleId, "", "", 1, 1); + + //now, add the asset's category + %assetType = AssetDatabase.getAssetCategory(%assetId); + + %checkBox = new GuiCheckBoxCtrl() + { + canSaveDynamicFields = "0"; + isContainer = "0"; + Profile = "ToolsGuiCheckBoxListProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = (%textLength * 4) @ " 18"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Variable = %var; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + text = %text; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + useInactiveState = "0"; + Command = %cmd; + }; + + TagFilterList.add(%checkBox); + } +} + +function AssetBrowser::changeAsset(%this) +{ + //alright, we've selectd an asset for a field, so time to set it! + %cmd = %this.fieldTargetObject @ "." @ %this.fieldTargetName @ "=\"" @ %this.selectedAsset @ "\";"; + echo("Changing asset via the " @ %cmd @ " command"); + eval(%cmd); +} + +function AssetBrowser::reImportAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = AssetDatabase.getAssetType(EditAssetPopup.assetId); + + if(%assetType $= "ShapeAsset" || %assetType $= "ImageAsset" || %assetType $= "SoundAsset") + { + AssetBrowser.isAssetReImport = true; + AssetBrowser.reImportingAssetId = EditAssetPopup.assetId; + + AssetBrowser.onBeginDropFiles(); + AssetBrowser.onDropFile(%assetDef.originalFilePath); + AssetBrowser.onEndDropFiles(); + + %module = AssetDatabase.getAssetModule(EditAssetPopup.assetId); + + //get the selected module data + ImportAssetModuleList.setText(%module.ModuleId); + } +} + +//------------------------------------------------------------------------------ +function AssetPreviewButton::onRightClick(%this) +{ + AssetBrowser.selectedAssetPreview = %this.getParent(); + EditAssetPopup.assetId = %this.getParent().moduleName @ ":" @ %this.getParent().assetName; + %assetType = %this.getParent().assetType; + + //Do some enabling/disabling of options depending on asset type + EditAssetPopup.enableItem(0, true); + EditAssetPopup.enableItem(7, true); + + //Is it an editable type? + if(%assetType $= "ImageAsset" || %assetType $= "GameObjectAsset" || %assetType $= "SoundAsset") + { + EditAssetPopup.enableItem(0, false); + } + + //Is it an importable type? + if(%assetType $= "GameObjectAsset" || %assetType $= "ComponentAsset" || %assetType $= "GUIAsset" || %assetType $= "LevelAsset" + || %assetType $= "MaterialAsset" || %assetType $= "ParticleAsset" || %assetType $= "PostEffectAsset" || %assetType $= "ScriptAsset" + || %assetType $= "StateMachineAsset") + { + EditAssetPopup.enableItem(7, false); + } + + EditAssetPopup.showPopup(Canvas); +} + +function AssetListPanel::onRightMouseDown(%this) +{ + AddNewAssetPopup.showPopup(Canvas); +} + +//------------------------------------------------------------------------------ +function AssetBrowser::refreshPreviews(%this) +{ + AssetBrowserFilterTree.onSelect(AssetBrowser.selectedItem); +} + +function AssetBrowserFilterTree::onSelect(%this, %itemId) +{ + if(%itemId == 1) + //can't select root + return; + + //Make sure we have an actual module selected! + %parentId = %this.getParentItem(%itemId); + + if(%parentId != 1) + AssetBrowser.selectedModule = %this.getItemText(%parentId);//looks like we have one of the categories selected, not the module. Nab the parent so we have the correct thing! + else + AssetBrowser.selectedModule = %this.getItemText(%itemId); + + AssetBrowser.selectedItem = %itemId; + + //alright, we have a module or sub-filter selected, so now build our asset list based on that filter! + echo("Asset Browser Filter Tree selected filter #:" @ %itemId); + + // manage schedule array properly + if(!isObject(MatEdScheduleArray)) + new ArrayObject(MatEdScheduleArray); + + // if we select another list... delete all schedules that were created by + // previous load + for( %i = 0; %i < MatEdScheduleArray.count(); %i++ ) + cancel(MatEdScheduleArray.getKey(%i)); + + // we have to empty out the list; so when we create new schedules, these dont linger + MatEdScheduleArray.empty(); + + // manage preview array + if(!isObject(AssetPreviewArray)) + new ArrayObject(AssetPreviewArray); + + // we have to empty out the list; so when we create new guicontrols, these dont linger + AssetPreviewArray.empty(); + AssetBrowser-->materialSelection.deleteAllObjects(); + //AssetBrowser-->materialPreviewPagesStack.deleteAllObjects(); + + %assetArray = new ArrayObject(); + + //First, Query for our assets + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + //module name per our selected filter: + %moduleItemId = %this.getParentItem(%itemId); + + //check if we've selected a Module + if(%moduleItemId == 1) + { + %FilterModuleName = %this.getItemText(%itemId); + } + else + { + %FilterModuleName = %this.getItemText(%moduleItemId); + } + + //now, we'll iterate through, and find the assets that are in this module, and this category + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + if(%FilterModuleName $= %moduleName) + { + //it's good, so test that the category is right! + %assetType = AssetDatabase.getAssetCategory(%assetId); + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + } + + if(%this.getItemText(%itemId) $= %assetType || (%assetType $= "" && %this.getItemText(%itemId) $= "Misc") + || %moduleItemId == 1) + { + //stop adding after previewsPerPage is hit + %assetName = AssetDatabase.getAssetName(%assetId); + + %searchText = AssetBrowserSearchFilter.getText(); + if(%searchText !$= "\c2Filter...") + { + if(strstr(strlwr(%assetName), strlwr(%searchText)) != -1) + %assetArray.add( %moduleName, %assetId); + } + else + { + //got it. + %assetArray.add( %moduleName, %assetId ); + } + } + } + } + + AssetBrowser.currentPreviewPage = 0; + AssetBrowser.totalPages = 1; + + for(%i=0; %i < %assetArray.count(); %i++) + AssetBrowser.buildPreviewArray( %assetArray.getValue(%i), %assetArray.getKey(%i) ); + + AssetBrowser.loadImages( 0 ); +} + +function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId) +{ + if( %this.getSelectedItemsCount() > 0 && %itemId != 1) + { + //AddNewAssetPopup.showPopup(Canvas); + + //We have something clicked, so figure out if it's a sub-filter or a module filter, then push the correct + //popup menu + if(%this.getParentItem(%itemId) == 1) + { + //yep, module, push the all-inclusive popup + EditModulePopup.showPopup(Canvas); + //also set the module value for creation info + AssetBrowser.selectedModule = %this.getItemText(%itemId); + } + else + { + //get the parent, and thus our module + %moduleId = %this.getParentItem(%itemId); + + //set the module value for creation info + AssetBrowser.selectedModule = %this.getItemText(%moduleId); + + if(%this.getItemText(%itemId) $= "ComponentAsset") + { + AddNewComponentAssetPopup.showPopup(Canvas); + //Canvas.popDialog(AssetBrowser_newComponentAsset); + //AssetBrowser_newComponentAsset-->AssetBrowserModuleList.setText(AssetBrowser.selectedModule); + } + else + { + + } + } + } + else if( %this.getSelectedItemsCount() > 0 && %itemId == 1) + { + AddNewModulePopup.showPopup(Canvas); + } +} + +// +// +function AssetBrowserSearchFilterText::onWake( %this ) +{ + /*%filter = %this.treeView.getFilterText(); + if( %filter $= "" ) + %this.setText( "\c2Filter..." ); + else + %this.setText( %filter );*/ +} + +//------------------------------------------------------------------------------ + +function AssetBrowserSearchFilterText::onGainFirstResponder( %this ) +{ + %this.selectAllText(); +} + +//--------------------------------------------------------------------------------------------- + +// When Enter is pressed in the filter text control, pass along the text of the control +// as the treeview's filter. +function AssetBrowserSearchFilterText::onReturn( %this ) +{ + %text = %this.getText(); + if( %text $= "" ) + %this.reset(); + else + { + //%this.treeView.setFilterText( %text ); + %curItem = AssetBrowserFilterTree.getSelectedItem(); + AssetBrowserFilterTree.onSelect(%curItem); + } +} + +//--------------------------------------------------------------------------------------------- + +function AssetBrowserSearchFilterText::reset( %this ) +{ + %this.setText( "\c2Filter..." ); + //%this.treeView.clearFilterText(); + %curItem = AssetBrowserFilterTree.getSelectedItem(); + AssetBrowserFilterTree.onSelect(%curItem); +} + +//--------------------------------------------------------------------------------------------- + +function AssetBrowserSearchFilterText::onClick( %this ) +{ + %this.textCtrl.reset(); +} + +// +// +// +function AssetBrowser::reloadModules(%this) +{ + ModuleDatabase.unloadGroup("Game"); + + %modulesList = ModuleDatabase.findModules(); + + %count = getWordCount(%modulesList); + + for(%i=0; %i < %count; %i++) + { + %moduleId = getWord(%modulesList, %i).ModuleId; + ModuleDatabase.unloadExplicit(%moduleId); + } + + ModuleDatabase.scanModules(); + + %modulesList = ModuleDatabase.findModules(); + + %count = getWordCount(%modulesList); + + for(%i=0; %i < %count; %i++) + { + %moduleId = getWord(%modulesList, %i).ModuleId; + ModuleDatabase.loadExplicit(%moduleId); + } + + //ModuleDatabase.loadGroup("Game"); +} +// + +function AssetPreviewButton::onMouseDragged(%this) +{ + %payload = new GuiBitmapButtonCtrl(); + %payload.assignFieldsFrom( %this ); + %payload.className = "AssetPreviewControl"; + %payload.position = "0 0"; + %payload.dragSourceControl = %this; + %payload.bitmap = %this.icon; + %payload.extent.x /= 2; + %payload.extent.y /= 2; + + %xOffset = getWord( %payload.extent, 0 ) / 2; + %yOffset = getWord( %payload.extent, 1 ) / 2; + + // Compute the initial position of the GuiDragAndDrop control on the cavas based on the current + // mouse cursor position. + + %cursorpos = Canvas.getCursorPos(); + %xPos = getWord( %cursorpos, 0 ) - %xOffset; + %yPos = getWord( %cursorpos, 1 ) - %yOffset; + + if(!isObject(EditorDragAndDropLayer)) + { + new GuiControl(EditorDragAndDropLayer) + { + position = "0 0"; + extent = Canvas.extent; + }; + } + + // Create the drag control. + %ctrl = new GuiDragAndDropControl() + { + canSaveDynamicFields = "0"; + Profile = "GuiSolidDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %xPos SPC %yPos; + extent = %payload.extent; + MinExtent = "4 4"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + + // Let the GuiDragAndDropControl delete itself on mouse-up. When the drag is aborted, + // this not only deletes the drag control but also our payload. + deleteOnMouseUp = true; + + useWholeCanvas = true; + + // To differentiate drags, use the namespace hierarchy to classify them. + // This will allow a color swatch drag to tell itself apart from a file drag, for example. + class = "AssetPreviewControlType_AssetDrop"; + }; + + // Add the temporary color swatch to the drag control as the payload. + %ctrl.add( %payload ); + + // Start drag by adding the drag control to the canvas and then calling startDragging(). + //Canvas.getContent().add( %ctrl ); + EditorDragAndDropLayer.add(%ctrl); + Canvas.pushDialog(EditorDragAndDropLayer); + + %ctrl.startDragging( %xOffset, %yOffset ); +} + +function AssetPreviewButton::onControlDragCancelled(%this) +{ + Canvas.popDialog(EditorDragAndDropLayer); +} + +function AssetPreviewButton::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + // If dropped on same button whence we came from, + // do nothing. + + if( %payload.dragSourceControl == %this ) + return; + + // If a swatch button control is dropped onto this control, + // copy it's color. + + if( %payload.isMemberOfClass( "AssetPreviewButton" ) ) + { + // If the swatch button is part of a color-type inspector field, + // remember the inspector field so we can later set the color + // through it. + + if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorI" ) ) + %this.parentGroup.apply( ColorFloatToInt( %payload.color ) ); + else if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorF" ) ) + %this.parentGroup.apply( %payload.color ); + else + %this.setColor( %payload.color ); + } +} + +function EWorldEditor::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + // If dropped on same button whence we came from, + // do nothing. + + if( %payload.dragSourceControl == %this ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + %pos = EWCreatorWindow.getCreateObjectPosition(); //LocalClientConnection.camera.position; + %module = %payload.dragSourceControl.parentGroup.moduleName; + %asset = %payload.dragSourceControl.parentGroup.assetName; + + if(%assetType $= "ImageAsset") + { + echo("DROPPED AN IMAGE ON THE EDITOR WINDOW!"); + } + else if(%assetType $= "ShapeAsset") + { + echo("DROPPED A SHAPE ON THE EDITOR WINDOW!"); + + %newEntity = new Entity() + { + position = %pos; + + new MeshComponent() + { + MeshAsset = %module @ ":" @ %asset; + }; + + //new CollisionComponent(){}; + }; + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + else if(%assetType $= "MaterialAsset") + { + echo("DROPPED A MATERIAL ON THE EDITOR WINDOW!"); + } + else if(%assetType $= "GameObjectAsset") + { + echo("DROPPED A GAME OBJECT ON THE EDITOR WINDOW!"); + + %GO = spawnGameObject(%asset, true); + + %pos = EWCreatorWindow.getCreateObjectPosition(); //LocalClientConnection.camera.position; + + %GO.position = %pos; + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%GO); + } + else if(%assetType $= "ComponentAsset") + { + %newEntity = new Entity() + { + position = %pos; + }; + + %assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset); + + if(%assetDef.componentClass $= "Component") + eval("$tmpVar = new " @ %assetDef.componentClass @ "() { class = " @ %assetDef.componentName @ "; }; %newEntity.add($tmpVar);"); + else + eval("$tmpVar = new " @ %assetDef.componentClass @ "() {}; %newEntity.add($tmpVar);"); + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + else if(%assetType $= "ScriptAsset") //do we want to do it this way? + { + %newEntity = new Entity() + { + position = %pos; + class = %asset; + }; + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + + EWorldEditor.isDirty = true; +} + +function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "ShapeAsset") + { + echo("DROPPED A SHAPE ON A SHAPE ASSET COMPONENT FIELD!"); + + %module = %payload.dragSourceControl.parentGroup.moduleName; + %asset = %payload.dragSourceControl.parentGroup.assetName; + + %targetComponent = %this.ComponentOwner; + %targetComponent.MeshAsset = %module @ ":" @ %asset; + + //Inspector.refresh(); + } + + EWorldEditor.isDirty= true; +} + +function GuiInspectorTypeImageAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "ImageAsset") + { + echo("DROPPED A IMAGE ON AN IMAGE ASSET COMPONENT FIELD!"); + } + + EWorldEditor.isDirty = true; +} + +function GuiInspectorTypeMaterialAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "MaterialAsset") + { + echo("DROPPED A MATERIAL ON A MATERIAL ASSET COMPONENT FIELD!"); + } + + EWorldEditor.isDirty = true; +} + +function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + %assetName = %payload.dragSourceControl.parentGroup.assetName; + %moduleName = %payload.dragSourceControl.parentGroup.moduleName; + + echo("DROPPED A " @ %assetType @ " ON THE ASSET BROWSER NAVIGATION TREE!"); + + %item = %this.getItemAtPosition(%position); + + echo("DROPPED IT ON ITEM " @ %item); + + %parent = %this.getParentItem(%item); + + if(%parent == 1) + { + //we're a module entry, cool + %targetModuleName = %this.getItemText(%item); + echo("DROPPED IT ON MODULE " @ %targetModuleName); + + if(%moduleName !$= %targetModuleName) + { + //we're trying to move the asset to a different module! + MessageBoxYesNo( "Move Asset", "Do you wish to move asset " @ %assetName @ " to module " @ %targetModuleName @ "?", + "AssetBrowser.moveAsset("@%assetName@", "@%targetModuleName@");", ""); + } + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs new file mode 100644 index 000000000..8732ac8a5 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs @@ -0,0 +1,1525 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// +// +function isImageFormat(%fileExt) +{ + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") || (%fileExt $= ".tif")) + return true; + + return false; +} + +function isShapeFormat(%fileExt) +{ + if( (%fileExt $= ".dae") || (%fileExt $= ".dts") || (%fileExt $= ".fbx") || (%fileExt $= ".obj") || (%fileExt $= ".blend")) + return true; + + return false; +} + +function isSoundFormat(%fileExt) +{ + if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + return true; + + return false; +} + +function getImageInfo(%file) +{ + //we're going to populate a GuiTreeCtrl with info of the inbound image file +} + +//This lets us go and look for a image at the importing directory as long as it matches the material name +function findImageFile(%path, %materialName, %type) +{ + + if(isFile(%path @ "/" @ %materialName @ ".jpg")) + return %path @ "/" @ %materialName @ ".jpg"; + else if(isFile(%path @ "/" @ %materialName @ ".png")) + return %path @ "/" @ %materialName @ ".png"; + else if(isFile(%path @ "/" @ %materialName @ ".dds")) + return %path @ "/" @ %materialName @ ".dds"; + else if(isFile(%path @ "/" @ %materialName @ ".tif")) + return %path @ "/" @ %materialName @ ".tif"; +} + +function AssetBrowser::onBeginDropFiles( %this ) +{ + error("% DragDrop - Beginning files dropping."); + %this.importAssetNewListArray.empty(); + %this.importAssetUnprocessedListArray.empty(); + %this.importAssetFinalListArray.empty(); +} + +function AssetBrowser::onDropFile( %this, %filePath ) +{ + if(!%this.isVisible()) + return; + + %fileExt = fileExt( %filePath ); + //add it to our array! + if(isImageFormat(%fileExt)) + %this.addImportingAsset("Image", %filePath); + else if( isShapeFormat(%fileExt)) + %this.addImportingAsset("Model", %filePath); + else if( isSoundFormat(%fileExt)) + %this.addImportingAsset("Sound", %filePath); + else if (%fileExt $= ".zip") + %this.onDropZipFile(%filePath); +} + +function AssetBrowser::onDropZipFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + %zip = new ZipObject(); + %zip.openArchive(%filePath); + %count = %zip.getFileEntryCount(); + + echo("Dropped in a zip file with" SPC %count SPC "files inside!"); + + return; + for (%i = 0; %i < %count; %i++) + { + %fileEntry = %zip.getFileEntry(%i); + %fileFrom = getField(%fileEntry, 0); + + //First, we wanna scan to see if we have modules to contend with. If we do, we'll just plunk them in wholesale + //and not process their contents. + + //If not modules, it's likely an art pack or other mixed files, so we'll import them as normal + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") ) + %this.importAssetListArray.add("Image", %filePath); + else if( (%fileExt $= ".dae") || (%fileExt $= ".dts")) + %this.importAssetListArray.add("Model", %filePath); + else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + %this.importAssetListArray.add("Sound", %filePath); + else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso")) + %this.importAssetListArray.add("GUI", %filePath); + //else if( (%fileExt $= ".cs") || (%fileExt $= ".dso")) + // %this.importAssetListArray.add("Script", %filePath); + else if( (%fileExt $= ".mis")) + %this.importAssetListArray.add("Level", %filePath); + + // For now, if it's a .cs file, we'll assume it's a behavior. + if (fileExt(%fileFrom) !$= ".cs") + continue; + + %fileTo = expandFilename("^game/behaviors/") @ fileName(%fileFrom); + %zip.extractFile(%fileFrom, %fileTo); + exec(%fileTo); + } +} + +function AssetBrowser::onDropImageFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + // File Information madness + %fileName = %filePath; + %fileOnlyName = fileName( %fileName ); + %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); + + // [neo, 5/17/2007 - #3117] + // Check if the file being dropped is already in data/images or a sub dir by checking if + // the file path up to length of check path is the same as check path. + %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); + + %checkPath = expandFilename( "^"@%defaultPath ); + %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); + %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); + + if( %checkPath !$= %fileBasePath ) + { + // No match so file is from outside images directory and we need to copy it in + %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + + // Move to final location + if( !pathCopy( %filePath, %fileNewLocation ) ) + return; + } + else + { + // Already in images path somewhere so just link to it + %fileNewLocation = %filePath; + } + + addResPath( filePath( %fileNewLocation ) ); + + %matName = fileBase( %fileName ); + + // Create Material + %imap = new Material(%matName) + { + mapTo = fileBase( %matName ); + diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + }; + //%imap.setName( %fileBase ); + //%imap.imageName = %fileNewLocation; + //%imap.imageMode = "FULL"; + //%imap.filterPad = false; + //%imap.compile(); + + %diffusecheck = %imap.diffuseMap[0]; + + // Bad Creation! + if( !isObject( %imap ) ) + return; + + %this.addDatablock( %fileBase, false ); +} + +function AssetBrowser::onDropSoundFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + // File Information madness + %fileName = %filePath; + %fileOnlyName = fileName( %fileName ); + %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); + + // [neo, 5/17/2007 - #3117] + // Check if the file being dropped is already in data/images or a sub dir by checking if + // the file path up to length of check path is the same as check path. + %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); + + %checkPath = expandFilename( "^"@%defaultPath ); + %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); + %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); + + if( %checkPath !$= %fileBasePath ) + { + // No match so file is from outside images directory and we need to copy it in + %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + + // Move to final location + if( !pathCopy( %filePath, %fileNewLocation ) ) + return; + } + else + { + // Already in images path somewhere so just link to it + %fileNewLocation = %filePath; + } + + addResPath( filePath( %fileNewLocation ) ); + + %matName = fileBase( %fileName ); + + // Create Material + %imap = new Material(%matName) + { + mapTo = fileBase( %matName ); + diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + }; + //%imap.setName( %fileBase ); + //%imap.imageName = %fileNewLocation; + //%imap.imageMode = "FULL"; + //%imap.filterPad = false; + //%imap.compile(); + + %diffusecheck = %imap.diffuseMap[0]; + + // Bad Creation! + if( !isObject( %imap ) ) + return; + + %this.addDatablock( %fileBase, false ); +} + +function AssetBrowser::onEndDropFiles( %this ) +{ + if(!%this.isVisible()) + return; + + //we have assets to import, so go ahead and display the window for that now + Canvas.pushDialog(AssetImportCtrl); + ImportAssetWindow.visible = true; + //ImportAssetWindow.validateAssets(); + ImportAssetWindow.refresh(); + ImportAssetWindow.selectWindow(); + + // Update object library + GuiFormManager::SendContentMessage($LBCreateSiderBar, %this, "refreshAll 1"); + + if(ImportAssetWindow.importConfigsList.count() == 0) + { + MessageBoxOK( "Warning", "No base import config. Please create an import configuration set to simplify asset importing."); + } +} +// +// +// + +function AssetBrowser::addImportingAsset( %this, %assetType, %filePath, %parentAssetItem ) +{ + %assetName = fileBase(%filePath); + %filePath = filePath(%filePath) @ "/" @ fileBase(%filePath) @ fileExt(%filePath); //sanitize the file path + + %moduleName = AssetBrowser.SelectedModule; + ImportAssetModuleList.text = %moduleName; + + //Add to our main list + %assetItem = new ScriptObject() + { + assetType = %assetType; + filePath = %filePath; + assetName = %assetName; + moduleName = %moduleName; + dirty = true; + parentAssetItem = %parentAssetItem; + status = ""; + statusType = ""; + statusInfo = ""; + skip = false; + }; + + //little bit of interception here + if(%assetItem.assetType $= "Model") + { + %fileExt = fileExt(%assetItem.filePath); + if(%fileExt $= ".dae") + { + %shapeInfo = new GuiTreeViewCtrl(); + enumColladaForImport(%assetItem.filePath, %shapeInfo); + } + else + { + %shapeInfo = GetShapeInfo(%assetItem.filePath); + } + + %assetItem.shapeInfo = %shapeInfo; + + %shapeItem = %assetItem.shapeInfo.findItemByName("Shape"); + %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem); + + %animItem = %assetItem.shapeInfo.findItemByName("Animations"); + %animCount = %assetItem.shapeInfo.getItemValue(%animItem); + + //If the model has shapes AND animations, then it's a normal shape with embedded animations + //if it has shapes and no animations it's a regular static mesh + //if it has no shapes and animations, it's a special case. This means it's a shape animation only file so it gets flagged as special + if(%shapeCount == 0 && %animCount != 0) + { + %assetItem.assetType = "Animation"; + } + else if(%shapeCount == 0 && %animCount == 0) + { + //either it imported wrong or it's a bad file we can't read. Either way, don't try importing it + error("Error - attempted to import a model file with no shapes or animations! Model in question was: " @ %filePath); + + %assetItem.delete(); + return 0; + } + } + + if(%parentAssetItem $= "") + { + %assetItem.parentDepth = 0; + %this.importAssetNewListArray.add(%assetItem); + %this.importAssetUnprocessedListArray.add(%assetItem); + } + else + { + %assetItem.parentDepth = %parentAssetItem.parentDepth + 1; + %parentIndex = %this.importAssetUnprocessedListArray.getIndexFromKey(%parentAssetItem); + + %parentAssetItem.dependencies = %parentAssetItem.dependencies SPC %assetItem; + trim(%parentAssetItem.dependencies); + + %this.importAssetUnprocessedListArray.insert(%assetItem, "", %parentIndex + 1); + } + + return %assetItem; +} + +// +function ImportAssetButton::onClick(%this) +{ + %dlg = new OpenFileDialog() + { + Filters = "Shape Files(*.dae, *.cached.dts)|*.dae;*.cached.dts|Images Files(*.jpg,*.png,*.tga,*.bmp,*.dds)|*.jpg;*.png;*.tga;*.bmp;*.dds|Any Files (*.*)|*.*|"; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = false; + OverwritePrompt = true; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = makeRelativePath( %dlg.FileName, getMainDotCSDir() ); + %file = fileBase( %fullPath ); + } + + %dlg.delete(); + + if ( !%ret ) + return; + + AssetBrowser.importAssetListArray.empty(); + + %fileExt = fileExt( %fullPath ); + //add it to our array! + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") ) + AssetBrowser.importAssetListArray.add("Image", %fullPath); + else if( (%fileExt $= ".dae") || (%fileExt $= ".dts")) + AssetBrowser.importAssetListArray.add("Model", %fullPath); + else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + AssetBrowser.importAssetListArray.add("Sound", %fullPath); + else if (%fileExt $= ".zip") + AssetBrowser.onDropZipFile(%fullPath); + + ImportAssetConfigWindow.visible = true; + ImportAssetConfigWindow.refresh(); + ImportAssetConfigWindow.selectWindow(); +} +// + +// +function ImportAssetWindow::onWake(%this) +{ + //We've woken, meaning we're trying to import assets + //Lets refresh our list + if(!ImportAssetWindow.isVisible()) + return; + + $AssetBrowser::importConfigsFile = "tools/assetBrowser/assetImportConfigs.xml"; + + %this.reloadImportOptionConfigs(); +} + +function ImportAssetWindow::reloadImportOptionConfigs(%this) +{ + ImportAssetWindow.importConfigsList = new ArrayObject(); + ImportAssetConfigList.clear(); + + %xmlDoc = new SimXMLDocument(); + if(%xmlDoc.loadFile($AssetBrowser::importConfigsFile)) + { + //StateMachine element + %xmlDoc.pushFirstChildElement("AssetImportConfigs"); + + //Configs + %configCount = 0; + while(%xmlDoc.pushChildElement(%configCount)) + { + %configObj = new ScriptObject(){}; + + %configObj.Name = %xmlDoc.attribute("Name"); + + %xmlDoc.pushFirstChildElement("Mesh"); + %configObj.ImportMesh = %xmlDoc.attribute("ImportMesh"); + %configObj.DoUpAxisOverride = %xmlDoc.attribute("DoUpAxisOverride"); + %configObj.UpAxisOverride = %xmlDoc.attribute("UpAxisOverride"); + %configObj.DoScaleOverride = %xmlDoc.attribute("DoScaleOverride"); + %configObj.ScaleOverride = %xmlDoc.attribute("ScaleOverride"); + %configObj.IgnoreNodeScale = %xmlDoc.attribute("IgnoreNodeScale"); + %configObj.AdjustCenter = %xmlDoc.attribute("AdjustCenter"); + %configObj.AdjustFloor = %xmlDoc.attribute("AdjustFloor"); + %configObj.CollapseSubmeshes = %xmlDoc.attribute("CollapseSubmeshes"); + %configObj.LODType = %xmlDoc.attribute("LODType"); + %configObj.ImportedNodes = %xmlDoc.attribute("ImportedNodes"); + %configObj.IgnoreNodes = %xmlDoc.attribute("IgnoreNodes"); + %configObj.ImportMeshes = %xmlDoc.attribute("ImportMeshes"); + %configObj.IgnoreMeshes = %xmlDoc.attribute("IgnoreMeshes"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Materials"); + %configObj.ImportMaterials = %xmlDoc.attribute("ImportMaterials"); + %configObj.CreateComposites = %xmlDoc.attribute("CreateComposites"); + %configObj.UseDiffuseSuffixOnOriginImg = %xmlDoc.attribute("UseDiffuseSuffixOnOriginImg"); + %configObj.UseExistingMaterials = %xmlDoc.attribute("UseExistingMaterials"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Animations"); + %configObj.ImportAnimations = %xmlDoc.attribute("ImportAnimations"); + %configObj.SeparateAnimations = %xmlDoc.attribute("SeparateAnimations"); + %configObj.SeparateAnimationPrefix = %xmlDoc.attribute("SeparateAnimationPrefix"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Collisions"); + %configObj.GenerateCollisions = %xmlDoc.attribute("GenerateCollisions"); + %configObj.GenCollisionType = %xmlDoc.attribute("GenCollisionType"); + %configObj.CollisionMeshPrefix = %xmlDoc.attribute("CollisionMeshPrefix"); + %configObj.GenerateLOSCollisions = %xmlDoc.attribute("GenerateLOSCollisions"); + %configObj.GenLOSCollisionType = %xmlDoc.attribute("GenLOSCollisionType"); + %configObj.LOSCollisionMeshPrefix = %xmlDoc.attribute("LOSCollisionMeshPrefix"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Images"); + %configObj.ImageType = %xmlDoc.attribute("ImageType"); + %configObj.DiffuseTypeSuffixes = %xmlDoc.attribute("DiffuseTypeSuffixes"); + %configObj.NormalTypeSuffixes = %xmlDoc.attribute("NormalTypeSuffixes"); + %configObj.SpecularTypeSuffixes = %xmlDoc.attribute("SpecularTypeSuffixes"); + %configObj.MetalnessTypeSuffixes = %xmlDoc.attribute("MetalnessTypeSuffixes"); + %configObj.RoughnessTypeSuffixes = %xmlDoc.attribute("RoughnessTypeSuffixes"); + %configObj.SmoothnessTypeSuffixes = %xmlDoc.attribute("SmoothnessTypeSuffixes"); + %configObj.AOTypeSuffixes = %xmlDoc.attribute("AOTypeSuffixes"); + %configObj.CompositeTypeSuffixes = %xmlDoc.attribute("CompositeTypeSuffixes"); + %configObj.TextureFilteringMode = %xmlDoc.attribute("TextureFilteringMode"); + %configObj.UseMips = %xmlDoc.attribute("UseMips"); + %configObj.IsHDR = %xmlDoc.attribute("IsHDR"); + %configObj.Scaling = %xmlDoc.attribute("Scaling"); + %configObj.Compressed = %xmlDoc.attribute("Compressed"); + %configObj.GenerateMaterialOnImport = %xmlDoc.attribute("GenerateMaterialOnImport"); + %configObj.PopulateMaterialMaps = %xmlDoc.attribute("PopulateMaterialMaps"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Sounds"); + %configObj.VolumeAdjust = %xmlDoc.attribute("VolumeAdjust"); + %configObj.PitchAdjust = %xmlDoc.attribute("PitchAdjust"); + %configObj.Compressed = %xmlDoc.attribute("Compressed"); + %xmlDoc.popElement(); + + %xmlDoc.popElement(); + %configCount++; + + ImportAssetWindow.importConfigsList.add(%configObj); + } + + %xmlDoc.popElement(); + } + + for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++) + { + %configObj = ImportAssetWindow.importConfigsList.getKey(%i); + ImportAssetConfigList.add(%configObj.Name); + } + + ImportAssetConfigList.setSelected(0); +} + +function ImportAssetWindow::setImportOptions(%this, %optionsObj) +{ + //Todo, editor + load from files for preconfigs + + //Meshes + %optionsObj.ImportMesh = true; + %optionsObj.UpAxisOverride = "Z_AXIS"; + %optionsObj.OverrideScale = 1.0; + %optionsObj.IgnoreNodeScale = false; + %optionsObj.AdjustCenter = false; + %optionsObj.AdjustFloor = false; + %optionsObj.CollapseSubmeshes = false; + %optionsObj.LODType = "TrailingNumber"; + %optionsObj.TrailingNumber = 2; + %optionsObj.ImportedNodes = ""; + %optionsObj.IgnoreNodes = ""; + %optionsObj.ImportMeshes = ""; + %optionsObj.IgnoreMeshes = ""; + + //Materials + %optionsObj.ImportMaterials = true; + %optionsObj.CreateComposites = true; + + //Animations + %optionsObj.ImportAnimations = true; + %optionsObj.SeparateAnimations = true; + %optionsObj.SeparateAnimationPrefix = ""; + + //Collision + %optionsObj.GenerateCollisions = true; + %optionsObj.GenCollisionType = "CollisionMesh"; + %optionsObj.CollisionMeshPrefix = "Collision"; + %optionsObj.GenerateLOSCollisions = true; + %optionsObj.GenLOSCollisionType = "CollisionMesh"; + %optionsObj.LOSCollisionMeshPrefix = "LOS"; + + //Images + %optionsObj.ImageType = "Diffuse"; + %optionsObj.DiffuseTypeSuffixes = "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL"; + %optionsObj.NormalTypeSuffixes = "_NORMAL,_NORM"; + %optionsObj.SpecularTypeSuffixes = "_SPECULAR,_SPEC"; + %optionsObj.MetalnessTypeSuffixes = "_METAL,_MET,_METALNESS,_METALLIC"; + %optionsObj.RoughnessTypeSuffixes = "_ROUGH,_ROUGHNESS"; + %optionsObj.SmoothnessTypeSuffixes = "_SMOOTH,_SMOOTHNESS"; + %optionsObj.AOTypeSuffixes = "_AO,_AMBIENT,_AMBIENTOCCLUSION"; + %optionsObj.CompositeTypeSuffixes = "_COMP,_COMPOSITE"; + %optionsObj.TextureFilteringMode = "Bilinear"; + %optionsObj.UseMips = true; + %optionsObj.IsHDR = false; + %optionsObj.Scaling = 1.0; + %optionsObj.Compressed = true; + + //Sounds + %optionsObj.VolumeAdjust = 1.0; + %optionsObj.PitchAdjust = 1.0; + %optionsObj.Compressed = false; +} + +// +function ImportAssetWindow::processNewImportAssets(%this) +{ + %unprocessedCount = AssetBrowser.importAssetUnprocessedListArray.count(); + while(AssetBrowser.importAssetUnprocessedListArray.count() > 0) + { + %assetItem = AssetBrowser.importAssetUnprocessedListArray.getKey(0); + + %assetConfigObj = ImportAssetWindow.activeImportConfig.clone(); + %assetConfigObj.assetIndex = %i; + %assetConfigObj.assetName = %assetItem.assetName; + %assetItem.importConfig = %assetConfigObj; + + if(%assetItem.assetType $= "Model") + { + %fileExt = fileExt(%assetItem.filePath); + if(%fileExt $= ".dae") + { + %shapeInfo = new GuiTreeViewCtrl(); + enumColladaForImport(%assetItem.filePath, %shapeInfo); + } + else + { + %shapeInfo = GetShapeInfo(%assetItem.filePath); + } + + %assetItem.shapeInfo = %shapeInfo; + + %shapeItem = %assetItem.shapeInfo.findItemByName("Shape"); + %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem); + + if(%assetConfigObj.ImportMesh == 1 && %shapeCount > 0) + { + + } + + %animItem = %assetItem.shapeInfo.findItemByName("Animations"); + %animCount = %assetItem.shapeInfo.getItemValue(%animItem); + + if(%assetConfigObj.ImportAnimations == 1 && %animCount > 0) + { + %animationItem = %assetItem.shapeInfo.getChild(%animItem); + + %animName = %assetItem.shapeInfo.getItemText(%animationItem); + //%animName = %assetItem.shapeInfo.getItemValue(%animationItem); + + AssetBrowser.addImportingAsset("Animation", %animName, %assetItem); + + %animationItem = %assetItem.shapeInfo.getNextSibling(%animationItem); + while(%animationItem != 0) + { + %animName = %assetItem.shapeInfo.getItemText(%animationItem); + //%animName = %assetItem.shapeInfo.getItemValue(%animationItem); + + AssetBrowser.addImportingAsset("Animation", %animName, %assetItem); + + %animationItem = %shapeInfo.getNextSibling(%animationItem); + } + } + + %matItem = %assetItem.shapeInfo.findItemByName("Materials"); + %matCount = %assetItem.shapeInfo.getItemValue(%matItem); + + if(%assetConfigObj.importMaterials == 1 && %matCount > 0) + { + %materialItem = %assetItem.shapeInfo.getChild(%matItem); + + %matName = %assetItem.shapeInfo.getItemText(%materialItem); + + %filePath = %assetItem.shapeInfo.getItemValue(%materialItem); + if(%filePath !$= "") + { + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + } + else + { + //we need to try and find our material, since the shapeInfo wasn't able to find it automatically + %filePath = findImageFile(filePath(%assetItem.filePath), %matName); + if(%filePath !$= "") + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + else + AssetBrowser.addImportingAsset("Material", %matName, %assetItem); + } + + %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem); + while(%materialItem != 0) + { + %matName = %assetItem.shapeInfo.getItemText(%materialItem); + %filePath = %assetItem.shapeInfo.getItemValue(%materialItem); + if(%filePath !$= "") + { + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + } + else + { + //we need to try and find our material, since the shapeInfo wasn't able to find it automatically + %filePath = findImageFile(filePath(%assetItem.filePath), %matName); + if(%filePath !$= "") + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + else + AssetBrowser.addImportingAsset("Material", %matName, %assetItem); + } + + %materialItem = %shapeInfo.getNextSibling(%materialItem); + } + } + } + else if(%assetItem.assetType $= "Animation") + { + //if we don't have our own file, that means we're gunna be using our parent shape's file so reference that + if(!isFile(%assetItem.filePath)) + { + %assetItem.filePath = %assetItem.parentAssetItem.filePath; + } + } + else if(%assetItem.assetType $= "Material") + { + //Iterate over to find appropriate images for + + //Fetch just the fileBase name + %fileDir = filePath(%assetItem.filePath); + %filename = fileBase(%assetItem.filePath); + %fileExt = fileExt(%assetItem.filePath); + + if(%assetItem.importConfig.PopulateMaterialMaps == 1) + { + if(%assetItem.diffuseImageAsset $= "") + { + //First, load our diffuse map, as set to the material in the shape + %diffuseAsset = AssetBrowser.addImportingAsset("Image", %fileDir @ "/" @ %filename @ %fileExt, %assetItem); + %assetItem.diffuseImageAsset = %diffuseAsset; + + if(%assetItem.importConfig.UseDiffuseSuffixOnOriginImg == 1) + { + %diffuseToken = getToken(%assetItem.importConfig.DiffuseTypeSuffixes, ",", 0); + %diffuseAsset.AssetName = %diffuseAsset.AssetName @ %diffuseToken; + } + } + + if(%assetItem.normalImageAsset $= "") + { + //Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any. + //First, normal map + %listCount = getTokenCount(%assetItem.importConfig.NormalTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.NormalTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.normalImageAsset = %normalAsset; + break; + } + } + } + if(%assetItem.specularImageAsset $= "") + { + //Specular + %listCount = getTokenCount(%assetItem.importConfig.SpecularTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.SpecularTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %specularAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.specularImageAsset = %specularAsset; + break; + } + } + } + + if(%assetItem.metalImageAsset $= "") + { + //Metal + %listCount = getTokenCount(%assetItem.importConfig.MetalnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.MetalnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.metalImageAsset = %metalAsset; + break; + } + } + } + + if(%assetItem.roughnessImageAsset $= "") + { + //Roughness + %listCount = getTokenCount(%assetItem.importConfig.RoughnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.RoughnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.roughnessImageAsset = %roughnessAsset; + break; + } + } + } + + if(%assetItem.smoothnessImageAsset $= "") + { + //Smoothness + %listCount = getTokenCount(%assetItem.importConfig.SmoothnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.SmoothnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.SmoothnessImageAsset = %smoothnessAsset; + break; + } + } + } + + if(%assetItem.AOImageAsset $= "") + { + //AO + %listCount = getTokenCount(%assetItem.importConfig.AOTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.AOTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.AOImageAsset = %AOAsset; + break; + } + } + } + + if(%assetItem.compositeImageAsset $= "") + { + //Composite + %listCount = getTokenCount(%assetItem.importConfig.CompositeTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.CompositeTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.compositeImageAsset = %compositeAsset; + break; + } + } + } + } + } + else if(%assetItem.assetType $= "Image") + { + if(%assetConfigObj.GenerateMaterialOnImport == 1 && %assetItem.parentAssetItem $= "") + { + %filePath = %assetItem.filePath; + if(%filePath !$= "") + %materialAsset = AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + + %materialAsset.diffuseImageAsset = %assetItem; + + if(%assetConfigObj.UseDiffuseSuffixOnOriginImg == 1) + { + %diffuseToken = getToken(%assetItem.importConfig.DiffuseTypeSuffixes, ",", 0); + %assetItem.AssetName = %assetItem.AssetName @ %diffuseToken; + } + } + } + + AssetBrowser.importAssetUnprocessedListArray.erase(0); + //Been processed, so add it to our final list + AssetBrowser.importAssetFinalListArray.add(%assetItem); + } +} + +function ImportAssetWindow::refresh(%this) +{ + ImportingAssetList.clear(); + + //Go through and process any newly, unprocessed assets + %this.processNewImportAssets(); + + if(AssetBrowser.importAssetUnprocessedListArray.count() == 0) + { + //We've processed them all, prep the assets for actual importing + //Initial set of assets + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + + for(%i=0; %i < %assetCount; %i++) + { + %assetItem = AssetBrowser.importAssetFinalListArray.getKey(%i); + %assetType = %assetItem.assetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + + //validate + %this.validateAsset(%assetItem); + + //Once validated, attempt any fixes for issues + %this.resolveIssue(%assetItem); + + //Make sure we size correctly + ImportingAssetList.extent.x = ImportingAssetList.getParent().extent.x - 15; + + //create! + %width = mRound(mRound(ImportingAssetList.extent.x) / 2); + %height = 20; + %indent = %assetItem.parentDepth * 16; + %toolTip = ""; + + %iconPath = "tools/gui/images/iconInformation"; + %configCommand = "ImportAssetOptionsWindow.editImportSettings(" @ %assetItem @ ");"; + + if(%assetType $= "Model" || %assetType $= "Animation" || %assetType $= "Image" || %assetType $= "Sound") + { + if(%assetItem.status $= "Error") + { + %iconPath = "tools/gui/images/iconError"; + %configCommand = "ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");"; + } + else if(%assetItem.status $= "Warning") + { + %iconPath = "tools/gui/images/iconWarn"; + %configCommand = "ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");"; + + if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset") + %assetName = %assetItem.assetName @ " "; + } + + %toolTip = %assetItem.statusInfo; + } + else + { + if(%assetItem.status $= "Error") + { + %iconPath = "tools/gui/images/iconError"; + %configCommand = "";//"ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");"; + } + else if(%assetItem.status $= "Warning") + { + %iconPath = "tools/gui/images/iconWarn"; + %configCommand = "";//"ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");"; + + if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset") + %assetName = %assetItem.assetName @ " "; + } + } + + %importEntry = new GuiControl() + { + position = "0 0"; + extent = ImportingAssetList.extent.x SPC %height; + + new GuiTextCtrl() + { + Text = %assetName; + position = %indent SPC "0"; + extent = %width - %indent SPC %height; + internalName = "AssetName"; + }; + + new GuiTextCtrl() + { + Text = %assetType; + position = %width SPC "0"; + extent = %width - %height - %height SPC %height; + internalName = "AssetType"; + }; + + new GuiBitmapButtonCtrl() + { + position = ImportingAssetList.extent.x - %height - %height SPC "0"; + extent = %height SPC %height; + command = %configCommand; + bitmap = %iconPath; + tooltip = %toolTip; + }; + new GuiBitmapButtonCtrl() + { + position = ImportingAssetList.extent.x - %height SPC "0"; + extent = %height SPC %height; + command = "ImportAssetOptionsWindow.deleteImportingAsset(" @ %assetItem @ ");"; + bitmap = "tools/gui/images/iconDelete"; + }; + }; + + ImportingAssetList.add(%importEntry); + } + } + else + { + //Continue processing + %this.refresh(); + } +} +// + +function ImportAssetWindow::validateAssets(%this) +{ + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + %moduleName = ImportAssetModuleList.getText(); + %assetQuery = new AssetQuery(); + + %hasIssues = false; + + //First, check the obvious: name collisions. We should have no asset that shares a similar name. + //If we do, prompt for it be renamed first before continuing + + for(%i=0; %i < %assetCount; %i++) + { + %assetItemA = AssetBrowser.importAssetFinalListArray.getKey(%i); + + //First, check our importing assets for name collisions + for(%j=0; %j < %assetCount; %j++) + { + %assetItemB = AssetBrowser.importAssetFinalListArray.getKey(%j); + if( (%assetItemA.assetName $= %assetItemB.assetName) && (%i != %j) ) + { + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!");*/ + + %assetItemA.status = "Warning"; + %assetItemA.statusType = "DuplicateImportAsset"; + %assetItemA.statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!"; + + %hasIssues = true; + } + } + + //No collisions of for this name in the importing assets. Now, check against the existing assets in the target module + if(!AssetBrowser.isAssetReImport) + { + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + %foundCollision = false; + for( %f=0; %f < %numAssetsFound; %f++) + { + %assetId = %assetQuery.getAsset(%f); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %testModuleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName !$= %testModuleName) + continue; + + %testAssetName = AssetDatabase.getAssetName(%assetId); + + if(%testAssetName $= %assetItemA.assetName) + { + %foundCollision = true; + + %assetItemA.status = "Warning"; + %assetItemA.statusType = "DuplicateAsset"; + %assetItemA.statusInfo = "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!"; + + break; + } + } + + if(%foundCollision == true) + { + %hasIssues = true; + + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!");*/ + + //%assetQuery.delete(); + //return false; + } + } + + if(!isFile(%assetItemA.filePath)) + { + %hasIssues = true; + %assetItemA.status = "error"; + %assetItemA.statusType = "MissingFile"; + %assetItemA.statusInfo = "Unable to find file to be imported. Please select asset file."; + } + } + + //Clean up our queries + %assetQuery.delete(); + + if(%hasIssues) + return false; + else + return true; +} + +function ImportAssetWindow::ImportAssets(%this) +{ + //do the actual importing, now! + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + + //get the selected module data + %moduleName = ImportAssetModuleList.getText(); + + %module = ModuleDatabase.findModule(%moduleName, 1); + + if(!isObject(%module)) + { + MessageBoxOK( "Error!", "No module selected. You must select or create a module for the assets to be added to."); + return; + } + + /*if(!%this.validateAssets()) + { + //Force a refresh, as some things may have changed, such as errors and failure info! + refresh(); + + return; + }*/ + + for(%i=0; %i < %assetCount; %i++) + { + %assetItem = AssetBrowser.importAssetFinalListArray.getKey(%i); + %assetType = %assetItem.AssetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + %assetImportSuccessful = false; + %assetId = %moduleName@":"@%assetName; + + if(%assetType $= "Image") + { + %assetPath = "data/" @ %moduleName @ "/Images"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ImageAsset() + { + assetName = %assetName; + versionId = 1; + imageFile = %assetFullPath; + originalFilePath = %filePath; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Model") + { + %assetPath = "data/" @ %moduleName @ "/Shapes"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ShapeAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + isNewShape = true; + }; + + %dependencyCount = getWordCount(%assetItem.dependencies); + for(%d=0; %d < %dependencyCount; %d++) + { + %dependencyAssetItem = getWord(%assetItem.dependencies, %d); + + %depAssetType = %dependencyAssetItem.assetType; + if(%depAssetType $= "Material") + { + %matSet = "%newAsset.materialSlot"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + if(%depAssetType $= "Animation") + { + %matSet = "%newAsset.animationSequence"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + } + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + + //now, force-load the file if it's collada + %fileExt = fileExt(%assetFullPath); + if(isSupportedFormat(getSubStr(%fileExt,1))) + { + %tempShape = new TSStatic() + { + shapeName = %assetFullPath; + }; + + %tempShape.delete(); + } + } + else if(%assetType $= "Animation") + { + %assetPath = "data/" @ %moduleName @ "/ShapeAnimations"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ShapeAnimationAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + animationFile = %assetFullPath; + animationName = %assetName; + startFrame = 0; + endFrame = -1; + padRotation = false; + padTransforms = false; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Sound") + { + %assetPath = "data/" @ %moduleName @ "/Sounds"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new SoundAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Material") + { + %assetPath = "data/" @ %moduleName @ "/materials"; + %tamlpath = %assetPath @ "/" @ %assetName @ ".asset.taml"; + %sgfPath = %assetPath @ "/" @ %assetName @ ".sgf"; + %scriptPath = %assetPath @ "/" @ %assetName @ ".cs"; + + %newAsset = new MaterialAsset() + { + assetName = %assetName; + versionId = 1; + shaderGraph = %sgfPath; + scriptFile = %scriptPath; + originalFilePath = %filePath; + materialDefinitionName = %assetName; + }; + + %dependencyCount = getWordCount(%assetItem.dependencies); + for(%d=0; %d < %dependencyCount; %d++) + { + %dependencyAssetItem = getWord(%assetItem.dependencies, %d); + + %depAssetType = %dependencyAssetItem.assetType; + if(%depAssetType $= "Image") + { + %matSet = "%newAsset.imageMap"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + } + + %assetImportSuccessful = TamlWrite(%newAsset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + %file.writeline("//--- OBJECT WRITE BEGIN ---"); + %file.writeline("singleton Material(" @ %assetName @ ") {"); + + //TODO: pass along the shape's target material for this just to be sure + %file.writeLine(" mapTo = \"" @ %assetName @ "\";"); + + if(%assetItem.diffuseImageAsset !$= "") + { + %diffuseAssetPath = "data/" @ %moduleName @ "/Images/" @ fileName(%assetItem.diffuseImageAsset.filePath); + %file.writeline(" DiffuseMap[0] = \"" @ %diffuseAssetPath @"\";"); + %file.writeline(" DiffuseMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.diffuseImageAsset.assetName @"\";"); + } + if(%assetItem.normalImageAsset) + { + %normalAssetPath = "data/" @ %moduleName @ "/Images/" @ fileName(%assetItem.normalImageAsset.filePath); + %file.writeline(" NormalMap[0] = \"" @ %normalAssetPath @"\";"); + %file.writeline(" NormalMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.normalImageAsset.assetName @"\";"); + } + /*if(%assetItem.specularImageAsset) + { + %file.writeline(" SpecularMap[0] = \"" @ %assetItem.specularImageAsset.filePath @"\";"); + %file.writeline(" SpecularMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.specularImageAsset.assetName @"\";"); + }*/ + if(%assetItem.roughnessImageAsset) + { + %file.writeline(" RoughMap[0] = \"" @ %assetItem.roughnessImageAsset.filePath @"\";"); + %file.writeline(" RoughMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.roughnessImageAsset.assetName @"\";"); + } + if(%assetItem.smoothnessImageAsset) + { + %file.writeline(" SmoothnessMap[0] = \"" @ %assetItem.smoothnessImageAsset.filePath @"\";"); + %file.writeline(" SmoothnessMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.smoothnessImageAsset.assetName @"\";"); + } + if(%assetItem.metalnessImageAsset) + { + %file.writeline(" MetalMap[0] = \"" @ %assetItem.metalnessImageAsset.filePath @"\";"); + %file.writeline(" MetalMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.metalnessImageAsset.assetName @"\";"); + } + if(%assetItem.AOImageAsset) + { + %file.writeline(" AOMap[0] = \"" @ %assetItem.AOImageAsset.filePath @"\";"); + %file.writeline(" AOMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.AOImageAsset.assetName @"\";"); + } + if(%assetItem.compositeImageAsset) + { + %file.writeline(" CompositeMap[0] = \"" @ %assetItem.compositeImageAsset.filePath @"\";"); + %file.writeline(" CompositeMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.compositeImageAsset.assetName @"\";"); + } + %file.writeline("};"); + %file.writeline("//--- OBJECT WRITE END ---"); + + %file.close(); + } + } + + if(%assetImportSuccessful) + { + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + + if(!AssetBrowser.isAssetReImport) + AssetDatabase.addDeclaredAsset(%moduleDef, %assetPath @ "/" @ %assetName @ ".asset.taml"); + else + AssetDatabase.refreshAsset(%assetId); + } + } + + //force an update of any and all modules so we have an up-to-date asset list + AssetBrowser.loadFilters(); + AssetBrowser.refreshPreviews(); + Canvas.popDialog(AssetImportCtrl); + AssetBrowser.isAssetReImport = false; +} + +// +function ImportAssetWindow::validateAsset(%this, %assetItem) +{ + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + %moduleName = ImportAssetModuleList.getText(); + + %hasIssues = false; + + //First, check the obvious: name collisions. We should have no asset that shares a similar name. + //If we do, prompt for it be renamed first before continuing + + for(%i=0; %i < %assetCount; %i++) + { + %assetItemA = AssetBrowser.importAssetFinalListArray.getKey(%i); + + if( (%assetItemA.assetName $= %assetItem.assetName) && (%assetItemA.getId() != %assetItem.getId()) ) + { + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!");*/ + + %assetItem.status = "Warning"; + %assetItem.statusType = "DuplicateImportAsset"; + %assetItem.statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItem.assetName @ "\" of type \"" @ %assetItem.assetType @ "\" have matching names.\nPlease rename one of them and try again!"; + + %hasIssues = true; + return false; + } + } + + //No collisions of for this name in the importing assets. Now, check against the existing assets in the target module + if(!AssetBrowser.isAssetReImport) + { + %assetQuery = new AssetQuery(); + + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + %foundCollision = false; + for( %f=0; %f < %numAssetsFound; %f++) + { + %assetId = %assetQuery.getAsset(%f); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %testModuleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName !$= %testModuleName) + continue; + + %testAssetName = AssetDatabase.getAssetName(%assetId); + + if(%testAssetName $= %assetItem.assetName) + { + %foundCollision = true; + + %assetItem.status = "Warning"; + %assetItem.statusType = "DuplicateAsset"; + %assetItem.statusInfo = "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItem.assetName @ "\" of type \"" @ %assetItem.assetType @ "\" has a matching name.\nPlease rename it and try again!"; + + //Clean up our queries + %assetQuery.delete(); + + return false; + } + } + + if(%foundCollision == true) + { + %hasIssues = true; + + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!");*/ + + //%assetQuery.delete(); + //return false; + } + + //Clean up our queries + %assetQuery.delete(); + } + + if(!isFile(%assetItem.filePath)) + { + %hasIssues = true; + %assetItem.status = "error"; + %assetItem.statusType = "MissingFile"; + %assetItem.statusInfo = "Unable to find file to be imported. Please select asset file."; + + return false; + } + + return true; +} + +function ImportAssetWindow::resolveIssue(%this, %assetItem) +{ + if(%assetItem.status !$= "Warning") + return; + + //Ok, we actually have a warning, so lets resolve + if(%assetItem.statusType $= "DuplicateImportAsset" || %assetItem.statusType $= "DuplicateAsset") + { + + } + else if(%assetItem.statusType $= "MissingFile") + { + %this.findMissingFile(%assetItem); + } +} +// + +// +function ImportAssetModuleList::onWake(%this) +{ + %this.refresh(); +} + +function ImportAssetModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} +// diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs new file mode 100644 index 000000000..bdd4c2851 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs @@ -0,0 +1,472 @@ +function ImportAssetConfigList::onSelect( %this, %id, %text ) +{ + //Apply our settings to the assets + echo("Changed our import config!"); + AssetBrowser.importAssetUnprocessedListArray.empty(); + AssetBrowser.importAssetUnprocessedListArray.duplicate(AssetBrowser.importAssetNewListArray); + AssetBrowser.importAssetFinalListArray.empty(); + + ImportAssetWindow.activeImportConfigIndex = %id; + ImportAssetWindow.activeImportConfig = ImportAssetWindow.importConfigsList.getKey(%id); + ImportAssetWindow.refresh(); +} + +function ImportAssetOptionsWindow::findMissingFile(%this, %assetItem) +{ + if(%assetItem.assetType $= "Model") + %filters = "Shape Files(*.dae, *.cached.dts)|*.dae;*.cached.dts"; + else if(%assetItem.assetType $= "Image") + %filters = "Images Files(*.jpg,*.png,*.tga,*.bmp,*.dds)|*.jpg;*.png;*.tga;*.bmp;*.dds"; + + %dlg = new OpenFileDialog() + { + Filters = %filters; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = true; + OverwritePrompt = true; + forceRelativePath = false; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = %dlg.FileName;//makeRelativePath( %dlg.FileName, getMainDotCSDir() ); + } + + %dlg.delete(); + + if ( !%ret ) + return; + + %assetItem.filePath = %fullPath; + + ImportAssetWindow.refresh(); +} + +// +function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem) +{ + ImportAssetOptionsWindow.setVisible(1); + ImportAssetOptionsWindow.selectWindow(); + + ImportOptionsList.clearFields(); + + %assetType = %assetItem.assetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + %assetConfigObj = %assetItem.importConfig; + + ImportOptionsList.startGroup("Asset"); + ImportOptionsList.addField("AssetName", "Asset Name", "string", "", "NewAsset", "", %assetItem); + ImportOptionsList.endGroup(); + + if(%assetType $= "Model") + { + //Get the shape info, so we know what we're doing with the mesh + %shapeInfo = GetShapeInfo(%filePath); + %meshItem = %shapeInfo.findItemByName("Meshes"); + %matItem = %shapeInfo.findItemByName("Materials"); + + %meshCount = %shapeInfo.getItemValue(%meshItem); + %matCount = %shapeInfo.getItemValue(%matItem); + + %firstMat = %shapeInfo.getChild(%matItem); + echo("Mesh's first material texture path is: " @ %shapeInfo.getItemValue(%firstMat)); + + if(%meshCount > 0) + { + ImportOptionsList.startGroup("Mesh"); + ImportOptionsList.addField("AutogenCollisions", "Auto-gen Collisions", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("UpAxisOverride", "Up-Axis Override", "list", "", "Z_AXIS", "Z_AXIS,Y_AXIS,X_AXIS", %assetConfigObj); + ImportOptionsList.addField("OverrideScale", "Override Scale", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.addField("IgnoreNodeScale", "IgnoreNodeScaling", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("AdjustCenter", "Adjust Center", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("AdjustFloor", "Adjust Floor", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS", %assetConfigObj); + ImportOptionsList.endGroup(); + } + + if(%matItem > 0) + { + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addCallbackField("ImportMaterials", "Import Materials", "bool", "", "1", "", "ImportMaterialsChanged", %assetConfigObj); + ImportOptionsList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } + } + else if(%assetType $= "Material") + { + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addField("CreateComposites", "Create Composite Textures", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } + else if(%assetType $= "Image") + { + ImportOptionsList.startGroup("Formatting"); + ImportOptionsList.addField("ImageType", "Image Type", "string", "", "Diffuse", "", %assetConfigObj); + ImportOptionsList.addField("TextureFiltering", "Texture Filtering", "list", "", "Bilinear", "None,Bilinear,Trilinear", %assetConfigObj); + ImportOptionsList.addField("UseMips", "Use Mips", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.addField("IsHDR", "Is HDR", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Scaling"); + ImportOptionsList.addField("Scaling", "Scaling", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Compression"); + ImportOptionsList.addField("IsCompressed", "Is Compressed", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addField("GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("UseDiffuseSuffixOnOriginImg", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsList.endGroup(); + } + else if(%assetType $= "Sound") + { + ImportOptionsList.startGroup("Adjustment"); + ImportOptionsList.addField("VolumeAdjust", "VolumeAdjustment", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.addField("PitchAdjust", "PitchAdjustment", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Compression"); + ImportOptionsList.addField("IsCompressed", "Is Compressed", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } +} + +function ImportAssetOptionsWindow::deleteImportingAsset(%this, %assetItem) +{ + %assetIndex = AssetBrowser.importAssetNewListArray.getIndexFromKey(%assetItem); + AssetBrowser.importAssetNewListArray.erase(%assetIndex); + + //check if we have any child assets and remove them as well + for(%i=0; %i < AssetBrowser.importAssetNewListArray.count(); %i++) + { + %asset = AssetBrowser.importAssetNewListArray.getKey(%i); + if(%asset.ParentAssetItem == %assetItem) + { + AssetBrowser.importAssetNewListArray.erase(%i); + %i--; + } + } + + %assetIndex = AssetBrowser.importAssetFinalListArray.getIndexFromKey(%assetItem); + AssetBrowser.importAssetFinalListArray.erase(%assetIndex); + + //check if we have any child assets and remove them as well + for(%i=0; %i < AssetBrowser.importAssetFinalListArray.count(); %i++) + { + %asset = AssetBrowser.importAssetFinalListArray.getKey(%i); + if(%asset.ParentAssetItem == %assetItem) + { + AssetBrowser.importAssetFinalListArray.erase(%i); + %i--; + } + } + + ImportAssetWindow.refresh(); + ImportAssetOptionsWindow.setVisible(0); +} + +function ImportAssetOptionsWindow::saveAssetOptions(%this) +{ + ImportAssetWindow.refresh(); + ImportAssetOptionsWindow.setVisible(0); +} + +function ImportOptionsList::ImportMaterialsChanged(%this, %fieldName, %newValue, %ownerObject) +{ + echo("CHANGED IF OUR IMPORTED MATERIALS WERE HAPPENING!"); +} + +function ImportAssetConfigEditorWindow::populateConfigList(%this, %optionsObj) +{ + AssetImportConfigName.setText(%optionsObj.Name); + + ImportOptionsConfigList.clear(); + + ImportOptionsConfigList.startGroup("Mesh"); + ImportOptionsConfigList.addCallbackField("ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh", %optionsObj); + ImportOptionsConfigList.addField("DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("UpAxisOverride", "Up-axis Override", "list", "", "Z_AXIS", "X_AXIS,Y_AXIS,Z_AXIS", %optionsObj); + ImportOptionsConfigList.addField("DoScaleOverride", "Do Scale Override", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("ScaleOverride", "Scale Override", "float", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreNodeScale", "Ignore Node Scale", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("AdjustCenter", "Adjust Center", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("AdjustFloor", "Adjust Floor", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS", %optionsObj); + //ImportOptionsConfigList.addField("TrailingNumber", "Trailing Number", "float", "", "2", "", %optionsObj, "Mesh"); + ImportOptionsConfigList.addField("ImportedNodes", "Imported Nodes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreNodes", "Ignore Nodes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("ImportMeshes", "Import Meshes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreMeshes", "Imported Meshes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Materials + ImportOptionsConfigList.startGroup("Material"); + ImportOptionsConfigList.addField("ImportMaterials", "Import Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("CreateComposites", "Create Composites", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("UseDiffuseSuffixOnOriginImg", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreMaterials", "Ignore Materials", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Animations + ImportOptionsConfigList.startGroup("Animations"); + ImportOptionsConfigList.addField("ImportAnimations", "Import Animations", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("SeparateAnimations", "Separate Animations", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("SeparateAnimationPrefix", "Separate Animation Prefix", "string", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Collision + ImportOptionsConfigList.startGroup("Collision"); + ImportOptionsConfigList.addField("GenerateCollisions", "Generate Collisions", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenCollisionType", "Generate Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull", %optionsObj); + ImportOptionsConfigList.addField("CollisionMeshPrefix", "CollisionMesh Prefix", "string", "", "Col", "", %optionsObj); + ImportOptionsConfigList.addField("GenerateLOSCollisions", "Generate LOS Collisions", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenLOSCollisionType", "Generate LOS Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull", %optionsObj); + ImportOptionsConfigList.addField("LOSCollisionMeshPrefix", "LOS CollisionMesh Prefix", "string", "", "LOS", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Images + ImportOptionsConfigList.startGroup("Image"); + ImportOptionsConfigList.addField("ImageType", "Image Type", "list", "", "N/A", "N/A,Diffuse,Normal,Specular,Metalness,Roughness,AO,Composite,GUI", %optionsObj); + ImportOptionsConfigList.addField("DiffuseTypeSuffixes", "Diffuse Type Suffixes", "command", "", "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL", "", %optionsObj); + ImportOptionsConfigList.addField("NormalTypeSuffixes", "Normal Type Suffixes", "command", "", "_NORMAL,_NORM", "", %optionsObj); + + if(EditorSettings.lightingModel $= "Legacy") + { + ImportOptionsConfigList.addField("SpecularTypeSuffixes", "Specular Type Suffixes", "command", "", "_SPECULAR,_SPEC", "", %optionsObj); + } + else + { + ImportOptionsConfigList.addField("MetalnessTypeSuffixes", "Metalness Type Suffixes", "command", "", "_METAL,_MET,_METALNESS,_METALLIC", "", %optionsObj); + ImportOptionsConfigList.addField("RoughnessTypeSuffixes", "Roughness Type Suffixes", "command", "", "_ROUGH,_ROUGHNESS", "", %optionsObj); + ImportOptionsConfigList.addField("SmoothnessTypeSuffixes", "Smoothness Type Suffixes", "command", "", "_SMOOTH,_SMOOTHNESS", "", %optionsObj); + ImportOptionsConfigList.addField("AOTypeSuffixes", "AO Type Suffixes", "command", "", "_AO,_AMBIENT,_AMBIENTOCCLUSION", "", %optionsObj); + ImportOptionsConfigList.addField("CompositeTypeSuffixes", "Composite Type Suffixes", "command", "", "_COMP,_COMPOSITE", "", %optionsObj); + } + + ImportOptionsConfigList.addField("TextureFilteringMode", "Texture Filtering Mode", "list", "", "Bilinear", "None,Bilinear,Trilinear", %optionsObj); + ImportOptionsConfigList.addField("UseMips", "Use Mipmaps", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IsHDR", "Is HDR", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("Scaling", "Scaling", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("Compressed", "Is Compressed", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Sounds + ImportOptionsConfigList.startGroup("Sound"); + ImportOptionsConfigList.addField("VolumeAdjust", "Volume Adjustment", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("PitchAdjust", "Pitch Adjustment", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("Compressed", "Is Compressed", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.endGroup(); +} + +function ImportAssetConfigEditorWindow::addNewConfig(%this) +{ + ImportAssetConfigEditorWindow.setVisible(1); + ImportAssetConfigEditorWindow.selectWindow(); + + %optionsObj = new ScriptObject(){}; + + ImportAssetWindow.importConfigsList.add(%optionsObj); + + //Initial, blank configuration + %optionsObj.ImportMesh = true; + %optionsObj.DoUpAxisOverride = false; + %optionsObj.UpAxisOverride = "Z_AXIS"; + %optionsObj.DoScaleOverride = false; + %optionsObj.ScaleOverride = 1.0; + %optionsObj.IgnoreNodeScale = false; + %optionsObj.AdjustCenter = false; + %optionsObj.AdjustFloor = false; + %optionsObj.CollapseSubmeshes = false; + %optionsObj.LODType = "TrailingNumber"; + //%optionsObj.TrailingNumber = 2; + %optionsObj.ImportedNodes = ""; + %optionsObj.IgnoreNodes = ""; + %optionsObj.ImportMeshes = ""; + %optionsObj.IgnoreMeshes = ""; + + //Materials + %optionsObj.ImportMaterials = true; + %optionsObj.CreateComposites = true; + %optionsObj.UseDiffuseSuffixOnOriginImg = true; + %optionsObj.UseExistingMaterials = true; + + //Animations + %optionsObj.ImportAnimations = true; + %optionsObj.SeparateAnimations = true; + %optionsObj.SeparateAnimationPrefix = ""; + + //Collision + %optionsObj.GenerateCollisions = true; + %optionsObj.GenCollisionType = "CollisionMesh"; + %optionsObj.CollisionMeshPrefix = "Col"; + %optionsObj.GenerateLOSCollisions = true; + %optionsObj.GenLOSCollisionType = "CollisionMesh"; + %optionsObj.LOSCollisionMeshPrefix = "LOS"; + + //Images + %optionsObj.ImageType = "N/A"; + %optionsObj.DiffuseTypeSuffixes = "_ALBEDO;_DIFFUSE;_ALB;_DIF;_COLOR;_COL;_BASECOLOR;_BASE_COLOR"; + %optionsObj.NormalTypeSuffixes = "_NORMAL;_NORM"; + %optionsObj.SpecularTypeSuffixes = "_SPECULAR;_SPEC"; + %optionsObj.MetalnessTypeSuffixes = "_METAL;_MET;_METALNESS;_METALLIC"; + %optionsObj.RoughnessTypeSuffixes = "_ROUGH;_ROUGHNESS"; + %optionsObj.SmoothnessTypeSuffixes = "_SMOOTH;_SMOOTHNESS"; + %optionsObj.AOTypeSuffixes = "_AO;_AMBIENT;_AMBIENTOCCLUSION"; + %optionsObj.CompositeTypeSuffixes = "_COMP;_COMPOSITE"; + %optionsObj.TextureFilteringMode = "Bilinear"; + %optionsObj.UseMips = true; + %optionsObj.IsHDR = false; + %optionsObj.Scaling = 1.0; + %optionsObj.Compressed = true; + %optionsObj.GenerateMaterialOnImport = true; + %optionsObj.PopulateMaterialMaps = true; + + //Sounds + %optionsObj.VolumeAdjust = 1.0; + %optionsObj.PitchAdjust = 1.0; + %optionsObj.Compressed = false; + + //Hook in the UI + %this.populateConfigList(%optionsObj); +} + +function ImportAssetConfigEditorWindow::editConfig(%this) +{ + ImportAssetConfigEditorWindow.setVisible(1); + ImportAssetConfigEditorWindow.selectWindow(); + + %this.populateConfigList(ImportAssetWindow.activeImportConfig); +} + +function ImportAssetConfigEditorWindow::deleteConfig(%this) +{ + ImportAssetWindow.importConfigsList.erase(ImportAssetWindow.activeImportConfigIndex); + ImportAssetConfigList.setSelected(0); //update it + + ImportAssetConfigEditorWindow.saveAssetOptionsConfig(); +} + +function ImportAssetConfigEditorWindow::saveAssetOptionsConfig(%this) +{ + %xmlDoc = new SimXMLDocument(); + + %xmlDoc.pushNewElement("AssetImportConfigs"); + + for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++) + { + %configObj = ImportAssetWindow.importConfigsList.getKey(%i); + + %xmlDoc.pushNewElement("Config"); + + if(%configObj.Name $= "") + %configObj.Name = AssetImportConfigName.getText(); + + %xmlDoc.setAttribute("Name", %configObj.Name); + + %xmlDoc.pushNewElement("Mesh"); + %xmlDoc.setAttribute("ImportMesh", %configObj.ImportMesh); + %xmlDoc.setAttribute("DoUpAxisOverride", %configObj.DoUpAxisOverride); + %xmlDoc.setAttribute("UpAxisOverride", %configObj.UpAxisOverride); + %xmlDoc.setAttribute("DoScaleOverride", %configObj.DoScaleOverride); + %xmlDoc.setAttribute("ScaleOverride", %configObj.ScaleOverride); + %xmlDoc.setAttribute("IgnoreNodeScale", %configObj.IgnoreNodeScale); + %xmlDoc.setAttribute("AdjustCenter", %configObj.AdjustCenter); + %xmlDoc.setAttribute("AdjustFloor", %configObj.AdjustFloor); + %xmlDoc.setAttribute("CollapseSubmeshes", %configObj.CollapseSubmeshes); + %xmlDoc.setAttribute("LODType", %configObj.LODType); + %xmlDoc.setAttribute("ImportedNodes", %configObj.ImportedNodes); + %xmlDoc.setAttribute("IgnoreNodes", %configObj.IgnoreNodes); + %xmlDoc.setAttribute("ImportMeshes", %configObj.ImportMeshes); + %xmlDoc.setAttribute("IgnoreMeshes", %configObj.IgnoreMeshes); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Materials"); + %xmlDoc.setAttribute("ImportMaterials", %configObj.ImportMaterials); + %xmlDoc.setAttribute("CreateComposites", %configObj.CreateComposites); + %xmlDoc.setAttribute("UseDiffuseSuffixOnOriginImg", %configObj.UseDiffuseSuffixOnOriginImg); + %xmlDoc.setAttribute("UseExistingMaterials", %configObj.UseExistingMaterials); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Animations"); + %xmlDoc.setAttribute("ImportAnimations", %configObj.ImportAnimations); + %xmlDoc.setAttribute("SeparateAnimations", %configObj.SeparateAnimations); + %xmlDoc.setAttribute("SeparateAnimationPrefix", %configObj.SeparateAnimationPrefix); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Collisions"); + %xmlDoc.setAttribute("GenerateCollisions", %configObj.GenerateCollisions); + %xmlDoc.setAttribute("GenCollisionType", %configObj.GenCollisionType); + %xmlDoc.setAttribute("CollisionMeshPrefix", %configObj.CollisionMeshPrefix); + %xmlDoc.setAttribute("GenerateLOSCollisions", %configObj.GenerateLOSCollisions); + %xmlDoc.setAttribute("GenLOSCollisionType", %configObj.GenLOSCollisionType); + %xmlDoc.setAttribute("LOSCollisionMeshPrefix", %configObj.LOSCollisionMeshPrefix); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Images"); + %xmlDoc.setAttribute("ImageType", %configObj.ImageType); + %xmlDoc.setAttribute("DiffuseTypeSuffixes", %configObj.DiffuseTypeSuffixes); + %xmlDoc.setAttribute("NormalTypeSuffixes", %configObj.NormalTypeSuffixes); + %xmlDoc.setAttribute("SpecularTypeSuffixes", %configObj.SpecularTypeSuffixes); + %xmlDoc.setAttribute("MetalnessTypeSuffixes", %configObj.MetalnessTypeSuffixes); + %xmlDoc.setAttribute("RoughnessTypeSuffixes", %configObj.RoughnessTypeSuffixes); + %xmlDoc.setAttribute("SmoothnessTypeSuffixes", %configObj.SmoothnessTypeSuffixes); + %xmlDoc.setAttribute("AOTypeSuffixes", %configObj.AOTypeSuffixes); + %xmlDoc.setAttribute("CompositeTypeSuffixes", %configObj.CompositeTypeSuffixes); + %xmlDoc.setAttribute("TextureFilteringMode", %configObj.TextureFilteringMode); + %xmlDoc.setAttribute("UseMips", %configObj.UseMips); + %xmlDoc.setAttribute("IsHDR", %configObj.IsHDR); + %xmlDoc.setAttribute("Scaling", %configObj.Scaling); + %xmlDoc.setAttribute("Compressed", %configObj.Compressed); + %xmlDoc.setAttribute("GenerateMaterialOnImport", %configObj.GenerateMaterialOnImport); + %xmlDoc.setAttribute("PopulateMaterialMaps", %configObj.PopulateMaterialMaps); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Sounds"); + %xmlDoc.setAttribute("VolumeAdjust", %configObj.VolumeAdjust); + %xmlDoc.setAttribute("PitchAdjust", %configObj.PitchAdjust); + %xmlDoc.setAttribute("Compressed", %configObj.Compressed); + %xmlDoc.popElement(); + + %xmlDoc.popElement(); + } + + %xmlDoc.popElement(); + + %xmlDoc.saveFile($AssetBrowser::importConfigsFile); + + ImportAssetConfigEditorWindow.setVisible(0); + ImportAssetWindow.reloadImportOptionConfigs(); +} + +function ImportOptionsConfigList::ToggleImportMesh(%this, %fieldName, %newValue, %ownerObject) +{ + %this.setFieldEnabled("DoUpAxisOverride", %newValue); + %this.setFieldEnabled("UpAxisOverride", %newValue); + %this.setFieldEnabled("DoScaleOverride", %newValue); + %this.setFieldEnabled("ScaleOverride", %newValue); + %this.setFieldEnabled("IgnoreNodeScale", %newValue); + %this.setFieldEnabled("AdjustCenter", %newValue); + %this.setFieldEnabled("AdjustFloor", %newValue); + %this.setFieldEnabled("CollapseSubmeshes", %newValue); + %this.setFieldEnabled("LODType", %newValue); + %this.setFieldEnabled("ImportedNodes", %newValue); + %this.setFieldEnabled("IgnoreNodes", %newValue); + %this.setFieldEnabled("ImportMeshes", %newValue); + %this.setFieldEnabled("IgnoreMeshes", %newValue); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs new file mode 100644 index 000000000..bc80f8977 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs @@ -0,0 +1,371 @@ +function AssetBrowser_editAsset::saveAsset(%this) +{ + %file = AssetDatabase.getAssetFilePath(%this.editedAssetId); + %success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file); + + AssetBrowser.loadFilters(); + + Canvas.popDialog(AssetBrowser_editAsset); +} + +function AssetBrowser::editAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = %assetDef.getClassName(); + + if(%assetType $= "MaterialAsset") + { + //if(EditorSettings.materialEditMode $= "MaterialEditor") + //{ + %assetDef.materialDefinitionName.reload(); + + EditorGui.setEditor(MaterialEditorPlugin); + + MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName; + MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName ); + + AssetBrowser.hideDialog(); + /*} + else + { + Canvas.pushDialog(ShaderEditor); + ShaderEditorGraph.loadGraph(%assetDef.shaderGraph); + $ShaderGen::targetShaderFile = filePath(%assetDef.shaderGraph) @"/"@fileBase(%assetDef.shaderGraph); + }*/ + } + else if(%assetType $= "StateMachineAsset") + { + eval("AssetBrowser.tempAsset = new " @ %assetDef.getClassName() @ "();"); + AssetBrowser.tempAsset.assignFieldsFrom(%assetDef); + + SMAssetEditInspector.inspect(AssetBrowser.tempAsset); + AssetBrowser_editAsset.editedAssetId = EditAssetPopup.assetId; + AssetBrowser_editAsset.editedAsset = AssetBrowser.tempAsset; + + //remove some of the groups we don't need: + for(%i=0; %i < SMAssetEditInspector.getCount(); %i++) + { + %caption = SMAssetEditInspector.getObject(%i).caption; + + if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing" + || %caption $= "Persistence" || %caption $= "Dynamic Fields") + { + SMAssetEditInspector.remove(SMAssetEditInspector.getObject(%i)); + %i--; + } + } + + Canvas.pushDialog(StateMachineEditor); + StateMachineEditor.loadStateMachineAsset(EditAssetPopup.assetId); + StateMachineEditor-->Window.text = "State Machine Editor ("@EditAssetPopup.assetId@")"; + } + else if(%assetType $= "ComponentAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFile; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "GameObjectAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFilePath; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "ScriptAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFilePath; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "ShapeAsset") + { + %this.hideDialog(); + ShapeEditorPlugin.openShapeAsset(EditAssetPopup.assetId); + } + else if(%assetType $= "ShapeAnimationAsset") + { + %this.hideDialog(); + ShapeEditorPlugin.openShapeAsset(EditAssetPopup.assetId); + } + else if(%assetType $= "LevelAsset") + { + schedule( 1, 0, "EditorOpenMission", %assetDef.LevelFile); + } + else if(%assetType $= "GUIAsset") + { + if(!isObject(%assetDef.assetName)) + { + exec(%assetDef.GUIFilePath); + exec(%assetDef.mScriptFilePath); + } + + GuiEditContent(%assetDef.assetName); + } +} + +function AssetBrowser::editAssetInfo(%this) +{ + Canvas.pushDialog(AssetBrowser_editAsset); + + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + eval("AssetBrowser.tempAsset = new " @ %assetDef.getClassName() @ "();"); + AssetBrowser.tempAsset.assignFieldsFrom(%assetDef); + + AssetEditInspector.inspect(AssetBrowser.tempAsset); + AssetBrowser_editAsset.editedAssetId = EditAssetPopup.assetId; + AssetBrowser_editAsset.editedAsset = AssetBrowser.tempAsset; + + //remove some of the groups we don't need: + for(%i=0; %i < AssetEditInspector.getCount(); %i++) + { + %caption = AssetEditInspector.getObject(%i).caption; + + if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing" + || %caption $= "Persistence" || %caption $= "Dynamic Fields") + { + AssetEditInspector.remove(AssetEditInspector.getObject(%i)); + %i--; + } + } +} + +//------------------------------------------------------------ + +function AssetBrowser::refreshAsset(%this, %assetId) +{ + if(%assetId $= "") + { + //if we have no passed-in asset ID, we're probably going through the popup menu, so get our edit popup id + %assetId = EditAssetPopup.assetId; + } + + AssetDatabase.refreshAsset(%assetId); + AssetBrowser.refreshPreviews(); +} + +//------------------------------------------------------------ + +function AssetBrowser::renameAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + %curFirstResponder = AssetBrowser.getFirstResponder(); + + if(%curFirstResponder != 0) + %curFirstResponder.clearFirstResponder(); + + AssetBrowser.selectedAssetPreview-->AssetNameLabel.setActive(true); + AssetBrowser.selectedAssetPreview-->AssetNameLabel.setFirstResponder(); +} + +function AssetNameField::onReturn(%this) +{ + //if the name is different to the asset's original name, rename it! + %newName = %this.getText(); + if(%this.originalAssetName !$= %this.getText()) + { + %moduleName = AssetBrowser.selectedModule; + + //do a rename! + %success = AssetDatabase.renameDeclaredAsset(%moduleName @ ":" @ %this.originalAssetName, %moduleName @ ":" @ %this.getText()); + + if(%success) + { + %newAssetId = %moduleName @ ":" @ %this.getText(); + %assetPath = AssetDatabase.getAssetFilePath(%newAssetId); + + //Rename any associated files as well + %assetDef = AssetDatabase.acquireAsset(%newAssetId); + %assetType = %assetDef.getClassName(); + + //rename the file to match + %path = filePath(%assetPath); + + if(%assetType $= "ComponentAsset") + { + %oldScriptFilePath = %assetDef.scriptFile; + %scriptFilePath = filePath(%assetDef.scriptFile); + %scriptExt = fileExt(%assetDef.scriptFile); + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + + %assetDef.componentName = %newName; + %assetDef.scriptFile = %newScriptFileName; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + exec(%newScriptFileName); + } + else if(%assetType $= "StateMachineAsset") + { + %oldScriptFilePath = %assetDef.stateMachineFile; + %scriptFilePath = filePath(%assetDef.stateMachineFile); + %scriptExt = fileExt(%assetDef.stateMachineFile); + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + + %assetDef.stateMachineFile = %newScriptFileName; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + } + else if(%assetType $= "GameObjectAsset") + { + %oldScriptFilePath = %assetDef.scriptFilePath; + %scriptFilePath = filePath(%assetDef.scriptFilePath); + %scriptExt = fileExt(%assetDef.scriptFilePath); + + %oldGOFilePath = %assetDef.TAMLFilePath; + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + %newGOFile = %path @ "/" @ %this.getText() @ ".taml"; + + %assetDef.gameObjectName = %newName; + %assetDef.scriptFilePath = %newScriptFileName; + %assetDef.TAMLFilePath = %newGOFile; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + + pathCopy(%oldGOFilePath, %newGOFile); + fileDelete(%oldGOFilePath); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + exec(%newScriptFileName); + + //Rename in the TAML file as well + %file = new FileObject(); + if ( %file.openForRead( %newGOFile ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newGOFile); + + %file.writeline(%editedFileContents); + + %file.close(); + } + } + } + } + + %this.clearFirstResponder(); + %this.setActive(false); +} + +//------------------------------------------------------------ + +function AssetBrowser::duplicateAsset(%this) +{ + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + %this.setupCreateNewAsset(%assetDef.getClassName(), AssetBrowser.selectedModule); +} + +function AssetBrowser::deleteAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = %assetDef.getClassName(); + + MessageBoxOKCancel("Warning!", "This will delete the selected asset and the files associated to it, do you wish to continue?", + "AssetBrowser.confirmDeleteAsset();", ""); +} + +function AssetBrowser::confirmDeleteAsset(%this) +{ + %currentSelectedItem = AssetBrowserFilterTree.getSelectedItem(); + %currentItemParent = AssetBrowserFilterTree.getParentItem(%currentSelectedItem); + + AssetDatabase.deleteAsset(EditAssetPopup.assetId, false); + + %this.loadFilters(); + + if(!AssetBrowserFilterTree.selectItem(%currentSelectedItem)) + { + //if it failed, that means we deleted the last item in that category, and we need to do the parent + AssetBrowserFilterTree.selectItem(%currentItemParent); + AssetBrowserFilterTree.expandItem(%currentItemParent); + } +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs new file mode 100644 index 000000000..996bec6f0 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs @@ -0,0 +1,127 @@ +// +function AssetBrowser::CreateNewModule(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); + + AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadFilters();"; +} + +function AssetBrowser_editModule::saveModule(%this) +{ + //Check what special actions we may need to do, such as renames + %moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1); + + %oldModuleName = %moduleDef.ModuleID; + + if(%oldModuleName !$= AssetBrowser.tempModule.ModuleID) + { + //rename the script file and script namespaces + %oldScriptFilePath = "data/" @ %oldModuleName @ "/" @ %moduleDef.scriptFile; + %newscriptFilePath = "data/" @ AssetBrowser.tempModule.ModuleID @ "/"; + %scriptExt = fileExt(%moduleDef.scriptFile); + + %newScriptFileName = %newscriptFilePath @ "/" @ AssetBrowser.tempModule.ModuleID @ %scriptExt; + %newScriptFileOldName = %newscriptFilePath @ "/" @ %oldModuleName @ %scriptExt; + + %moduleDef.ModuleId = AssetBrowser.tempModule.ModuleID; + %moduleDef.scriptFile = AssetBrowser.tempModule.ModuleID @ %scriptExt; + + ModuleDatabase.copyModule(%moduleDef, AssetBrowser.tempModule.ModuleID, "data/" @ AssetBrowser.tempModule.ModuleID); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileOldName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %oldModuleName, AssetBrowser.tempModule.ModuleID) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + %success = fileDelete(%newScriptFileOldName); + + ModuleDatabase.unloadExplicit(%oldModuleName); + + %success = fileDelete("data/" @ %oldModuleName); + + ModuleDatabase.loadExplicit(AssetBrowser.tempModule.ModuleID); + } + + //Now, update the module file itself + //%file = ModuleDatabase.getAssetFilePath(%moduleDef.ModuleID); + //%success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file); + + AssetBrowser.loadFilters(); + + Canvas.popDialog(AssetBrowser_editModule); +} + +function AssetBrowser::editModuleInfo(%this) +{ + Canvas.pushDialog(AssetBrowser_editModule); + + %moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1); + + AssetBrowser.tempModule = new ModuleDefinition(); + AssetBrowser.tempModule.assignFieldsFrom(%moduleDef); + + ModuleEditInspector.inspect(AssetBrowser.tempModule); + AssetBrowser_editModule.editedModuleId = AssetBrowser.selectedModule; + AssetBrowser_editModule.editedModule = AssetBrowser.tempModule; + + //remove some of the groups we don't need: + for(%i=0; %i < ModuleEditInspector.getCount(); %i++) + { + %caption = ModuleEditInspector.getObject(%i).caption; + + if(%caption $= "BuildId" || %caption $= "type" || %caption $= "Dependencies" || %caption $= "scriptFile" + || %caption $= "AssetTagsManifest" || %caption $= "ScopeSet" || %caption $= "ModulePath" + || %caption $= "ModuleFile" || %caption $= "ModuleFilePath" || %caption $= "ModuleScriptFilePath" ) + { + ModuleEditInspector.remove(ModuleEditInspector.getObject(%i)); + %i--; + } + } +} + +function AssetBrowser::renameModule(%this) +{ + +} + +function AssetBrowser::reloadModule(%this) +{ + ModuleDatabase.unregisterModule(AssetBrowser.SelectedModule, 1); + ModuleDatabase.loadExplicit(AssetBrowser.SelectedModule); +} + +function AssetBrowser::deleteModule(%this) +{ + +} + +function AssetBrowser::RefreshModuleDependencies(%this) +{ + //Iterate through all our modules + + //then, iterate through the module's assets + + //if an asset has a module that isn't us, queue that into the dependencies list +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs new file mode 100644 index 000000000..fe524ce65 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs @@ -0,0 +1,127 @@ +function GuiVariableInspector::onInspectorFieldModified(%this, %targetObj, %fieldName, %index, %oldValue, %newValue) +{ + echo("FIELD CHANGED: " @ %fieldName @ " from " @ %oldValue @ " to " @ %newValue); +} + +function GuiInspectorVariableGroup::onConstructField(%this, %fieldName, %fieldLabel, %fieldTypeName, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj) +{ + %makeCommand = %this @ ".build" @ %fieldTypeName @ "Field(\""@ %fieldName @ "\",\"" @ %fieldLabel @ "\",\"" @ %fieldDesc @ "\",\"" @ + %fieldDefaultVal @ "\",\"" @ %fieldDataVals @ "\",\"" @ %ownerObj @"\");"; + eval(%makeCommand); +} + +function GuiInspectorVariableGroup::buildListField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj) +{ + %extent = 200; + + %fieldCtrl = %this.createInspectorField(); + + %extent = %this.stack.getExtent(); + + %width = mRound(%extent/2); + %height = 20; + %inset = 10; + + /*%container = new GuiControl() { + canSaveDynamicFields = "0"; + Profile = "EditorContainerProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = %extent.x SPC %height; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = %tooltip; + tooltipProfile = "EditorToolTipProfile"; + }; + + %labelControl = new GuiTextCtrl() { + canSaveDynamicFields = "0"; + Profile = "EditorFontHLBold"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %inset SPC "0"; + Extent = %width + %inset SPC %height; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = %tooltip; + tooltipProfile = "EditorToolTipProfile"; + text = %fieldLabel; + maxLength = "1024"; + };*/ + + %editControl = new GuiPopUpMenuCtrl() { + class = "guiInspectorListField"; + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + maxLength = "1024"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + isContainer = "0"; + Profile = "ToolsGuiPopUpMenuProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %fieldCtrl.edit.position; + Extent = %fieldCtrl.edit.extent; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + tooltip = %tooltip; + text = %fieldDefaultVal; + hovertime = "1000"; + ownerObject = %ownerObj; + fieldName = %fieldName; + }; + + //set the field value + if(getSubStr(%this.fieldName, 0, 1) $= "$") + { + if(%fieldName $= "") + %editControl.setText(%fieldName); + } + else + { + //regular variable + %setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");"; + eval(%setCommand); + } + + %listCount = getTokenCount(%fieldDataVals, ","); + + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%fieldDataVals, ",", %i); + %editControl.add(%entryText); + } + + %fieldCtrl.setCaption(%fieldLabel); + %fieldCtrl.setEditControl(%editControl); + + %this.addInspectorField(%fieldCtrl); +} + +function guiInspectorListField::onSelect( %this, %id, %text ) +{ + if(getSubStr(%this.fieldName, 0, 1) $= "$") + { + //ah, a global var, just do it straight, then + %setCommand = %this.fieldName @ " = \"" @ %text @ "\";"; + } + else + { + //regular variable + %setCommand = %this.ownerObject @ "." @ %this.fieldName @ " = \"" @ %text @ "\";"; + } + eval(%setCommand); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs new file mode 100644 index 000000000..a2c526251 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs @@ -0,0 +1,130 @@ +function GameObjectModuleList::onWake(%this) +{ + %this.refresh(); +} + +function GameObjectModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} + +function GameObjectCreatorPkgBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); +} + +function GameObjectCreateBtn::onClick(%this) +{ + %className = GameObjectCreatorName.getText(); + + if(%className $= "") + { + error("Attempted to make a new Game Object with no name!"); + Canvas.popDialog(GameObjectCreator); + return; + } + + //First, find out if this one already exists. If so, we're obviously merely updating it + //also, exec any components that may exist + //find all GameObjectAssets + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) + return; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); + + %createNew = true; + + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); + + if(%gameObjectAsset.gameObjectName $= %className) + { + %createNew = false; + break; + } + } + + %selectedEntity = GameObjectCreator.selectedEntity; + + %selectedEntity.class = %className; + Inspector.inspect(%selectedEntity); + + if(%createNew) + { + //get the selected module data + %moduleName = GameObjectModuleList.getText(); + + %selectedEntity.gameObjectAsset = %moduleName @ ":" @ %className; + + %path = "data/" @ %moduleName @ "/gameObjects/"; + + %file = new FileObject(); + + if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) + { + %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); + %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //set up the paths + %tamlPath = %path @ %className @ ".taml"; + %scriptPath = %path @ %className @ ".cs"; + saveGameObject(%className, %tamlPath, %scriptPath); + + %asset = new GameObjectAsset() + { + AssetName = %className; + VersionId = 1; + gameObjectName=%className; + TAMLFilePath = %tamlPath; + scriptFilePath = %scriptPath; + }; + %assetPath = %path @ %className @ ".asset.taml"; + + //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. + TamlWrite(%selectedEntity, %tamlpath); + TamlWrite(%asset, %assetPath); + + GameObjectCreator.selectedEntity = ""; + + Canvas.popDialog(GameObjectCreator); + + //Load it + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + AssetDatabase.addDeclaredAsset(%moduleDef, %assetPath); + } + else + { + %moduleDef = AssetDatabase.getAssetModule(%assetId); + %moduleName = %moduleDef.ModuleId; + %path = "data/" @ %moduleName @ "/gameObjects/"; + + %selectedEntity.gameObjectAsset = %moduleName @ ":" @ %className; + + %tamlPath = %path @ %className @ ".taml"; + TamlWrite(%selectedEntity, %tamlpath); + + GameObjectCreator.selectedEntity = ""; + + Canvas.popDialog(GameObjectCreator); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs new file mode 100644 index 000000000..ee351a192 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs @@ -0,0 +1,663 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function CreateAssetButton::onClick(%this) +{ + AddNewAssetPopup.showPopup(Canvas); +} + +function AssetBrowser_newAsset::onWake(%this) +{ + NewAssetModuleList.refresh(); + //NewComponentParentClass.setText("Component"); +} + +function AssetBrowser_newAssetWindow::onClose(%this) +{ + NewAssetPropertiesInspector.clearFields(); + Canvas.popDialog(AssetBrowser_newAsset); +} + +function NewAssetTypeList::onWake(%this) +{ + %this.refresh(); +} + +function NewAssetTypeList::refresh(%this) +{ + %this.clear(); + + //TODO: make this more automated + //%this.add("GameObject", 0); + %this.add("Component", 0); + %this.add("Image", 1); + %this.add("Material", 2); + %this.add("Shape", 3); + %this.add("Sound", 4); + %this.add("State Machine", 5); +} + +function NewAssetTypeList::onSelected(%this) +{ + %assetType = %this.getText(); + + if(%assetType $= "Component") + { + NewComponentAssetSettings.hidden = false; + } +} + +function NewAssetModuleBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); +} + +function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName) +{ + Canvas.pushDialog(AssetBrowser_newAsset); + + AssetBrowser_newAssetWindow.text = "New" SPC %assetType SPC "Asset"; + + NewAssetPropertiesInspector.clear(); + + NewAssetModuleList.setText(%moduleName); + + //get rid of the old one if we had one. + if(isObject(%this.newAssetSettings)) + %this.newAssetSettings.delete(); + + %this.newAssetSettings = new ScriptObject(); + + %this.newAssetSettings.assetType = %assetType; + %this.newAssetSettings.moduleName = %moduleName; + + %shortAssetTypeName = strreplace(%assetType, "Asset", ""); + + NewAssetPropertiesInspector.startGroup("General"); + NewAssetPropertiesInspector.addField("assetName", "New Asset Name", "String", "Name of the new asset", "New" @ %shortAssetTypeName, "", %this.newAssetSettings); + //NewAssetPropertiesInspector.addField("AssetType", "New Asset Type", "List", "Type of the new asset", %assetType, "Component,Image,Material,Shape,Sound,State Machine", %newAssetSettings); + + NewAssetPropertiesInspector.addField("friendlyName", "Friendly Name", "String", "Human-readable name of new asset", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("description", "Description", "Command", "Description of the new asset", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + + if(%assetType $= "ComponentAsset") + { + NewAssetPropertiesInspector.startGroup("Components"); + NewAssetPropertiesInspector.addField("parentClass", "New Asset Parent Class", "String", "Name of the new asset's parent class", "Component", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("componentGroup", "Component Group", "String", "Name of the group of components this component asset belongs to", "", "", %this.newAssetSettings); + //NewAssetPropertiesInspector.addField("componentName", "Component Name", "String", "Name of the new component", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + else if(%assetType $= "LevelAsset") + { + NewAssetPropertiesInspector.startGroup("Level"); + NewAssetPropertiesInspector.addField("levelPreviewImage", "LevePreviewImage", "Image", "Preview Image for the level", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + else if(%assetType $= "ScriptAsset") + { + NewAssetPropertiesInspector.startGroup("Script"); + NewAssetPropertiesInspector.addField("isServerScript", "Is Server Script", "bool", "Is this script used on the server?", "1", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + /*else if(%assetType $= "ShapeAnimationAsset") + { + NewAssetPropertiesInspector.startGroup("Animation"); + NewAssetPropertiesInspector.addField("sourceFile", "Source File", "filename", "Source file this animation will pull from", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("animationName", "Animation Name", "string", "Name of the animation clip when used in a shape", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("startFrame", "Starting Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("endFrame", "Ending Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("padRotation", "Pad Rotations", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("padTransforms", "Pad Transforms", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + }*/ + + return; + + if(%moduleName $= "") + { + Canvas.pushDialog(AssetBrowser_selectModule); + } + else + { + AssetBrowser.SelectedModule = %moduleName; + + if(%assetType $= "MaterialAsset") + { + createNewMaterialAsset("NewMaterial", %moduleName); + } + else if(%assetType $= "StateMachineAsset") + { + createNewStateMachineAsset("NewStateMachine", %moduleName); + } + else if(%assetType $= "ScriptAsset") + { + createNewScriptAsset("NewScriptAsset", %moduleName); + } + } +} + +//We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function +function CreateNewAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + if(%assetName $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no name!"); + return; + } + + //get the selected module data + %moduleName = NewAssetModuleList.getText(); + + if(%moduleName $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no module!"); + return; + } + + AssetBrowser.newAssetSettings.moduleName = %moduleName; + + %assetType = AssetBrowser.newAssetSettings.assetType; + if(%assetType $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no type!"); + return; + } + + if(%assetType $= "ComponentAsset") + { + //Canvas.popDialog(AssetBrowser_newComponentAsset); + //AssetBrowser_newComponentAsset-->AssetBrowserModuleList.setText(AssetBrowser.selectedModule); + %assetFilePath = createNewComponentAsset(%assetName, %path); + } + else if(%assetType $= "MaterialAsset") + { + %assetFilePath = createNewMaterialAsset(); + } + else if(%assetType $= "StateMachineAsset") + { + %assetFilePath = createNewStateMachineAsset(); + } + else if(%assetType $= "GUIAsset") + { + %assetFilePath = createNewGUIAsset(); + } + else if(%assetType $= "LevelAsset") + { + %assetFilePath = createNewLevelAsset(); + } + else if(%assetType $= "ScriptAsset") + { + %assetFilePath = createNewScriptAsset(); + } + else if(%assetType $= "ShapeAnimationAsset") + { + %assetFilePath = createShapeAnimationAsset(); + } + + Canvas.popDialog(AssetBrowser_newAsset); + + //Load it + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath); + + AssetBrowser.loadFilters(); +} + +function createNewComponentAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/components/" @ %assetName @ ".asset.taml"; + %scriptPath = %modulePath @ "/components/" @ %assetName @ ".cs"; + + %asset = new ComponentAsset() + { + AssetName = %assetName; + versionId = 1; + componentName = %assetName; + componentClass = AssetBrowser.newAssetSettings.parentClass; + friendlyName = AssetBrowser.newAssetSettings.friendlyName; + componentType = AssetBrowser.newAssetSettings.componentGroup; + description = AssetBrowser.newAssetSettings.description; + scriptFile = %scriptPath; + }; + + TamlWrite(%asset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + //TODO: enable ability to auto-embed a header for copyright or whatnot + %file.writeline("//onAdd is called when the component is created and then added to it's owner entity.\n"); + %file.writeline("//You would also add any script-defined component fields via addComponentField().\n"); + %file.writeline("function " @ %assetName @ "::onAdd(%this)\n{\n\n}\n"); + %file.writeline("//onAdd is called when the component is removed and deleted from it's owner entity."); + %file.writeline("function " @ %assetName @ "::onRemove(%this)\n{\n\n}\n"); + %file.writeline("//onClientConnect is called any time a new client connects to the server."); + %file.writeline("function " @ %assetName @ "::onClientConnect(%this, %client)\n{\n\n}\n"); + %file.writeline("//onClientDisconnect is called any time a client disconnects from the server."); + %file.writeline("function " @ %assetName @ "::onClientDisonnect(%this, %client)\n{\n\n}\n"); + %file.writeline("//update is called when the component does an update tick.\n"); + %file.writeline("function " @ %assetName @ "::Update(%this)\n{\n\n}\n"); + + %file.close(); + } + + Canvas.popDialog(AssetBrowser_newComponentAsset); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Components"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewMaterialAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %tamlpath = %modulePath @ "/materials/" @ %assetName @ ".asset.taml"; + %sgfPath = %modulePath @ "/materials/" @ %assetName @ ".sgf"; + + %asset = new MaterialAsset() + { + AssetName = %assetName; + versionId = 1; + shaderData = ""; + shaderGraph = %sgfPath; + }; + + TamlWrite(%asset, %tamlpath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Materials"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewScriptAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/scripts/" @ %assetName @ ".asset.taml"; + %scriptPath = %modulePath @ "/scripts/" @ %assetName @ ".cs"; + + %asset = new ScriptAsset() + { + AssetName = %assetName; + versionId = 1; + scriptFilePath = %scriptPath; + }; + + TamlWrite(%asset, %tamlpath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Scripts"); + + AssetBrowserFilterTree.onSelect(%smItem); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + %file.close(); + } + + return %tamlpath; +} + +function createNewStateMachineAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + %assetQuery = new AssetQuery(); + + %matchingAssetCount = AssetDatabase.findAssetName(%assetQuery, %assetName); + + %i=1; + while(%matchingAssetCount > 0) + { + %newAssetName = %assetName @ %i; + %i++; + + %matchingAssetCount = AssetDatabase.findAssetName(%assetQuery, %newAssetName); + } + + %assetName = %newAssetName; + + %assetQuery.delete(); + + %tamlpath = "data/" @ %moduleName @ "/stateMachines/" @ %assetName @ ".asset.taml"; + %smFilePath = "data/" @ %moduleName @ "/stateMachines/" @ %assetName @ ".xml"; + + %asset = new StateMachineAsset() + { + AssetName = %assetName; + versionId = 1; + stateMachineFile = %smFilePath; + }; + + %xmlDoc = new SimXMLDocument(); + %xmlDoc.saveFile(%smFilePath); + %xmlDoc.delete(); + + TamlWrite(%asset, %tamlpath); + + //Now write our XML file + %xmlFile = new FileObject(); + %xmlFile.openForWrite(%smFilePath); + %xmlFile.writeLine(""); + %xmlFile.writeLine(""); + %xmlFile.close(); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "StateMachines"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewGUIAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/GUIs/" @ %assetName @ ".asset.taml"; + %guipath = %modulePath @ "/GUIs/" @ %assetName @ ".gui"; + %scriptPath = %modulePath @ "/GUIs/" @ %assetName @ ".cs"; + + %asset = new GUIAsset() + { + AssetName = %assetName; + versionId = 1; + scriptFilePath = %scriptPath; + guiFilePath = %guipath; + }; + + TamlWrite(%asset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%guipath)) + { + %file.writeline("//--- OBJECT WRITE BEGIN ---"); + %file.writeline("%guiContent = new GuiControl(" @ %assetName @ ") {"); + %file.writeline(" position = \"0 0\";"); + %file.writeline(" extent = \"100 100\";"); + %file.writeline("};"); + %file.writeline("//--- OBJECT WRITE END ---"); + + %file.close(); + } + + if(%file.openForWrite(%scriptPath)) + { + %file.writeline("function " @ %assetName @ "::onWake(%this)\n{\n\n}\n"); + %file.writeline("function " @ %assetName @ "::onSleep(%this)\n{\n\n}\n"); + + %file.close(); + } + + //load the gui + exec(%guipath); + exec(%scriptPath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "GUIs"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewLevelAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/levels/" @ %assetName @ ".asset.taml"; + %levelPath = %modulePath @ "/levels/" @ %assetName @ ".mis"; + + %asset = new LevelAsset() + { + AssetName = %assetName; + versionId = 1; + LevelFile = %levelPath; + LevelDescription = AssetBrowser.newAssetSettings.levelDescription; + PreviewImage = AssetBrowser.newAssetSettings.levelPreviewImage; + }; + + TamlWrite(%asset, %tamlpath); + + if(!pathCopy("tools/levels/BlankRoom.mis", %levelPath, false)) + { + echo("Unable to copy template level file!"); + } + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewShapeAnimationAsset() +{ + %dlg = new OpenFileDialog() + { + Filters = "Animation Files(*.dae, *.cached.dts)|*.dae;*.cached.dts"; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = false; + OverwritePrompt = true; + forceRelativePath = false; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = %dlg.FileName; + } + + %dlg.delete(); + + if ( !%ret ) + return; + + /*%moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/levels/" @ %assetName @ ".asset.taml"; + %levelPath = %modulePath @ "/levels/" @ %assetName @ ".mis"; + + %asset = new ShapeAnimationAsset() + { + AssetName = %assetName; + versionId = 1; + LevelFile = %levelPath; + LevelDescription = AssetBrowser.newAssetSettings.levelDescription; + PreviewImage = AssetBrowser.newAssetSettings.levelPreviewImage; + }; + + TamlWrite(%asset, %tamlpath); + + if(!pathCopy("tools/levels/BlankRoom.mis", %levelPath, false)) + { + echo("Unable to copy template level file!"); + } + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath;*/ +} + +function ParentComponentList::onWake(%this) +{ + %this.refresh(); +} + +function ParentComponentList::refresh(%this) +{ + %this.clear(); + + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "ComponentAsset")) + return; //if we didn't find ANY, just exit + + // Find all the types. + %count = %assetQuery.getCount(); + + /*%categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentName = %componentAsset.componentName; + + if(%componentName $= "") + %componentName = %componentAsset.componentClass; + + %this.add(%componentName, %i); + }*/ + + %categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentClass = %componentAsset.componentClass; + if (!isInList(%componentClass, %categories)) + %categories = %categories TAB %componentClass; + } + + %categories = trim(%categories); + + %index = 0; + %categoryCount = getFieldCount(%categories); + for (%i = 0; %i < %categoryCount; %i++) + { + %category = getField(%categories, %i); + %this.addCategory(%category); + + for (%j = 0; %j < %count; %j++) + { + %assetId = %assetQuery.getAsset(%j); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentName = %componentAsset.componentName; + %componentClass = %componentAsset.componentClass; + + if (%componentClass $= %category) + { + if(%componentName !$= "") + %this.add(" "@%componentName, %i); + } + } + } +} + +//---------------------------------------------------------- +// Game Object creation +//---------------------------------------------------------- +function EWorldEditor::createGameObject( %this ) +{ + GameObjectCreatorObjectName.text = ""; + + %activeSelection = %this.getActiveSelection(); + if( %activeSelection.getCount() == 0 ) + return; + + GameObjectCreator.selectedEntity = %activeSelection.getObject( 0 ); + + Canvas.pushDialog(GameObjectCreator); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs new file mode 100644 index 000000000..12f422485 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs @@ -0,0 +1,154 @@ +function AssetBrowser::buildPopupMenus(%this) +{ + if( !isObject( AddNewModulePopup ) ) + { + new PopupMenu( AddNewModulePopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + isPopup = true; + + item[ 0 ] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();"; + item[ 1 ] = "Refresh Module Dependencies" TAB "" TAB "AssetBrowser.RefreshModuleDependencies();"; + }; + } + + if( !isObject( EditAssetPopup ) ) + { + new PopupMenu( EditAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Edit Asset" TAB "" TAB "AssetBrowser.editAsset();"; + item[ 1 ] = "Rename Asset" TAB "" TAB "AssetBrowser.renameAsset();"; + item[ 2 ] = "Refresh Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; + item[ 3 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();"; + item[ 4 ] = "-"; + Item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; + item[ 6 ] = "-"; + item[ 7 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();"; + item[ 8 ] = "-"; + item[ 9 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();"; + + jumpFileName = ""; + jumpLineNumber = ""; + }; + } + + if( !isObject( AddNewComponentAssetPopup ) ) + { + new PopupMenu( AddNewComponentAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + //item[ 0 ] = "Create Component" TAB "" TAB "Canvas.pushDialog(AssetBrowser_newComponentAsset); AssetBrowser_newComponentAsset-->NewComponentPackageList.setText(AssetBrowser.selectedModule);"; + item[ 0 ] = "Component" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ComponentAsset\", AssetBrowser.selectedModule);"; + + //list other common component types here to shortcut the creation process + }; + } + + if( !isObject( AddNewScriptAssetPopup ) ) + { + %this.AddNewScriptAssetPopup = new PopupMenu( AddNewScriptAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create Component" TAB AddNewComponentAssetPopup; + item[ 1 ] = "Create Script" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ScriptAsset\", AssetBrowser.selectedModule);"; + item[ 2 ] = "Create State Machine" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"StateMachineAsset\", AssetBrowser.selectedModule);"; + //item[ 3 ] = "-"; + //item[ 3 ] = "Create Game Object" TAB "" TAB "AssetBrowser.createNewGameObjectAsset(\"NewGameObject\", AssetBrowser.selectedModule);"; + }; + //%this.AddNewScriptAssetPopup.insertSubMenu(0, "Create Component", AddNewComponentAssetPopup); + } + + if( !isObject( AddNewArtAssetPopup ) ) + { + %this.AddNewArtAssetPopup = new PopupMenu( AddNewArtAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"MaterialAsset\", AssetBrowser.selectedModule);";//"createNewMaterialAsset(\"NewMaterial\", AssetBrowser.selectedModule);"; + item[ 1 ] = "Create Image" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ImageAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);"; + item[ 2 ] = "-"; + item[ 3 ] = "Create Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);"; + item[ 4 ] = "Create Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);"; + item[ 5 ] = "-"; + item[ 6 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);"; + item[ 7 ] = "-"; + item[ 8 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);"; + item[ 9 ] = "-"; + item[ 10 ] = "Create Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);"; + item[ 11 ] = "-"; + item[ 12 ] = "Create Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);"; + }; + } + + if( !isObject( AddNewAssetPopup ) ) + { + %this.AddNewAssetPopup = new PopupMenu( AddNewAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + + item[0] = "Create Code Asset" TAB AddNewScriptAssetPopup; + item[1] = "-"; + item[2] = "Create Art Asset" TAB AddNewArtAssetPopup; + item[3] = "-"; + item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);"; + }; + } + + if( !isObject( EditModulePopup ) ) + { + new PopupMenu( EditModulePopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create New Asset" TAB AddNewAssetPopup; + item[ 1 ] = "Reload Module" TAB "" TAB "AssetBrowser.reloadModule();"; + Item[ 2 ] = "-"; + Item[ 3 ] = "Edit Module" TAB "" TAB "AssetBrowser.editModuleInfo();"; + Item[ 4 ] = "-"; + Item[ 5 ] = "Duplicate Module" TAB "" TAB "AssetBrowser.copyModule();"; + Item[ 6 ] = "-"; + Item[ 7 ] = "Delete Module" TAB "" TAB "AssetBrowser.deleteModule();"; + }; + } + + //Some assets are not yet ready/implemented, so disable their creation here + AddNewArtAssetPopup.enableItem(3, false); //shape + AddNewArtAssetPopup.enableItem(4, false); //shape animation + AddNewArtAssetPopup.enableItem(8, false); //post effect + AddNewArtAssetPopup.enableItem(10, false); //sound asset + AddNewArtAssetPopup.enableItem(12, false); //particle effect + + AddNewScriptAssetPopup.enableItem(2, false); //state machine +} + +function AddNewScriptAssetPopupMenu::onSelectItem(%this, %id, %text) +{ + return true; +} +function AddNewScriptAssetPopupMenu::setupDefaultState(%this) +{ + // Setup camera speed gui's. Both menu and editorgui + %this.setupGuiControls(); + + Parent::setupDefaultState(%this); +} + +function AddNewScriptAssetPopupMenu::setupGuiControls(%this) +{ +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs new file mode 100644 index 000000000..3c2c7c1ea --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs @@ -0,0 +1,17 @@ +function AssetBrowser_selectModule::onWake(%this) +{ + AssetBrowser_SelectModuleWindow-->ModuleList.refresh(); +} + +function SelectModule_NewAssetModuleBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); + + AssetBrowser_AddModule.callback = "AssetBrowser_selectModule.newModuleAdded();"; +} + +function AssetBrowser_selectModule::newModuleAdded(%this) +{ + AssetBrowser_SelectModuleWindow-->ModuleList.refresh(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs new file mode 100644 index 000000000..42f66ddb1 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs @@ -0,0 +1,17 @@ +function AssetBrowser_selectPackage::onWake(%this) +{ + AssetBrowser_SelectPackageWindow-->packageList.refresh(); +} + +function SelectPackage_NewAssetPackageBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddPackage); + AssetBrowser_addPackageWindow.selectWindow(); + + AssetBrowser_AddPackage.callback = "AssetBrowser_selectPackage.newPackageAdded();"; +} + +function AssetBrowser_selectPackage::newPackageAdded(%this) +{ + AssetBrowser_SelectPackageWindow-->packageList.refresh(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/base/images/materials.cs b/Templates/BaseGame/game/tools/base/images/materials.cs index 11b766b04..a407c2ed2 100644 --- a/Templates/BaseGame/game/tools/base/images/materials.cs +++ b/Templates/BaseGame/game/tools/base/images/materials.cs @@ -16,7 +16,6 @@ singleton CubemapData( BlankSkyCubemap ) singleton Material( BlankSkyMat ) { cubemap = BlankSkyCubemap; - isSky = true; }; singleton Material(White) diff --git a/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs b/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs index 9a9ce33d6..a2a62b08a 100644 --- a/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs +++ b/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs @@ -154,13 +154,13 @@ function QuickEditComponentList::onHotTrackItem( %this, %itemID ) SuperTooltipDlg.setTitle(%componentObj.friendlyName); SuperTooltipDlg.addParam("", %componentObj.description @ "\n"); - %fieldCount = %componentObj.getComponentFieldCount(); + /*%fieldCount = %componentObj.getComponentFieldCount(); for (%i = 0; %i < %fieldCount; %i++) { %name = getField(%componentObj.getComponentField(%i), 0); SuperTooltipDlg.addParam(%name, %description @ "\n"); - } + }*/ %position = %this.getGlobalPosition(); SuperTooltipDlg.processTooltip( %position,0,1 ); %this.opened = true; @@ -219,7 +219,7 @@ function AddComponentQuickEditButton::onClick(%this) %instance.owner = Inspector.getInspectObject(0); %instance.owner.add(%instance); - Inspector.schedule( 50, "refresh" ); + schedule( 50, 0, "refreshInspector", Inspector.getInspectObject(0) ); EWorldEditor.isDirty = true; } @@ -227,7 +227,97 @@ function addComponent(%obj, %instance) { echo("Adding the component!"); %obj.addComponent(%instance); - Inspector.schedule( 50, "refresh" ); + //Inspector.schedule( 50, "refresh" ); + schedule( 50, 0, "refreshInspector", Inspector.getInspectObject(0) ); EWorldEditor.isDirty = true; } +function refreshInspector(%entity) +{ + inspector.removeInspect(%entity); + inspector.addInspect(%entity); +} + +function GuiInspectorComponentGroup::onConstructComponentField(%this, %component, %fieldName) +{ + //echo("Tried to make a component field for component:" @ %component @ " for the " @ %fieldName @ " field."); + + %fieldType = %component.getComponentFieldType(%fieldName); + %makeCommand = %this @ ".build" @ %fieldType @ "Field("@ %component @ "," @ %fieldName @ ");"; + eval(%makeCommand); +} + +function GuiInspectorComponentGroup::onRightMouseUp(%this, %point) +{ + if( !isObject( InspectComponentPopup ) ) + new PopupMenu( InspectComponentPopup ) + { + superClass = "MenuBuilder"; + isPopup = true; + + item[ 0 ] = "View in Asset Browser" TAB "" TAB "AssetBrowser.editAsset();"; + item[ 1 ] = "Delete Component" TAB "" TAB "schedule(10, 0, ComponentEditorRemoveComponent, InspectComponentPopup.componentOwner, InspectComponentPopup.component);"; + item[ 2 ] = "Edit Script" TAB "" TAB "AssetBrowser.editAsset();"; + item[ 3 ] = ""; + }; + + %comp = %this.getComponent(); + InspectComponentPopup.componentOwner = %comp.owner; + InspectComponentPopup.component = %comp; + + //Find out our asset! + %componentName = %this.caption; + + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "ComponentAsset")) + return; //if we didn't find ANY, just exit + + EditAssetPopup.assetId = ""; + + // Find all the types. + %count = %assetQuery.getCount(); + + %categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %friendlyName = %componentAsset.friendlyName; + + if(%friendlyName !$= "" && %friendlyName $= %componentName) + { + EditAssetPopup.assetId = %assetId; + break; + } + + %compName = %componentAsset.componentName; + + if(%compName !$= "" && %compName $= %componentName) + { + EditAssetPopup.assetId = %assetId; + break; + } + } + + if(EditAssetPopup.assetId $= "") + { + //didn't find it + InspectComponentPopup.enableItem(0, false); + InspectComponentPopup.enableItem(2, false); + } + else + { + InspectComponentPopup.enableItem(0, true); + InspectComponentPopup.enableItem(2, true); + } + + InspectComponentPopup.showPopup(Canvas); +} + +function ComponentEditorRemoveComponent(%entity, %component) +{ + %entity.removeComponent(%component, true); + inspector.removeInspect(%entity); + inspector.addInspect(%entity); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs index e0e9f1ce4..5916e84d7 100644 --- a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs +++ b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs @@ -50,7 +50,7 @@ function ForestEditorGui::onActiveForestUpdated( %this, %forest, %createNew ) /// Called from a message box when a forest is not found. function ForestEditorGui::createForest( %this ) { - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { diff --git a/Templates/BaseGame/game/tools/forestEditor/main.cs b/Templates/BaseGame/game/tools/forestEditor/main.cs index 346365b04..288807bb8 100644 --- a/Templates/BaseGame/game/tools/forestEditor/main.cs +++ b/Templates/BaseGame/game/tools/forestEditor/main.cs @@ -144,7 +144,7 @@ function ForestEditorPlugin::onActivated( %this ) //ForestEditToolbar.setVisible( true ); //Get our existing forest object in our current mission if we have one - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if(isObject(%forestObject)) { ForestEditorGui.setActiveForest(%forestObject.getName()); @@ -242,7 +242,7 @@ function ForestEditorPlugin::onSaveMission( %this, %missionFile ) ForestDataManager.saveDirty(); //First, find out if we have an existing forest object - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { diff --git a/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs b/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs index 696b98975..f2de82d96 100644 --- a/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs +++ b/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs @@ -35,5 +35,4 @@ exec("./GuiEaseEditDlg.ed.cs"); exec("./guiObjectInspector.ed.cs"); exec("./uvEditor.ed.gui"); exec("./objectSelection.ed.cs"); -exec("./guiPlatformGenericMenubar.ed.cs"); exec("./postFxManager.gui"); \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.cs b/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.cs deleted file mode 100644 index 089b0b8fa..000000000 --- a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.cs +++ /dev/null @@ -1,19 +0,0 @@ -if(isClass(GuiPlatformGenericMenuBar)) -{ - exec("./guiPlatformGenericMenubar.ed.gui"); -} -else -{ - %guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiControl() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; - }; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.gui b/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.gui deleted file mode 100644 index 8d2cbcd74..000000000 --- a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.gui +++ /dev/null @@ -1,14 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -%guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiPlatformGenericMenuBar() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; -}; -//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/gui/images/iconError.png b/Templates/BaseGame/game/tools/gui/images/iconError.png new file mode 100644 index 000000000..b0947dd84 Binary files /dev/null and b/Templates/BaseGame/game/tools/gui/images/iconError.png differ diff --git a/Templates/BaseGame/game/tools/gui/images/iconWarn.png b/Templates/BaseGame/game/tools/gui/images/iconWarn.png new file mode 100644 index 000000000..4c97ba74b Binary files /dev/null and b/Templates/BaseGame/game/tools/gui/images/iconWarn.png differ diff --git a/Templates/BaseGame/game/tools/gui/profiles.ed.cs b/Templates/BaseGame/game/tools/gui/profiles.ed.cs index 04e8df5b2..a1b120e0d 100644 --- a/Templates/BaseGame/game/tools/gui/profiles.ed.cs +++ b/Templates/BaseGame/game/tools/gui/profiles.ed.cs @@ -287,6 +287,31 @@ new GuiControlProfile( ToolsGuiTextEditProfile ) category = "Tools"; }; +if( !isObject( ToolsGuiTextEditCenterProfile ) ) +new GuiControlProfile (ToolsGuiTextEditCenterProfile) +{ + opaque = true; + //bitmap = "./images/textEditFrame"; + //hasBitmapArray = true; + border = -2; // fix to display textEdit img + //borderWidth = "1"; // fix to display textEdit img + //borderColor = "100 100 100"; + fillColor = "255 255 255 0"; + fillColorHL = "72 72 72"; + fillColorSEL = "255 255 255"; + fontColor = "196 196 196 255"; + fontColorHL = "255 255 255"; + fontColorSEL = "0 0 0"; + fontColorNA = "196 196 196 255"; + textOffset = "4 2"; + autoSizeWidth = false; + autoSizeHeight = true; + justify = "center"; + tab = true; + canKeyFocus = true; + category = "Tools"; +}; + if( !isObject( ToolsGuiNumericTextEditProfile ) ) new GuiControlProfile( ToolsGuiNumericTextEditProfile : ToolsGuiTextEditProfile ) { @@ -1068,10 +1093,14 @@ singleton GuiControlProfile( GuiMenuBarProfile ) { fillcolor = "255 255 255"; fillcolorHL = "213 231 248"; - borderColor = "98 163 229"; - borderColorHL = "122 177 232"; - border = 0; + + fontColorNA = "180 180 180"; + + border = 1; borderThickness = 1; + borderColor = "128 128 128"; + borderColorHL = "122 177 232"; + opaque = true; mouseOverSelected = true; category = "Editor"; diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs index 61dc8c5e7..e68c2e3db 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs @@ -223,7 +223,7 @@ function GuiEditor::switchToWorldEditor( %this ) function GuiEditor::enableMenuItems(%this, %val) { - %menu = GuiEditCanvas.menuBar->EditMenu.getID(); + %menu = GuiEditCanvas.menuBar.findMenu("Edit").getID(); %menu.enableItem( 3, %val ); // cut %menu.enableItem( 4, %val ); // copy @@ -239,8 +239,8 @@ function GuiEditor::enableMenuItems(%this, %val) %menu.enableItem( 18, %val ); // group %menu.enableItem( 19, %val ); // ungroup - GuiEditCanvas.menuBar->LayoutMenu.enableAllItems( %val ); - GuiEditCanvas.menuBar->MoveMenu.enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Layout").enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Move").enableAllItems( %val ); } //--------------------------------------------------------------------------------------------- @@ -294,7 +294,7 @@ function GuiEditor::updateUndoMenu(%this) %nextUndo = %uman.getNextUndoName(); %nextRedo = %uman.getNextRedoName(); - %editMenu = GuiEditCanvas.menuBar->editMenu; + %editMenu = GuiEditCanvas.menuBar.findMenu("Edit"); %editMenu.setItemName( 0, "Undo " @ %nextUndo ); %editMenu.setItemName( 1, "Redo " @ %nextRedo ); @@ -443,7 +443,7 @@ function GuiEditor::setPreviewResolution( %this, %width, %height ) function GuiEditor::toggleEdgeSnap( %this ) { %this.snapToEdges = !%this.snapToEdges; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); GuiEditorEdgeSnapping_btn.setStateOn( %this.snapToEdges ); } @@ -452,7 +452,7 @@ function GuiEditor::toggleEdgeSnap( %this ) function GuiEditor::toggleCenterSnap( %this ) { %this.snapToCenters = !%this.snapToCenters; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); GuiEditorCenterSnapping_btn.setStateOn( %this.snapToCenters ); } @@ -461,7 +461,7 @@ function GuiEditor::toggleCenterSnap( %this ) function GuiEditor::toggleFullBoxSelection( %this ) { %this.fullBoxSelection = !%this.fullBoxSelection; - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); } //--------------------------------------------------------------------------------------------- @@ -469,7 +469,7 @@ function GuiEditor::toggleFullBoxSelection( %this ) function GuiEditor::toggleDrawGuides( %this ) { %this.drawGuides= !%this.drawGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); } //--------------------------------------------------------------------------------------------- @@ -477,7 +477,7 @@ function GuiEditor::toggleDrawGuides( %this ) function GuiEditor::toggleGuideSnap( %this ) { %this.snapToGuides = !%this.snapToGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); } //--------------------------------------------------------------------------------------------- @@ -485,7 +485,7 @@ function GuiEditor::toggleGuideSnap( %this ) function GuiEditor::toggleControlSnap( %this ) { %this.snapToControls = !%this.snapToControls; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); } //--------------------------------------------------------------------------------------------- @@ -493,7 +493,7 @@ function GuiEditor::toggleControlSnap( %this ) function GuiEditor::toggleCanvasSnap( %this ) { %this.snapToCanvas = !%this.snapToCanvas; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); } //--------------------------------------------------------------------------------------------- @@ -506,7 +506,7 @@ function GuiEditor::toggleGridSnap( %this ) else %this.setSnapToGrid( %this.snap2GridSize ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); GuiEditorSnapCheckBox.setStateOn( %this.snap2Grid ); } @@ -993,14 +993,14 @@ function GuiEditorGui::onWake( %this ) // Set up initial menu toggle states. - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); // Sync toolbar buttons. diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs index 1305ae170..83317d0d8 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs @@ -66,9 +66,13 @@ function GuiEditCanvas::onCreateMenu(%this) } // Menu bar - %this.menuBar = new MenuBar() + %this.menuBar = new GuiMenuBar(GuiEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; new PopupMenu() { diff --git a/Templates/BaseGame/game/tools/levels/BlankRoom.mis b/Templates/BaseGame/game/tools/levels/BlankRoom.mis index d8cd0768b..3d43918be 100644 --- a/Templates/BaseGame/game/tools/levels/BlankRoom.mis +++ b/Templates/BaseGame/game/tools/levels/BlankRoom.mis @@ -24,9 +24,9 @@ new SimGroup(MissionGroup) { soundDistanceModel = "Linear"; canSave = "1"; canSaveDynamicFields = "1"; - desc0 = "A blank room ready to be populated with Torque objects. Guns, anyone?"; + desc0 = "A blank room template that acts as a starting point."; enabled = "1"; - levelName = "Blank Room"; + levelName = "Blank Room Template"; }; new SkyBox(theSky) { Material = "BlankSkyMat"; diff --git a/Templates/BaseGame/game/tools/main.cs b/Templates/BaseGame/game/tools/main.cs index dd238eac0..0941c29a4 100644 --- a/Templates/BaseGame/game/tools/main.cs +++ b/Templates/BaseGame/game/tools/main.cs @@ -122,6 +122,17 @@ package Tools if( isFunction( %initializeFunction ) ) call( %initializeFunction ); } + + //Now, go through and load any tool-group modules + ModuleDatabase.setModuleExtension("module"); + + //Any common tool modules + ModuleDatabase.scanModules( "tools", false ); + ModuleDatabase.LoadGroup( "Tool" ); + + //Do any tools that come in with a gameplay package. These are usually specialized tools + //ModuleDatabase.scanModules( "data", false ); + //ModuleDatabase.LoadGroup( "Tool" ); // Popuplate the default SimObject icons that // are used by the various editors. @@ -214,6 +225,29 @@ package Tools } }; +function EditorCreateFakeGameSession(%fileName) +{ + // Create a local game server and connect to it. + if(isObject(ServerGroup)) + ServerGroup.delete(); + + new SimGroup(ServerGroup); + + if(isObject(ServerConnection)) + ServerConnection.delete(); + + new GameConnection(ServerConnection); + + // This calls GameConnection::onConnect. + ServerConnection.connectLocal(); + + $instantGroup = ServerGroup; + + $Game::MissionGroup = "MissionGroup"; + + exec(%file); +} + function fastLoadWorldEdit(%val) { if(%val) @@ -222,37 +256,64 @@ function fastLoadWorldEdit(%val) { onStart(); } - - if(!$Game::running) + + %timerId = startPrecisionTimer(); + + if( GuiEditorIsActive() ) + toggleGuiEditor(1); + + if( !$missionRunning ) { - //startGame(); - activatePackage( "BootEditor" ); - ChooseLevelDlg.launchInEditor = false; - StartGame("tools/levels/BlankRoom.mis", "SinglePlayer"); - - if(!isObject(Observer)) - { - datablock CameraData(Observer) {}; - } - - %cam = new Camera() - { - datablock = Observer; - }; - - %cam.scopeToClient(LocalClientConnection); - - LocalClientConnection.setCameraObject(%cam); - LocalClientConnection.setControlObject(%cam); - - LocalClientConnection.camera = %cam; - - %cam.setPosition("0 0 0"); + // Flag saying, when level is chosen, launch it with the editor open. + ChooseLevelDlg.launchInEditor = true; + Canvas.pushDialog( ChooseLevelDlg ); } else - { - toggleEditor(true); + { + pushInstantGroup(); + + if ( !isObject( Editor ) ) + { + Editor::create(); + MissionCleanup.add( Editor ); + MissionCleanup.add( Editor.getUndoManager() ); + } + + if( EditorIsActive() ) + { + if (theLevelInfo.type $= "DemoScene") + { + commandToServer('dropPlayerAtCamera'); + Editor.close("SceneGui"); + } + else + { + Editor.close("PlayGui"); + } + } + else + { + canvas.pushDialog( EditorLoadingGui ); + canvas.repaint(); + + Editor.open(); + + // Cancel the scheduled event to prevent + // the level from cycling after it's duration + // has elapsed. + cancel($Game::Schedule); + + if (theLevelInfo.type $= "DemoScene") + commandToServer('dropCameraAtPlayer', true); + + canvas.popDialog(EditorLoadingGui); + } + + popInstantGroup(); } + + %elapsed = stopPrecisionTimer( %timerId ); + warn( "Time spent in toggleEditor() : " @ %elapsed / 1000.0 @ " s" ); } } diff --git a/Templates/BaseGame/game/tools/shapeEditor/main.cs b/Templates/BaseGame/game/tools/shapeEditor/main.cs index 721313e95..efbc1c538 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/main.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/main.cs @@ -145,6 +145,13 @@ function ShapeEditorPlugin::onWorldEditorStartup(%this) } } +function ShapeEditorPlugin::openShapeAsset(%this, %assetId) +{ + %this.selectedAssetId = %assetId; + %this.selectedAssetDef = AssetDatabase.acquireAsset(%assetId); + %this.open(%this.selectedAssetDef.fileName); +} + function ShapeEditorPlugin::open(%this, %filename) { if ( !%this.isActivated ) diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs index d79923776..9675ac7c9 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs @@ -611,6 +611,19 @@ function ShapeEdPropWindow::update_onShapeSelectionChanged( %this ) ShapeEdSequenceList.addItem( %name ); } ShapeEdThreadWindow.onAddThread(); // add thread 0 + + //Now, fetch any animation assets if we're utilizing a shape asset + if(ShapeEditorPlugin.selectedAssetId !$= "") + { + %animationAssetCount = ShapeEditorPlugin.selectedAssetDef.getAnimationCount(); + + for(%animIdx = 0; %animIdx < %animationAssetCount; %animIdx++) + { + %animAsset = ShapeEditorPlugin.selectedAssetDef.getAnimation(%animIdx); + + //ShapeEdSequenceList.addItem( %animAsset.assetName ); + } + } // --- DETAILS TAB --- // Add detail levels and meshes to tree @@ -789,7 +802,8 @@ function ShapeEdSeqNodeTabBook::onTabSelected( %this, %name, %index ) { case "Seq": ShapeEdPropWindow-->newBtn.ToolTip = "Add new sequence"; - ShapeEdPropWindow-->newBtn.Command = "ShapeEdSequences.onAddSequence();"; + //ShapeEdPropWindow-->newBtn.Command = "ShapeEdSequences.onAddSequence();"; + ShapeEdPropWindow-->newBtn.Command = "AssetBrowser.showDialog(\"ShapeAnimationAsset\", \"onAddAnimationAssetShapeEditor\", \"\", \"\", \"\");"; ShapeEdPropWindow-->newBtn.setActive( true ); ShapeEdPropWindow-->deleteBtn.ToolTip = "Delete selected sequence (cannot be undone)"; ShapeEdPropWindow-->deleteBtn.Command = "ShapeEdSequences.onDeleteSequence();"; diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs index 2c48b25a1..3847226f6 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs @@ -299,6 +299,12 @@ function ActionEditNodeTransform::undo( %this ) //------------------------------------------------------------------------------ // Add sequence +function onAddAnimationAssetShapeEditor(%selectedAnimation) +{ + echo("SELECTED MUH ASSET"); + ShapeEditor.doAddSequence(%selectedAnimation, 0, 0, 0); +} + function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end ) { %action = %this.createAction( ActionAddSequence, "Add sequence" ); @@ -313,23 +319,44 @@ function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end ) function ActionAddSequence::doit( %this ) { - // If adding this sequence from an existing sequence, make a backup copy of - // the existing sequence first, so we can edit the start/end frames later - // without having to worry if the original source sequence has changed. - if ( ShapeEditor.shape.getSequenceIndex( %this.from ) >= 0 ) + if(ShapeEditorPlugin.selectedAssetId $= "") { - %this.from = ShapeEditor.getUniqueName( "sequence", "__backup__" @ %this.origFrom @ "_" ); - ShapeEditor.shape.addSequence( %this.origFrom, %this.from ); + // If adding this sequence from an existing sequence, make a backup copy of + // the existing sequence first, so we can edit the start/end frames later + // without having to worry if the original source sequence has changed. + if ( ShapeEditor.shape.getSequenceIndex( %this.from ) >= 0 ) + { + %this.from = ShapeEditor.getUniqueName( "sequence", "__backup__" @ %this.origFrom @ "_" ); + ShapeEditor.shape.addSequence( %this.origFrom, %this.from ); + } + + // Add the sequence + $collada::forceLoadDAE = EditorSettings.value( "forceLoadDAE" ); + %success = ShapeEditor.shape.addSequence( %this.from, %this.seqName, %this.start, %this.end ); + $collada::forceLoadDAE = false; + + if ( %success ) + { + ShapeEdPropWindow.update_onSequenceAdded( %this.seqName, -1 ); + return true; + } } - - // Add the sequence - $collada::forceLoadDAE = EditorSettings.value( "forceLoadDAE" ); - %success = ShapeEditor.shape.addSequence( %this.from, %this.seqName, %this.start, %this.end ); - $collada::forceLoadDAE = false; - - if ( %success ) + else { - ShapeEdPropWindow.update_onSequenceAdded( %this.seqName, -1 ); + %assetDef = AssetDatabase.acquireAsset(%this.seqName); + %moduleName = getWord(getToken(%this.seqName, ":", 0),0); + + %idx = ShapeEdSequenceList.rowCount(); + + %matSet = "ShapeEditorPlugin.selectedAssetDef.animationSequence"@%idx@"=\"@Asset="@%moduleName@":"@%this.seqName.assetName@"\";"; + eval(%matSet); + + %assetPath = AssetDatabase.getAssetFilePath(ShapeEditorPlugin.selectedAssetId); + + %assetImportSuccessful = TAMLWrite(ShapeEditorPlugin.selectedAssetDef, %assetPath); + + AssetDatabase.refreshAsset(ShapeEditorPlugin.selectedAssetId); + return true; } return false; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index bc1905292..2d9e2ec53 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1302,6 +1302,7 @@ function VisibilityDropdownToggle() { EVisibility.setVisible(true); visibilityToggleBtn.setStateOn(1); + EVisibility.setExtent("200 540"); } } @@ -1569,6 +1570,27 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveObjectEntries = false; %haveLockAndHideEntries = true; + //Set up the generic pop-up pre-emptively if we haven't already + if( !isObject( ETContextPopup ) ) + { + %popup = new PopupMenu( ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; + item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + object = -1; + }; + } + // Handle multi-selection. if( %this.getSelectedItemsCount() > 1 ) { @@ -1615,12 +1637,67 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; }; } + + else if(%obj.isMemberOfClass("Entity")) + { + %popup = EntityObjectPopup; + if(!isObject(EntityObjectPopup)) + { + %popup = new PopupMenu( EntityObjectPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; + item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + item[ 8 ] = "-"; + item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; + item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; + item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; + item[ 12 ] = "-"; + item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; + item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; + item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; + + object = -1; + }; + } + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + EntityObjectPopup.enableItem(13, true); + EntityObjectPopup.enableItem(14, false); + EntityObjectPopup.enableItem(15, false); + } + else + { + EntityObjectPopup.enableItem(13, false); + EntityObjectPopup.enableItem(14, true); + EntityObjectPopup.enableItem(15, true); + } + + %popup.object = %obj; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + } // Open context menu if this is a SimGroup else if( !%obj.isMemberOfClass( "SceneObject" ) ) { %popup = ETSimGroupContextPopup; if( !isObject( %popup ) ) + { %popup = new PopupMenu( ETSimGroupContextPopup ) { superClass = "MenuBuilder"; @@ -1641,6 +1718,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) object = -1; }; + } %popup.object = %obj; @@ -1652,77 +1730,56 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveLockAndHideEntries = false; } - // Open generic context menu. - else + // Specialized version for ConvexShapes. + else if( %obj.isMemberOfClass( "ConvexShape" ) ) { - %popup = ETContextPopup; + %popup = ETConvexShapeContextPopup; if( !isObject( %popup ) ) - %popup = new PopupMenu( ETContextPopup ) + { + %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) { superClass = "MenuBuilder"; isPopup = "1"; - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; + item[ 8 ] = "-"; + item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; }; - - if(%obj.isMemberOfClass("Entity")) - { - %popup = ETEntityContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - }; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; } - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) + %popup.object = %obj; + %haveObjectEntries = true; + } + + // Specialized version for polyhedral objects. + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup = ETPolyObjectContextPopup; + if( !isObject( %popup ) ) { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; + %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; + item[ 8 ] = "-"; + item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + }; } + + %popup.object = %obj; + %haveObjectEntries = true; + } + + // Open generic context menu. + else + { + %popup = ETContextPopup; %popup.object = %obj; %haveObjectEntries = true; @@ -2017,7 +2074,7 @@ function EWorldEditor::syncGui( %this ) %this.syncToolPalette(); EditorTree.update(); - Editor.getUndoManager().updateUndoMenu( EditorGui.menuBar-->EditMenu ); + Editor.getUndoManager().updateUndoMenu( EditorGui.findMenu("Edit") ); EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() ); EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 ); @@ -2253,155 +2310,6 @@ function EWorldEditor::deleteMissionObject( %this, %object ) EditorTree.buildVisibleTree( true ); } -function EWorldEditor::createGameObject( %this, %entity ) -{ - if(!isObject(GameObjectBuilder)) - { - new GuiControl(GameObjectBuilder, EditorGuiGroup) { - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "0 0"; - extent = "800 600"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - - new GuiWindowCtrl(GameObjectBuilderTargetWindow) { - profile = "ToolsGuiWindowProfile"; - horizSizing = "center"; - vertSizing = "center"; - position = "384 205"; - extent = "256 102"; - minExtent = "256 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - resizeWidth = "1"; - resizeHeight = "1"; - canMove = "1"; - canClose = "0"; - canMinimize = "0"; - canMaximize = "0"; - minSize = "50 50"; - text = "Create Object"; - - new GuiTextCtrl() { - profile = "GuiCenterTextProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "9 26"; - extent = "84 16"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - text = "Object Name:"; - }; - new GuiTextEditCtrl(GameObjectBuilderObjectName) { - class = ObjectBuilderGuiTextEditCtrl; - profile = "ToolsGuiTextEditProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "78 26"; - extent = "172 18"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - historySize = "0"; - }; - new GuiButtonCtrl(GameObjectBuilderOKButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "7 250"; - extent = "156 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "EWorldEditor.buildGameObject();"; - helpTag = "0"; - text = "Create New"; - Accelerator = "return"; - }; - new GuiButtonCtrl(GameObjectBuilderCancelButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "left"; - vertSizing = "bottom"; - position = "170 250"; - extent = "80 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "Canvas.popDialog(GameObjectBuilder);"; - helpTag = "0"; - text = "Cancel"; - Accelerator = "escape"; - }; - }; - }; - - GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88; - GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57; - GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57; - } - - GameObjectBuilderObjectName.text = ""; - GameObjectBuilder.selectedEntity = %entity; - - Canvas.pushDialog(GameObjectBuilder); -} - -function EWorldEditor::buildGameObject(%this) -{ - if(GameObjectBuilderObjectName.getText() $= "") - { - error("Attempted to make a new Game Object with no name!"); - Canvas.popDialog(GameObjectBuilder); - return; - } - - %path = EditorSettings.value( "WorldEditor/newGameObjectDir" ); - %className = GameObjectBuilderObjectName.getText(); - GameObjectBuilder.selectedEntity.class = %className; - Inspector.inspect(GameObjectBuilder.selectedEntity); - - %file = new FileObject(); - - if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) - { - %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); - %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); - - //todo, pre-write any event functions of interest - - %file.close(); - } - - //set up the paths - %tamlPath = %path @ "/" @ %className @ ".taml"; - %scriptPath = %path @ "/" @ %className @ ".cs"; - saveGameObject(%className, %tamlPath, %scriptPath); - - //reload it - execGameObjects(); - - //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. - TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath); - - GameObjectBuilder.selectedEntity = ""; - - Canvas.popDialog(GameObjectBuilder); -} - function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect ) { if( !isObject( %set ) ) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs index f476ccaeb..8c558bfef 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs @@ -587,6 +587,13 @@ function makeSelectedAMesh() EditorTree.buildVisibleTree( true ); } +function EditorTakeControlOfEntity() +{ + %object = EWorldEditor.getSelectedObject(0); + switchCamera(localClientConnection, %object); + switchControlObject(localClientConnection, %object); +} + function EditorMount() { echo( "EditorMount" ); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs index dbe978cab..e0d53a76d 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs @@ -110,9 +110,13 @@ function EditorGui::buildMenus(%this) }; // Menu bar - %this.menuBar = new MenuBar(WorldEditorMenubar) + %this.menuBar = new GuiMenuBar(WorldEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; }; // File Menu @@ -158,7 +162,7 @@ function EditorGui::buildMenus(%this) %fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();"); %fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();"); - %this.menuBar.insert(%fileMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%fileMenu); // Edit Menu %editMenu = new PopupMenu() @@ -187,7 +191,7 @@ function EditorGui::buildMenus(%this) item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; }; - %this.menuBar.insert(%editMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editMenu); // View Menu %viewMenu = new PopupMenu() @@ -201,7 +205,7 @@ function EditorGui::buildMenus(%this) item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();"; item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();"; }; - %this.menuBar.insert(%viewMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%viewMenu); // Camera Menu %cameraMenu = new PopupMenu() @@ -229,7 +233,7 @@ function EditorGui::buildMenus(%this) Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();"; item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu; }; - %this.menuBar.insert(%cameraMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%cameraMenu); // Editors Menu %editorsMenu = new PopupMenu() @@ -246,7 +250,7 @@ function EditorGui::buildMenus(%this) //item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin; //item[5] = "-"; }; - %this.menuBar.insert(%editorsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editorsMenu); // Lighting Menu %lightingMenu = new PopupMenu() @@ -263,7 +267,7 @@ function EditorGui::buildMenus(%this) // NOTE: The light managers will be inserted as the // last menu items in EditorLightingMenu::onAdd(). }; - %this.menuBar.insert(%lightingMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%lightingMenu); // Tools Menu %toolsMenu = new PopupMenu() @@ -278,7 +282,7 @@ function EditorGui::buildMenus(%this) item[2] = "Torque SimView" TAB "" TAB "tree();"; item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();"; }; - %this.menuBar.insert(%toolsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%toolsMenu); // Help Menu %helpMenu = new PopupMenu() @@ -293,7 +297,7 @@ function EditorGui::buildMenus(%this) item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);"; item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);"; }; - %this.menuBar.insert(%helpMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%helpMenu); // Menus that are added/removed dynamically (temporary) @@ -375,8 +379,10 @@ function EditorGui::buildMenus(%this) Item[17] = "Make Selection Prefab" TAB "" TAB "EditorMakePrefab();"; Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();"; Item[19] = "-"; - Item[20] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; - Item[21] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; + Item[20] = "Take control of entity" TAB "" TAB "EditorTakeControlOfEntity();"; + Item[21] = "-"; + Item[22] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; + Item[23] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; }; } } @@ -398,9 +404,9 @@ function EditorGui::setMenuDefaultState(%this) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + for(%i = 0;%i < %this.menuBar.getMenuCount();%i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); %menu.setupDefaultState(); } @@ -414,9 +420,10 @@ function EditorGui::findMenu(%this, %name) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + + for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); if(%name $= %menu.barTitle) return %menu; diff --git a/Templates/Full/game/art/art.module.taml b/Templates/Full/game/art/art.module.taml deleted file mode 100644 index 73855c09e..000000000 --- a/Templates/Full/game/art/art.module.taml +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml b/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml deleted file mode 100644 index 4ba732205..000000000 --- a/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/Full/game/art/skies/Desert_Sky/materials.cs b/Templates/Full/game/art/skies/Desert_Sky/materials.cs index 0ee4080d8..af6a979c8 100644 --- a/Templates/Full/game/art/skies/Desert_Sky/materials.cs +++ b/Templates/Full/game/art/skies/Desert_Sky/materials.cs @@ -34,5 +34,4 @@ singleton Material( DesertSkyMat ) { cubemap = DesertSkyCubemap; materialTag0 = "Skies"; - isSky = true; }; diff --git a/Templates/Full/game/art/skies/night/materials.cs b/Templates/Full/game/art/skies/night/materials.cs index 11f9f6348..79cc050fc 100644 --- a/Templates/Full/game/art/skies/night/materials.cs +++ b/Templates/Full/game/art/skies/night/materials.cs @@ -34,7 +34,6 @@ singleton Material( NightSkyMat ) { cubemap = NightCubemap; materialTag0 = "Skies"; - isSky = true; }; singleton Material( Moon_Glow_Mat ) @@ -51,5 +50,4 @@ singleton Material( Moon_Mat ) emissive = true; translucent = true; vertColor[ 0 ] = true; - isSky = true; }; diff --git a/Templates/Full/game/core/art/grids/512_forestgreen.png b/Templates/Full/game/core/art/grids/512_forestgreen.png index 179831bea..c5f2cd2fd 100644 Binary files a/Templates/Full/game/core/art/grids/512_forestgreen.png and b/Templates/Full/game/core/art/grids/512_forestgreen.png differ diff --git a/Templates/Full/game/core/art/grids/512_forestgreen_lines.png b/Templates/Full/game/core/art/grids/512_forestgreen_lines.png index 4a09fc4a1..5f6f1a105 100644 Binary files a/Templates/Full/game/core/art/grids/512_forestgreen_lines.png and b/Templates/Full/game/core/art/grids/512_forestgreen_lines.png differ diff --git a/Templates/Full/game/core/art/skies/blank/materials.cs b/Templates/Full/game/core/art/skies/blank/materials.cs index 39f268866..53709d11d 100644 --- a/Templates/Full/game/core/art/skies/blank/materials.cs +++ b/Templates/Full/game/core/art/skies/blank/materials.cs @@ -34,7 +34,6 @@ singleton Material( BlackSkyMat ) { cubemap = BlackSkyCubemap; materialTag0 = "Skies"; - isSky = true; }; singleton CubemapData( BlueSkyCubemap ) diff --git a/Templates/Full/game/scripts/scripts.module.taml b/Templates/Full/game/scripts/scripts.module.taml deleted file mode 100644 index e1a6b57be..000000000 --- a/Templates/Full/game/scripts/scripts.module.taml +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/components/animationComponent.asset.taml b/Templates/Full/game/scripts/server/components/animationComponent.asset.taml deleted file mode 100644 index 62f15cdf9..000000000 --- a/Templates/Full/game/scripts/server/components/animationComponent.asset.taml +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/components/meshComponent.asset.taml b/Templates/Full/game/scripts/server/components/meshComponent.asset.taml deleted file mode 100644 index d019cd893..000000000 --- a/Templates/Full/game/scripts/server/components/meshComponent.asset.taml +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs b/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs deleted file mode 100644 index f0b618920..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- -function execGameObjects() -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(isFile(%gameObjectAsset.scriptFilePath)) - exec(%gameObjectAsset.scriptFilePath); - } -} - -function findGameObject(%name) -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return 0; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(%gameObjectAsset.gameObjectName $= %name) - { - if(isFile(%gameObjectAsset.TAMLFilePath)) - { - return %gameObjectAsset; - } - } - } - - return 0; -} - -function spawnGameObject(%name, %addToMissionGroup) -{ - if(%addToMissionGroup $= "") - %addToMissionGroup = true; - - %gameObjectAsset = findGameObject(%name); - - if(isObject(%gameObjectAsset)) - { - %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); - - if(%addToMissionGroup == true) //save instance when saving level - MissionGroup.add(%newSGOObject); - else // clear instance on level exit - MissionCleanup.add(%newSGOObject); - - return %newSGOObject; - } - - return 0; -} - -function saveGameObject(%name, %tamlPath, %scriptPath) -{ - %gameObjectAsset = findGameObject(%name); - - //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset - if(isObject(%gameObjectAsset)) - { - %assetID = %gameObjectAsset.getAssetId(); - - %gameObjectAsset.TAMLFilePath = %tamlPath; - %gameObjectAsset.scriptFilePath = %scriptPath; - - TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); - AssetDatabase.refreshAsset(%assetID); - } - else - { - //Doesn't exist, so make a new one - %gameObjectAsset = new GameObjectAsset() - { - assetName = %name @ "Asset"; - gameObjectName = %name; - TAMLFilePath = %tamlPath; - scriptFilePath = %scriptPath; - }; - - //Save it alongside the taml file - %path = filePath(%tamlPath); - - TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); - AssetDatabase.refreshAllAssets(true); - } -} \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml deleted file mode 100644 index 2d593a50b..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs deleted file mode 100644 index 3ab05a79d..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs +++ /dev/null @@ -1,247 +0,0 @@ -function ThirdPersonPlayerObject::onAdd(%this) -{ - %this.turnRate = 0.3; - - %this.phys = %this.getComponent("PlayerControllerComponent"); - %this.collision = %this.getComponent("CollisionComponent"); - %this.cam = %this.getComponent("CameraComponent"); - %this.camArm = %this.getComponent("CameraOrbiterComponent"); - %this.animation = %this.getComponent("AnimationComponent"); - %this.stateMachine = %this.getComponent("StateMachineComponent"); - %this.mesh = %this.getComponent("MeshComponent"); - - %this.stateMachine.forwardVector = 0; - - %this.crouch = false; - - %this.firstPerson = false; - - %this.crouchSpeedMod = 0.5; - - %this.aimOrbitDist = 1.5; - %this.regularOrbitDist = 5; - - %this.regularOrbitMaxPitch = 70; - %this.regularOrbitMinPitch = -10; - - %this.aimedMaxPitch = 90; - %this.aimedMinPitch = -90; -} - -function ThirdPersonPlayerObject::onRemove(%this) -{ - -} - -function ThirdPersonPlayerObject::moveVectorEvent(%this) -{ - %moveVector = %this.getMoveVector(); - - // forward of the camera on the x-z plane - %cameraForward = %this.cam.getForwardVector(); - - %cameraRight = %this.cam.getRightVector(); - - %moveVec = VectorAdd(VectorScale(%cameraRight, %moveVector.x), VectorScale(%cameraForward, %moveVector.y)); - - if(%this.aiming || %this.firstPerson) - { - %forMove = "0 0 0"; - - if(%moveVector.x != 0) - { - %this.phys.inputVelocity.x = %moveVector.x * 10; - } - else - { - %this.phys.inputVelocity.x = 0; - } - - if(%moveVector.y != 0) - { - - %this.phys.inputVelocity.y = %moveVector.y * 10; - } - else - { - %this.phys.inputVelocity.y = 0; - } - } - else - { - if(%moveVec.x == 0 && %moveVec.y == 0) - { - %this.phys.inputVelocity = "0 0 0"; - %this.stateMachine.forwardVector = 0; - } - else - { - %moveVec.z = 0; - - %curForVec = %this.getForwardVector(); - - %newForVec = VectorLerp(%curForVec, %moveVec, %this.turnRate); - - %this.setForwardVector(%newForVec); - - %this.phys.inputVelocity.y = 10; - - %this.stateMachine.forwardVector = 1; - } - } - - if(%this.crouch) - %this.phys.inputVelocity = VectorScale(%this.phys.inputVelocity, %this.crouchSpeedMod); -} - -function ThirdPersonPlayerObject::moveYawEvent(%this) -{ - %moveRotation = %this.getMoveRotation(); - - %camOrb = %this.getComponent("CameraOrbiterComponent"); - - if(%this.aiming || %this.firstPerson) - { - %this.rotation.z += %moveRotation.z * 10; - } - - %camOrb.rotation.z += %moveRotation.z * 10; -} - -function ThirdPersonPlayerObject::movePitchEvent(%this) -{ - %moveRotation = %this.getMoveRotation(); - - %camOrb = %this.getComponent("CameraOrbiterComponent"); - - %camOrb.rotation.x += %moveRotation.x * 10; -} - -function ThirdPersonPlayerObject::moveRollEvent(%this){} - -function ThirdPersonPlayerObject::moveTriggerEvent(%this, %triggerNum, %triggerValue) -{ - if(%triggerNum == 3 && %triggerValue) - { - if(%triggerValue) - { - %this.firstPerson = !%this.firstPerson; - - if(%this.firstPerson) - { - %this.rotation.z = %this.cam.rotationOffset.z; - %this.camArm.orbitDistance = 0; - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - - %this.cam.positionOffset = "0 0 0"; - %this.cam.rotationOffset = "0 0 0"; - } - else if(%this.aiming) - { - %this.camArm.orbitDistance = %this.aimOrbitDist; - - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - } - else - { - %this.camArm.orbitDistance = %this.regularOrbitDist; - - %this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch; - %this.camArm.minPitchAngle = %this.regularOrbitMinPitch; - } - - commandToClient(localclientConnection, 'SetClientRenderShapeVisibility', - localclientConnection.getGhostID(%this.getComponent("MeshComponent")), !%this.firstPerson); - } - } - else if(%triggerNum == 2 && %triggerValue == true) - { - //get our best collision assuming up is 0 0 1 - %collisionAngle = %this.collision.getBestCollisionAngle("0 0 1"); - - if(%collisionAngle >= 80) - { - %surfaceNormal = %this.collision.getCollisionNormal(0); - %jumpVector = VectorScale(%surfaceNormal, 200); - echo("Jump surface Angle is at: " @ %surfaceNormal); - - %this.phys.applyImpulse(%this.position, %jumpVector); - %this.setForwardVector(%jumpVector); - } - else - %this.phys.applyImpulse(%this.position, "0 0 300"); - } - else if(%triggerNum == 4) - { - %this.crouch = %triggerValue; - } - else if(%triggerNum == 1) - { - %this.aiming = %triggerValue; - - if(%this.aiming) - { - %this.rotation.z = %this.cam.rotationOffset.z; - %this.camArm.orbitDistance = %this.aimOrbitDist; - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - } - else - { - %this.camArm.orbitDistance = %this.regularOrbitDist; - %this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch; - %this.camArm.minPitchAngle = %this.regularOrbitMinPitch; - } - } -} - -function ThirdPersonPlayerObject::onCollisionEvent(%this, %colObject, %colNormal, %colPoint, %colMatID, %velocity) -{ - if(!%this.phys.isContacted()) - echo(%this @ " collided with " @ %colObject); -} - -function ThirdPersonPlayerObject::processTick(%this) -{ - %moveVec = %this.getMoveVector(); - %bestFit = ""; - - if(%this.crouch) - { - if(%moveVec.x != 0 || %moveVec.y != 0) - %bestFit = "Crouch_Forward"; - else - %bestFit = "Crouch_Root"; - } - else - { - if(%moveVec.x != 0 || %moveVec.y != 0) - %bestFit = "Run"; - else - %bestFit = "Root"; - } - - if(%this.animation.getThreadAnimation(0) !$= %bestFit) - %this.animation.playThread(0, %bestFit); -} - -//Used for first person mode -function clientCmdSetClientRenderShapeVisibility(%id, %visiblilty) -{ - %localID = ServerConnection.resolveGhostID(%id); - %localID.enabled = %visiblilty; -} - -function serverToClientObject( %serverObject ) -{ - assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); - assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); - - %ghostId = LocalClientConnection.getGhostId( %serverObject ); - if ( %ghostId == -1 ) - return 0; - - return ServerConnection.resolveGhostID( %ghostId ); -} \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml deleted file mode 100644 index df2397bb5..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - diff --git a/Templates/Full/game/scripts/server/scriptExec.cs b/Templates/Full/game/scripts/server/scriptExec.cs index f6eb29b7d..a61204040 100644 --- a/Templates/Full/game/scripts/server/scriptExec.cs +++ b/Templates/Full/game/scripts/server/scriptExec.cs @@ -58,23 +58,3 @@ exec("./turret.cs"); // Load our gametypes exec("./gameCore.cs"); // This is the 'core' of the gametype functionality. exec("./gameDM.cs"); // Overrides GameCore with DeathMatch functionality. - -//Entity/Component stuff -if(isFile("./components/game/camera.cs")) - exec("./components/game/camera.cs"); -if(isFile("./components/game/controlObject.cs")) - exec("./components/game/controlObject.cs"); -if(isFile("./components/game/itemRotate.cs")) - exec("./components/game/itemRotate.cs"); -if(isFile("./components/game/playerSpawner.cs")) - exec("./components/game/playerSpawner.cs"); -if(isFile("./components/input/fpsControls.cs")) - exec("./components/input/fpsControls.cs"); -if(isFile("./components/input/inputManager.cs")) - exec("./components/input/inputManager.cs"); - -if(isFile("./gameObjects/GameObjectManager.cs")) -{ - exec("./gameObjects/GameObjectManager.cs"); - execGameObjects(); -} diff --git a/Templates/Full/game/tools/forestEditor/forestEditorGui.cs b/Templates/Full/game/tools/forestEditor/forestEditorGui.cs index e0e9f1ce4..5916e84d7 100644 --- a/Templates/Full/game/tools/forestEditor/forestEditorGui.cs +++ b/Templates/Full/game/tools/forestEditor/forestEditorGui.cs @@ -50,7 +50,7 @@ function ForestEditorGui::onActiveForestUpdated( %this, %forest, %createNew ) /// Called from a message box when a forest is not found. function ForestEditorGui::createForest( %this ) { - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { diff --git a/Templates/Full/game/tools/forestEditor/main.cs b/Templates/Full/game/tools/forestEditor/main.cs index 6a7dbf994..813c744eb 100644 --- a/Templates/Full/game/tools/forestEditor/main.cs +++ b/Templates/Full/game/tools/forestEditor/main.cs @@ -143,7 +143,7 @@ function ForestEditorPlugin::onActivated( %this ) //ForestEditToolbar.setVisible( true ); //Get our existing forest object in our current mission if we have one - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if(isObject(%forestObject)) { ForestEditorGui.setActiveForest(%forestObject.getName()); @@ -241,7 +241,7 @@ function ForestEditorPlugin::onSaveMission( %this, %missionFile ) ForestDataManager.saveDirty(); //First, find out if we have an existing forest object - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { diff --git a/Templates/Full/game/tools/gui/guiDialogs.ed.cs b/Templates/Full/game/tools/gui/guiDialogs.ed.cs index db09e8570..dc6b4e3a3 100644 --- a/Templates/Full/game/tools/gui/guiDialogs.ed.cs +++ b/Templates/Full/game/tools/gui/guiDialogs.ed.cs @@ -35,4 +35,3 @@ exec("./GuiEaseEditDlg.ed.cs"); exec("./guiObjectInspector.ed.cs"); exec("./uvEditor.ed.gui"); exec("./objectSelection.ed.cs"); -exec("./guiPlatformGenericMenubar.ed.cs"); diff --git a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.cs b/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.cs deleted file mode 100644 index 089b0b8fa..000000000 --- a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.cs +++ /dev/null @@ -1,19 +0,0 @@ -if(isClass(GuiPlatformGenericMenuBar)) -{ - exec("./guiPlatformGenericMenubar.ed.gui"); -} -else -{ - %guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiControl() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; - }; -} \ No newline at end of file diff --git a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.gui b/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.gui deleted file mode 100644 index 8d2cbcd74..000000000 --- a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.gui +++ /dev/null @@ -1,14 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -%guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiPlatformGenericMenuBar() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; -}; -//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs b/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs index 1305ae170..83317d0d8 100644 --- a/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs +++ b/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs @@ -66,9 +66,13 @@ function GuiEditCanvas::onCreateMenu(%this) } // Menu bar - %this.menuBar = new MenuBar() + %this.menuBar = new GuiMenuBar(GuiEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; new PopupMenu() { diff --git a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs index bc1905292..535d00880 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -2017,7 +2017,7 @@ function EWorldEditor::syncGui( %this ) %this.syncToolPalette(); EditorTree.update(); - Editor.getUndoManager().updateUndoMenu( EditorGui.menuBar-->EditMenu ); + Editor.getUndoManager().updateUndoMenu( EditorGui.findMenu("Edit") ); EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() ); EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 ); diff --git a/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs index dbe978cab..b225d3534 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs @@ -110,9 +110,13 @@ function EditorGui::buildMenus(%this) }; // Menu bar - %this.menuBar = new MenuBar(WorldEditorMenubar) + %this.menuBar = new GuiMenuBar(WorldEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; }; // File Menu @@ -158,7 +162,7 @@ function EditorGui::buildMenus(%this) %fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();"); %fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();"); - %this.menuBar.insert(%fileMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%fileMenu); // Edit Menu %editMenu = new PopupMenu() @@ -187,7 +191,7 @@ function EditorGui::buildMenus(%this) item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; }; - %this.menuBar.insert(%editMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editMenu); // View Menu %viewMenu = new PopupMenu() @@ -201,7 +205,7 @@ function EditorGui::buildMenus(%this) item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();"; item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();"; }; - %this.menuBar.insert(%viewMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%viewMenu); // Camera Menu %cameraMenu = new PopupMenu() @@ -229,7 +233,7 @@ function EditorGui::buildMenus(%this) Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();"; item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu; }; - %this.menuBar.insert(%cameraMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%cameraMenu); // Editors Menu %editorsMenu = new PopupMenu() @@ -246,7 +250,7 @@ function EditorGui::buildMenus(%this) //item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin; //item[5] = "-"; }; - %this.menuBar.insert(%editorsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editorsMenu); // Lighting Menu %lightingMenu = new PopupMenu() @@ -263,7 +267,7 @@ function EditorGui::buildMenus(%this) // NOTE: The light managers will be inserted as the // last menu items in EditorLightingMenu::onAdd(). }; - %this.menuBar.insert(%lightingMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%lightingMenu); // Tools Menu %toolsMenu = new PopupMenu() @@ -278,7 +282,7 @@ function EditorGui::buildMenus(%this) item[2] = "Torque SimView" TAB "" TAB "tree();"; item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();"; }; - %this.menuBar.insert(%toolsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%toolsMenu); // Help Menu %helpMenu = new PopupMenu() @@ -293,7 +297,7 @@ function EditorGui::buildMenus(%this) item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);"; item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);"; }; - %this.menuBar.insert(%helpMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%helpMenu); // Menus that are added/removed dynamically (temporary) @@ -398,9 +402,9 @@ function EditorGui::setMenuDefaultState(%this) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + for(%i = 0;%i < %this.menuBar.getMenuCount();%i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); %menu.setupDefaultState(); } @@ -414,9 +418,10 @@ function EditorGui::findMenu(%this, %name) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + + for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); if(%name $= %menu.barTitle) return %menu; diff --git a/Templates/Modules/FPSGameplay/FPSGameplay.module b/Templates/Modules/FPSGameplay/FPSGameplay.module index 9833352e2..37623bf1e 100644 --- a/Templates/Modules/FPSGameplay/FPSGameplay.module +++ b/Templates/Modules/FPSGameplay/FPSGameplay.module @@ -7,4 +7,9 @@ DestroyFunction="destroy" Group="Game" Dependencies="clientServer=1,UI=1"> + \ No newline at end of file diff --git a/Templates/Modules/FPSGameplay/art/skies/Blank_sky/materials.cs b/Templates/Modules/FPSGameplay/art/skies/Blank_sky/materials.cs index 4f0ddc658..493573f5b 100644 --- a/Templates/Modules/FPSGameplay/art/skies/Blank_sky/materials.cs +++ b/Templates/Modules/FPSGameplay/art/skies/Blank_sky/materials.cs @@ -16,5 +16,4 @@ singleton CubemapData( BlankSkyCubemap ) singleton Material( BlankSkyMat ) { cubemap = BlankSkyCubemap; - isSky = true; }; diff --git a/Templates/Modules/FPSGameplay/art/skies/Desert_Sky/materials.cs b/Templates/Modules/FPSGameplay/art/skies/Desert_Sky/materials.cs index 0ee4080d8..af6a979c8 100644 --- a/Templates/Modules/FPSGameplay/art/skies/Desert_Sky/materials.cs +++ b/Templates/Modules/FPSGameplay/art/skies/Desert_Sky/materials.cs @@ -34,5 +34,4 @@ singleton Material( DesertSkyMat ) { cubemap = DesertSkyCubemap; materialTag0 = "Skies"; - isSky = true; }; diff --git a/Templates/Modules/FPSGameplay/art/skies/night/materials.cs b/Templates/Modules/FPSGameplay/art/skies/night/materials.cs index 252c8c52e..79cc050fc 100644 --- a/Templates/Modules/FPSGameplay/art/skies/night/materials.cs +++ b/Templates/Modules/FPSGameplay/art/skies/night/materials.cs @@ -34,7 +34,6 @@ singleton Material( NightSkyMat ) { cubemap = NightCubemap; materialTag0 = "Skies"; - isSky = true; }; singleton Material( Moon_Glow_Mat ) diff --git a/Templates/Modules/FPSGameplay/levels/EmptyLevel.asset.taml b/Templates/Modules/FPSGameplay/levels/EmptyLevel.asset.taml new file mode 100644 index 000000000..4f33dbd9f --- /dev/null +++ b/Templates/Modules/FPSGameplay/levels/EmptyLevel.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Modules/FPSGameplay/levels/EmptyTerrain.asset.taml b/Templates/Modules/FPSGameplay/levels/EmptyTerrain.asset.taml new file mode 100644 index 000000000..657070e50 --- /dev/null +++ b/Templates/Modules/FPSGameplay/levels/EmptyTerrain.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Modules/FPSGameplay/levels/Outpost.asset.taml b/Templates/Modules/FPSGameplay/levels/Outpost.asset.taml new file mode 100644 index 000000000..3f70498f0 --- /dev/null +++ b/Templates/Modules/FPSGameplay/levels/Outpost.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Modules/spectatorGameplay/SpectatorGameplay.module b/Templates/Modules/spectatorGameplay/SpectatorGameplay.module index 953932b87..08e040082 100644 --- a/Templates/Modules/spectatorGameplay/SpectatorGameplay.module +++ b/Templates/Modules/spectatorGameplay/SpectatorGameplay.module @@ -7,4 +7,9 @@ DestroyFunction="destroy" Group="Game" Dependencies="clientServer=1,UI=1"> + \ No newline at end of file diff --git a/Templates/Modules/spectatorGameplay/levels/Empty_Room.asset.taml b/Templates/Modules/spectatorGameplay/levels/Empty_Room.asset.taml new file mode 100644 index 000000000..c3917fcd3 --- /dev/null +++ b/Templates/Modules/spectatorGameplay/levels/Empty_Room.asset.taml @@ -0,0 +1,7 @@ + diff --git a/Tools/CMake/libraries/lmng.cmake b/Tools/CMake/libraries/lmng.cmake deleted file mode 100644 index 3564e362d..000000000 --- a/Tools/CMake/libraries/lmng.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright (c) 2014 GarageGames, LLC -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# ----------------------------------------------------------------------------- - -project(lmng) - - -addDef(MNG_OPTIMIZE_OBJCLEANUP) - -addInclude(${libDir}/lpng) -addInclude(${libDir}/zlib) -addInclude(${libDir}/ljpeg) - -finishLibrary("${libDir}/${PROJECT_NAME}") diff --git a/Tools/CMake/libraries/lungif.cmake b/Tools/CMake/libraries/lungif.cmake deleted file mode 100644 index 910a9922f..000000000 --- a/Tools/CMake/libraries/lungif.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright (c) 2014 GarageGames, LLC -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# ----------------------------------------------------------------------------- - -project(lungif) - -addDef(_GBA_NO_FILEIO) - - -finishLibrary("${libDir}/${PROJECT_NAME}") diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 1850e4751..f5813ccba 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -143,9 +143,6 @@ if(WIN32) option(TORQUE_D3D11 "Allow Direct3D 11 render" ON) endif() -option(TORQUE_EXPERIMENTAL_EC "Experimental Entity/Component systems" OFF) -mark_as_advanced(TORQUE_EXPERIMENTAL_EC) - option(TORQUE_DEDICATED "Torque dedicated" OFF) mark_as_advanced(TORQUE_DEDICATED) @@ -316,9 +313,6 @@ addPath("${srcDir}/physics") addPath("${srcDir}/gui/3d") addPath("${srcDir}/postFx") -if(NOT TORQUE_EXPERIMENTAL_EC) - set(BLACKLIST "entity.cpp;entity.h" ) -endif() addPath("${srcDir}/T3D") set(BLACKLIST "" ) @@ -331,21 +325,13 @@ addPath("${srcDir}/T3D/decal") addPath("${srcDir}/T3D/sfx") addPath("${srcDir}/T3D/gameBase") addPath("${srcDir}/T3D/turret") - -if( TORQUE_EXPERIMENTAL_EC ) - addPath("${srcDir}/T3D/components/") - addPath("${srcDir}/T3D/components/animation") - addPath("${srcDir}/T3D/components/camera") - addPath("${srcDir}/T3D/components/collision") - addPath("${srcDir}/T3D/components/game") - addPath("${srcDir}/T3D/components/physics") - addPath("${srcDir}/T3D/components/render") -endif() +addPathRec("${srcDir}/T3D/components/") +addPathRec("${srcDir}/T3D/systems") addPath("${srcDir}/main/") addPath("${srcDir}/assets") addPath("${srcDir}/module") -addPath("${srcDir}/T3D/assets") +addPathRec("${srcDir}/T3D/assets") addPathRec("${srcDir}/persistence") addPathRec("${srcDir}/ts/collada") addPathRec("${srcDir}/ts/loader") @@ -418,12 +404,10 @@ endif() # Include tools for non-tool builds (or define player if a tool build) if(TORQUE_TOOLS) addPath("${srcDir}/gui/worldEditor") + addPath("${srcDir}/gui/worldEditor/tools") addPath("${srcDir}/environment/editors") addPath("${srcDir}/forest/editor") addPath("${srcDir}/gui/editor") - if(NOT TORQUE_EXPERIMENTAL_EC) - set(BLACKLIST "entityGroup.cpp;entityGroup.h;mountingGroup.cpp;mountingGroup.h;componentGroup.cpp;componentGroup.h" ) - endif() addPath("${srcDir}/gui/editor/inspector") set(BLACKLIST "" ) endif() @@ -501,10 +485,6 @@ if(TORQUE_DEDICATED) addDef(TORQUE_DEDICATED) endif() -if(TORQUE_EXPERIMENTAL_EC) - addDef(TORQUE_EXPERIMENTAL_EC) -endif() - #modules dir file(GLOB modules "modules/*.cmake") foreach(module ${modules}) @@ -636,9 +616,7 @@ endif() ############################################################################### # Common Libraries ############################################################################### -addLib(lmng) addLib(lpng) -addLib(lungif) addLib(ljpeg) addLib(zlib) addLib(tinyxml) @@ -660,13 +638,6 @@ if(WIN32) if(TORQUE_OPENGL) addLib(OpenGL32.lib) endif() - - # JTH: DXSDK is compiled with older runtime, and MSVC 2015+ is when __vsnprintf is undefined. - # This is a workaround by linking with the older legacy library functions. - # See this for more info: http://stackoverflow.com/a/34230122 - if (MSVC14) - addLib(legacy_stdio_definitions.lib) - endif() endif() if (APPLE) @@ -854,26 +825,6 @@ if(TORQUE_TEMPLATE) message("Prepare Template(${TORQUE_TEMPLATE}) install...") file(GLOB_RECURSE INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/*") - IF( NOT TORQUE_EXPERIMENTAL_EC) - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/art.module.taml") - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/shapes/actors/Soldier/soldier.asset.taml") - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/scripts.module.taml") - - foreach(ITEM ${INSTALL_FILES_AND_DIRS}) - get_filename_component( dir ${ITEM} DIRECTORY ) - get_filename_component( fileName ${ITEM} NAME ) - if( ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/game - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/input - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/gameObjects - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/gui - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/scripts ) - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS ${dir}/${fileName}) - ENDIF() - endforeach() - ENDIF() - foreach(ITEM ${INSTALL_FILES_AND_DIRS}) get_filename_component( dir ${ITEM} DIRECTORY ) STRING(REGEX REPLACE "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/" "${TORQUE_APP_DIR}/" INSTALL_DIR ${dir})