Lines 224-232
bool PNGImageDecoder::setFailed()
Link Here
|
224 |
static ColorProfile readColorProfile(png_structp png, png_infop info) |
224 |
static ColorProfile readColorProfile(png_structp png, png_infop info) |
225 |
{ |
225 |
{ |
226 |
#ifdef PNG_iCCP_SUPPORTED |
226 |
#ifdef PNG_iCCP_SUPPORTED |
227 |
char* profileName; |
227 |
png_charp profileName; |
228 |
int compressionType; |
228 |
int compressionType; |
229 |
char* profile; |
229 |
#if (PNG_LIBPNG_VER < 10500) |
|
|
230 |
png_charp profile; |
231 |
#else |
232 |
png_bytep profile; |
233 |
#endif |
230 |
png_uint_32 profileLength; |
234 |
png_uint_32 profileLength; |
231 |
if (png_get_iCCP(png, info, &profileName, &compressionType, &profile, &profileLength)) { |
235 |
if (png_get_iCCP(png, info, &profileName, &compressionType, &profile, &profileLength)) { |
232 |
ColorProfile colorProfile; |
236 |
ColorProfile colorProfile; |
Lines 241-251
void PNGImageDecoder::headerAvailable()
Link Here
|
241 |
{ |
245 |
{ |
242 |
png_structp png = m_reader->pngPtr(); |
246 |
png_structp png = m_reader->pngPtr(); |
243 |
png_infop info = m_reader->infoPtr(); |
247 |
png_infop info = m_reader->infoPtr(); |
244 |
png_uint_32 width = png->width; |
248 |
png_uint_32 width = png_get_image_width(png, info); |
245 |
png_uint_32 height = png->height; |
249 |
png_uint_32 height = png_get_image_height(png, info); |
246 |
|
250 |
|
247 |
// Protect against large images. |
251 |
// Protect against large images. |
248 |
if (png->width > cMaxPNGSize || png->height > cMaxPNGSize) { |
252 |
if (width > cMaxPNGSize || height > cMaxPNGSize) { |
249 |
longjmp(JMPBUF(png), 1); |
253 |
longjmp(JMPBUF(png), 1); |
250 |
return; |
254 |
return; |
251 |
} |
255 |
} |
Lines 318-326
void PNGImageDecoder::headerAvailable()
Link Here
|
318 |
m_reader->setHasAlpha(channels == 4); |
322 |
m_reader->setHasAlpha(channels == 4); |
319 |
|
323 |
|
320 |
if (m_reader->decodingSizeOnly()) { |
324 |
if (m_reader->decodingSizeOnly()) { |
321 |
// If we only needed the size, halt the reader. |
325 |
// If we only needed the size, halt the reader. |
|
|
326 |
#if (PNG_LIBPNG_VER < 10501) |
322 |
m_reader->setReadOffset(m_reader->currentBufferSize() - png->buffer_size); |
327 |
m_reader->setReadOffset(m_reader->currentBufferSize() - png->buffer_size); |
323 |
png->buffer_size = 0; |
328 |
png->buffer_size = 0; |
|
|
329 |
#else |
330 |
/* '0' argument to png_process_data_pause means: do not save the data */ |
331 |
m_reader->setReadOffset(m_reader->currentBufferSize() - png_process_data_pause(png, 0)); |
332 |
#endif |
324 |
} |
333 |
} |
325 |
} |
334 |
} |
326 |
|
335 |
|
Lines 343-349
void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex,
Link Here
|
343 |
// For PNGs, the frame always fills the entire image. |
352 |
// For PNGs, the frame always fills the entire image. |
344 |
buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
353 |
buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
345 |
|
354 |
|
346 |
if (m_reader->pngPtr()->interlaced) |
355 |
if (png_get_interlace_type(m_reader->pngPtr(), m_reader->infoPtr())) |
347 |
m_reader->createInterlaceBuffer((m_reader->hasAlpha() ? 4 : 3) * size().width() * size().height()); |
356 |
m_reader->createInterlaceBuffer((m_reader->hasAlpha() ? 4 : 3) * size().width() * size().height()); |
348 |
} |
357 |
} |
349 |
|
358 |
|