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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreColorSpace) { | 155 if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreColorSpace) { |
156 // We only support color profiles for color PALETTE and RGB[A] PNG. | 156 // We only support color profiles for color PALETTE and RGB[A] PNG. |
157 // Supporting color profiles for gray-scale images is slightly tricky, at | 157 // Supporting color profiles for gray-scale images is slightly tricky, at |
158 // least using the CoreGraphics ICC library, because we expand gray-scale | 158 // least using the CoreGraphics ICC library, because we expand gray-scale |
159 // images to RGB but we do not similarly transform the color profile. We'd | 159 // images to RGB but we do not similarly transform the color profile. We'd |
160 // either need to transform the color profile or we'd need to decode into a | 160 // either need to transform the color profile or we'd need to decode into a |
161 // gray-scale image buffer and hand that to CoreGraphics. | 161 // gray-scale image buffer and hand that to CoreGraphics. |
162 sk_sp<SkColorSpace> colorSpace = readColorSpace(png, info); | 162 sk_sp<SkColorSpace> colorSpace = readColorSpace(png, info); |
163 if (colorSpace) { | 163 if (colorSpace) { |
164 setColorSpaceAndComputeTransform(colorSpace); | 164 setEmbeddedColorSpace(colorSpace); |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 if (!hasEmbeddedColorSpace()) { | 168 if (!hasEmbeddedColorSpace()) { |
169 // TODO (msarett): | 169 // TODO (msarett): |
170 // Applying the transfer function (gamma) should be handled by | 170 // Applying the transfer function (gamma) should be handled by |
171 // SkColorSpaceXform. Here we always convert to a transfer function that | 171 // SkColorSpaceXform. Here we always convert to a transfer function that |
172 // is a 2.2 exponential. This is a little strange given that the dst | 172 // is a 2.2 exponential. This is a little strange given that the dst |
173 // transfer function is not necessarily a 2.2 exponential. | 173 // transfer function is not necessarily a 2.2 exponential. |
174 // TODO (msarett): | 174 // TODO (msarett): |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // has failed. | 381 // has failed. |
382 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 382 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
383 setFailed(); | 383 setFailed(); |
384 | 384 |
385 // If decoding is done or failed, we don't need the PNGImageReader anymore. | 385 // If decoding is done or failed, we don't need the PNGImageReader anymore. |
386 if (isComplete(this) || failed()) | 386 if (isComplete(this) || failed()) |
387 m_reader.reset(); | 387 m_reader.reset(); |
388 } | 388 } |
389 | 389 |
390 } // namespace blink | 390 } // namespace blink |
OLD | NEW |