OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * Portions are Copyright (C) 2001-6 mozilla.org | 4 * Portions are Copyright (C) 2001-6 mozilla.org |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Stuart Parmenter <stuart@mozilla.com> | 7 * Stuart Parmenter <stuart@mozilla.com> |
8 * | 8 * |
9 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 9 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
10 * | 10 * |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 m_decoder->setIgnoreGammaAndColorProfile(true); | 215 m_decoder->setIgnoreGammaAndColorProfile(true); |
216 // Note fall-through! | 216 // Note fall-through! |
217 case JCS_RGB: | 217 case JCS_RGB: |
218 m_info.out_color_space = JCS_RGB; | 218 m_info.out_color_space = JCS_RGB; |
219 break; | 219 break; |
220 case JCS_CMYK: | 220 case JCS_CMYK: |
221 case JCS_YCCK: | 221 case JCS_YCCK: |
222 // jpeglib cannot convert these to rgb, but it can convert ycck | 222 // jpeglib cannot convert these to rgb, but it can convert ycck |
223 // to cmyk. | 223 // to cmyk. |
224 m_info.out_color_space = JCS_CMYK; | 224 m_info.out_color_space = JCS_CMYK; |
| 225 |
| 226 // Same as with grayscale images, we convert CMYK images to RGBA |
| 227 // ones. When we keep the color profiles of these CMYK images, |
| 228 // CoreGraphics will convert their colors again. So, we discard |
| 229 // their color profiles to prevent color corruption. |
| 230 m_decoder->setIgnoreGammaAndColorProfile(true); |
225 break; | 231 break; |
226 default: | 232 default: |
227 return m_decoder->setFailed(); | 233 return m_decoder->setFailed(); |
228 } | 234 } |
229 | 235 |
230 // Don't allocate a giant and superfluous memory buffer when the | 236 // Don't allocate a giant and superfluous memory buffer when the |
231 // image is a sequential JPEG. | 237 // image is a sequential JPEG. |
232 m_info.buffered_image = jpeg_has_multiple_scans(&m_info); | 238 m_info.buffered_image = jpeg_has_multiple_scans(&m_info); |
233 | 239 |
234 // Used to set up image size so arrays can be allocated. | 240 // Used to set up image size so arrays can be allocated. |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 // has failed. | 533 // has failed. |
528 if (!m_reader->decode(m_data->buffer(), onlySize) && isAllDataReceived()) | 534 if (!m_reader->decode(m_data->buffer(), onlySize) && isAllDataReceived()) |
529 setFailed(); | 535 setFailed(); |
530 // If we're done decoding the image, we don't need the JPEGImageReader | 536 // If we're done decoding the image, we don't need the JPEGImageReader |
531 // anymore. (If we failed, |m_reader| has already been cleared.) | 537 // anymore. (If we failed, |m_reader| has already been cleared.) |
532 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() ==
RGBA32Buffer::FrameComplete)) | 538 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() ==
RGBA32Buffer::FrameComplete)) |
533 m_reader.clear(); | 539 m_reader.clear(); |
534 } | 540 } |
535 | 541 |
536 } | 542 } |
OLD | NEW |