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