blob: d397329a53cd07e4c85dc8b263447c7ea960ea53 [file] [log] [blame]
The Android Open Source Project893912b2009-03-03 19:30:05 -08001
2/* pngget.c - retrieval of values from info struct
3 *
Patrick Scott5f6bd842010-06-28 16:55:16 -04004 * Last changed in libpng 1.2.43 [February 25, 2010]
5 * Copyright (c) 1998-2010 Glenn Randers-Pehrson
The Android Open Source Project893912b2009-03-03 19:30:05 -08006 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Patrick Scotta0bb96c2009-07-22 11:50:02 -04008 *
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 *
The Android Open Source Project893912b2009-03-03 19:30:05 -080013 */
14
15#define PNG_INTERNAL
Patrick Scott5f6bd842010-06-28 16:55:16 -040016#define PNG_NO_PEDANTIC_WARNINGS
The Android Open Source Project893912b2009-03-03 19:30:05 -080017#include "png.h"
The Android Open Source Project893912b2009-03-03 19:30:05 -080018#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
19
20png_uint_32 PNGAPI
21png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
22{
23 if (png_ptr != NULL && info_ptr != NULL)
24 return(info_ptr->valid & flag);
Patrick Scotta0bb96c2009-07-22 11:50:02 -040025
The Android Open Source Project893912b2009-03-03 19:30:05 -080026 else
27 return(0);
28}
29
30png_uint_32 PNGAPI
31png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
32{
33 if (png_ptr != NULL && info_ptr != NULL)
34 return(info_ptr->rowbytes);
Patrick Scotta0bb96c2009-07-22 11:50:02 -040035
The Android Open Source Project893912b2009-03-03 19:30:05 -080036 else
37 return(0);
38}
39
Patrick Scott5f6bd842010-06-28 16:55:16 -040040#ifdef PNG_INFO_IMAGE_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -080041png_bytepp PNGAPI
42png_get_rows(png_structp png_ptr, png_infop info_ptr)
43{
44 if (png_ptr != NULL && info_ptr != NULL)
45 return(info_ptr->row_pointers);
Patrick Scotta0bb96c2009-07-22 11:50:02 -040046
The Android Open Source Project893912b2009-03-03 19:30:05 -080047 else
48 return(0);
49}
50#endif
51
52#ifdef PNG_EASY_ACCESS_SUPPORTED
Patrick Scotta0bb96c2009-07-22 11:50:02 -040053/* Easy access to info, added in libpng-0.99 */
The Android Open Source Project893912b2009-03-03 19:30:05 -080054png_uint_32 PNGAPI
55png_get_image_width(png_structp png_ptr, png_infop info_ptr)
56{
57 if (png_ptr != NULL && info_ptr != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -080058 return info_ptr->width;
Patrick Scotta0bb96c2009-07-22 11:50:02 -040059
The Android Open Source Project893912b2009-03-03 19:30:05 -080060 return (0);
61}
62
63png_uint_32 PNGAPI
64png_get_image_height(png_structp png_ptr, png_infop info_ptr)
65{
66 if (png_ptr != NULL && info_ptr != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -080067 return info_ptr->height;
Patrick Scotta0bb96c2009-07-22 11:50:02 -040068
The Android Open Source Project893912b2009-03-03 19:30:05 -080069 return (0);
70}
71
72png_byte PNGAPI
73png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
74{
75 if (png_ptr != NULL && info_ptr != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -080076 return info_ptr->bit_depth;
Patrick Scotta0bb96c2009-07-22 11:50:02 -040077
The Android Open Source Project893912b2009-03-03 19:30:05 -080078 return (0);
79}
80
81png_byte PNGAPI
82png_get_color_type(png_structp png_ptr, png_infop info_ptr)
83{
84 if (png_ptr != NULL && info_ptr != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -080085 return info_ptr->color_type;
Patrick Scotta0bb96c2009-07-22 11:50:02 -040086
The Android Open Source Project893912b2009-03-03 19:30:05 -080087 return (0);
88}
89
90png_byte PNGAPI
91png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
92{
93 if (png_ptr != NULL && info_ptr != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -080094 return info_ptr->filter_type;
Patrick Scotta0bb96c2009-07-22 11:50:02 -040095
The Android Open Source Project893912b2009-03-03 19:30:05 -080096 return (0);
97}
98
99png_byte PNGAPI
100png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
101{
102 if (png_ptr != NULL && info_ptr != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800103 return info_ptr->interlace_type;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400104
The Android Open Source Project893912b2009-03-03 19:30:05 -0800105 return (0);
106}
107
108png_byte PNGAPI
109png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
110{
111 if (png_ptr != NULL && info_ptr != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800112 return info_ptr->compression_type;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400113
The Android Open Source Project893912b2009-03-03 19:30:05 -0800114 return (0);
115}
116
117png_uint_32 PNGAPI
118png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
119{
120 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scott5f6bd842010-06-28 16:55:16 -0400121#ifdef PNG_pHYs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800122 if (info_ptr->valid & PNG_INFO_pHYs)
123 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700124 png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400125
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700126 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800127 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400128
129 else
130 return (info_ptr->x_pixels_per_unit);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800131 }
132#else
133 return (0);
134#endif
135 return (0);
136}
137
138png_uint_32 PNGAPI
139png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
140{
141 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scott5f6bd842010-06-28 16:55:16 -0400142#ifdef PNG_pHYs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800143 if (info_ptr->valid & PNG_INFO_pHYs)
144 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700145 png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400146
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700147 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800148 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400149
150 else
151 return (info_ptr->y_pixels_per_unit);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800152 }
153#else
154 return (0);
155#endif
156 return (0);
157}
158
159png_uint_32 PNGAPI
160png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
161{
162 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scott5f6bd842010-06-28 16:55:16 -0400163#ifdef PNG_pHYs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800164 if (info_ptr->valid & PNG_INFO_pHYs)
165 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700166 png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400167
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700168 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
The Android Open Source Project893912b2009-03-03 19:30:05 -0800169 info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
170 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400171
172 else
173 return (info_ptr->x_pixels_per_unit);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800174 }
175#else
176 return (0);
177#endif
178 return (0);
179}
180
181#ifdef PNG_FLOATING_POINT_SUPPORTED
182float PNGAPI
183png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
184 {
185 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scott5f6bd842010-06-28 16:55:16 -0400186#ifdef PNG_pHYs_SUPPORTED
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400187
The Android Open Source Project893912b2009-03-03 19:30:05 -0800188 if (info_ptr->valid & PNG_INFO_pHYs)
189 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700190 png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
Patrick Scott5f6bd842010-06-28 16:55:16 -0400191
The Android Open Source Project893912b2009-03-03 19:30:05 -0800192 if (info_ptr->x_pixels_per_unit == 0)
193 return ((float)0.0);
Patrick Scott5f6bd842010-06-28 16:55:16 -0400194
The Android Open Source Project893912b2009-03-03 19:30:05 -0800195 else
196 return ((float)((float)info_ptr->y_pixels_per_unit
197 /(float)info_ptr->x_pixels_per_unit));
198 }
199#else
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400200 return (0.0);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800201#endif
202 return ((float)0.0);
203}
204#endif
205
206png_int_32 PNGAPI
207png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
208{
209 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scott5f6bd842010-06-28 16:55:16 -0400210#ifdef PNG_oFFs_SUPPORTED
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400211
The Android Open Source Project893912b2009-03-03 19:30:05 -0800212 if (info_ptr->valid & PNG_INFO_oFFs)
213 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700214 png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400215
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700216 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800217 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400218
219 else
220 return (info_ptr->x_offset);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800221 }
222#else
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400223 return (0);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800224#endif
225 return (0);
226}
227
228png_int_32 PNGAPI
229png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
230{
231 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400232
Patrick Scott5f6bd842010-06-28 16:55:16 -0400233#ifdef PNG_oFFs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800234 if (info_ptr->valid & PNG_INFO_oFFs)
235 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700236 png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400237
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700238 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800239 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400240
241 else
242 return (info_ptr->y_offset);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800243 }
244#else
245 return (0);
246#endif
247 return (0);
248}
249
250png_int_32 PNGAPI
251png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
252{
253 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400254
Patrick Scott5f6bd842010-06-28 16:55:16 -0400255#ifdef PNG_oFFs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800256 if (info_ptr->valid & PNG_INFO_oFFs)
257 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700258 png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400259
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700260 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800261 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400262
263 else
264 return (info_ptr->x_offset);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800265 }
266#else
267 return (0);
268#endif
269 return (0);
270}
271
272png_int_32 PNGAPI
273png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
274{
275 if (png_ptr != NULL && info_ptr != NULL)
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400276
Patrick Scott5f6bd842010-06-28 16:55:16 -0400277#ifdef PNG_oFFs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800278 if (info_ptr->valid & PNG_INFO_oFFs)
279 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700280 png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400281
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700282 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800283 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400284
285 else
286 return (info_ptr->y_offset);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800287 }
288#else
289 return (0);
290#endif
291 return (0);
292}
293
294#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
295png_uint_32 PNGAPI
296png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
297{
298 return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
299 *.0254 +.5));
300}
301
302png_uint_32 PNGAPI
303png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
304{
305 return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
306 *.0254 +.5));
307}
308
309png_uint_32 PNGAPI
310png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
311{
312 return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
313 *.0254 +.5));
314}
315
316float PNGAPI
317png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
318{
319 return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
320 *.00003937);
321}
322
323float PNGAPI
324png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
325{
326 return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
327 *.00003937);
328}
329
Patrick Scott5f6bd842010-06-28 16:55:16 -0400330#ifdef PNG_pHYs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800331png_uint_32 PNGAPI
332png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
333 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
334{
335 png_uint_32 retval = 0;
336
337 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
338 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700339 png_debug1(1, "in %s retrieval function", "pHYs");
Patrick Scott5f6bd842010-06-28 16:55:16 -0400340
The Android Open Source Project893912b2009-03-03 19:30:05 -0800341 if (res_x != NULL)
342 {
343 *res_x = info_ptr->x_pixels_per_unit;
344 retval |= PNG_INFO_pHYs;
345 }
346 if (res_y != NULL)
347 {
348 *res_y = info_ptr->y_pixels_per_unit;
349 retval |= PNG_INFO_pHYs;
350 }
351 if (unit_type != NULL)
352 {
353 *unit_type = (int)info_ptr->phys_unit_type;
354 retval |= PNG_INFO_pHYs;
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700355 if (*unit_type == 1)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800356 {
357 if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
358 if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
359 }
360 }
361 }
362 return (retval);
363}
364#endif /* PNG_pHYs_SUPPORTED */
365#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
366
367/* png_get_channels really belongs in here, too, but it's been around longer */
368
369#endif /* PNG_EASY_ACCESS_SUPPORTED */
370
371png_byte PNGAPI
372png_get_channels(png_structp png_ptr, png_infop info_ptr)
373{
374 if (png_ptr != NULL && info_ptr != NULL)
375 return(info_ptr->channels);
376 else
377 return (0);
378}
379
380png_bytep PNGAPI
381png_get_signature(png_structp png_ptr, png_infop info_ptr)
382{
383 if (png_ptr != NULL && info_ptr != NULL)
384 return(info_ptr->signature);
385 else
386 return (NULL);
387}
388
Patrick Scott5f6bd842010-06-28 16:55:16 -0400389#ifdef PNG_bKGD_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800390png_uint_32 PNGAPI
391png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
392 png_color_16p *background)
393{
394 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
395 && background != NULL)
396 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700397 png_debug1(1, "in %s retrieval function", "bKGD");
Patrick Scott5f6bd842010-06-28 16:55:16 -0400398
The Android Open Source Project893912b2009-03-03 19:30:05 -0800399 *background = &(info_ptr->background);
400 return (PNG_INFO_bKGD);
401 }
402 return (0);
403}
404#endif
405
Patrick Scott5f6bd842010-06-28 16:55:16 -0400406#ifdef PNG_cHRM_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800407#ifdef PNG_FLOATING_POINT_SUPPORTED
408png_uint_32 PNGAPI
409png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
410 double *white_x, double *white_y, double *red_x, double *red_y,
411 double *green_x, double *green_y, double *blue_x, double *blue_y)
412{
413 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
414 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700415 png_debug1(1, "in %s retrieval function", "cHRM");
Patrick Scott5f6bd842010-06-28 16:55:16 -0400416
The Android Open Source Project893912b2009-03-03 19:30:05 -0800417 if (white_x != NULL)
418 *white_x = (double)info_ptr->x_white;
419 if (white_y != NULL)
420 *white_y = (double)info_ptr->y_white;
421 if (red_x != NULL)
422 *red_x = (double)info_ptr->x_red;
423 if (red_y != NULL)
424 *red_y = (double)info_ptr->y_red;
425 if (green_x != NULL)
426 *green_x = (double)info_ptr->x_green;
427 if (green_y != NULL)
428 *green_y = (double)info_ptr->y_green;
429 if (blue_x != NULL)
430 *blue_x = (double)info_ptr->x_blue;
431 if (blue_y != NULL)
432 *blue_y = (double)info_ptr->y_blue;
433 return (PNG_INFO_cHRM);
434 }
435 return (0);
436}
437#endif
438#ifdef PNG_FIXED_POINT_SUPPORTED
439png_uint_32 PNGAPI
440png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
441 png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
442 png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
443 png_fixed_point *blue_x, png_fixed_point *blue_y)
444{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400445 png_debug1(1, "in %s retrieval function", "cHRM");
446
The Android Open Source Project893912b2009-03-03 19:30:05 -0800447 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
448 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800449 if (white_x != NULL)
450 *white_x = info_ptr->int_x_white;
451 if (white_y != NULL)
452 *white_y = info_ptr->int_y_white;
453 if (red_x != NULL)
454 *red_x = info_ptr->int_x_red;
455 if (red_y != NULL)
456 *red_y = info_ptr->int_y_red;
457 if (green_x != NULL)
458 *green_x = info_ptr->int_x_green;
459 if (green_y != NULL)
460 *green_y = info_ptr->int_y_green;
461 if (blue_x != NULL)
462 *blue_x = info_ptr->int_x_blue;
463 if (blue_y != NULL)
464 *blue_y = info_ptr->int_y_blue;
465 return (PNG_INFO_cHRM);
466 }
467 return (0);
468}
469#endif
470#endif
471
Patrick Scott5f6bd842010-06-28 16:55:16 -0400472#ifdef PNG_gAMA_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800473#ifdef PNG_FLOATING_POINT_SUPPORTED
474png_uint_32 PNGAPI
475png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
476{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400477 png_debug1(1, "in %s retrieval function", "gAMA");
478
The Android Open Source Project893912b2009-03-03 19:30:05 -0800479 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
480 && file_gamma != NULL)
481 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800482 *file_gamma = (double)info_ptr->gamma;
483 return (PNG_INFO_gAMA);
484 }
485 return (0);
486}
487#endif
488#ifdef PNG_FIXED_POINT_SUPPORTED
489png_uint_32 PNGAPI
490png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
491 png_fixed_point *int_file_gamma)
492{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400493 png_debug1(1, "in %s retrieval function", "gAMA");
494
The Android Open Source Project893912b2009-03-03 19:30:05 -0800495 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
496 && int_file_gamma != NULL)
497 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800498 *int_file_gamma = info_ptr->int_gamma;
499 return (PNG_INFO_gAMA);
500 }
501 return (0);
502}
503#endif
504#endif
505
Patrick Scott5f6bd842010-06-28 16:55:16 -0400506#ifdef PNG_sRGB_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800507png_uint_32 PNGAPI
508png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
509{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400510 png_debug1(1, "in %s retrieval function", "sRGB");
511
The Android Open Source Project893912b2009-03-03 19:30:05 -0800512 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
513 && file_srgb_intent != NULL)
514 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800515 *file_srgb_intent = (int)info_ptr->srgb_intent;
516 return (PNG_INFO_sRGB);
517 }
518 return (0);
519}
520#endif
521
Patrick Scott5f6bd842010-06-28 16:55:16 -0400522#ifdef PNG_iCCP_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800523png_uint_32 PNGAPI
524png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
525 png_charpp name, int *compression_type,
526 png_charpp profile, png_uint_32 *proflen)
527{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400528 png_debug1(1, "in %s retrieval function", "iCCP");
529
The Android Open Source Project893912b2009-03-03 19:30:05 -0800530 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
531 && name != NULL && profile != NULL && proflen != NULL)
532 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800533 *name = info_ptr->iccp_name;
534 *profile = info_ptr->iccp_profile;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400535 /* Compression_type is a dummy so the API won't have to change
536 * if we introduce multiple compression types later.
537 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800538 *proflen = (int)info_ptr->iccp_proflen;
539 *compression_type = (int)info_ptr->iccp_compression;
540 return (PNG_INFO_iCCP);
541 }
542 return (0);
543}
544#endif
545
Patrick Scott5f6bd842010-06-28 16:55:16 -0400546#ifdef PNG_sPLT_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800547png_uint_32 PNGAPI
548png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
549 png_sPLT_tpp spalettes)
550{
551 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
552 {
553 *spalettes = info_ptr->splt_palettes;
554 return ((png_uint_32)info_ptr->splt_palettes_num);
555 }
556 return (0);
557}
558#endif
559
Patrick Scott5f6bd842010-06-28 16:55:16 -0400560#ifdef PNG_hIST_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800561png_uint_32 PNGAPI
562png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
563{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400564 png_debug1(1, "in %s retrieval function", "hIST");
565
The Android Open Source Project893912b2009-03-03 19:30:05 -0800566 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
567 && hist != NULL)
568 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800569 *hist = info_ptr->hist;
570 return (PNG_INFO_hIST);
571 }
572 return (0);
573}
574#endif
575
576png_uint_32 PNGAPI
577png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
578 png_uint_32 *width, png_uint_32 *height, int *bit_depth,
579 int *color_type, int *interlace_type, int *compression_type,
580 int *filter_type)
581
582{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400583 png_debug1(1, "in %s retrieval function", "IHDR");
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400584
Patrick Scott5f6bd842010-06-28 16:55:16 -0400585 if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
586 height == NULL || bit_depth == NULL || color_type == NULL)
587 return (0);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400588
Patrick Scott5f6bd842010-06-28 16:55:16 -0400589 *width = info_ptr->width;
590 *height = info_ptr->height;
591 *bit_depth = info_ptr->bit_depth;
592 *color_type = info_ptr->color_type;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400593
Patrick Scott5f6bd842010-06-28 16:55:16 -0400594 if (compression_type != NULL)
595 *compression_type = info_ptr->compression_type;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400596
Patrick Scott5f6bd842010-06-28 16:55:16 -0400597 if (filter_type != NULL)
598 *filter_type = info_ptr->filter_type;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400599
Patrick Scott5f6bd842010-06-28 16:55:16 -0400600 if (interlace_type != NULL)
601 *interlace_type = info_ptr->interlace_type;
The Android Open Source Project893912b2009-03-03 19:30:05 -0800602
Patrick Scott5f6bd842010-06-28 16:55:16 -0400603 /* This is redundant if we can be sure that the info_ptr values were all
604 * assigned in png_set_IHDR(). We do the check anyhow in case an
605 * application has ignored our advice not to mess with the members
606 * of info_ptr directly.
607 */
608 png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
609 info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
610 info_ptr->compression_type, info_ptr->filter_type);
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400611
Patrick Scott5f6bd842010-06-28 16:55:16 -0400612 return (1);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800613}
614
Patrick Scott5f6bd842010-06-28 16:55:16 -0400615#ifdef PNG_oFFs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800616png_uint_32 PNGAPI
617png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
618 png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
619{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400620 png_debug1(1, "in %s retrieval function", "oFFs");
621
The Android Open Source Project893912b2009-03-03 19:30:05 -0800622 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
623 && offset_x != NULL && offset_y != NULL && unit_type != NULL)
624 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800625 *offset_x = info_ptr->x_offset;
626 *offset_y = info_ptr->y_offset;
627 *unit_type = (int)info_ptr->offset_unit_type;
628 return (PNG_INFO_oFFs);
629 }
630 return (0);
631}
632#endif
633
Patrick Scott5f6bd842010-06-28 16:55:16 -0400634#ifdef PNG_pCAL_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800635png_uint_32 PNGAPI
636png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
637 png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
638 png_charp *units, png_charpp *params)
639{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400640 png_debug1(1, "in %s retrieval function", "pCAL");
641
The Android Open Source Project893912b2009-03-03 19:30:05 -0800642 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400643 && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
644 nparams != NULL && units != NULL && params != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800645 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800646 *purpose = info_ptr->pcal_purpose;
647 *X0 = info_ptr->pcal_X0;
648 *X1 = info_ptr->pcal_X1;
649 *type = (int)info_ptr->pcal_type;
650 *nparams = (int)info_ptr->pcal_nparams;
651 *units = info_ptr->pcal_units;
652 *params = info_ptr->pcal_params;
653 return (PNG_INFO_pCAL);
654 }
655 return (0);
656}
657#endif
658
Patrick Scott5f6bd842010-06-28 16:55:16 -0400659#ifdef PNG_sCAL_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800660#ifdef PNG_FLOATING_POINT_SUPPORTED
661png_uint_32 PNGAPI
662png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
663 int *unit, double *width, double *height)
664{
665 if (png_ptr != NULL && info_ptr != NULL &&
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400666 (info_ptr->valid & PNG_INFO_sCAL))
The Android Open Source Project893912b2009-03-03 19:30:05 -0800667 {
668 *unit = info_ptr->scal_unit;
669 *width = info_ptr->scal_pixel_width;
670 *height = info_ptr->scal_pixel_height;
671 return (PNG_INFO_sCAL);
672 }
673 return(0);
674}
675#else
676#ifdef PNG_FIXED_POINT_SUPPORTED
677png_uint_32 PNGAPI
678png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
679 int *unit, png_charpp width, png_charpp height)
680{
681 if (png_ptr != NULL && info_ptr != NULL &&
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400682 (info_ptr->valid & PNG_INFO_sCAL))
The Android Open Source Project893912b2009-03-03 19:30:05 -0800683 {
684 *unit = info_ptr->scal_unit;
685 *width = info_ptr->scal_s_width;
686 *height = info_ptr->scal_s_height;
687 return (PNG_INFO_sCAL);
688 }
689 return(0);
690}
691#endif
692#endif
693#endif
694
Patrick Scott5f6bd842010-06-28 16:55:16 -0400695#ifdef PNG_pHYs_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800696png_uint_32 PNGAPI
697png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
698 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
699{
700 png_uint_32 retval = 0;
701
Patrick Scott5f6bd842010-06-28 16:55:16 -0400702 png_debug1(1, "in %s retrieval function", "pHYs");
703
The Android Open Source Project893912b2009-03-03 19:30:05 -0800704 if (png_ptr != NULL && info_ptr != NULL &&
705 (info_ptr->valid & PNG_INFO_pHYs))
706 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800707 if (res_x != NULL)
708 {
709 *res_x = info_ptr->x_pixels_per_unit;
710 retval |= PNG_INFO_pHYs;
711 }
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400712
The Android Open Source Project893912b2009-03-03 19:30:05 -0800713 if (res_y != NULL)
714 {
715 *res_y = info_ptr->y_pixels_per_unit;
716 retval |= PNG_INFO_pHYs;
717 }
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400718
The Android Open Source Project893912b2009-03-03 19:30:05 -0800719 if (unit_type != NULL)
720 {
721 *unit_type = (int)info_ptr->phys_unit_type;
722 retval |= PNG_INFO_pHYs;
723 }
724 }
725 return (retval);
726}
727#endif
728
729png_uint_32 PNGAPI
730png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
731 int *num_palette)
732{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400733 png_debug1(1, "in %s retrieval function", "PLTE");
734
The Android Open Source Project893912b2009-03-03 19:30:05 -0800735 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
736 && palette != NULL)
737 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800738 *palette = info_ptr->palette;
739 *num_palette = info_ptr->num_palette;
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700740 png_debug1(3, "num_palette = %d", *num_palette);
The Android Open Source Project893912b2009-03-03 19:30:05 -0800741 return (PNG_INFO_PLTE);
742 }
743 return (0);
744}
745
Patrick Scott5f6bd842010-06-28 16:55:16 -0400746#ifdef PNG_sBIT_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800747png_uint_32 PNGAPI
748png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
749{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400750 png_debug1(1, "in %s retrieval function", "sBIT");
751
The Android Open Source Project893912b2009-03-03 19:30:05 -0800752 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
753 && sig_bit != NULL)
754 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800755 *sig_bit = &(info_ptr->sig_bit);
756 return (PNG_INFO_sBIT);
757 }
758 return (0);
759}
760#endif
761
Patrick Scott5f6bd842010-06-28 16:55:16 -0400762#ifdef PNG_TEXT_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800763png_uint_32 PNGAPI
764png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
765 int *num_text)
766{
767 if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
768 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700769 png_debug1(1, "in %s retrieval function",
The Android Open Source Project893912b2009-03-03 19:30:05 -0800770 (png_ptr->chunk_name[0] == '\0' ? "text"
771 : (png_const_charp)png_ptr->chunk_name));
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400772
The Android Open Source Project893912b2009-03-03 19:30:05 -0800773 if (text_ptr != NULL)
774 *text_ptr = info_ptr->text;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400775
The Android Open Source Project893912b2009-03-03 19:30:05 -0800776 if (num_text != NULL)
777 *num_text = info_ptr->num_text;
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400778
The Android Open Source Project893912b2009-03-03 19:30:05 -0800779 return ((png_uint_32)info_ptr->num_text);
780 }
781 if (num_text != NULL)
782 *num_text = 0;
783 return(0);
784}
785#endif
786
Patrick Scott5f6bd842010-06-28 16:55:16 -0400787#ifdef PNG_tIME_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800788png_uint_32 PNGAPI
789png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
790{
Patrick Scott5f6bd842010-06-28 16:55:16 -0400791 png_debug1(1, "in %s retrieval function", "tIME");
792
The Android Open Source Project893912b2009-03-03 19:30:05 -0800793 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
794 && mod_time != NULL)
795 {
The Android Open Source Project893912b2009-03-03 19:30:05 -0800796 *mod_time = &(info_ptr->mod_time);
797 return (PNG_INFO_tIME);
798 }
799 return (0);
800}
801#endif
802
Patrick Scott5f6bd842010-06-28 16:55:16 -0400803#ifdef PNG_tRNS_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800804png_uint_32 PNGAPI
805png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
806 png_bytep *trans, int *num_trans, png_color_16p *trans_values)
807{
808 png_uint_32 retval = 0;
809 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
810 {
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700811 png_debug1(1, "in %s retrieval function", "tRNS");
Patrick Scott5f6bd842010-06-28 16:55:16 -0400812
The Android Open Source Project893912b2009-03-03 19:30:05 -0800813 if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
814 {
815 if (trans != NULL)
816 {
817 *trans = info_ptr->trans;
818 retval |= PNG_INFO_tRNS;
819 }
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400820
The Android Open Source Project893912b2009-03-03 19:30:05 -0800821 if (trans_values != NULL)
822 *trans_values = &(info_ptr->trans_values);
823 }
824 else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
825 {
826 if (trans_values != NULL)
827 {
828 *trans_values = &(info_ptr->trans_values);
829 retval |= PNG_INFO_tRNS;
830 }
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400831
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700832 if (trans != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800833 *trans = NULL;
834 }
The Android Open Source Project4215dd12009-03-09 11:52:12 -0700835 if (num_trans != NULL)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800836 {
837 *num_trans = info_ptr->num_trans;
838 retval |= PNG_INFO_tRNS;
839 }
840 }
841 return (retval);
842}
843#endif
844
Patrick Scott5f6bd842010-06-28 16:55:16 -0400845#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800846png_uint_32 PNGAPI
847png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
848 png_unknown_chunkpp unknowns)
849{
850 if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
851 {
852 *unknowns = info_ptr->unknown_chunks;
853 return ((png_uint_32)info_ptr->unknown_chunks_num);
854 }
855 return (0);
856}
857#endif
858
Patrick Scott5f6bd842010-06-28 16:55:16 -0400859#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800860png_byte PNGAPI
861png_get_rgb_to_gray_status (png_structp png_ptr)
862{
863 return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
864}
865#endif
866
Patrick Scott5f6bd842010-06-28 16:55:16 -0400867#ifdef PNG_USER_CHUNKS_SUPPORTED
The Android Open Source Project893912b2009-03-03 19:30:05 -0800868png_voidp PNGAPI
869png_get_user_chunk_ptr(png_structp png_ptr)
870{
871 return (png_ptr? png_ptr->user_chunk_ptr : NULL);
872}
873#endif
874
The Android Open Source Project893912b2009-03-03 19:30:05 -0800875png_uint_32 PNGAPI
876png_get_compression_buffer_size(png_structp png_ptr)
877{
878 return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
879}
The Android Open Source Project893912b2009-03-03 19:30:05 -0800880
881#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
882#ifndef PNG_1_0_X
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400883/* This function was added to libpng 1.2.0 and should exist by default */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800884png_uint_32 PNGAPI
885png_get_asm_flags (png_structp png_ptr)
886{
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400887 /* Obsolete, to be removed from libpng-1.4.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800888 return (png_ptr? 0L: 0L);
889}
890
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400891/* This function was added to libpng 1.2.0 and should exist by default */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800892png_uint_32 PNGAPI
893png_get_asm_flagmask (int flag_select)
894{
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400895 /* Obsolete, to be removed from libpng-1.4.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800896 flag_select=flag_select;
897 return 0L;
898}
899
900 /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400901/* This function was added to libpng 1.2.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800902png_uint_32 PNGAPI
903png_get_mmx_flagmask (int flag_select, int *compilerID)
904{
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400905 /* Obsolete, to be removed from libpng-1.4.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800906 flag_select=flag_select;
907 *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
908 return 0L;
909}
910
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400911/* This function was added to libpng 1.2.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800912png_byte PNGAPI
913png_get_mmx_bitdepth_threshold (png_structp png_ptr)
914{
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400915 /* Obsolete, to be removed from libpng-1.4.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800916 return (png_ptr? 0: 0);
917}
918
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400919/* This function was added to libpng 1.2.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800920png_uint_32 PNGAPI
921png_get_mmx_rowbytes_threshold (png_structp png_ptr)
922{
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400923 /* Obsolete, to be removed from libpng-1.4.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800924 return (png_ptr? 0L: 0L);
925}
926#endif /* ?PNG_1_0_X */
927#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
928
929#ifdef PNG_SET_USER_LIMITS_SUPPORTED
Patrick Scott5f6bd842010-06-28 16:55:16 -0400930/* These functions were added to libpng 1.2.6 but not enabled
931* by default. They will be enabled in libpng-1.4.0 */
The Android Open Source Project893912b2009-03-03 19:30:05 -0800932png_uint_32 PNGAPI
933png_get_user_width_max (png_structp png_ptr)
934{
935 return (png_ptr? png_ptr->user_width_max : 0);
936}
937png_uint_32 PNGAPI
938png_get_user_height_max (png_structp png_ptr)
939{
940 return (png_ptr? png_ptr->user_height_max : 0);
941}
942#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
Patrick Scotta0bb96c2009-07-22 11:50:02 -0400943
The Android Open Source Project893912b2009-03-03 19:30:05 -0800944#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */