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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 qcms_profile* deviceProfile = ImageDecoder::qcmsOutputDeviceProfile(); | 167 qcms_profile* deviceProfile = ImageDecoder::qcmsOutputDeviceProfile(); |
168 if (!deviceProfile) | 168 if (!deviceProfile) |
169 return; | 169 return; |
170 qcms_profile* inputProfile = 0; | 170 qcms_profile* inputProfile = 0; |
171 if (!colorProfile.isEmpty()) | 171 if (!colorProfile.isEmpty()) |
172 inputProfile = qcms_profile_from_memory(colorProfile.data(), colorPr
ofile.size()); | 172 inputProfile = qcms_profile_from_memory(colorProfile.data(), colorPr
ofile.size()); |
173 else | 173 else |
174 inputProfile = qcms_profile_sRGB(); | 174 inputProfile = qcms_profile_sRGB(); |
175 if (!inputProfile) | 175 if (!inputProfile) |
176 return; | 176 return; |
| 177 |
177 // We currently only support color profiles for RGB and RGBA images. | 178 // We currently only support color profiles for RGB and RGBA images. |
178 ASSERT(rgbData == qcms_profile_get_color_space(inputProfile)); | 179 ASSERT(rgbData == qcms_profile_get_color_space(inputProfile)); |
| 180 |
| 181 if (qcms_profile_match(inputProfile, deviceProfile)) { |
| 182 qcms_profile_release(inputProfile); |
| 183 return; |
| 184 } |
| 185 |
| 186 // FIXME: Don't force perceptual intent if the image profile contains an
intent. |
179 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_
8; | 187 qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_
8; |
180 // FIXME: Don't force perceptual intent if the image profile contains an
intent. | |
181 m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProf
ile, dataFormat, QCMS_INTENT_PERCEPTUAL); | 188 m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProf
ile, dataFormat, QCMS_INTENT_PERCEPTUAL); |
| 189 |
182 qcms_profile_release(inputProfile); | 190 qcms_profile_release(inputProfile); |
183 } | 191 } |
184 #endif | 192 #endif |
185 | 193 |
186 private: | 194 private: |
187 png_structp m_png; | 195 png_structp m_png; |
188 png_infop m_info; | 196 png_infop m_info; |
189 PNGImageDecoder* m_decoder; | 197 PNGImageDecoder* m_decoder; |
190 unsigned m_readOffset; | 198 unsigned m_readOffset; |
191 unsigned m_currentBufferSize; | 199 unsigned m_currentBufferSize; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 // has failed. | 504 // has failed. |
497 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 505 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
498 setFailed(); | 506 setFailed(); |
499 | 507 |
500 // If decoding is done or failed, we don't need the PNGImageReader anymore. | 508 // If decoding is done or failed, we don't need the PNGImageReader anymore. |
501 if (isComplete(this) || failed()) | 509 if (isComplete(this) || failed()) |
502 m_reader.clear(); | 510 m_reader.clear(); |
503 } | 511 } |
504 | 512 |
505 } // namespace blink | 513 } // namespace blink |
OLD | NEW |