Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 5635002: Merge 73112 - 2010-12-02 Adam Barth <abarth@webkit.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « WebCore/platform/image-decoders/ImageDecoder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 switch (m_state) { 202 switch (m_state) {
203 case JPEG_HEADER: 203 case JPEG_HEADER:
204 // Read file parameters with jpeg_read_header(). 204 // Read file parameters with jpeg_read_header().
205 if (jpeg_read_header(&m_info, true) == JPEG_SUSPENDED) 205 if (jpeg_read_header(&m_info, true) == JPEG_SUSPENDED)
206 return false; // I/O suspension. 206 return false; // I/O suspension.
207 207
208 // Let libjpeg take care of gray->RGB and YCbCr->RGB conversions. 208 // Let libjpeg take care of gray->RGB and YCbCr->RGB conversions.
209 switch (m_info.jpeg_color_space) { 209 switch (m_info.jpeg_color_space) {
210 case JCS_GRAYSCALE: 210 case JCS_GRAYSCALE:
211 case JCS_YCbCr:
212 // Grayscale images get "upsampled" by libjpeg. If we use
213 // their color profile, CoreGraphics will "upsample" them
214 // again, resulting in horizontal distortions.
215 m_decoder->setIgnoreGammaAndColorProfile(true);
216 // Note fall-through!
211 case JCS_RGB: 217 case JCS_RGB:
212 case JCS_YCbCr:
213 m_info.out_color_space = JCS_RGB; 218 m_info.out_color_space = JCS_RGB;
214 break; 219 break;
215 case JCS_CMYK: 220 case JCS_CMYK:
216 case JCS_YCCK: 221 case JCS_YCCK:
217 // jpeglib cannot convert these to rgb, but it can convert ycck 222 // jpeglib cannot convert these to rgb, but it can convert ycck
218 // to cmyk. 223 // to cmyk.
219 m_info.out_color_space = JCS_CMYK; 224 m_info.out_color_space = JCS_CMYK;
220 break; 225 break;
221 default: 226 default:
222 return m_decoder->setFailed(); 227 return m_decoder->setFailed();
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // has failed. 527 // has failed.
523 if (!m_reader->decode(m_data->buffer(), onlySize) && isAllDataReceived()) 528 if (!m_reader->decode(m_data->buffer(), onlySize) && isAllDataReceived())
524 setFailed(); 529 setFailed();
525 // If we're done decoding the image, we don't need the JPEGImageReader 530 // If we're done decoding the image, we don't need the JPEGImageReader
526 // anymore. (If we failed, |m_reader| has already been cleared.) 531 // anymore. (If we failed, |m_reader| has already been cleared.)
527 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() == RGBA32Buffer::FrameComplete)) 532 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() == RGBA32Buffer::FrameComplete))
528 m_reader.clear(); 533 m_reader.clear();
529 } 534 }
530 535
531 } 536 }
OLDNEW
« no previous file with comments | « WebCore/platform/image-decoders/ImageDecoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698