| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 unsigned type = readUint16(ifd + 2, isBigEndian); | 207 unsigned type = readUint16(ifd + 2, isBigEndian); |
| 208 unsigned count = readUint32(ifd + 4, isBigEndian); | 208 unsigned count = readUint32(ifd + 4, isBigEndian); |
| 209 if (tag == orientationTag && type == shortType && count == 1) | 209 if (tag == orientationTag && type == shortType && count == 1) |
| 210 return ImageOrientation::fromEXIFValue(readUint16(ifd + 8, isBig
Endian)); | 210 return ImageOrientation::fromEXIFValue(readUint16(ifd + 8, isBig
Endian)); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 return ImageOrientation(); | 214 return ImageOrientation(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 #if USE(QCMSLIB) |
| 217 static void readColorProfile(jpeg_decompress_struct* info, ColorProfile& colorPr
ofile) | 218 static void readColorProfile(jpeg_decompress_struct* info, ColorProfile& colorPr
ofile) |
| 218 { | 219 { |
| 219 #if USE(ICCJPEG) | 220 #if USE(ICCJPEG) |
| 220 JOCTET* profile; | 221 JOCTET* profile; |
| 221 unsigned int profileLength; | 222 unsigned int profileLength; |
| 222 | 223 |
| 223 if (!read_icc_profile(info, &profile, &profileLength)) | 224 if (!read_icc_profile(info, &profile, &profileLength)) |
| 224 return; | 225 return; |
| 225 | 226 |
| 226 // Only accept RGB color profiles from input class devices. | 227 // Only accept RGB color profiles from input class devices. |
| 227 bool ignoreProfile = false; | 228 bool ignoreProfile = false; |
| 228 char* profileData = reinterpret_cast<char*>(profile); | 229 char* profileData = reinterpret_cast<char*>(profile); |
| 229 if (profileLength < ImageDecoder::iccColorProfileHeaderLength) | 230 if (profileLength < ImageDecoder::iccColorProfileHeaderLength) |
| 230 ignoreProfile = true; | 231 ignoreProfile = true; |
| 231 else if (!ImageDecoder::rgbColorProfile(profileData, profileLength)) | 232 else if (!ImageDecoder::rgbColorProfile(profileData, profileLength)) |
| 232 ignoreProfile = true; | 233 ignoreProfile = true; |
| 233 else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength)) | 234 else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength)) |
| 234 ignoreProfile = true; | 235 ignoreProfile = true; |
| 235 | 236 |
| 236 ASSERT(colorProfile.isEmpty()); | 237 ASSERT(colorProfile.isEmpty()); |
| 237 if (!ignoreProfile) | 238 if (!ignoreProfile) |
| 238 colorProfile.append(profileData, profileLength); | 239 colorProfile.append(profileData, profileLength); |
| 239 free(profile); | 240 free(profile); |
| 240 #else | 241 #else |
| 241 UNUSED_PARAM(info); | 242 UNUSED_PARAM(info); |
| 242 UNUSED_PARAM(colorProfile); | 243 UNUSED_PARAM(colorProfile); |
| 243 #endif | 244 #endif |
| 244 } | 245 } |
| 246 #endif |
| 245 | 247 |
| 246 class JPEGImageReader { | 248 class JPEGImageReader { |
| 247 WTF_MAKE_FAST_ALLOCATED; | 249 WTF_MAKE_FAST_ALLOCATED; |
| 248 public: | 250 public: |
| 249 JPEGImageReader(JPEGImageDecoder* decoder) | 251 JPEGImageReader(JPEGImageDecoder* decoder) |
| 250 : m_decoder(decoder) | 252 : m_decoder(decoder) |
| 251 , m_bufferLength(0) | 253 , m_bufferLength(0) |
| 252 , m_bytesToSkip(0) | 254 , m_bytesToSkip(0) |
| 253 , m_state(JPEG_HEADER) | 255 , m_state(JPEG_HEADER) |
| 254 , m_samples(0) | 256 , m_samples(0) |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 // has failed. | 791 // has failed. |
| 790 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 792 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
| 791 setFailed(); | 793 setFailed(); |
| 792 // If we're done decoding the image, we don't need the JPEGImageReader | 794 // If we're done decoding the image, we don't need the JPEGImageReader |
| 793 // anymore. (If we failed, |m_reader| has already been cleared.) | 795 // anymore. (If we failed, |m_reader| has already been cleared.) |
| 794 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() ==
ImageFrame::FrameComplete)) | 796 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() ==
ImageFrame::FrameComplete)) |
| 795 m_reader.clear(); | 797 m_reader.clear(); |
| 796 } | 798 } |
| 797 | 799 |
| 798 } | 800 } |
| OLD | NEW |