fix(mDCv): Correct the floating-point setter `png_set_mDCv` In the floating-point API function `png_set_mDCv` we incorrectly divided by two the chromaticity values before passing them on to `png_set_mDCv_fixed`. Reported-by: Mohit Bakshi <mohitbakshi2205@gmail.com> Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
diff --git a/pngset.c b/pngset.c index d7f3393..3e63c27 100644 --- a/pngset.c +++ b/pngset.c
@@ -300,17 +300,14 @@ double maxDL, double minDL) { png_set_mDCV_fixed(png_ptr, info_ptr, - /* The ITU approach is to scale by 50,000, not 100,000 so just divide - * the input values by 2 and use png_fixed: - */ - png_fixed(png_ptr, white_x / 2, "png_set_mDCV(white(x))"), - png_fixed(png_ptr, white_y / 2, "png_set_mDCV(white(y))"), - png_fixed(png_ptr, red_x / 2, "png_set_mDCV(red(x))"), - png_fixed(png_ptr, red_y / 2, "png_set_mDCV(red(y))"), - png_fixed(png_ptr, green_x / 2, "png_set_mDCV(green(x))"), - png_fixed(png_ptr, green_y / 2, "png_set_mDCV(green(y))"), - png_fixed(png_ptr, blue_x / 2, "png_set_mDCV(blue(x))"), - png_fixed(png_ptr, blue_y / 2, "png_set_mDCV(blue(y))"), + png_fixed(png_ptr, white_x, "png_set_mDCV(white(x))"), + png_fixed(png_ptr, white_y, "png_set_mDCV(white(y))"), + png_fixed(png_ptr, red_x, "png_set_mDCV(red(x))"), + png_fixed(png_ptr, red_y, "png_set_mDCV(red(y))"), + png_fixed(png_ptr, green_x, "png_set_mDCV(green(x))"), + png_fixed(png_ptr, green_y, "png_set_mDCV(green(y))"), + png_fixed(png_ptr, blue_x, "png_set_mDCV(blue(x))"), + png_fixed(png_ptr, blue_y, "png_set_mDCV(blue(y))"), png_fixed_ITU(png_ptr, maxDL, "png_set_mDCV(maxDL)"), png_fixed_ITU(png_ptr, minDL, "png_set_mDCV(minDL)")); }