1 
2 /* pngconf.h - machine configurable file for libpng
3  *
4  * libpng version 1.2.13 - November 15, 2006
5  * For conditions of distribution and use, see copyright notice in png.h
6  * Copyright (c) 1998-2005 Glenn Randers-Pehrson
7  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
9  */
10 
11 /* Any machine specific code is near the front of this file, so if you
12  * are configuring libpng for a machine, you may want to read the section
13  * starting here down to where it starts to typedef png_color, png_text,
14  * and png_info.
15  */
16 
17 #ifndef PNGCONF_H
18 #define PNGCONF_H
19 
20 #define PNG_1_2_X
21 
22 /*
23  * PNG_USER_CONFIG has to be defined on the compiler command line. This
24  * includes the resource compiler for Windows DLL configurations.
25  */
26 #ifdef PNG_USER_CONFIG
27 #  ifndef PNG_USER_PRIVATEBUILD
28 #    define PNG_USER_PRIVATEBUILD
29 #  endif
30 #include "pngusr.h"
31 #endif
32 
33 /* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
34 #ifdef PNG_CONFIGURE_LIBPNG
35 #ifdef HAVE_CONFIG_H
36 #include "config.h"
37 #endif
38 #endif
39 
40 /*
41  * Added at libpng-1.2.8
42  *
43  * If you create a private DLL you need to define in "pngusr.h" the followings:
44  * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
45  *        the DLL was built>
46  *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
47  * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
48  *        distinguish your DLL from those of the official release. These
49  *        correspond to the trailing letters that come after the version
50  *        number and must match your private DLL name>
51  *  e.g. // private DLL "libpng13gx.dll"
52  *       #define PNG_USER_DLLFNAME_POSTFIX "gx"
53  *
54  * The following macros are also at your disposal if you want to complete the
55  * DLL VERSIONINFO structure.
56  * - PNG_USER_VERSIONINFO_COMMENTS
57  * - PNG_USER_VERSIONINFO_COMPANYNAME
58  * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
59  */
60 
61 #ifdef __STDC__
62 #ifdef SPECIALBUILD
63 #  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
64  are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
65 #endif
66 
67 #ifdef PRIVATEBUILD
68 # pragma message("PRIVATEBUILD is deprecated.\
69  Use PNG_USER_PRIVATEBUILD instead.")
70 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
71 #endif
72 #endif /* __STDC__ */
73 
74 #ifndef PNG_VERSION_INFO_ONLY
75 
76 /* End of material added to libpng-1.2.8 */
77 
78 /* This is the size of the compression buffer, and thus the size of
79  * an IDAT chunk.  Make this whatever size you feel is best for your
80  * machine.  One of these will be allocated per png_struct.  When this
81  * is full, it writes the data to the disk, and does some other
82  * calculations.  Making this an extremely small size will slow
83  * the library down, but you may want to experiment to determine
84  * where it becomes significant, if you are concerned with memory
85  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
86  * this describes the size of the buffer available to read the data in.
87  * Unless this gets smaller than the size of a row (compressed),
88  * it should not make much difference how big this is.
89  */
90 
91 #ifndef PNG_ZBUF_SIZE
92 #  define PNG_ZBUF_SIZE 8192
93 #endif
94 
95 /* Enable if you want a write-only libpng */
96 
97 #ifndef PNG_NO_READ_SUPPORTED
98 #  define PNG_READ_SUPPORTED
99 #endif
100 
101 /* Enable if you want a read-only libpng */
102 
103 #ifndef PNG_NO_WRITE_SUPPORTED
104 #  define PNG_WRITE_SUPPORTED
105 #endif
106 
107 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
108    support PNGs that are embedded in MNG datastreams */
109 #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
110 #  ifndef PNG_MNG_FEATURES_SUPPORTED
111 #    define PNG_MNG_FEATURES_SUPPORTED
112 #  endif
113 #endif
114 
115 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
116 #  ifndef PNG_FLOATING_POINT_SUPPORTED
117 #    define PNG_FLOATING_POINT_SUPPORTED
118 #  endif
119 #endif
120 
121 /* If you are running on a machine where you cannot allocate more
122  * than 64K of memory at once, uncomment this.  While libpng will not
123  * normally need that much memory in a chunk (unless you load up a very
124  * large file), zlib needs to know how big of a chunk it can use, and
125  * libpng thus makes sure to check any memory allocation to verify it
126  * will fit into memory.
127 #define PNG_MAX_MALLOC_64K
128  */
129 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
130 #  define PNG_MAX_MALLOC_64K
131 #endif
132 
133 /* Special munging to support doing things the 'cygwin' way:
134  * 'Normal' png-on-win32 defines/defaults:
135  *   PNG_BUILD_DLL -- building dll
136  *   PNG_USE_DLL   -- building an application, linking to dll
137  *   (no define)   -- building static library, or building an
138  *                    application and linking to the static lib
139  * 'Cygwin' defines/defaults:
140  *   PNG_BUILD_DLL -- (ignored) building the dll
141  *   (no define)   -- (ignored) building an application, linking to the dll
142  *   PNG_STATIC    -- (ignored) building the static lib, or building an
143  *                    application that links to the static lib.
144  *   ALL_STATIC    -- (ignored) building various static libs, or building an
145  *                    application that links to the static libs.
146  * Thus,
147  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
148  * this bit of #ifdefs will define the 'correct' config variables based on
149  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
150  * unnecessary.
151  *
152  * Also, the precedence order is:
153  *   ALL_STATIC (since we can't #undef something outside our namespace)
154  *   PNG_BUILD_DLL
155  *   PNG_STATIC
156  *   (nothing) == PNG_USE_DLL
157  *
158  * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
159  *   of auto-import in binutils, we no longer need to worry about
160  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
161  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
162  *   to __declspec() stuff.  However, we DO need to worry about
163  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
164  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
165  */
166 #if defined(__CYGWIN__)
167 #  if defined(ALL_STATIC)
168 #    if defined(PNG_BUILD_DLL)
169 #      undef PNG_BUILD_DLL
170 #    endif
171 #    if defined(PNG_USE_DLL)
172 #      undef PNG_USE_DLL
173 #    endif
174 #    if defined(PNG_DLL)
175 #      undef PNG_DLL
176 #    endif
177 #    if !defined(PNG_STATIC)
178 #      define PNG_STATIC
179 #    endif
180 #  else
181 #    if defined (PNG_BUILD_DLL)
182 #      if defined(PNG_STATIC)
183 #        undef PNG_STATIC
184 #      endif
185 #      if defined(PNG_USE_DLL)
186 #        undef PNG_USE_DLL
187 #      endif
188 #      if !defined(PNG_DLL)
189 #        define PNG_DLL
190 #      endif
191 #    else
192 #      if defined(PNG_STATIC)
193 #        if defined(PNG_USE_DLL)
194 #          undef PNG_USE_DLL
195 #        endif
196 #        if defined(PNG_DLL)
197 #          undef PNG_DLL
198 #        endif
199 #      else
200 #        if !defined(PNG_USE_DLL)
201 #          define PNG_USE_DLL
202 #        endif
203 #        if !defined(PNG_DLL)
204 #          define PNG_DLL
205 #        endif
206 #      endif
207 #    endif
208 #  endif
209 #endif
210 
211 /* This protects us against compilers that run on a windowing system
212  * and thus don't have or would rather us not use the stdio types:
213  * stdin, stdout, and stderr.  The only one currently used is stderr
214  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
215  * prevent these from being compiled and used. #defining PNG_NO_STDIO
216  * will also prevent these, plus will prevent the entire set of stdio
217  * macros and functions (FILE *, printf, etc.) from being compiled and used,
218  * unless (PNG_DEBUG > 0) has been #defined.
219  *
220  * #define PNG_NO_CONSOLE_IO
221  * #define PNG_NO_STDIO
222  */
223 
224 #if defined(_WIN32_WCE)
225 #  include <windows.h>
226    /* Console I/O functions are not supported on WindowsCE */
227 #  define PNG_NO_CONSOLE_IO
228 #  ifdef PNG_DEBUG
229 #    undef PNG_DEBUG
230 #  endif
231 #endif
232 
233 #ifdef PNG_BUILD_DLL
234 #  ifndef PNG_CONSOLE_IO_SUPPORTED
235 #    ifndef PNG_NO_CONSOLE_IO
236 #      define PNG_NO_CONSOLE_IO
237 #    endif
238 #  endif
239 #endif
240 
241 #  ifdef PNG_NO_STDIO
242 #    ifndef PNG_NO_CONSOLE_IO
243 #      define PNG_NO_CONSOLE_IO
244 #    endif
245 #    ifdef PNG_DEBUG
246 #      if (PNG_DEBUG > 0)
247 #        include <stdio.h>
248 #      endif
249 #    endif
250 #  else
251 #    if !defined(_WIN32_WCE)
252 /* "stdio.h" functions are not supported on WindowsCE */
253 #      include <stdio.h>
254 #    endif
255 #  endif
256 
257 /* This macro protects us against machines that don't have function
258  * prototypes (ie K&R style headers).  If your compiler does not handle
259  * function prototypes, define this macro and use the included ansi2knr.
260  * I've always been able to use _NO_PROTO as the indicator, but you may
261  * need to drag the empty declaration out in front of here, or change the
262  * ifdef to suit your own needs.
263  */
264 #ifndef PNGARG
265 
266 #ifdef OF /* zlib prototype munger */
267 #  define PNGARG(arglist) OF(arglist)
268 #else
269 
270 #ifdef _NO_PROTO
271 #  define PNGARG(arglist) ()
272 #  ifndef PNG_TYPECAST_NULL
273 #     define PNG_TYPECAST_NULL
274 #  endif
275 #else
276 #  define PNGARG(arglist) arglist
277 #endif /* _NO_PROTO */
278 
279 #endif /* OF */
280 
281 #endif /* PNGARG */
282 
283 /* Try to determine if we are compiling on a Mac.  Note that testing for
284  * just __MWERKS__ is not good enough, because the Codewarrior is now used
285  * on non-Mac platforms.
286  */
287 #ifndef MACOS
288 #  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
289       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
290 #    define MACOS
291 #  endif
292 #endif
293 
294 /* enough people need this for various reasons to include it here */
295 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
296 #  include <sys/types.h>
297 #endif
298 
299 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
300 #  define PNG_SETJMP_SUPPORTED
301 #endif
302 
303 #ifdef PNG_SETJMP_SUPPORTED
304 /* This is an attempt to force a single setjmp behaviour on Linux.  If
305  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
306  */
307 
308 #  ifdef __linux__
309 #    ifdef _BSD_SOURCE
310 #      define PNG_SAVE_BSD_SOURCE
311 #      undef _BSD_SOURCE
312 #    endif
313 #    ifdef _SETJMP_H
314      /* If you encounter a compiler error here, see the explanation
315       * near the end of INSTALL.
316       */
317          __png.h__ already includes setjmp.h;
318          __dont__ include it again.;
319 #    endif
320 #  endif /* __linux__ */
321 
322    /* include setjmp.h for error handling */
323 #  include <setjmp.h>
324 
325 #  ifdef __linux__
326 #    ifdef PNG_SAVE_BSD_SOURCE
327 #      define _BSD_SOURCE
328 #      undef PNG_SAVE_BSD_SOURCE
329 #    endif
330 #  endif /* __linux__ */
331 #endif /* PNG_SETJMP_SUPPORTED */
332 
333 #ifdef BSD
334 #  include <strings.h>
335 #else
336 #  include <string.h>
337 #endif
338 
339 /* Other defines for things like memory and the like can go here.  */
340 #ifdef PNG_INTERNAL
341 
342 #include <stdlib.h>
343 
344 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
345  * aren't usually used outside the library (as far as I know), so it is
346  * debatable if they should be exported at all.  In the future, when it is
347  * possible to have run-time registry of chunk-handling functions, some of
348  * these will be made available again.
349 #define PNG_EXTERN extern
350  */
351 #define PNG_EXTERN
352 
353 /* Other defines specific to compilers can go here.  Try to keep
354  * them inside an appropriate ifdef/endif pair for portability.
355  */
356 
357 #if defined(PNG_FLOATING_POINT_SUPPORTED)
358 #  if defined(MACOS)
359      /* We need to check that <math.h> hasn't already been included earlier
360       * as it seems it doesn't agree with <fp.h>, yet we should really use
361       * <fp.h> if possible.
362       */
363 #    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
364 #      include <fp.h>
365 #    endif
366 #  else
367 #    include <math.h>
368 #  endif
369 #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
370      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
371       * MATH=68881
372       */
373 #    include <m68881.h>
374 #  endif
375 #endif
376 
377 /* Codewarrior on NT has linking problems without this. */
378 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
379 #  define PNG_ALWAYS_EXTERN
380 #endif
381 
382 /* This provides the non-ANSI (far) memory allocation routines. */
383 #if defined(__TURBOC__) && defined(__MSDOS__)
384 #  include <mem.h>
385 #  include <alloc.h>
386 #endif
387 
388 /* I have no idea why is this necessary... */
389 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
390     defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
391 #  include <malloc.h>
392 #endif
393 
394 /* This controls how fine the dithering gets.  As this allocates
395  * a largish chunk of memory (32K), those who are not as concerned
396  * with dithering quality can decrease some or all of these.
397  */
398 #ifndef PNG_DITHER_RED_BITS
399 #  define PNG_DITHER_RED_BITS 5
400 #endif
401 #ifndef PNG_DITHER_GREEN_BITS
402 #  define PNG_DITHER_GREEN_BITS 5
403 #endif
404 #ifndef PNG_DITHER_BLUE_BITS
405 #  define PNG_DITHER_BLUE_BITS 5
406 #endif
407 
408 /* This controls how fine the gamma correction becomes when you
409  * are only interested in 8 bits anyway.  Increasing this value
410  * results in more memory being used, and more pow() functions
411  * being called to fill in the gamma tables.  Don't set this value
412  * less then 8, and even that may not work (I haven't tested it).
413  */
414 
415 #ifndef PNG_MAX_GAMMA_8
416 #  define PNG_MAX_GAMMA_8 11
417 #endif
418 
419 /* This controls how much a difference in gamma we can tolerate before
420  * we actually start doing gamma conversion.
421  */
422 #ifndef PNG_GAMMA_THRESHOLD
423 #  define PNG_GAMMA_THRESHOLD 0.05
424 #endif
425 
426 #endif /* PNG_INTERNAL */
427 
428 /* The following uses const char * instead of char * for error
429  * and warning message functions, so some compilers won't complain.
430  * If you do not want to use const, define PNG_NO_CONST here.
431  */
432 
433 #ifndef PNG_NO_CONST
434 #  define PNG_CONST const
435 #else
436 #  define PNG_CONST
437 #endif
438 
439 /* The following defines give you the ability to remove code from the
440  * library that you will not be using.  I wish I could figure out how to
441  * automate this, but I can't do that without making it seriously hard
442  * on the users.  So if you are not using an ability, change the #define
443  * to and #undef, and that part of the library will not be compiled.  If
444  * your linker can't find a function, you may want to make sure the
445  * ability is defined here.  Some of these depend upon some others being
446  * defined.  I haven't figured out all the interactions here, so you may
447  * have to experiment awhile to get everything to compile.  If you are
448  * creating or using a shared library, you probably shouldn't touch this,
449  * as it will affect the size of the structures, and this will cause bad
450  * things to happen if the library and/or application ever change.
451  */
452 
453 /* Any features you will not be using can be undef'ed here */
454 
455 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
456  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
457  * on the compile line, then pick and choose which ones to define without
458  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
459  * if you only want to have a png-compliant reader/writer but don't need
460  * any of the extra transformations.  This saves about 80 kbytes in a
461  * typical installation of the library. (PNG_NO_* form added in version
462  * 1.0.1c, for consistency)
463  */
464 
465 /* The size of the png_text structure changed in libpng-1.0.6 when
466  * iTXt support was added.  iTXt support was turned off by default through
467  * libpng-1.2.x, to support old apps that malloc the png_text structure
468  * instead of calling png_set_text() and letting libpng malloc it.  It
469  * was turned on by default in libpng-1.3.0.
470  */
471 
472 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
473 #  ifndef PNG_NO_iTXt_SUPPORTED
474 #    define PNG_NO_iTXt_SUPPORTED
475 #  endif
476 #  ifndef PNG_NO_READ_iTXt
477 #    define PNG_NO_READ_iTXt
478 #  endif
479 #  ifndef PNG_NO_WRITE_iTXt
480 #    define PNG_NO_WRITE_iTXt
481 #  endif
482 #endif
483 
484 #if !defined(PNG_NO_iTXt_SUPPORTED)
485 #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
486 #    define PNG_READ_iTXt
487 #  endif
488 #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
489 #    define PNG_WRITE_iTXt
490 #  endif
491 #endif
492 
493 /* The following support, added after version 1.0.0, can be turned off here en
494  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
495  * with old applications that require the length of png_struct and png_info
496  * to remain unchanged.
497  */
498 
499 #ifdef PNG_LEGACY_SUPPORTED
500 #  define PNG_NO_FREE_ME
501 #  define PNG_NO_READ_UNKNOWN_CHUNKS
502 #  define PNG_NO_WRITE_UNKNOWN_CHUNKS
503 #  define PNG_NO_READ_USER_CHUNKS
504 #  define PNG_NO_READ_iCCP
505 #  define PNG_NO_WRITE_iCCP
506 #  define PNG_NO_READ_iTXt
507 #  define PNG_NO_WRITE_iTXt
508 #  define PNG_NO_READ_sCAL
509 #  define PNG_NO_WRITE_sCAL
510 #  define PNG_NO_READ_sPLT
511 #  define PNG_NO_WRITE_sPLT
512 #  define PNG_NO_INFO_IMAGE
513 #  define PNG_NO_READ_RGB_TO_GRAY
514 #  define PNG_NO_READ_USER_TRANSFORM
515 #  define PNG_NO_WRITE_USER_TRANSFORM
516 #  define PNG_NO_USER_MEM
517 #  define PNG_NO_READ_EMPTY_PLTE
518 #  define PNG_NO_MNG_FEATURES
519 #  define PNG_NO_FIXED_POINT_SUPPORTED
520 #endif
521 
522 /* Ignore attempt to turn off both floating and fixed point support */
523 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
524     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
525 #  define PNG_FIXED_POINT_SUPPORTED
526 #endif
527 
528 #ifndef PNG_NO_FREE_ME
529 #  define PNG_FREE_ME_SUPPORTED
530 #endif
531 
532 #if defined(PNG_READ_SUPPORTED)
533 
534 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
535       !defined(PNG_NO_READ_TRANSFORMS)
536 #  define PNG_READ_TRANSFORMS_SUPPORTED
537 #endif
538 
539 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
540 #  ifndef PNG_NO_READ_EXPAND
541 #    define PNG_READ_EXPAND_SUPPORTED
542 #  endif
543 #  ifndef PNG_NO_READ_SHIFT
544 #    define PNG_READ_SHIFT_SUPPORTED
545 #  endif
546 #  ifndef PNG_NO_READ_PACK
547 #    define PNG_READ_PACK_SUPPORTED
548 #  endif
549 #  ifndef PNG_NO_READ_BGR
550 #    define PNG_READ_BGR_SUPPORTED
551 #  endif
552 #  ifndef PNG_NO_READ_SWAP
553 #    define PNG_READ_SWAP_SUPPORTED
554 #  endif
555 #  ifndef PNG_NO_READ_PACKSWAP
556 #    define PNG_READ_PACKSWAP_SUPPORTED
557 #  endif
558 #  ifndef PNG_NO_READ_INVERT
559 #    define PNG_READ_INVERT_SUPPORTED
560 #  endif
561 #  ifndef PNG_NO_READ_DITHER
562 #    define PNG_READ_DITHER_SUPPORTED
563 #  endif
564 #  ifndef PNG_NO_READ_BACKGROUND
565 #    define PNG_READ_BACKGROUND_SUPPORTED
566 #  endif
567 #  ifndef PNG_NO_READ_16_TO_8
568 #    define PNG_READ_16_TO_8_SUPPORTED
569 #  endif
570 #  ifndef PNG_NO_READ_FILLER
571 #    define PNG_READ_FILLER_SUPPORTED
572 #  endif
573 #  ifndef PNG_NO_READ_GAMMA
574 #    define PNG_READ_GAMMA_SUPPORTED
575 #  endif
576 #  ifndef PNG_NO_READ_GRAY_TO_RGB
577 #    define PNG_READ_GRAY_TO_RGB_SUPPORTED
578 #  endif
579 #  ifndef PNG_NO_READ_SWAP_ALPHA
580 #    define PNG_READ_SWAP_ALPHA_SUPPORTED
581 #  endif
582 #  ifndef PNG_NO_READ_INVERT_ALPHA
583 #    define PNG_READ_INVERT_ALPHA_SUPPORTED
584 #  endif
585 #  ifndef PNG_NO_READ_STRIP_ALPHA
586 #    define PNG_READ_STRIP_ALPHA_SUPPORTED
587 #  endif
588 #  ifndef PNG_NO_READ_USER_TRANSFORM
589 #    define PNG_READ_USER_TRANSFORM_SUPPORTED
590 #  endif
591 #  ifndef PNG_NO_READ_RGB_TO_GRAY
592 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
593 #  endif
594 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
595 
596 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
597  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
598 #  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
599 #endif                               /* about interlacing capability!  You'll */
600               /* still have interlacing unless you change the following line: */
601 
602 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
603 
604 #ifndef PNG_NO_READ_COMPOSITE_NODIV
605 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
606 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
607 #  endif
608 #endif
609 
610 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
611 /* Deprecated, will be removed from version 2.0.0.
612    Use PNG_MNG_FEATURES_SUPPORTED instead. */
613 #ifndef PNG_NO_READ_EMPTY_PLTE
614 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
615 #endif
616 #endif
617 
618 #endif /* PNG_READ_SUPPORTED */
619 
620 #if defined(PNG_WRITE_SUPPORTED)
621 
622 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
623     !defined(PNG_NO_WRITE_TRANSFORMS)
624 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
625 #endif
626 
627 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
628 #  ifndef PNG_NO_WRITE_SHIFT
629 #    define PNG_WRITE_SHIFT_SUPPORTED
630 #  endif
631 #  ifndef PNG_NO_WRITE_PACK
632 #    define PNG_WRITE_PACK_SUPPORTED
633 #  endif
634 #  ifndef PNG_NO_WRITE_BGR
635 #    define PNG_WRITE_BGR_SUPPORTED
636 #  endif
637 #  ifndef PNG_NO_WRITE_SWAP
638 #    define PNG_WRITE_SWAP_SUPPORTED
639 #  endif
640 #  ifndef PNG_NO_WRITE_PACKSWAP
641 #    define PNG_WRITE_PACKSWAP_SUPPORTED
642 #  endif
643 #  ifndef PNG_NO_WRITE_INVERT
644 #    define PNG_WRITE_INVERT_SUPPORTED
645 #  endif
646 #  ifndef PNG_NO_WRITE_FILLER
647 #    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
648 #  endif
649 #  ifndef PNG_NO_WRITE_SWAP_ALPHA
650 #    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
651 #  endif
652 #  ifndef PNG_NO_WRITE_INVERT_ALPHA
653 #    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
654 #  endif
655 #  ifndef PNG_NO_WRITE_USER_TRANSFORM
656 #    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
657 #  endif
658 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
659 
660 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
661     !defined(PNG_WRITE_INTERLACING_SUPPORTED)
662 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
663                                             encoders, but can cause trouble
664                                             if left undefined */
665 #endif
666 
667 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
668     !defined(PNG_WRITE_WEIGHTED_FILTER) && \
669      defined(PNG_FLOATING_POINT_SUPPORTED)
670 #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
671 #endif
672 
673 #ifndef PNG_NO_WRITE_FLUSH
674 #  define PNG_WRITE_FLUSH_SUPPORTED
675 #endif
676 
677 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
678 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
679 #ifndef PNG_NO_WRITE_EMPTY_PLTE
680 #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
681 #endif
682 #endif
683 
684 #endif /* PNG_WRITE_SUPPORTED */
685 
686 #ifndef PNG_1_0_X
687 #  ifndef PNG_NO_ERROR_NUMBERS
688 #    define PNG_ERROR_NUMBERS_SUPPORTED
689 #  endif
690 #endif /* PNG_1_0_X */
691 
692 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
693     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
694 #  ifndef PNG_NO_USER_TRANSFORM_PTR
695 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
696 #  endif
697 #endif
698 
699 #ifndef PNG_NO_STDIO
700 #  define PNG_TIME_RFC1123_SUPPORTED
701 #endif
702 
703 /* This adds extra functions in pngget.c for accessing data from the
704  * info pointer (added in version 0.99)
705  * png_get_image_width()
706  * png_get_image_height()
707  * png_get_bit_depth()
708  * png_get_color_type()
709  * png_get_compression_type()
710  * png_get_filter_type()
711  * png_get_interlace_type()
712  * png_get_pixel_aspect_ratio()
713  * png_get_pixels_per_meter()
714  * png_get_x_offset_pixels()
715  * png_get_y_offset_pixels()
716  * png_get_x_offset_microns()
717  * png_get_y_offset_microns()
718  */
719 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
720 #  define PNG_EASY_ACCESS_SUPPORTED
721 #endif
722 
723 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
724    even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
725 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
726 #  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
727 #    define PNG_ASSEMBLER_CODE_SUPPORTED
728 #  endif
729 #  if defined(XP_MACOSX) && !defined(PNG_NO_MMX_CODE)
730      /* work around Intel-Mac compiler bug */
731 #    define PNG_NO_MMX_CODE
732 #  endif
733 #  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \
734      defined(__MMX__)
735 #    define PNG_MMX_CODE_SUPPORTED
736 #  endif
737 #  if !defined(PNG_USE_PNGGCCRD) && !defined(PNG_NO_MMX_CODE) && \
738      !defined(PNG_USE_PNGVCRD) && defined(__MMX__)
739 #    define PNG_USE_PNGGCCRD
740 #  endif
741 #endif
742 
743 /* If you are sure that you don't need thread safety and you are compiling
744    with PNG_USE_PNGCCRD for an MMX application, you can define this for
745    faster execution.  See pnggccrd.c.
746 #define PNG_THREAD_UNSAFE_OK
747 */
748 
749 #if !defined(PNG_1_0_X)
750 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
751 #  define PNG_USER_MEM_SUPPORTED
752 #endif
753 #endif /* PNG_1_0_X */
754 
755 /* Added at libpng-1.2.6 */
756 #if !defined(PNG_1_0_X)
757 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
758 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
759 #  define PNG_SET_USER_LIMITS_SUPPORTED
760 #endif
761 #endif
762 #endif /* PNG_1_0_X */
763 
764 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
765  * how large, set these limits to 0x7fffffffL
766  */
767 #ifndef PNG_USER_WIDTH_MAX
768 #  define PNG_USER_WIDTH_MAX 1000000L
769 #endif
770 #ifndef PNG_USER_HEIGHT_MAX
771 #  define PNG_USER_HEIGHT_MAX 1000000L
772 #endif
773 
774 /* These are currently experimental features, define them if you want */
775 
776 /* very little testing */
777 /*
778 #ifdef PNG_READ_SUPPORTED
779 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
780 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
781 #  endif
782 #endif
783 */
784 
785 /* This is only for PowerPC big-endian and 680x0 systems */
786 /* some testing */
787 /*
788 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
789 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
790 #endif
791 */
792 
793 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
794 /*
795 #define PNG_NO_POINTER_INDEXING
796 */
797 
798 /* These functions are turned off by default, as they will be phased out. */
799 /*
800 #define  PNG_USELESS_TESTS_SUPPORTED
801 #define  PNG_CORRECT_PALETTE_SUPPORTED
802 */
803 
804 /* Any chunks you are not interested in, you can undef here.  The
805  * ones that allocate memory may be expecially important (hIST,
806  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
807  * a bit smaller.
808  */
809 
810 #if defined(PNG_READ_SUPPORTED) && \
811     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
812     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
813 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
814 #endif
815 
816 #if defined(PNG_WRITE_SUPPORTED) && \
817     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
818     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
819 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
820 #endif
821 
822 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
823 
824 #ifdef PNG_NO_READ_TEXT
825 #  define PNG_NO_READ_iTXt
826 #  define PNG_NO_READ_tEXt
827 #  define PNG_NO_READ_zTXt
828 #endif
829 #ifndef PNG_NO_READ_bKGD
830 #  define PNG_READ_bKGD_SUPPORTED
831 #  define PNG_bKGD_SUPPORTED
832 #endif
833 #ifndef PNG_NO_READ_cHRM
834 #  define PNG_READ_cHRM_SUPPORTED
835 #  define PNG_cHRM_SUPPORTED
836 #endif
837 #ifndef PNG_NO_READ_gAMA
838 #  define PNG_READ_gAMA_SUPPORTED
839 #  define PNG_gAMA_SUPPORTED
840 #endif
841 #ifndef PNG_NO_READ_hIST
842 #  define PNG_READ_hIST_SUPPORTED
843 #  define PNG_hIST_SUPPORTED
844 #endif
845 #ifndef PNG_NO_READ_iCCP
846 #  define PNG_READ_iCCP_SUPPORTED
847 #  define PNG_iCCP_SUPPORTED
848 #endif
849 #ifndef PNG_NO_READ_iTXt
850 #  ifndef PNG_READ_iTXt_SUPPORTED
851 #    define PNG_READ_iTXt_SUPPORTED
852 #  endif
853 #  ifndef PNG_iTXt_SUPPORTED
854 #    define PNG_iTXt_SUPPORTED
855 #  endif
856 #endif
857 #ifndef PNG_NO_READ_oFFs
858 #  define PNG_READ_oFFs_SUPPORTED
859 #  define PNG_oFFs_SUPPORTED
860 #endif
861 #ifndef PNG_NO_READ_pCAL
862 #  define PNG_READ_pCAL_SUPPORTED
863 #  define PNG_pCAL_SUPPORTED
864 #endif
865 #ifndef PNG_NO_READ_sCAL
866 #  define PNG_READ_sCAL_SUPPORTED
867 #  define PNG_sCAL_SUPPORTED
868 #endif
869 #ifndef PNG_NO_READ_pHYs
870 #  define PNG_READ_pHYs_SUPPORTED
871 #  define PNG_pHYs_SUPPORTED
872 #endif
873 #ifndef PNG_NO_READ_sBIT
874 #  define PNG_READ_sBIT_SUPPORTED
875 #  define PNG_sBIT_SUPPORTED
876 #endif
877 #ifndef PNG_NO_READ_sPLT
878 #  define PNG_READ_sPLT_SUPPORTED
879 #  define PNG_sPLT_SUPPORTED
880 #endif
881 #ifndef PNG_NO_READ_sRGB
882 #  define PNG_READ_sRGB_SUPPORTED
883 #  define PNG_sRGB_SUPPORTED
884 #endif
885 #ifndef PNG_NO_READ_tEXt
886 #  define PNG_READ_tEXt_SUPPORTED
887 #  define PNG_tEXt_SUPPORTED
888 #endif
889 #ifndef PNG_NO_READ_tIME
890 #  define PNG_READ_tIME_SUPPORTED
891 #  define PNG_tIME_SUPPORTED
892 #endif
893 #ifndef PNG_NO_READ_tRNS
894 #  define PNG_READ_tRNS_SUPPORTED
895 #  define PNG_tRNS_SUPPORTED
896 #endif
897 #ifndef PNG_NO_READ_zTXt
898 #  define PNG_READ_zTXt_SUPPORTED
899 #  define PNG_zTXt_SUPPORTED
900 #endif
901 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
902 #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
903 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
904 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
905 #  endif
906 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
907 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
908 #  endif
909 #endif
910 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
911      defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
912 #  define PNG_READ_USER_CHUNKS_SUPPORTED
913 #  define PNG_USER_CHUNKS_SUPPORTED
914 #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
915 #    undef PNG_NO_READ_UNKNOWN_CHUNKS
916 #  endif
917 #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
918 #    undef PNG_NO_HANDLE_AS_UNKNOWN
919 #  endif
920 #endif
921 #ifndef PNG_NO_READ_OPT_PLTE
922 #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
923 #endif                      /* optional PLTE chunk in RGB and RGBA images */
924 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
925     defined(PNG_READ_zTXt_SUPPORTED)
926 #  define PNG_READ_TEXT_SUPPORTED
927 #  define PNG_TEXT_SUPPORTED
928 #endif
929 
930 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
931 
932 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
933 
934 #ifdef PNG_NO_WRITE_TEXT
935 #  define PNG_NO_WRITE_iTXt
936 #  define PNG_NO_WRITE_tEXt
937 #  define PNG_NO_WRITE_zTXt
938 #endif
939 #ifndef PNG_NO_WRITE_bKGD
940 #  define PNG_WRITE_bKGD_SUPPORTED
941 #  ifndef PNG_bKGD_SUPPORTED
942 #    define PNG_bKGD_SUPPORTED
943 #  endif
944 #endif
945 #ifndef PNG_NO_WRITE_cHRM
946 #  define PNG_WRITE_cHRM_SUPPORTED
947 #  ifndef PNG_cHRM_SUPPORTED
948 #    define PNG_cHRM_SUPPORTED
949 #  endif
950 #endif
951 #ifndef PNG_NO_WRITE_gAMA
952 #  define PNG_WRITE_gAMA_SUPPORTED
953 #  ifndef PNG_gAMA_SUPPORTED
954 #    define PNG_gAMA_SUPPORTED
955 #  endif
956 #endif
957 #ifndef PNG_NO_WRITE_hIST
958 #  define PNG_WRITE_hIST_SUPPORTED
959 #  ifndef PNG_hIST_SUPPORTED
960 #    define PNG_hIST_SUPPORTED
961 #  endif
962 #endif
963 #ifndef PNG_NO_WRITE_iCCP
964 #  define PNG_WRITE_iCCP_SUPPORTED
965 #  ifndef PNG_iCCP_SUPPORTED
966 #    define PNG_iCCP_SUPPORTED
967 #  endif
968 #endif
969 #ifndef PNG_NO_WRITE_iTXt
970 #  ifndef PNG_WRITE_iTXt_SUPPORTED
971 #    define PNG_WRITE_iTXt_SUPPORTED
972 #  endif
973 #  ifndef PNG_iTXt_SUPPORTED
974 #    define PNG_iTXt_SUPPORTED
975 #  endif
976 #endif
977 #ifndef PNG_NO_WRITE_oFFs
978 #  define PNG_WRITE_oFFs_SUPPORTED
979 #  ifndef PNG_oFFs_SUPPORTED
980 #    define PNG_oFFs_SUPPORTED
981 #  endif
982 #endif
983 #ifndef PNG_NO_WRITE_pCAL
984 #  define PNG_WRITE_pCAL_SUPPORTED
985 #  ifndef PNG_pCAL_SUPPORTED
986 #    define PNG_pCAL_SUPPORTED
987 #  endif
988 #endif
989 #ifndef PNG_NO_WRITE_sCAL
990 #  define PNG_WRITE_sCAL_SUPPORTED
991 #  ifndef PNG_sCAL_SUPPORTED
992 #    define PNG_sCAL_SUPPORTED
993 #  endif
994 #endif
995 #ifndef PNG_NO_WRITE_pHYs
996 #  define PNG_WRITE_pHYs_SUPPORTED
997 #  ifndef PNG_pHYs_SUPPORTED
998 #    define PNG_pHYs_SUPPORTED
999 #  endif
1000 #endif
1001 #ifndef PNG_NO_WRITE_sBIT
1002 #  define PNG_WRITE_sBIT_SUPPORTED
1003 #  ifndef PNG_sBIT_SUPPORTED
1004 #    define PNG_sBIT_SUPPORTED
1005 #  endif
1006 #endif
1007 #ifndef PNG_NO_WRITE_sPLT
1008 #  define PNG_WRITE_sPLT_SUPPORTED
1009 #  ifndef PNG_sPLT_SUPPORTED
1010 #    define PNG_sPLT_SUPPORTED
1011 #  endif
1012 #endif
1013 #ifndef PNG_NO_WRITE_sRGB
1014 #  define PNG_WRITE_sRGB_SUPPORTED
1015 #  ifndef PNG_sRGB_SUPPORTED
1016 #    define PNG_sRGB_SUPPORTED
1017 #  endif
1018 #endif
1019 #ifndef PNG_NO_WRITE_tEXt
1020 #  define PNG_WRITE_tEXt_SUPPORTED
1021 #  ifndef PNG_tEXt_SUPPORTED
1022 #    define PNG_tEXt_SUPPORTED
1023 #  endif
1024 #endif
1025 #ifndef PNG_NO_WRITE_tIME
1026 #  define PNG_WRITE_tIME_SUPPORTED
1027 #  ifndef PNG_tIME_SUPPORTED
1028 #    define PNG_tIME_SUPPORTED
1029 #  endif
1030 #endif
1031 #ifndef PNG_NO_WRITE_tRNS
1032 #  define PNG_WRITE_tRNS_SUPPORTED
1033 #  ifndef PNG_tRNS_SUPPORTED
1034 #    define PNG_tRNS_SUPPORTED
1035 #  endif
1036 #endif
1037 #ifndef PNG_NO_WRITE_zTXt
1038 #  define PNG_WRITE_zTXt_SUPPORTED
1039 #  ifndef PNG_zTXt_SUPPORTED
1040 #    define PNG_zTXt_SUPPORTED
1041 #  endif
1042 #endif
1043 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
1044 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
1045 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
1046 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
1047 #  endif
1048 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
1049 #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1050 #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1051 #     endif
1052 #  endif
1053 #endif
1054 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
1055     defined(PNG_WRITE_zTXt_SUPPORTED)
1056 #  define PNG_WRITE_TEXT_SUPPORTED
1057 #  ifndef PNG_TEXT_SUPPORTED
1058 #    define PNG_TEXT_SUPPORTED
1059 #  endif
1060 #endif
1061 
1062 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
1063 
1064 /* Turn this off to disable png_read_png() and
1065  * png_write_png() and leave the row_pointers member
1066  * out of the info structure.
1067  */
1068 #ifndef PNG_NO_INFO_IMAGE
1069 #  define PNG_INFO_IMAGE_SUPPORTED
1070 #endif
1071 
1072 /* need the time information for reading tIME chunks */
1073 #if defined(PNG_tIME_SUPPORTED)
1074 #  if !defined(_WIN32_WCE)
1075      /* "time.h" functions are not supported on WindowsCE */
1076 #    include <time.h>
1077 #  endif
1078 #endif
1079 
1080 /* Some typedefs to get us started.  These should be safe on most of the
1081  * common platforms.  The typedefs should be at least as large as the
1082  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
1083  * don't have to be exactly that size.  Some compilers dislike passing
1084  * unsigned shorts as function parameters, so you may be better off using
1085  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
1086  * want to have unsigned int for png_uint_32 instead of unsigned long.
1087  */
1088 
1089 typedef unsigned long png_uint_32;
1090 typedef long png_int_32;
1091 typedef unsigned short png_uint_16;
1092 typedef short png_int_16;
1093 typedef unsigned char png_byte;
1094 
1095 /* This is usually size_t.  It is typedef'ed just in case you need it to
1096    change (I'm not sure if you will or not, so I thought I'd be safe) */
1097 #ifdef PNG_SIZE_T
1098    typedef PNG_SIZE_T png_size_t;
1099 #  define png_sizeof(x) png_convert_size(sizeof (x))
1100 #else
1101    typedef size_t png_size_t;
1102 #  define png_sizeof(x) sizeof (x)
1103 #endif
1104 
1105 /* The following is needed for medium model support.  It cannot be in the
1106  * PNG_INTERNAL section.  Needs modification for other compilers besides
1107  * MSC.  Model independent support declares all arrays and pointers to be
1108  * large using the far keyword.  The zlib version used must also support
1109  * model independent data.  As of version zlib 1.0.4, the necessary changes
1110  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
1111  * changes that are needed. (Tim Wegner)
1112  */
1113 
1114 /* Separate compiler dependencies (problem here is that zlib.h always
1115    defines FAR. (SJT) */
1116 #ifdef __BORLANDC__
1117 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
1118 #    define LDATA 1
1119 #  else
1120 #    define LDATA 0
1121 #  endif
1122    /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
1123 #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
1124 #    define PNG_MAX_MALLOC_64K
1125 #    if (LDATA != 1)
1126 #      ifndef FAR
1127 #        define FAR __far
1128 #      endif
1129 #      define USE_FAR_KEYWORD
1130 #    endif   /* LDATA != 1 */
1131      /* Possibly useful for moving data out of default segment.
1132       * Uncomment it if you want. Could also define FARDATA as
1133       * const if your compiler supports it. (SJT)
1134 #    define FARDATA FAR
1135       */
1136 #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
1137 #endif   /* __BORLANDC__ */
1138 
1139 
1140 /* Suggest testing for specific compiler first before testing for
1141  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
1142  * making reliance oncertain keywords suspect. (SJT)
1143  */
1144 
1145 /* MSC Medium model */
1146 #if defined(FAR)
1147 #  if defined(M_I86MM)
1148 #    define USE_FAR_KEYWORD
1149 #    define FARDATA FAR
1150 #    include <dos.h>
1151 #  endif
1152 #endif
1153 
1154 /* SJT: default case */
1155 #ifndef FAR
1156 #  define FAR
1157 #endif
1158 
1159 /* At this point FAR is always defined */
1160 #ifndef FARDATA
1161 #  define FARDATA
1162 #endif
1163 
1164 /* Typedef for floating-point numbers that are converted
1165    to fixed-point with a multiple of 100,000, e.g., int_gamma */
1166 typedef png_int_32 png_fixed_point;
1167 
1168 /* Add typedefs for pointers */
1169 typedef void            FAR * png_voidp;
1170 typedef png_byte        FAR * png_bytep;
1171 typedef png_uint_32     FAR * png_uint_32p;
1172 typedef png_int_32      FAR * png_int_32p;
1173 typedef png_uint_16     FAR * png_uint_16p;
1174 typedef png_int_16      FAR * png_int_16p;
1175 typedef PNG_CONST char  FAR * png_const_charp;
1176 typedef char            FAR * png_charp;
1177 typedef png_fixed_point FAR * png_fixed_point_p;
1178 
1179 #ifndef PNG_NO_STDIO
1180 #if defined(_WIN32_WCE)
1181 typedef HANDLE                png_FILE_p;
1182 #else
1183 typedef FILE                * png_FILE_p;
1184 #endif
1185 #endif
1186 
1187 #ifdef PNG_FLOATING_POINT_SUPPORTED
1188 typedef double          FAR * png_doublep;
1189 #endif
1190 
1191 /* Pointers to pointers; i.e. arrays */
1192 typedef png_byte        FAR * FAR * png_bytepp;
1193 typedef png_uint_32     FAR * FAR * png_uint_32pp;
1194 typedef png_int_32      FAR * FAR * png_int_32pp;
1195 typedef png_uint_16     FAR * FAR * png_uint_16pp;
1196 typedef png_int_16      FAR * FAR * png_int_16pp;
1197 typedef PNG_CONST char  FAR * FAR * png_const_charpp;
1198 typedef char            FAR * FAR * png_charpp;
1199 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
1200 #ifdef PNG_FLOATING_POINT_SUPPORTED
1201 typedef double          FAR * FAR * png_doublepp;
1202 #endif
1203 
1204 /* Pointers to pointers to pointers; i.e., pointer to array */
1205 typedef char            FAR * FAR * FAR * png_charppp;
1206 
1207 #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
1208 /* SPC -  Is this stuff deprecated? */
1209 /* It'll be removed as of libpng-1.3.0 - GR-P */
1210 /* libpng typedefs for types in zlib. If zlib changes
1211  * or another compression library is used, then change these.
1212  * Eliminates need to change all the source files.
1213  */
1214 typedef charf *         png_zcharp;
1215 typedef charf * FAR *   png_zcharpp;
1216 typedef z_stream FAR *  png_zstreamp;
1217 #endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
1218 
1219 /*
1220  * Define PNG_BUILD_DLL if the module being built is a Windows
1221  * LIBPNG DLL.
1222  *
1223  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
1224  * It is equivalent to Microsoft predefined macro _DLL that is
1225  * automatically defined when you compile using the share
1226  * version of the CRT (C Run-Time library)
1227  *
1228  * The cygwin mods make this behavior a little different:
1229  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1230  * Define PNG_STATIC if you are building a static library for use with cygwin,
1231  *   -or- if you are building an application that you want to link to the
1232  *   static library.
1233  * PNG_USE_DLL is defined by default (no user action needed) unless one of
1234  *   the other flags is defined.
1235  */
1236 
1237 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
1238 #  define PNG_DLL
1239 #endif
1240 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
1241  * When building a static lib, default to no GLOBAL ARRAYS, but allow
1242  * command-line override
1243  */
1244 #if defined(__CYGWIN__)
1245 #  if !defined(PNG_STATIC)
1246 #    if defined(PNG_USE_GLOBAL_ARRAYS)
1247 #      undef PNG_USE_GLOBAL_ARRAYS
1248 #    endif
1249 #    if !defined(PNG_USE_LOCAL_ARRAYS)
1250 #      define PNG_USE_LOCAL_ARRAYS
1251 #    endif
1252 #  else
1253 #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
1254 #      if defined(PNG_USE_GLOBAL_ARRAYS)
1255 #        undef PNG_USE_GLOBAL_ARRAYS
1256 #      endif
1257 #    endif
1258 #  endif
1259 #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1260 #    define PNG_USE_LOCAL_ARRAYS
1261 #  endif
1262 #endif
1263 
1264 /* Do not use global arrays (helps with building DLL's)
1265  * They are no longer used in libpng itself, since version 1.0.5c,
1266  * but might be required for some pre-1.0.5c applications.
1267  */
1268 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1269 #  if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
1270 #    define PNG_USE_LOCAL_ARRAYS
1271 #  else
1272 #    define PNG_USE_GLOBAL_ARRAYS
1273 #  endif
1274 #endif
1275 
1276 #if defined(__CYGWIN__)
1277 #  undef PNGAPI
1278 #  define PNGAPI __cdecl
1279 #  undef PNG_IMPEXP
1280 #  define PNG_IMPEXP
1281 #endif
1282 
1283 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
1284  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
1285  * Don't ignore those warnings; you must also reset the default calling
1286  * convention in your compiler to match your PNGAPI, and you must build
1287  * zlib and your applications the same way you build libpng.
1288  */
1289 
1290 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
1291 #  ifndef PNG_NO_MODULEDEF
1292 #    define PNG_NO_MODULEDEF
1293 #  endif
1294 #endif
1295 
1296 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
1297 #  define PNG_IMPEXP
1298 #endif
1299 
1300 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
1301     (( defined(_Windows) || defined(_WINDOWS) || \
1302        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
1303 
1304 #  ifndef PNGAPI
1305 #     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1306 #        define PNGAPI __cdecl
1307 #     else
1308 #        define PNGAPI _cdecl
1309 #     endif
1310 #  endif
1311 
1312 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1313        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1314 #     define PNG_IMPEXP
1315 #  endif
1316 
1317 #  if !defined(PNG_IMPEXP)
1318 
1319 #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
1320 #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
1321 
1322       /* Borland/Microsoft */
1323 #     if defined(_MSC_VER) || defined(__BORLANDC__)
1324 #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1325 #           define PNG_EXPORT PNG_EXPORT_TYPE1
1326 #        else
1327 #           define PNG_EXPORT PNG_EXPORT_TYPE2
1328 #           if defined(PNG_BUILD_DLL)
1329 #              define PNG_IMPEXP __export
1330 #           else
1331 #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
1332                                                  VC++ */
1333 #           endif                             /* Exists in Borland C++ for
1334                                                  C++ classes (== huge) */
1335 #        endif
1336 #     endif
1337 
1338 #     if !defined(PNG_IMPEXP)
1339 #        if defined(PNG_BUILD_DLL)
1340 #           define PNG_IMPEXP __declspec(dllexport)
1341 #        else
1342 #           define PNG_IMPEXP __declspec(dllimport)
1343 #        endif
1344 #     endif
1345 #  endif  /* PNG_IMPEXP */
1346 #else /* !(DLL || non-cygwin WINDOWS) */
1347 #   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
1348 #      ifndef PNGAPI
1349 #         define PNGAPI _System
1350 #      endif
1351 #   else
1352 #      if 0 /* ... other platforms, with other meanings */
1353 #      endif
1354 #   endif
1355 #endif
1356 
1357 #ifndef PNGAPI
1358 #  define PNGAPI
1359 #endif
1360 #ifndef PNG_IMPEXP
1361 #  define PNG_IMPEXP
1362 #endif
1363 
1364 #ifdef PNG_BUILDSYMS
1365 #  ifndef PNG_EXPORT
1366 #    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
1367 #  endif
1368 #  ifdef PNG_USE_GLOBAL_ARRAYS
1369 #    ifndef PNG_EXPORT_VAR
1370 #      define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
1371 #    endif
1372 #  endif
1373 #endif
1374 
1375 #ifndef PNG_EXPORT
1376 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
1377 #endif
1378 
1379 #ifdef PNG_USE_GLOBAL_ARRAYS
1380 #  ifndef PNG_EXPORT_VAR
1381 #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
1382 #  endif
1383 #endif
1384 
1385 /* User may want to use these so they are not in PNG_INTERNAL. Any library
1386  * functions that are passed far data must be model independent.
1387  */
1388 
1389 #ifndef PNG_ABORT
1390 #  define PNG_ABORT() abort()
1391 #endif
1392 
1393 #ifdef PNG_SETJMP_SUPPORTED
1394 #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
1395 #else
1396 #  define png_jmpbuf(png_ptr) \
1397    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
1398 #endif
1399 
1400 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
1401 /* use this to make far-to-near assignments */
1402 #  define CHECK   1
1403 #  define NOCHECK 0
1404 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1405 #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
1406 #  define png_strcpy  _fstrcpy
1407 #  define png_strncpy _fstrncpy   /* Added to v 1.2.6 */
1408 #  define png_strlen  _fstrlen
1409 #  define png_memcmp  _fmemcmp    /* SJT: added */
1410 #  define png_memcpy  _fmemcpy
1411 #  define png_memset  _fmemset
1412 #else /* use the usual functions */
1413 #  define CVT_PTR(ptr)         (ptr)
1414 #  define CVT_PTR_NOCHECK(ptr) (ptr)
1415 #  define png_strcpy  strcpy
1416 #  define png_strncpy strncpy     /* Added to v 1.2.6 */
1417 #  define png_strlen  strlen
1418 #  define png_memcmp  memcmp      /* SJT: added */
1419 #  define png_memcpy  memcpy
1420 #  define png_memset  memset
1421 #endif
1422 /* End of memory model independent support */
1423 
1424 /* Just a little check that someone hasn't tried to define something
1425  * contradictory.
1426  */
1427 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
1428 #  undef PNG_ZBUF_SIZE
1429 #  define PNG_ZBUF_SIZE 65536L
1430 #endif
1431 
1432 #ifdef PNG_READ_SUPPORTED
1433 /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
1434 #if defined(PNG_INTERNAL)
1435 
1436 /* These are the default thresholds before the MMX code kicks in; if either
1437  * rowbytes or bitdepth is below the threshold, plain C code is used.  These
1438  * can be overridden at runtime via the png_set_mmx_thresholds() call in
1439  * libpng 1.2.0 and later.  The values below were chosen by Intel.
1440  */
1441 
1442 #ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
1443 #  define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT  128  /*  >=  */
1444 #endif
1445 #ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
1446 #  define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT  9    /*  >=  */
1447 #endif
1448 
1449 /* Set this in the makefile for VC++ on Pentium, not here. */
1450 /* Platform must be Pentium.  Makefile must assemble and load pngvcrd.c .
1451  * MMX will be detected at run time and used if present.
1452  */
1453 #ifdef PNG_USE_PNGVCRD
1454 #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
1455 #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
1456 #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
1457 #endif
1458 
1459 /* Set this in the makefile for gcc/as on Pentium, not here. */
1460 /* Platform must be Pentium.  Makefile must assemble and load pnggccrd.c .
1461  * MMX will be detected at run time and used if present.
1462  */
1463 #ifdef PNG_USE_PNGGCCRD
1464 #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
1465 #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
1466 #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
1467 #endif
1468 /* - see pnggccrd.c for info about what is currently enabled */
1469 
1470 #endif /* PNG_INTERNAL */
1471 #endif /* PNG_READ_SUPPORTED */
1472 
1473 /* Added at libpng-1.2.8 */
1474 #endif /* PNG_VERSION_INFO_ONLY */
1475 
1476 #endif /* PNGCONF_H */
1477