[master] Issue warning instead of error for out of range coefficients

for rgb_to_gray transform
This commit is contained in:
Glenn Randers-Pehrson 2011-06-05 23:44:05 -05:00
parent 59397f985e
commit 4d694dadd8

View File

@ -665,9 +665,16 @@ png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
return;
if (red > 21474.83647 || red < -21474.83648 ||
green > 21474.83647 || green < -21474.83648)
png_error(png_ptr, "ignoring out of range rgb_to_gray coefficients");
red_fixed = (int)((float)red*100000.0 + 0.5);
green_fixed = (int)((float)green*100000.0 + 0.5);
{
png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients");
red_fixed = -1;
green_fixed = -1;
}
else
{
red_fixed = (int)((float)red*100000.0 + 0.5);
green_fixed = (int)((float)green*100000.0 + 0.5);
}
png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
}
#endif