Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

308 lines
13 KiB

  1. /* pngstruct.h - header file for PNG reference library
  2. *
  3. * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  4. * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  5. * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  6. *
  7. * Last changed in libpng 1.5.0 [January 6, 2011]
  8. *
  9. * This code is released under the libpng license.
  10. * For conditions of distribution and use, see the disclaimer
  11. * and license in png.h
  12. */
  13. /* The structure that holds the information to read and write PNG files.
  14. * The only people who need to care about what is inside of this are the
  15. * people who will be modifying the library for their own special needs.
  16. * It should NOT be accessed directly by an application.
  17. */
  18. #ifndef PNGSTRUCT_H
  19. #define PNGSTRUCT_H
  20. /* zlib.h defines the structure z_stream, an instance of which is included
  21. * in this structure and is required for decompressing the LZ compressed
  22. * data in PNG files.
  23. */
  24. #include "../zlib-1.2.5/zlib.h"
  25. struct png_struct_def
  26. {
  27. #ifdef PNG_SETJMP_SUPPORTED
  28. jmp_buf png_jmpbuf; /* used in png_error */
  29. png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
  30. #endif
  31. png_error_ptr error_fn; /* function for printing errors and aborting */
  32. png_error_ptr warning_fn; /* function for printing warnings */
  33. png_voidp error_ptr; /* user supplied struct for error functions */
  34. png_rw_ptr write_data_fn; /* function for writing output data */
  35. png_rw_ptr read_data_fn; /* function for reading input data */
  36. png_voidp io_ptr; /* ptr to application struct for I/O functions */
  37. #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
  38. png_user_transform_ptr read_user_transform_fn; /* user read transform */
  39. #endif
  40. #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
  41. png_user_transform_ptr write_user_transform_fn; /* user write transform */
  42. #endif
  43. /* These were added in libpng-1.0.2 */
  44. #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
  45. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  46. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  47. png_voidp user_transform_ptr; /* user supplied struct for user transform */
  48. png_byte user_transform_depth; /* bit depth of user transformed pixels */
  49. png_byte user_transform_channels; /* channels in user transformed pixels */
  50. #endif
  51. #endif
  52. png_uint_32 mode; /* tells us where we are in the PNG file */
  53. png_uint_32 flags; /* flags indicating various things to libpng */
  54. png_uint_32 transformations; /* which transformations to perform */
  55. z_stream zstream; /* pointer to decompression structure (below) */
  56. png_bytep zbuf; /* buffer for zlib */
  57. uInt zbuf_size; /* size of zbuf (typically 65536) */
  58. int zlib_level; /* holds zlib compression level */
  59. int zlib_method; /* holds zlib compression method */
  60. int zlib_window_bits; /* holds zlib compression window bits */
  61. int zlib_mem_level; /* holds zlib compression memory level */
  62. int zlib_strategy; /* holds zlib compression strategy */
  63. png_uint_32 width; /* width of image in pixels */
  64. png_uint_32 height; /* height of image in pixels */
  65. png_uint_32 num_rows; /* number of rows in current pass */
  66. png_uint_32 usr_width; /* width of row at start of write */
  67. png_size_t rowbytes; /* size of row in bytes */
  68. png_uint_32 iwidth; /* width of current interlaced row in pixels */
  69. png_uint_32 row_number; /* current row in interlace pass */
  70. png_bytep prev_row; /* buffer to save previous (unfiltered) row */
  71. png_bytep row_buf; /* buffer to save current (unfiltered) row */
  72. png_bytep sub_row; /* buffer to save "sub" row when filtering */
  73. png_bytep up_row; /* buffer to save "up" row when filtering */
  74. png_bytep avg_row; /* buffer to save "avg" row when filtering */
  75. png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
  76. png_row_info row_info; /* used for transformation routines */
  77. png_uint_32 idat_size; /* current IDAT size for read */
  78. png_uint_32 crc; /* current chunk CRC value */
  79. png_colorp palette; /* palette from the input file */
  80. png_uint_16 num_palette; /* number of color entries in palette */
  81. png_uint_16 num_trans; /* number of transparency values */
  82. png_byte chunk_name[5]; /* null-terminated name of current chunk */
  83. png_byte compression; /* file compression type (always 0) */
  84. png_byte filter; /* file filter type (always 0) */
  85. png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  86. png_byte pass; /* current interlace pass (0 - 6) */
  87. png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
  88. png_byte color_type; /* color type of file */
  89. png_byte bit_depth; /* bit depth of file */
  90. png_byte usr_bit_depth; /* bit depth of users row */
  91. png_byte pixel_depth; /* number of bits per pixel */
  92. png_byte channels; /* number of channels in file */
  93. png_byte usr_channels; /* channels at start of write */
  94. png_byte sig_bytes; /* magic bytes read/written from start of file */
  95. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  96. png_uint_16 filler; /* filler bytes for pixel expansion */
  97. #endif
  98. #ifdef PNG_bKGD_SUPPORTED
  99. png_byte background_gamma_type;
  100. png_fixed_point background_gamma;
  101. png_color_16 background; /* background color in screen gamma space */
  102. #ifdef PNG_READ_GAMMA_SUPPORTED
  103. png_color_16 background_1; /* background normalized to gamma 1.0 */
  104. #endif
  105. #endif /* PNG_bKGD_SUPPORTED */
  106. #ifdef PNG_WRITE_FLUSH_SUPPORTED
  107. png_flush_ptr output_flush_fn; /* Function for flushing output */
  108. png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
  109. png_uint_32 flush_rows; /* number of rows written since last flush */
  110. #endif
  111. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  112. int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
  113. png_fixed_point gamma; /* file gamma value */
  114. png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
  115. #endif
  116. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  117. png_bytep gamma_table; /* gamma table for 8-bit depth files */
  118. png_bytep gamma_from_1; /* converts from 1.0 to screen */
  119. png_bytep gamma_to_1; /* converts from file to 1.0 */
  120. png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
  121. png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
  122. png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
  123. #endif
  124. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
  125. png_color_8 sig_bit; /* significant bits in each available channel */
  126. #endif
  127. #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
  128. png_color_8 shift; /* shift for significant bit tranformation */
  129. #endif
  130. #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
  131. || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  132. png_bytep trans_alpha; /* alpha values for paletted files */
  133. png_color_16 trans_color; /* transparent color for non-paletted files */
  134. #endif
  135. png_read_status_ptr read_row_fn; /* called after each row is decoded */
  136. png_write_status_ptr write_row_fn; /* called after each row is encoded */
  137. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  138. png_progressive_info_ptr info_fn; /* called after header data fully read */
  139. png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
  140. png_progressive_end_ptr end_fn; /* called after image is complete */
  141. png_bytep save_buffer_ptr; /* current location in save_buffer */
  142. png_bytep save_buffer; /* buffer for previously read data */
  143. png_bytep current_buffer_ptr; /* current location in current_buffer */
  144. png_bytep current_buffer; /* buffer for recently used data */
  145. png_uint_32 push_length; /* size of current input chunk */
  146. png_uint_32 skip_length; /* bytes to skip in input data */
  147. png_size_t save_buffer_size; /* amount of data now in save_buffer */
  148. png_size_t save_buffer_max; /* total size of save_buffer */
  149. png_size_t buffer_size; /* total amount of available input data */
  150. png_size_t current_buffer_size; /* amount of data now in current_buffer */
  151. int process_mode; /* what push library is currently doing */
  152. int cur_palette; /* current push library palette index */
  153. # ifdef PNG_TEXT_SUPPORTED
  154. png_size_t current_text_size; /* current size of text input data */
  155. png_size_t current_text_left; /* how much text left to read in input */
  156. png_charp current_text; /* current text chunk buffer */
  157. png_charp current_text_ptr; /* current location in current_text */
  158. # endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
  159. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  160. #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
  161. /* For the Borland special 64K segment handler */
  162. png_bytepp offset_table_ptr;
  163. png_bytep offset_table;
  164. png_uint_16 offset_table_number;
  165. png_uint_16 offset_table_count;
  166. png_uint_16 offset_table_count_free;
  167. #endif
  168. #ifdef PNG_READ_QUANTIZE_SUPPORTED
  169. png_bytep palette_lookup; /* lookup table for quantizing */
  170. png_bytep quantize_index; /* index translation for palette files */
  171. #endif
  172. #if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
  173. png_uint_16p hist; /* histogram */
  174. #endif
  175. #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
  176. png_byte heuristic_method; /* heuristic for row filter selection */
  177. png_byte num_prev_filters; /* number of weights for previous rows */
  178. png_bytep prev_filters; /* filter type(s) of previous row(s) */
  179. png_uint_16p filter_weights; /* weight(s) for previous line(s) */
  180. png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
  181. png_uint_16p filter_costs; /* relative filter calculation cost */
  182. png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
  183. #endif
  184. #ifdef PNG_TIME_RFC1123_SUPPORTED
  185. png_charp time_buffer; /* String to hold RFC 1123 time text */
  186. #endif
  187. /* New members added in libpng-1.0.6 */
  188. png_uint_32 free_me; /* flags items libpng is responsible for freeing */
  189. #ifdef PNG_USER_CHUNKS_SUPPORTED
  190. png_voidp user_chunk_ptr;
  191. png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
  192. #endif
  193. #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  194. int num_chunk_list;
  195. png_bytep chunk_list;
  196. #endif
  197. /* New members added in libpng-1.0.3 */
  198. #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
  199. png_byte rgb_to_gray_status;
  200. /* These were changed from png_byte in libpng-1.0.6 */
  201. png_uint_16 rgb_to_gray_red_coeff;
  202. png_uint_16 rgb_to_gray_green_coeff;
  203. png_uint_16 rgb_to_gray_blue_coeff;
  204. #endif
  205. /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
  206. #if defined(PNG_MNG_FEATURES_SUPPORTED) || \
  207. defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
  208. defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
  209. /* Changed from png_byte to png_uint_32 at version 1.2.0 */
  210. png_uint_32 mng_features_permitted;
  211. #endif
  212. /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
  213. #ifdef PNG_MNG_FEATURES_SUPPORTED
  214. png_byte filter_type;
  215. #endif
  216. /* New members added in libpng-1.2.0 */
  217. /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
  218. #ifdef PNG_USER_MEM_SUPPORTED
  219. png_voidp mem_ptr; /* user supplied struct for mem functions */
  220. png_malloc_ptr malloc_fn; /* function for allocating memory */
  221. png_free_ptr free_fn; /* function for freeing memory */
  222. #endif
  223. /* New member added in libpng-1.0.13 and 1.2.0 */
  224. png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
  225. #ifdef PNG_READ_QUANTIZE_SUPPORTED
  226. /* The following three members were added at version 1.0.14 and 1.2.4 */
  227. png_bytep quantize_sort; /* working sort array */
  228. png_bytep index_to_palette; /* where the original index currently is
  229. in the palette */
  230. png_bytep palette_to_index; /* which original index points to this
  231. palette color */
  232. #endif
  233. /* New members added in libpng-1.0.16 and 1.2.6 */
  234. png_byte compression_type;
  235. #ifdef PNG_USER_LIMITS_SUPPORTED
  236. png_uint_32 user_width_max;
  237. png_uint_32 user_height_max;
  238. /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
  239. * chunks that can be stored (0 means unlimited).
  240. */
  241. png_uint_32 user_chunk_cache_max;
  242. /* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
  243. * can occupy when decompressed. 0 means unlimited.
  244. */
  245. png_alloc_size_t user_chunk_malloc_max;
  246. #endif
  247. /* New member added in libpng-1.0.25 and 1.2.17 */
  248. #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
  249. /* Storage for unknown chunk that the library doesn't recognize. */
  250. png_unknown_chunk unknown_chunk;
  251. #endif
  252. /* New members added in libpng-1.2.26 */
  253. png_size_t old_big_row_buf_size;
  254. png_size_t old_prev_row_size;
  255. /* New member added in libpng-1.2.30 */
  256. png_charp chunkdata; /* buffer for reading chunk data */
  257. #ifdef PNG_IO_STATE_SUPPORTED
  258. /* New member added in libpng-1.4.0 */
  259. png_uint_32 io_state;
  260. #endif
  261. };
  262. #endif /* PNGSTRUCT_H */