pngstruct.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. /* pngstruct.h - header file for PNG reference library
  2. *
  3. * Last changed in libpng 1.6.18 [July 23, 2015]
  4. * Copyright (c) 1998-2015 Glenn Randers-Pehrson
  5. * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  6. * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  7. *
  8. * This code is released under the libpng license.
  9. * For conditions of distribution and use, see the disclaimer
  10. * and license in png.h
  11. */
  12. /* The structure that holds the information to read and write PNG files.
  13. * The only people who need to care about what is inside of this are the
  14. * people who will be modifying the library for their own special needs.
  15. * It should NOT be accessed directly by an application.
  16. */
  17. #ifndef PNGSTRUCT_H
  18. #define PNGSTRUCT_H
  19. /* zlib.h defines the structure z_stream, an instance of which is included
  20. * in this structure and is required for decompressing the LZ compressed
  21. * data in PNG files.
  22. */
  23. #ifndef ZLIB_CONST
  24. /* We must ensure that zlib uses 'const' in declarations. */
  25. # define ZLIB_CONST
  26. #endif
  27. #include "zlib.h"
  28. #ifdef const
  29. /* zlib.h sometimes #defines const to nothing, undo this. */
  30. # undef const
  31. #endif
  32. /* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility
  33. * with older builds.
  34. */
  35. #if ZLIB_VERNUM < 0x1260
  36. # define PNGZ_MSG_CAST(s) png_constcast(char*,s)
  37. # define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b)
  38. #else
  39. # define PNGZ_MSG_CAST(s) (s)
  40. # define PNGZ_INPUT_CAST(b) (b)
  41. #endif
  42. /* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
  43. * can handle at once. This type need be no larger than 16 bits (so maximum of
  44. * 65535), this define allows us to discover how big it is, but limited by the
  45. * maximuum for png_size_t. The value can be overriden in a library build
  46. * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
  47. * lower value (e.g. 255 works). A lower value may help memory usage (slightly)
  48. * and may even improve performance on some systems (and degrade it on others.)
  49. */
  50. #ifndef ZLIB_IO_MAX
  51. # define ZLIB_IO_MAX ((uInt)-1)
  52. #endif
  53. #ifdef PNG_WRITE_SUPPORTED
  54. /* The type of a compression buffer list used by the write code. */
  55. typedef struct png_compression_buffer
  56. {
  57. struct png_compression_buffer *next;
  58. png_byte output[1]; /* actually zbuf_size */
  59. } png_compression_buffer, *png_compression_bufferp;
  60. #define PNG_COMPRESSION_BUFFER_SIZE(pp)\
  61. (offsetof(png_compression_buffer, output) + (pp)->zbuffer_size)
  62. #endif
  63. /* Colorspace support; structures used in png_struct, png_info and in internal
  64. * functions to hold and communicate information about the color space.
  65. *
  66. * PNG_COLORSPACE_SUPPORTED is only required if the application will perform
  67. * colorspace corrections, otherwise all the colorspace information can be
  68. * skipped and the size of libpng can be reduced (significantly) by compiling
  69. * out the colorspace support.
  70. */
  71. #ifdef PNG_COLORSPACE_SUPPORTED
  72. /* The chromaticities of the red, green and blue colorants and the chromaticity
  73. * of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)).
  74. */
  75. typedef struct png_xy
  76. {
  77. png_fixed_point redx, redy;
  78. png_fixed_point greenx, greeny;
  79. png_fixed_point bluex, bluey;
  80. png_fixed_point whitex, whitey;
  81. } png_xy;
  82. /* The same data as above but encoded as CIE XYZ values. When this data comes
  83. * from chromaticities the sum of the Y values is assumed to be 1.0
  84. */
  85. typedef struct png_XYZ
  86. {
  87. png_fixed_point red_X, red_Y, red_Z;
  88. png_fixed_point green_X, green_Y, green_Z;
  89. png_fixed_point blue_X, blue_Y, blue_Z;
  90. } png_XYZ;
  91. #endif /* COLORSPACE */
  92. #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
  93. /* A colorspace is all the above plus, potentially, profile information;
  94. * however at present libpng does not use the profile internally so it is only
  95. * stored in the png_info struct (if iCCP is supported.) The rendering intent
  96. * is retained here and is checked.
  97. *
  98. * The file gamma encoding information is also stored here and gamma correction
  99. * is done by libpng, whereas color correction must currently be done by the
  100. * application.
  101. */
  102. typedef struct png_colorspace
  103. {
  104. #ifdef PNG_GAMMA_SUPPORTED
  105. png_fixed_point gamma; /* File gamma */
  106. #endif
  107. #ifdef PNG_COLORSPACE_SUPPORTED
  108. png_xy end_points_xy; /* End points as chromaticities */
  109. png_XYZ end_points_XYZ; /* End points as CIE XYZ colorant values */
  110. png_uint_16 rendering_intent; /* Rendering intent of a profile */
  111. #endif
  112. /* Flags are always defined to simplify the code. */
  113. png_uint_16 flags; /* As defined below */
  114. } png_colorspace, * PNG_RESTRICT png_colorspacerp;
  115. typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp;
  116. /* General flags for the 'flags' field */
  117. #define PNG_COLORSPACE_HAVE_GAMMA 0x0001
  118. #define PNG_COLORSPACE_HAVE_ENDPOINTS 0x0002
  119. #define PNG_COLORSPACE_HAVE_INTENT 0x0004
  120. #define PNG_COLORSPACE_FROM_gAMA 0x0008
  121. #define PNG_COLORSPACE_FROM_cHRM 0x0010
  122. #define PNG_COLORSPACE_FROM_sRGB 0x0020
  123. #define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
  124. #define PNG_COLORSPACE_MATCHES_sRGB 0x0080 /* exact match on profile */
  125. #define PNG_COLORSPACE_INVALID 0x8000
  126. #define PNG_COLORSPACE_CANCEL(flags) (0xffff ^ (flags))
  127. #endif /* COLORSPACE || GAMMA */
  128. #ifdef PNG_INDEX_SUPPORTED
  129. /* png_line_index_struct records an index point, where we impose an index point
  130. * to be located at the beginning of a line for simplifying the implementation.
  131. */
  132. typedef struct png_line_index_struct
  133. {
  134. // state of the lz decoder
  135. z_streamp z_state;
  136. // the IDAT header position of the chunk, which the index point is in
  137. png_uint_32 stream_idat_position;
  138. // we intend to record the offset of the index point in the chunk,
  139. // but we record the number of remaining bytes in the chunk after the
  140. // index point. That's because PNG processes a chunk this way.
  141. png_uint_32 bytes_left_in_idat;
  142. // decompressed data of the previous row
  143. png_bytep prev_row;
  144. } png_line_index;
  145. typedef png_line_index FAR * png_line_indexp;
  146. typedef struct png_index_struct
  147. {
  148. // A temporary variable used when we build the index. The variable records
  149. // the IDAT header position of the last chunk read in so far.
  150. png_uint_32 stream_idat_position;
  151. // line index information about each passes
  152. // the number of index points in each pass
  153. png_uint_32 size[7];
  154. // the line span of two index points of each pass
  155. png_uint_32 step[7];
  156. // the index points of each pass
  157. png_line_indexp *pass_line_index[7];
  158. } png_index;
  159. typedef png_index FAR * png_indexp;
  160. #define INDEX_SAMPLE_SIZE 254
  161. #endif
  162. struct png_struct_def
  163. {
  164. #ifdef PNG_SETJMP_SUPPORTED
  165. jmp_buf jmp_buf_local; /* New name in 1.6.0 for jmp_buf in png_struct */
  166. png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
  167. jmp_buf *jmp_buf_ptr; /* passed to longjmp_fn */
  168. size_t jmp_buf_size; /* size of the above, if allocated */
  169. #endif
  170. png_error_ptr error_fn; /* function for printing errors and aborting */
  171. #ifdef PNG_WARNINGS_SUPPORTED
  172. png_error_ptr warning_fn; /* function for printing warnings */
  173. #endif
  174. png_voidp error_ptr; /* user supplied struct for error functions */
  175. png_rw_ptr write_data_fn; /* function for writing output data */
  176. png_rw_ptr read_data_fn; /* function for reading input data */
  177. #ifdef PNG_INDEX_SUPPORTED
  178. png_seek_ptr seek_data_fn; /* function for seeking input data */
  179. #endif
  180. png_voidp io_ptr; /* ptr to application struct for I/O functions */
  181. #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
  182. png_user_transform_ptr read_user_transform_fn; /* user read transform */
  183. #endif
  184. #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
  185. png_user_transform_ptr write_user_transform_fn; /* user write transform */
  186. #endif
  187. /* These were added in libpng-1.0.2 */
  188. #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
  189. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  190. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  191. png_voidp user_transform_ptr; /* user supplied struct for user transform */
  192. png_byte user_transform_depth; /* bit depth of user transformed pixels */
  193. png_byte user_transform_channels; /* channels in user transformed pixels */
  194. #endif
  195. #endif
  196. png_uint_32 mode; /* tells us where we are in the PNG file */
  197. png_uint_32 flags; /* flags indicating various things to libpng */
  198. png_uint_32 transformations; /* which transformations to perform */
  199. png_uint_32 zowner; /* ID (chunk type) of zstream owner, 0 if none */
  200. z_stream zstream; /* decompression structure */
  201. #ifdef PNG_WRITE_SUPPORTED
  202. png_compression_bufferp zbuffer_list; /* Created on demand during write */
  203. uInt zbuffer_size; /* size of the actual buffer */
  204. int zlib_level; /* holds zlib compression level */
  205. int zlib_method; /* holds zlib compression method */
  206. int zlib_window_bits; /* holds zlib compression window bits */
  207. int zlib_mem_level; /* holds zlib compression memory level */
  208. int zlib_strategy; /* holds zlib compression strategy */
  209. #endif
  210. /* Added at libpng 1.5.4 */
  211. #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
  212. int zlib_text_level; /* holds zlib compression level */
  213. int zlib_text_method; /* holds zlib compression method */
  214. int zlib_text_window_bits; /* holds zlib compression window bits */
  215. int zlib_text_mem_level; /* holds zlib compression memory level */
  216. int zlib_text_strategy; /* holds zlib compression strategy */
  217. #endif
  218. /* End of material added at libpng 1.5.4 */
  219. /* Added at libpng 1.6.0 */
  220. #ifdef PNG_WRITE_SUPPORTED
  221. int zlib_set_level; /* Actual values set into the zstream on write */
  222. int zlib_set_method;
  223. int zlib_set_window_bits;
  224. int zlib_set_mem_level;
  225. int zlib_set_strategy;
  226. #endif
  227. png_uint_32 width; /* width of image in pixels */
  228. png_uint_32 height; /* height of image in pixels */
  229. png_uint_32 num_rows; /* number of rows in current pass */
  230. png_uint_32 usr_width; /* width of row at start of write */
  231. png_size_t rowbytes; /* size of row in bytes */
  232. png_uint_32 iwidth; /* width of current interlaced row in pixels */
  233. png_uint_32 row_number; /* current row in interlace pass */
  234. png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
  235. png_bytep prev_row; /* buffer to save previous (unfiltered) row.
  236. * While reading this is a pointer into
  237. * big_prev_row; while writing it is separately
  238. * allocated if needed.
  239. */
  240. png_bytep row_buf; /* buffer to save current (unfiltered) row.
  241. * While reading, this is a pointer into
  242. * big_row_buf; while writing it is separately
  243. * allocated.
  244. */
  245. #ifdef PNG_WRITE_FILTER_SUPPORTED
  246. png_bytep try_row; /* buffer to save trial row when filtering */
  247. png_bytep tst_row; /* buffer to save best trial row when filtering */
  248. #endif
  249. png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
  250. png_uint_32 idat_size; /* current IDAT size for read */
  251. png_uint_32 crc; /* current chunk CRC value */
  252. png_colorp palette; /* palette from the input file */
  253. png_uint_16 num_palette; /* number of color entries in palette */
  254. /* Added at libpng-1.5.10 */
  255. #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
  256. int num_palette_max; /* maximum palette index found in IDAT */
  257. #endif
  258. png_uint_16 num_trans; /* number of transparency values */
  259. png_byte compression; /* file compression type (always 0) */
  260. png_byte filter; /* file filter type (always 0) */
  261. png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  262. png_byte pass; /* current interlace pass (0 - 6) */
  263. png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
  264. png_byte color_type; /* color type of file */
  265. png_byte bit_depth; /* bit depth of file */
  266. png_byte usr_bit_depth; /* bit depth of users row: write only */
  267. png_byte pixel_depth; /* number of bits per pixel */
  268. png_byte channels; /* number of channels in file */
  269. #ifdef PNG_WRITE_SUPPORTED
  270. png_byte usr_channels; /* channels at start of write: write only */
  271. #endif
  272. png_byte sig_bytes; /* magic bytes read/written from start of file */
  273. png_byte maximum_pixel_depth;
  274. /* pixel depth used for the row buffers */
  275. png_byte transformed_pixel_depth;
  276. /* pixel depth after read/write transforms */
  277. #if PNG_ZLIB_VERNUM >= 0x1240
  278. png_byte zstream_start; /* at start of an input zlib stream */
  279. #endif /* Zlib >= 1.2.4 */
  280. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  281. png_uint_16 filler; /* filler bytes for pixel expansion */
  282. #endif
  283. #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
  284. defined(PNG_READ_ALPHA_MODE_SUPPORTED)
  285. png_byte background_gamma_type;
  286. png_fixed_point background_gamma;
  287. png_color_16 background; /* background color in screen gamma space */
  288. #ifdef PNG_READ_GAMMA_SUPPORTED
  289. png_color_16 background_1; /* background normalized to gamma 1.0 */
  290. #endif
  291. #endif /* bKGD */
  292. #ifdef PNG_WRITE_FLUSH_SUPPORTED
  293. png_flush_ptr output_flush_fn; /* Function for flushing output */
  294. png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
  295. png_uint_32 flush_rows; /* number of rows written since last flush */
  296. #endif
  297. #ifdef PNG_READ_GAMMA_SUPPORTED
  298. int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
  299. png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
  300. png_bytep gamma_table; /* gamma table for 8-bit depth files */
  301. png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
  302. #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
  303. defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
  304. defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
  305. png_bytep gamma_from_1; /* converts from 1.0 to screen */
  306. png_bytep gamma_to_1; /* converts from file to 1.0 */
  307. png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
  308. png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
  309. #endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
  310. #endif
  311. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
  312. png_color_8 sig_bit; /* significant bits in each available channel */
  313. #endif
  314. #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
  315. png_color_8 shift; /* shift for significant bit tranformation */
  316. #endif
  317. #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
  318. || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  319. png_bytep trans_alpha; /* alpha values for paletted files */
  320. png_color_16 trans_color; /* transparent color for non-paletted files */
  321. #endif
  322. png_read_status_ptr read_row_fn; /* called after each row is decoded */
  323. png_write_status_ptr write_row_fn; /* called after each row is encoded */
  324. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  325. png_progressive_info_ptr info_fn; /* called after header data fully read */
  326. png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
  327. png_progressive_end_ptr end_fn; /* called after image is complete */
  328. png_bytep save_buffer_ptr; /* current location in save_buffer */
  329. png_bytep save_buffer; /* buffer for previously read data */
  330. png_bytep current_buffer_ptr; /* current location in current_buffer */
  331. png_bytep current_buffer; /* buffer for recently used data */
  332. png_uint_32 push_length; /* size of current input chunk */
  333. png_uint_32 skip_length; /* bytes to skip in input data */
  334. png_size_t save_buffer_size; /* amount of data now in save_buffer */
  335. png_size_t save_buffer_max; /* total size of save_buffer */
  336. png_size_t buffer_size; /* total amount of available input data */
  337. png_size_t current_buffer_size; /* amount of data now in current_buffer */
  338. int process_mode; /* what push library is currently doing */
  339. int cur_palette; /* current push library palette index */
  340. #endif /* PROGRESSIVE_READ */
  341. #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
  342. /* For the Borland special 64K segment handler */
  343. png_bytepp offset_table_ptr;
  344. png_bytep offset_table;
  345. png_uint_16 offset_table_number;
  346. png_uint_16 offset_table_count;
  347. png_uint_16 offset_table_count_free;
  348. #endif
  349. #ifdef PNG_READ_QUANTIZE_SUPPORTED
  350. png_bytep palette_lookup; /* lookup table for quantizing */
  351. png_bytep quantize_index; /* index translation for palette files */
  352. #endif
  353. /* Options */
  354. #ifdef PNG_SET_OPTION_SUPPORTED
  355. png_byte options; /* On/off state (up to 4 options) */
  356. #endif
  357. #if PNG_LIBPNG_VER < 10700
  358. /* To do: remove this from libpng-1.7 */
  359. #ifdef PNG_TIME_RFC1123_SUPPORTED
  360. char time_buffer[29]; /* String to hold RFC 1123 time text */
  361. #endif
  362. #endif
  363. /* New members added in libpng-1.0.6 */
  364. png_uint_32 free_me; /* flags items libpng is responsible for freeing */
  365. #ifdef PNG_USER_CHUNKS_SUPPORTED
  366. png_voidp user_chunk_ptr;
  367. #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
  368. png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
  369. #endif
  370. #endif
  371. #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
  372. int unknown_default; /* As PNG_HANDLE_* */
  373. unsigned int num_chunk_list; /* Number of entries in the list */
  374. png_bytep chunk_list; /* List of png_byte[5]; the textual chunk name
  375. * followed by a PNG_HANDLE_* byte */
  376. #endif
  377. /* New members added in libpng-1.0.3 */
  378. #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
  379. png_byte rgb_to_gray_status;
  380. /* Added in libpng 1.5.5 to record setting of coefficients: */
  381. png_byte rgb_to_gray_coefficients_set;
  382. /* These were changed from png_byte in libpng-1.0.6 */
  383. png_uint_16 rgb_to_gray_red_coeff;
  384. png_uint_16 rgb_to_gray_green_coeff;
  385. /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
  386. #endif
  387. /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
  388. #if defined(PNG_MNG_FEATURES_SUPPORTED)
  389. /* Changed from png_byte to png_uint_32 at version 1.2.0 */
  390. png_uint_32 mng_features_permitted;
  391. #endif
  392. /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
  393. #ifdef PNG_MNG_FEATURES_SUPPORTED
  394. png_byte filter_type;
  395. #endif
  396. /* New members added in libpng-1.2.0 */
  397. /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
  398. #ifdef PNG_USER_MEM_SUPPORTED
  399. png_voidp mem_ptr; /* user supplied struct for mem functions */
  400. png_malloc_ptr malloc_fn; /* function for allocating memory */
  401. png_free_ptr free_fn; /* function for freeing memory */
  402. #endif
  403. /* New member added in libpng-1.0.13 and 1.2.0 */
  404. png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
  405. #ifdef PNG_READ_QUANTIZE_SUPPORTED
  406. /* The following three members were added at version 1.0.14 and 1.2.4 */
  407. png_bytep quantize_sort; /* working sort array */
  408. png_bytep index_to_palette; /* where the original index currently is
  409. in the palette */
  410. png_bytep palette_to_index; /* which original index points to this
  411. palette color */
  412. #endif
  413. /* New members added in libpng-1.0.16 and 1.2.6 */
  414. png_byte compression_type;
  415. #ifdef PNG_USER_LIMITS_SUPPORTED
  416. png_uint_32 user_width_max;
  417. png_uint_32 user_height_max;
  418. /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
  419. * chunks that can be stored (0 means unlimited).
  420. */
  421. png_uint_32 user_chunk_cache_max;
  422. /* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
  423. * can occupy when decompressed. 0 means unlimited.
  424. */
  425. png_alloc_size_t user_chunk_malloc_max;
  426. #endif
  427. /* New member added in libpng-1.0.25 and 1.2.17 */
  428. #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
  429. /* Temporary storage for unknown chunk that the library doesn't recognize,
  430. * used while reading the chunk.
  431. */
  432. png_unknown_chunk unknown_chunk;
  433. #endif
  434. /* New member added in libpng-1.2.26 */
  435. png_size_t old_big_row_buf_size;
  436. #ifdef PNG_READ_SUPPORTED
  437. /* New member added in libpng-1.2.30 */
  438. png_bytep read_buffer; /* buffer for reading chunk data */
  439. png_alloc_size_t read_buffer_size; /* current size of the buffer */
  440. #endif
  441. #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
  442. uInt IDAT_read_size; /* limit on read buffer size for IDAT */
  443. #endif
  444. #ifdef PNG_IO_STATE_SUPPORTED
  445. /* New member added in libpng-1.4.0 */
  446. png_uint_32 io_state;
  447. #endif
  448. /* New member added in libpng-1.5.6 */
  449. png_bytep big_prev_row;
  450. /* New member added in libpng-1.5.7 */
  451. void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
  452. png_bytep row, png_const_bytep prev_row);
  453. #ifdef PNG_READ_SUPPORTED
  454. #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
  455. png_colorspace colorspace;
  456. #endif
  457. #endif
  458. #ifdef PNG_INDEX_SUPPORTED
  459. png_indexp index;
  460. png_uint_32 total_data_read;
  461. #endif
  462. };
  463. #endif /* PNGSTRUCT_H */