summaryrefslogtreecommitdiff
path: root/pngget.c
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-07-31 06:34:36 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-07-31 06:34:36 -0500
commit4009a76e9724e2ef936add6d3d7c05ca4d143500 (patch)
treea67c53c95937a697e0fee6d2ce5edbaf9bff9561 /pngget.c
parent459432a1b82c847b98407136f4f6db8f06875567 (diff)
downloadlibpng-4009a76e9724e2ef936add6d3d7c05ca4d143500.tar.gz
[devel] Implemented remaining "_fixed" functions and corrected warnings
that were recently introduced, mostly resulting from safe but uncast assignments to shorter integers. Also added a zlib VStudio release library project because the latest zlib Official Windows build does not include such a thing.
Diffstat (limited to 'pngget.c')
-rw-r--r--pngget.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/pngget.c b/pngget.c
index 9634f807f..c3e5591a7 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
- * Last changed in libpng 1.4.1 [July 30, 2010]
+ * Last changed in libpng 1.4.1 [July 31, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -182,7 +182,7 @@ float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#ifdef PNG_pHYs_SUPPORTED
+#ifdef PNG_READ_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
@@ -202,6 +202,27 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
}
#endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
+png_fixed_point PNGAPI
+png_get_pixel_aspect_ratio_fixed(png_structp png_ptr, png_infop info_ptr)
+{
+#ifdef PNG_READ_pHYs_SUPPORTED
+ if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)
+ && info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0)
+ {
+ png_fixed_point res;
+
+ png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio_fixed");
+
+ if (png_muldiv(&res, info_ptr->y_pixels_per_unit, PNG_FP_1,
+ info_ptr->x_pixels_per_unit))
+ return res;
+ }
+#endif
+ return 0;
+}
+#endif
+
png_int_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
@@ -728,6 +749,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
+#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL_fixed(png_structp png_ptr, png_infop info_ptr,
int *unit, png_fixed_point *width, png_fixed_point *height)
@@ -736,7 +758,7 @@ png_get_sCAL_fixed(png_structp png_ptr, png_infop info_ptr,
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
- /*TODO: make this work */
+ /*TODO: make this work without FP support */
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
"sCAL height");
@@ -745,7 +767,8 @@ png_get_sCAL_fixed(png_structp png_ptr, png_infop info_ptr,
return(0);
}
-#endif
+#endif /*FLOATING_ARITHMETIC*/
+#endif /*FIXED_POINT*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,