mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel]
Fixed point APIs are now supported throughout (no missing APIs).
Internal fixed point arithmetic support exists for all internal floating
point operations.
sCAL validates the floating point strings it is passed.
Safe, albeit rudimentary, Watcom support is provided by PNG_API_RULE==2
Two new APIs exist to get the number of passes without turning on the
PNG_INTERLACE transform and to get the number of rows in the current
pass.
A new test program, pngvalid.c, validates the gamma code.
Errors in the 16 bit gamma correction (overflows) have been corrected.
cHRM chunk testing is done consistently (previously the floating point
API bypassed it, because the test really didn't work on FP, now the test
is performed on the actual values to be stored in the PNG file so it
works in the FP case too.)
Most floating point APIs now simply call the fixed point APIs after
converting the values to the fixed point form used in the PNG file.
The standard headers no longer include zlib.h, which is currently only
required for pngstruct.h and can therefore be internal.
(Patches by John Bowler)
This commit is contained in:
@@ -55,8 +55,10 @@
|
||||
|
||||
|
||||
#include <stdlib.h> /* for exit() prototype */
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
|
||||
#include <zlib.h>
|
||||
#include "png.h" /* libpng header from the local directory */
|
||||
#include "readpng2.h" /* typedefs, common macros, public prototypes */
|
||||
|
||||
|
||||
@@ -216,7 +218,11 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
mainprog_info *mainprog_ptr;
|
||||
int color_type, bit_depth;
|
||||
png_uint_32 width, height;
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
double gamma;
|
||||
#else
|
||||
png_fixed_point gamma;
|
||||
#endif
|
||||
|
||||
|
||||
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
||||
@@ -327,11 +333,19 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
||||
* "gamma" value for the entire display system, i.e., the product of
|
||||
* LUT_exponent and CRT_exponent. */
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
||||
else
|
||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
|
||||
|
||||
#else
|
||||
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
|
||||
png_set_gamma_fixed(png_ptr,
|
||||
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
|
||||
else
|
||||
png_set_gamma_fixed(png_ptr,
|
||||
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
|
||||
#endif
|
||||
|
||||
/* we'll let libpng expand interlaced images, too */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user