Changeset 205661 in webkit
- Timestamp:
- Sep 8, 2016 2:16:38 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205660 r205661 1 2016-09-08 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Get rid of the color profile from ImageFrame and ImageDecoder 4 https://bugs.webkit.org/show_bug.cgi?id=159699 5 6 Reviewed by Simon Fraser. 7 8 The color profile is set but it is never used. 9 10 * platform/image-decoders/ImageDecoder.cpp: 11 (WebCore::ImageFrame::setColorProfile): Deleted. 12 * platform/image-decoders/ImageDecoder.h: 13 * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: 14 (WebCore::JPEGImageReader::decode): 15 (WebCore::JPEGImageDecoder::outputScanlines): 16 (WebCore::readColorProfile): Deleted. 17 * platform/image-decoders/jpeg/JPEGImageDecoder.h: 18 * platform/image-decoders/png/PNGImageDecoder.cpp: 19 (WebCore::PNGImageDecoder::headerAvailable): 20 (WebCore::PNGImageDecoder::rowAvailable): 21 (WebCore::readColorProfile): Deleted. 22 1 23 2016-09-08 Dave Hyatt <hyatt@apple.com> 2 24 -
trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp
r202800 r205661 221 221 } 222 222 223 void ImageFrame::setColorProfile(const ColorProfile& colorProfile)224 {225 m_colorProfile = colorProfile;226 }227 228 223 void ImageFrame::setStatus(FrameStatus status) 229 224 { -
trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h
r202800 r205661 111 111 112 112 void setHasAlpha(bool alpha); 113 void setColorProfile(const ColorProfile&);114 113 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; } 115 114 void setStatus(FrameStatus status); … … 215 214 PixelData* m_bytes; // The memory is backed by m_backingStore. 216 215 IntSize m_size; 217 // FIXME: Do we need m_colorProfile anymore?218 ColorProfile m_colorProfile;219 216 bool m_hasAlpha; 220 217 IntRect m_originalFrameRect; // This will always just be the entire … … 382 379 RefPtr<SharedBuffer> m_data; // The encoded data. 383 380 Vector<ImageFrame, 1> m_frameBufferCache; 384 // FIXME: Do we need m_colorProfile any more, for any port?385 ColorProfile m_colorProfile;386 381 bool m_scaled { false }; 387 382 Vector<int> m_scaledColumns; -
trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
r197171 r205661 197 197 } 198 198 199 static ColorProfile readColorProfile(jpeg_decompress_struct* info)200 {201 #if USE(ICCJPEG)202 JOCTET* profile;203 unsigned int profileLength;204 205 if (!read_icc_profile(info, &profile, &profileLength))206 return ColorProfile();207 208 // Only accept RGB color profiles from input class devices.209 bool ignoreProfile = false;210 char* profileData = reinterpret_cast<char*>(profile);211 if (profileLength < ImageDecoder::iccColorProfileHeaderLength)212 ignoreProfile = true;213 else if (!ImageDecoder::rgbColorProfile(profileData, profileLength))214 ignoreProfile = true;215 else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength))216 ignoreProfile = true;217 218 ColorProfile colorProfile;219 if (!ignoreProfile)220 colorProfile.append(profileData, profileLength);221 free(profile);222 return colorProfile;223 #else224 UNUSED_PARAM(info);225 return ColorProfile();226 #endif227 }228 229 199 class JPEGImageReader { 230 200 WTF_MAKE_FAST_ALLOCATED; … … 364 334 m_info.out_color_space = JCS_RGB; 365 335 #endif 366 // Allow color management of the decoded RGBA pixels if possible.367 if (!m_decoder->ignoresGammaAndColorProfile()) {368 ColorProfile rgbInputDeviceColorProfile = readColorProfile(info());369 if (!rgbInputDeviceColorProfile.isEmpty())370 m_decoder->setColorProfile(rgbInputDeviceColorProfile);371 }372 373 336 // Don't allocate a giant and superfluous memory buffer when the 374 337 // image is a sequential JPEG. … … 661 624 // loading. The completed image will be marked fully opaque in jpegComplete(). 662 625 buffer.setHasAlpha(true); 663 buffer.setColorProfile(m_colorProfile);664 626 665 627 // For JPEGs, the frame always fills the entire image. -
trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
r202677 r205661 67 67 void jpegComplete(); 68 68 69 void setColorProfile(const ColorProfile& colorProfile) { m_colorProfile = colorProfile; }70 69 void setOrientation(ImageOrientation orientation) { m_orientation = orientation; } 71 70 -
trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
r197171 r205661 277 277 } 278 278 279 static void readColorProfile(png_structp png, png_infop info, ColorProfile& colorProfile)280 {281 ASSERT(colorProfile.isEmpty());282 283 #ifdef PNG_iCCP_SUPPORTED284 char* profileName;285 int compressionType;286 #if (PNG_LIBPNG_VER < 10500)287 png_charp profile;288 #else289 png_bytep profile;290 #endif291 png_uint_32 profileLength;292 if (!png_get_iCCP(png, info, &profileName, &compressionType, &profile, &profileLength))293 return;294 295 // Only accept RGB color profiles from input class devices.296 bool ignoreProfile = false;297 char* profileData = reinterpret_cast<char*>(profile);298 if (profileLength < ImageDecoder::iccColorProfileHeaderLength)299 ignoreProfile = true;300 else if (!ImageDecoder::rgbColorProfile(profileData, profileLength))301 ignoreProfile = true;302 else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength))303 ignoreProfile = true;304 305 if (!ignoreProfile)306 colorProfile.append(profileData, profileLength);307 #endif308 }309 310 279 void PNGImageDecoder::headerAvailable() 311 280 { … … 406 375 png_set_gray_to_rgb(png); 407 376 408 if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreGammaAndColorProfile) {409 // We only support color profiles for color PALETTE and RGB[A] PNG. Supporting410 // color profiles for gray-scale images is slightly tricky, at least using the411 // CoreGraphics ICC library, because we expand gray-scale images to RGB but we412 // do not similarly transform the color profile. We'd either need to transform413 // the color profile or we'd need to decode into a gray-scale image buffer and414 // hand that to CoreGraphics.415 readColorProfile(png, info, m_colorProfile);416 }417 418 377 // Deal with gamma and keep it under our control. 419 378 double gamma; … … 507 466 buffer.setStatus(ImageFrame::FramePartial); 508 467 buffer.setHasAlpha(false); 509 buffer.setColorProfile(m_colorProfile);510 468 511 469 #if ENABLE(APNG)
Note: See TracChangeset
for help on using the changeset viewer.