Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: third_party/libpng/pngget.c

Issue 15041: Update libpng to 1.2.33. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/libpng/pngerror.c ('k') | third_party/libpng/pngmem.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* pngget.c - retrieval of values from info struct 2 /* pngget.c - retrieval of values from info struct
3 * 3 *
4 * Last changed in libpng 1.2.15 January 5, 2007 4 * Last changed in libpng 1.2.30 [August 15, 2008]
5 * For conditions of distribution and use, see copyright notice in png.h 5 * For conditions of distribution and use, see copyright notice in png.h
6 * Copyright (c) 1998-2007 Glenn Randers-Pehrson 6 * Copyright (c) 1998-2008 Glenn Randers-Pehrson
7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
9 */ 9 */
10 10
11 #define PNG_INTERNAL 11 #define PNG_INTERNAL
12 #include "png.h" 12 #include "png.h"
13
14 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) 13 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
15 14
16 png_uint_32 PNGAPI 15 png_uint_32 PNGAPI
17 png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag) 16 png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
18 { 17 {
19 if (png_ptr != NULL && info_ptr != NULL) 18 if (png_ptr != NULL && info_ptr != NULL)
20 return(info_ptr->valid & flag); 19 return(info_ptr->valid & flag);
21 else 20 else
22 return(0); 21 return(0);
23 } 22 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 114 }
116 115
117 png_uint_32 PNGAPI 116 png_uint_32 PNGAPI
118 png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) 117 png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
119 { 118 {
120 if (png_ptr != NULL && info_ptr != NULL) 119 if (png_ptr != NULL && info_ptr != NULL)
121 #if defined(PNG_pHYs_SUPPORTED) 120 #if defined(PNG_pHYs_SUPPORTED)
122 if (info_ptr->valid & PNG_INFO_pHYs) 121 if (info_ptr->valid & PNG_INFO_pHYs)
123 { 122 {
124 png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter"); 123 png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
125 if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER) 124 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
126 return (0); 125 return (0);
127 else return (info_ptr->x_pixels_per_unit); 126 else return (info_ptr->x_pixels_per_unit);
128 } 127 }
129 #else 128 #else
130 return (0); 129 return (0);
131 #endif 130 #endif
132 return (0); 131 return (0);
133 } 132 }
134 133
135 png_uint_32 PNGAPI 134 png_uint_32 PNGAPI
136 png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) 135 png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
137 { 136 {
138 if (png_ptr != NULL && info_ptr != NULL) 137 if (png_ptr != NULL && info_ptr != NULL)
139 #if defined(PNG_pHYs_SUPPORTED) 138 #if defined(PNG_pHYs_SUPPORTED)
140 if (info_ptr->valid & PNG_INFO_pHYs) 139 if (info_ptr->valid & PNG_INFO_pHYs)
141 { 140 {
142 png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter"); 141 png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
143 if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER) 142 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
144 return (0); 143 return (0);
145 else return (info_ptr->y_pixels_per_unit); 144 else return (info_ptr->y_pixels_per_unit);
146 } 145 }
147 #else 146 #else
148 return (0); 147 return (0);
149 #endif 148 #endif
150 return (0); 149 return (0);
151 } 150 }
152 151
153 png_uint_32 PNGAPI 152 png_uint_32 PNGAPI
154 png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) 153 png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
155 { 154 {
156 if (png_ptr != NULL && info_ptr != NULL) 155 if (png_ptr != NULL && info_ptr != NULL)
157 #if defined(PNG_pHYs_SUPPORTED) 156 #if defined(PNG_pHYs_SUPPORTED)
158 if (info_ptr->valid & PNG_INFO_pHYs) 157 if (info_ptr->valid & PNG_INFO_pHYs)
159 { 158 {
160 png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter"); 159 png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
161 if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER || 160 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
162 info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) 161 info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
163 return (0); 162 return (0);
164 else return (info_ptr->x_pixels_per_unit); 163 else return (info_ptr->x_pixels_per_unit);
165 } 164 }
166 #else 165 #else
167 return (0); 166 return (0);
168 #endif 167 #endif
169 return (0); 168 return (0);
170 } 169 }
171 170
(...skipping 20 matching lines...) Expand all
192 #endif 191 #endif
193 192
194 png_int_32 PNGAPI 193 png_int_32 PNGAPI
195 png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) 194 png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
196 { 195 {
197 if (png_ptr != NULL && info_ptr != NULL) 196 if (png_ptr != NULL && info_ptr != NULL)
198 #if defined(PNG_oFFs_SUPPORTED) 197 #if defined(PNG_oFFs_SUPPORTED)
199 if (info_ptr->valid & PNG_INFO_oFFs) 198 if (info_ptr->valid & PNG_INFO_oFFs)
200 { 199 {
201 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); 200 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
202 if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) 201 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
203 return (0); 202 return (0);
204 else return (info_ptr->x_offset); 203 else return (info_ptr->x_offset);
205 } 204 }
206 #else 205 #else
207 return (0); 206 return (0);
208 #endif 207 #endif
209 return (0); 208 return (0);
210 } 209 }
211 210
212 png_int_32 PNGAPI 211 png_int_32 PNGAPI
213 png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) 212 png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
214 { 213 {
215 if (png_ptr != NULL && info_ptr != NULL) 214 if (png_ptr != NULL && info_ptr != NULL)
216 #if defined(PNG_oFFs_SUPPORTED) 215 #if defined(PNG_oFFs_SUPPORTED)
217 if (info_ptr->valid & PNG_INFO_oFFs) 216 if (info_ptr->valid & PNG_INFO_oFFs)
218 { 217 {
219 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); 218 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
220 if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) 219 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
221 return (0); 220 return (0);
222 else return (info_ptr->y_offset); 221 else return (info_ptr->y_offset);
223 } 222 }
224 #else 223 #else
225 return (0); 224 return (0);
226 #endif 225 #endif
227 return (0); 226 return (0);
228 } 227 }
229 228
230 png_int_32 PNGAPI 229 png_int_32 PNGAPI
231 png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) 230 png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
232 { 231 {
233 if (png_ptr != NULL && info_ptr != NULL) 232 if (png_ptr != NULL && info_ptr != NULL)
234 #if defined(PNG_oFFs_SUPPORTED) 233 #if defined(PNG_oFFs_SUPPORTED)
235 if (info_ptr->valid & PNG_INFO_oFFs) 234 if (info_ptr->valid & PNG_INFO_oFFs)
236 { 235 {
237 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); 236 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
238 if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) 237 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
239 return (0); 238 return (0);
240 else return (info_ptr->x_offset); 239 else return (info_ptr->x_offset);
241 } 240 }
242 #else 241 #else
243 return (0); 242 return (0);
244 #endif 243 #endif
245 return (0); 244 return (0);
246 } 245 }
247 246
248 png_int_32 PNGAPI 247 png_int_32 PNGAPI
249 png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) 248 png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
250 { 249 {
251 if (png_ptr != NULL && info_ptr != NULL) 250 if (png_ptr != NULL && info_ptr != NULL)
252 #if defined(PNG_oFFs_SUPPORTED) 251 #if defined(PNG_oFFs_SUPPORTED)
253 if (info_ptr->valid & PNG_INFO_oFFs) 252 if (info_ptr->valid & PNG_INFO_oFFs)
254 { 253 {
255 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); 254 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
256 if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) 255 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
257 return (0); 256 return (0);
258 else return (info_ptr->y_offset); 257 else return (info_ptr->y_offset);
259 } 258 }
260 #else 259 #else
261 return (0); 260 return (0);
262 #endif 261 #endif
263 return (0); 262 return (0);
264 } 263 }
265 264
266 #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) 265 #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 315 }
317 if (res_y != NULL) 316 if (res_y != NULL)
318 { 317 {
319 *res_y = info_ptr->y_pixels_per_unit; 318 *res_y = info_ptr->y_pixels_per_unit;
320 retval |= PNG_INFO_pHYs; 319 retval |= PNG_INFO_pHYs;
321 } 320 }
322 if (unit_type != NULL) 321 if (unit_type != NULL)
323 { 322 {
324 *unit_type = (int)info_ptr->phys_unit_type; 323 *unit_type = (int)info_ptr->phys_unit_type;
325 retval |= PNG_INFO_pHYs; 324 retval |= PNG_INFO_pHYs;
326 if(*unit_type == 1) 325 if (*unit_type == 1)
327 { 326 {
328 if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); 327 if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
329 if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); 328 if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
330 } 329 }
331 } 330 }
332 } 331 }
333 return (retval); 332 return (retval);
334 } 333 }
335 #endif /* PNG_pHYs_SUPPORTED */ 334 #endif /* PNG_pHYs_SUPPORTED */
336 #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ 335 #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 if (trans_values != NULL) 776 if (trans_values != NULL)
778 *trans_values = &(info_ptr->trans_values); 777 *trans_values = &(info_ptr->trans_values);
779 } 778 }
780 else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */ 779 else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
781 { 780 {
782 if (trans_values != NULL) 781 if (trans_values != NULL)
783 { 782 {
784 *trans_values = &(info_ptr->trans_values); 783 *trans_values = &(info_ptr->trans_values);
785 retval |= PNG_INFO_tRNS; 784 retval |= PNG_INFO_tRNS;
786 } 785 }
787 if(trans != NULL) 786 if (trans != NULL)
788 *trans = NULL; 787 *trans = NULL;
789 } 788 }
790 if(num_trans != NULL) 789 if (num_trans != NULL)
791 { 790 {
792 *num_trans = info_ptr->num_trans; 791 *num_trans = info_ptr->num_trans;
793 retval |= PNG_INFO_tRNS; 792 retval |= PNG_INFO_tRNS;
794 } 793 }
795 } 794 }
796 return (retval); 795 return (retval);
797 } 796 }
798 #endif 797 #endif
799 798
800 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 799 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 } 891 }
893 png_uint_32 PNGAPI 892 png_uint_32 PNGAPI
894 png_get_user_height_max (png_structp png_ptr) 893 png_get_user_height_max (png_structp png_ptr)
895 { 894 {
896 return (png_ptr? png_ptr->user_height_max : 0); 895 return (png_ptr? png_ptr->user_height_max : 0);
897 } 896 }
898 #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ 897 #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
899 898
900 899
901 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ 900 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
OLDNEW
« no previous file with comments | « third_party/libpng/pngerror.c ('k') | third_party/libpng/pngmem.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698