[devel] Moved the PNG_DIVIDE_* and PNG_*_PREMULTIPLY macros
from png.h to pngpriv.h.
This commit is contained in:
parent
5a2015e146
commit
b2154ccb2b
1
ANNOUNCE
1
ANNOUNCE
@ -715,6 +715,7 @@ version 1.4.0beta105 [November 25, 2009]
|
||||
that the 255 is used as a double.
|
||||
|
||||
version 1.4.0beta106 [November 26, 2009]
|
||||
Moved the PNG_DIVIDE_* and PNG_*_PREMULTIPLY macros from png.h to pngpriv.h.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
1
CHANGES
1
CHANGES
@ -2402,6 +2402,7 @@ version 1.4.0beta105 [November 25, 2009]
|
||||
that the 255 is used as a double.
|
||||
|
||||
version 1.4.0beta106 [November 26, 2009]
|
||||
Moved the PNG_DIVIDE_* and PNG_*_PREMULTIPLY macros from png.h to pngpriv.h.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
21
png.h
21
png.h
@ -131,7 +131,7 @@
|
||||
* 1.4.0beta15-36 14 10400 14.so.0.0[.0]
|
||||
* 1.4.0beta37-87 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc01 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0beta88-106 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0beta88-105 14 10400 14.so.14.0[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -2474,15 +2474,6 @@ extern PNG_EXPORT(png_bytep,png_get_io_chunk_name)
|
||||
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
|
||||
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
|
||||
|
||||
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
|
||||
#define PNG_DIVIDE_BY_255(v) \
|
||||
((png_byte)(((png_uint_16)(v) + \
|
||||
(((png_uint_16)(v) + 128) >> 8) + 128) >> 8))
|
||||
#define PNG_DIVIDE_BY_65535(v) \
|
||||
((png_byte)(((png_uint_32)(v) + \
|
||||
(((png_uint_32)(v) + 32768L) >> 16) + 32768L) >> 16))
|
||||
#endif
|
||||
|
||||
#else /* Standard method using integer division */
|
||||
|
||||
# define png_composite(composite, fg, alpha, bg) \
|
||||
@ -2494,18 +2485,8 @@ extern PNG_EXPORT(png_bytep,png_get_io_chunk_name)
|
||||
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
|
||||
(png_uint_32)32767) / (png_uint_32)65535L)
|
||||
|
||||
#define PNG_DIVIDE_BY_255(v) (((png_uint_16)(v))/255)
|
||||
#define PNG_DIVIDE_BY_65535(v) (((png_uint_32)(v))/65535L)
|
||||
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
||||
|
||||
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
|
||||
#define PNG_8_BIT_PREMULTIPLY(color,alpha) \
|
||||
PNG_DIVIDE_BY_255((color)*(alpha))
|
||||
#define PNG_16_BIT_PREMULTIPLY(color,alpha)\
|
||||
PNG_DIVIDE_BY_65535((color)*(alpha))
|
||||
#endif
|
||||
|
||||
#ifdef PNG_USE_READ_MACROS
|
||||
/* Inline macros to do direct reads of bytes from the input buffer.
|
||||
* The png_get_int_32() routine assumes we are using two's complement
|
||||
|
19
pngpriv.h
19
pngpriv.h
@ -831,6 +831,25 @@ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
|
||||
int color_type, int interlace_type, int compression_type,
|
||||
int filter_type));
|
||||
|
||||
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
|
||||
# ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||
# define PNG_DIVIDE_BY_255(v) \
|
||||
((png_byte)(((png_uint_16)(v) + \
|
||||
(((png_uint_16)(v) + 128) >> 8) + 128) >> 8))
|
||||
# define PNG_DIVIDE_BY_65535(v) \
|
||||
((png_byte)(((png_uint_32)(v) + \
|
||||
(((png_uint_32)(v) + 32768L) >> 16) + 32768L) >> 16))
|
||||
# else
|
||||
# define PNG_DIVIDE_BY_255(v) (((png_uint_16)(v))/255)
|
||||
# define PNG_DIVIDE_BY_65535(v) (((png_uint_32)(v))/65535L)
|
||||
# endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
||||
|
||||
# define PNG_8_BIT_PREMULTIPLY(color,alpha) \
|
||||
PNG_DIVIDE_BY_255((color)*(alpha))
|
||||
# define PNG_16_BIT_PREMULTIPLY(color,alpha)\
|
||||
PNG_DIVIDE_BY_65535((color)*(alpha))
|
||||
#endif /* PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED */
|
||||
|
||||
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
|
||||
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
|
||||
png_infop end_info_ptr));
|
||||
|
Loading…
Reference in New Issue
Block a user