From e2062f9fa021a77facbc460bac836188ecff6c7c Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sat, 15 Jan 2011 22:36:33 -0600 Subject: [PATCH] [devel] Correct pngvalid gamma test to check each color sample, not just red. --- pngvalid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pngvalid.c b/pngvalid.c index cbba734f5..991ec5c66 100644 --- a/pngvalid.c +++ b/pngvalid.c @@ -249,10 +249,13 @@ sample(png_const_bytep row, png_byte colour_type, png_byte bit_depth, if ((colour_type & 1) == 0) /* !palette */ { if (colour_type & 2) - index *= 3, index += sample; /* Colour channels; select one */ + index *= 3; if (colour_type & 4) index += x; /* Alpha channel */ + + if (colour_type & (2+4)) + index += sample * bit_depth; /* Multiple channels: select one */ } /* Return the sample from the row as an integer. */