Line
Link Here
|
0 |
-- a/lib/cximage-6.0/CxImage/ximapng.cpp |
0 |
++ b/lib/cximage-6.0/CxImage/ximapng.cpp |
Lines 178-189
bool CxImagePNG::Decode(CxFile *hFile)
Link Here
|
178 |
int _num_palette; |
178 |
int _num_palette; |
179 |
png_colorp _palette; |
179 |
png_colorp _palette; |
180 |
#if PNG_LIBPNG_VER > 10399 |
180 |
#if PNG_LIBPNG_VER > 10399 |
181 |
png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette); |
181 |
png_uint_32 _palette_ret; |
|
|
182 |
_palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette); |
183 |
if (_palette_ret && _num_palette>0){ |
182 |
#else |
184 |
#else |
183 |
_num_palette=info_ptr->num_palette; |
185 |
_num_palette=info_ptr->num_palette; |
184 |
_palette=info_ptr->palette; |
186 |
_palette=info_ptr->palette; |
185 |
#endif |
|
|
186 |
if (_num_palette>0){ |
187 |
if (_num_palette>0){ |
|
|
188 |
#endif |
187 |
SetPalette((rgb_color*)_palette,_num_palette); |
189 |
SetPalette((rgb_color*)_palette,_num_palette); |
188 |
SetClrImportant(_num_palette); |
190 |
SetClrImportant(_num_palette); |
189 |
} else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs |
191 |
} else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs |
Lines 199-209
bool CxImagePNG::Decode(CxFile *hFile)
Link Here
|
199 |
int _num_trans; |
201 |
int _num_trans; |
200 |
png_color_16p _trans_color; |
202 |
png_color_16p _trans_color; |
201 |
#if PNG_LIBPNG_VER > 10399 |
203 |
#if PNG_LIBPNG_VER > 10399 |
202 |
png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color); |
204 |
png_uint_32 _trans_ret; |
|
|
205 |
_trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color); |
206 |
if (_trans_ret && _num_trans!=0){ //palette transparency |
203 |
#else |
207 |
#else |
204 |
_num_trans=info_ptr->num_trans; |
208 |
_num_trans=info_ptr->num_trans; |
205 |
#endif |
|
|
206 |
if (_num_trans!=0){ //palette transparency |
209 |
if (_num_trans!=0){ //palette transparency |
|
|
210 |
#endif |
207 |
if (_num_trans==1){ |
211 |
if (_num_trans==1){ |
208 |
if (_color_type == PNG_COLOR_TYPE_PALETTE){ |
212 |
if (_color_type == PNG_COLOR_TYPE_PALETTE){ |
209 |
#if PNG_LIBPNG_VER > 10399 |
213 |
#if PNG_LIBPNG_VER > 10399 |
Lines 219-225
bool CxImagePNG::Decode(CxFile *hFile)
Link Here
|
219 |
#endif |
223 |
#endif |
220 |
} |
224 |
} |
221 |
} |
225 |
} |
|
|
226 |
#if PNG_LIBPNG_VER > 10399 |
227 |
if (_num_trans>1 && _trans_alpha!=NULL){ |
228 |
#else |
222 |
if (_num_trans>1){ |
229 |
if (_num_trans>1){ |
|
|
230 |
#endif |
223 |
RGBQUAD* pal=GetPalette(); |
231 |
RGBQUAD* pal=GetPalette(); |
224 |
if (pal){ |
232 |
if (pal){ |
225 |
DWORD ip; |
233 |
DWORD ip; |