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