Changeset 71174 in webkit
- Timestamp:
- Nov 2, 2010 3:01:32 PM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r71170 r71174 1 2010-11-02 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 JPEG decoders should understand color profiles 6 https://bugs.webkit.org/show_bug.cgi?id=48819 7 8 This patch is currently a no-op because no one defines USE(ICCJPEG). 9 We'll enable this for Chromium Mac once we have ICCJPEG landed in 10 Chromium's third_party directory. 11 12 * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: 13 (WebCore::readColorProfile): 14 (WebCore::JPEGImageReader::JPEGImageReader): 15 (WebCore::JPEGImageReader::decode): 16 (WebCore::JPEGImageDecoder::outputScanlines): 17 * platform/image-decoders/jpeg/JPEGImageDecoder.h: 18 (WebCore::JPEGImageDecoder::setColorProfile): 19 1 20 2010-11-02 Mihai Parparita <mihaip@chromium.org> 2 21 -
trunk/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
r71162 r71174 52 52 53 53 extern "C" { 54 54 55 #include "jpeglib.h" 56 57 #if USE(ICCJPEG) 58 #include "iccjpeg.h" 59 #endif 60 55 61 } 56 62 … … 86 92 JPEGImageReader* decoder; 87 93 }; 94 95 static ColorProfile readColorProfile(jpeg_decompress_struct* info) 96 { 97 #if USE(ICCJPEG) 98 JOCTET* profile; 99 unsigned int profileLength; 100 101 if (!read_icc_profile(info, &profile, &profileLength)) 102 return ColorProfile(); 103 104 ColorProfile colorProfile; 105 colorProfile.append(reinterpret_cast<char*>(profile), profileLength); 106 free(profile); 107 return colorProfile; 108 #else 109 return ColorProfile(); 110 #endif 111 } 88 112 89 113 class JPEGImageReader … … 124 148 src->pub.term_source = term_source; 125 149 src->decoder = this; 150 151 // Enable these markers for the ICC color profile. 152 // Apparently there are 16 of these markers. I don't see anywhere in the header with this constant. 153 for (unsigned i = 0; i < 0xF; ++i) 154 jpeg_save_markers(&m_info, JPEG_APP0 + i, 0xFFFF); 126 155 } 127 156 … … 213 242 return false; 214 243 244 m_decoder->setColorProfile(readColorProfile(info())); 245 215 246 if (m_decodingSizeOnly) { 216 247 // We can stop here. Reduce our buffer length and available … … 422 453 buffer.setStatus(RGBA32Buffer::FramePartial); 423 454 buffer.setHasAlpha(false); 455 buffer.setColorProfile(m_colorProfile); 424 456 425 457 // For JPEGs, the frame always fills the entire image. -
trunk/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
r71162 r71174 55 55 void jpegComplete(); 56 56 57 void setColorProfile(const ColorProfile& colorProfile) { m_colorProfile = colorProfile; } 58 57 59 private: 58 60 // Decodes the image. If |onlySize| is true, stops decoding after
Note: See TracChangeset
for help on using the changeset viewer.