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