| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 2001 mozilla.org | 5 * Portions are Copyright (C) 2001 mozilla.org |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Stuart Parmenter <stuart@mozilla.com> | 8 * Stuart Parmenter <stuart@mozilla.com> |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool PNGImageDecoder::setFailed() | 257 bool PNGImageDecoder::setFailed() |
| 258 { | 258 { |
| 259 if (m_doNothingOnFailure) | 259 if (m_doNothingOnFailure) |
| 260 return false; | 260 return false; |
| 261 m_reader.clear(); | 261 m_reader.clear(); |
| 262 return ImageDecoder::setFailed(); | 262 return ImageDecoder::setFailed(); |
| 263 } | 263 } |
| 264 | 264 |
| 265 #if USE(QCMSLIB) |
| 265 static void readColorProfile(png_structp png, png_infop info, ColorProfile& colo
rProfile) | 266 static void readColorProfile(png_structp png, png_infop info, ColorProfile& colo
rProfile) |
| 266 { | 267 { |
| 267 #ifdef PNG_iCCP_SUPPORTED | 268 #ifdef PNG_iCCP_SUPPORTED |
| 268 char* profileName; | 269 char* profileName; |
| 269 int compressionType; | 270 int compressionType; |
| 270 #if (PNG_LIBPNG_VER < 10500) | 271 #if (PNG_LIBPNG_VER < 10500) |
| 271 png_charp profile; | 272 png_charp profile; |
| 272 #else | 273 #else |
| 273 png_bytep profile; | 274 png_bytep profile; |
| 274 #endif | 275 #endif |
| (...skipping 13 matching lines...) Expand all Loading... |
| 288 | 289 |
| 289 ASSERT(colorProfile.isEmpty()); | 290 ASSERT(colorProfile.isEmpty()); |
| 290 if (!ignoreProfile) | 291 if (!ignoreProfile) |
| 291 colorProfile.append(profileData, profileLength); | 292 colorProfile.append(profileData, profileLength); |
| 292 #else | 293 #else |
| 293 UNUSED_PARAM(png); | 294 UNUSED_PARAM(png); |
| 294 UNUSED_PARAM(info); | 295 UNUSED_PARAM(info); |
| 295 UNUSED_PARAM(colorProfile); | 296 UNUSED_PARAM(colorProfile); |
| 296 #endif | 297 #endif |
| 297 } | 298 } |
| 299 #endif |
| 298 | 300 |
| 299 void PNGImageDecoder::headerAvailable() | 301 void PNGImageDecoder::headerAvailable() |
| 300 { | 302 { |
| 301 png_structp png = m_reader->pngPtr(); | 303 png_structp png = m_reader->pngPtr(); |
| 302 png_infop info = m_reader->infoPtr(); | 304 png_infop info = m_reader->infoPtr(); |
| 303 png_uint_32 width = png_get_image_width(png, info); | 305 png_uint_32 width = png_get_image_width(png, info); |
| 304 png_uint_32 height = png_get_image_height(png, info); | 306 png_uint_32 height = png_get_image_height(png, info); |
| 305 | 307 |
| 306 // Protect against large images. | 308 // Protect against large images. |
| 307 if (width > cMaxPNGSize || height > cMaxPNGSize) { | 309 if (width > cMaxPNGSize || height > cMaxPNGSize) { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 // has failed. | 524 // has failed. |
| 523 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 525 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
| 524 setFailed(); | 526 setFailed(); |
| 525 // If we're done decoding the image, we don't need the PNGImageReader | 527 // If we're done decoding the image, we don't need the PNGImageReader |
| 526 // anymore. (If we failed, |m_reader| has already been cleared.) | 528 // anymore. (If we failed, |m_reader| has already been cleared.) |
| 527 else if (isComplete()) | 529 else if (isComplete()) |
| 528 m_reader.clear(); | 530 m_reader.clear(); |
| 529 } | 531 } |
| 530 | 532 |
| 531 } // namespace WebCore | 533 } // namespace WebCore |
| OLD | NEW |