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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, |
232 &profileLength)) { | 232 &profileLength)) { |
233 setColorSpaceAndComputeTransform(reinterpret_cast<char*>(profile), | 233 setColorProfileAndComputeTransform(reinterpret_cast<char*>(profile), |
234 profileLength); | 234 profileLength); |
235 } | 235 } |
236 } | 236 } |
237 #endif // PNG_iCCP_SUPPORTED | 237 #endif // PNG_iCCP_SUPPORTED |
238 } | 238 } |
239 | 239 |
240 if (!hasColorSpace()) { | 240 if (!hasEmbeddedColorSpace()) { |
241 // TODO (msarett): | 241 // TODO (msarett): |
242 // Applying the transfer function (gamma) should be handled by | 242 // Applying the transfer function (gamma) should be handled by |
243 // SkColorSpaceXform. Here we always convert to a transfer function that | 243 // SkColorSpaceXform. Here we always convert to a transfer function that |
244 // is a 2.2 exponential. This is a little strange given that the dst | 244 // is a 2.2 exponential. This is a little strange given that the dst |
245 // transfer function is not necessarily a 2.2 exponential. | 245 // transfer function is not necessarily a 2.2 exponential. |
246 // TODO (msarett): | 246 // TODO (msarett): |
247 // Often, PNGs that specify their transfer function with the gAMA tag will | 247 // Often, PNGs that specify their transfer function with the gAMA tag will |
248 // also specify their gamut with the cHRM tag. We should read this tag | 248 // also specify their gamut with the cHRM tag. We should read this tag |
249 // and do a full color space transformation if it is present. | 249 // and do a full color space transformation if it is present. |
250 const double inverseGamma = 0.45455; | 250 const double inverseGamma = 0.45455; |
(...skipping 202 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 |