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