| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreColorSpace) { | 211 if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreColorSpace) { |
| 212 // We only support color profiles for color PALETTE and RGB[A] PNG. | 212 // We only support color profiles for color PALETTE and RGB[A] PNG. |
| 213 // Supporting color profiles for gray-scale images is slightly tricky, at | 213 // Supporting color profiles for gray-scale images is slightly tricky, at |
| 214 // least using the CoreGraphics ICC library, because we expand gray-scale | 214 // least using the CoreGraphics ICC library, because we expand gray-scale |
| 215 // images to RGB but we do not similarly transform the color profile. We'd | 215 // images to RGB but we do not similarly transform the color profile. We'd |
| 216 // either need to transform the color profile or we'd need to decode into a | 216 // either need to transform the color profile or we'd need to decode into a |
| 217 // gray-scale image buffer and hand that to CoreGraphics. | 217 // gray-scale image buffer and hand that to CoreGraphics. |
| 218 #ifdef PNG_iCCP_SUPPORTED | 218 #ifdef PNG_iCCP_SUPPORTED |
| 219 if (png_get_valid(png, info, PNG_INFO_sRGB)) { | 219 if (png_get_valid(png, info, PNG_INFO_sRGB)) { |
| 220 setColorSpaceAndComputeTransform( | 220 setColorSpaceAndComputeTransform( |
| 221 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)); | 221 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named)); |
| 222 } else { | 222 } else { |
| 223 char* profileName = nullptr; | 223 char* profileName = nullptr; |
| 224 int compressionType = 0; | 224 int compressionType = 0; |
| 225 #if (PNG_LIBPNG_VER < 10500) | 225 #if (PNG_LIBPNG_VER < 10500) |
| 226 png_charp profile = nullptr; | 226 png_charp profile = nullptr; |
| 227 #else | 227 #else |
| 228 png_bytep profile = nullptr; | 228 png_bytep profile = nullptr; |
| 229 #endif | 229 #endif |
| 230 png_uint_32 profileLength = 0; | 230 png_uint_32 profileLength = 0; |
| 231 if (png_get_iCCP(png, info, &profileName, &compressionType, &profile, | 231 if (png_get_iCCP(png, info, &profileName, &compressionType, &profile, |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 // has failed. | 453 // has failed. |
| 454 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 454 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
| 455 setFailed(); | 455 setFailed(); |
| 456 | 456 |
| 457 // If decoding is done or failed, we don't need the PNGImageReader anymore. | 457 // If decoding is done or failed, we don't need the PNGImageReader anymore. |
| 458 if (isComplete(this) || failed()) | 458 if (isComplete(this) || failed()) |
| 459 m_reader.reset(); | 459 m_reader.reset(); |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace blink | 462 } // namespace blink |
| OLD | NEW |