mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Fixed previous support for Z_PREFIX in configure builds, corrected
sCAL APIs; some of these use floating point arithmetic so they need to be disabled if floating point arithmetic is switched off. This is a quiet API change - previously it appeared that the APIs were supported if fixed point arithmetic was used internally, however they required certain APIs (floor, modf, frexp, atof) that are part of C floating point support. Changed png_fixed and the gamma code specific version of the same to avoid floor(), which may be a library function (not an intrinsic). Removed unused #if 0 code.
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
9b99600c4d
commit
fbbbc620b8
12
pngrtran.c
12
pngrtran.c
@@ -257,16 +257,10 @@ convert_gamma_value(png_structrp png_ptr, double output_gamma)
|
||||
* bug reports. Negative values fail inside the _fixed API unless they
|
||||
* correspond to the flag values.
|
||||
*/
|
||||
if (output_gamma > 0 && output_gamma < 128)
|
||||
output_gamma *= PNG_FP_1;
|
||||
if (output_gamma < 0 || output_gamma > 128)
|
||||
output_gamma *= .00001;
|
||||
|
||||
/* This preserves -1 and -2 exactly: */
|
||||
output_gamma = floor(output_gamma + .5);
|
||||
|
||||
if (output_gamma > PNG_FP_MAX || output_gamma < PNG_FP_MIN)
|
||||
png_fixed_error(png_ptr, "gamma value");
|
||||
|
||||
return (png_fixed_point)output_gamma;
|
||||
return png_fixed(png_ptr, output_gamma, "gamma value");
|
||||
}
|
||||
# endif
|
||||
#endif /* READ_ALPHA_MODE || READ_GAMMA */
|
||||
|
||||
Reference in New Issue
Block a user