summaryrefslogtreecommitdiff
path: root/pngtrans.c
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@acm.org>2011-02-12 08:59:17 -0600
committerGlenn Randers-Pehrson <glennrp@shaggy.simplesystems.org>2011-02-12 08:59:17 -0600
commit5432c01ffd6260d19403ce9c1a09b99ab488485e (patch)
tree25d86ed1b82c662b81c02d3b9502f89ad36b7726 /pngtrans.c
parent9c69360e97a305703f9cbcfa78a2526a228bfa43 (diff)
downloadlibpng-5432c01ffd6260d19403ce9c1a09b99ab488485e.tar.gz
[devel] Fix png_get_current_row_number in the interlaced case.
Diffstat (limited to 'pngtrans.c')
-rw-r--r--pngtrans.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/pngtrans.c b/pngtrans.c
index 137f555a6..89661adb4 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -703,11 +703,21 @@ png_get_user_transform_ptr(png_const_structp png_ptr)
}
#endif
+#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
png_uint_32 PNGAPI
png_get_current_row_number(png_const_structp png_ptr)
{
+ /* This API returns the row in output, not the input row: */
if (png_ptr != NULL)
- return png_ptr->row_number;
+ {
+ if (png_ptr->interlaced == PNG_INTERLACE_NONE)
+ return png_ptr->row_number;
+ else if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
+ return PNG_ROW_FROM_PASS_ROW(png_ptr->row_number, png_ptr->pass);
+
+ /* Else something bad is happening: */
+ }
+
return PNG_UINT_32_MAX; /* help the app not to fail silently */
}
@@ -718,6 +728,7 @@ png_get_current_pass_number(png_const_structp png_ptr)
return png_ptr->pass;
return 8; /* invalid */
}
+#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */