Diff
Modified: trunk/Source/WebCore/ChangeLog (205660 => 205661)
--- trunk/Source/WebCore/ChangeLog 2016-09-08 21:09:04 UTC (rev 205660)
+++ trunk/Source/WebCore/ChangeLog 2016-09-08 21:16:38 UTC (rev 205661)
@@ -1,3 +1,25 @@
+2016-09-08 Said Abou-Hallawa <[email protected]>
+
+ Get rid of the color profile from ImageFrame and ImageDecoder
+ https://bugs.webkit.org/show_bug.cgi?id=159699
+
+ Reviewed by Simon Fraser.
+
+ The color profile is set but it is never used.
+
+ * platform/image-decoders/ImageDecoder.cpp:
+ (WebCore::ImageFrame::setColorProfile): Deleted.
+ * platform/image-decoders/ImageDecoder.h:
+ * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+ (WebCore::JPEGImageReader::decode):
+ (WebCore::JPEGImageDecoder::outputScanlines):
+ (WebCore::readColorProfile): Deleted.
+ * platform/image-decoders/jpeg/JPEGImageDecoder.h:
+ * platform/image-decoders/png/PNGImageDecoder.cpp:
+ (WebCore::PNGImageDecoder::headerAvailable):
+ (WebCore::PNGImageDecoder::rowAvailable):
+ (WebCore::readColorProfile): Deleted.
+
2016-09-08 Dave Hyatt <[email protected]>
[CSS Parser] Add support for new CSS selector parsing
Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp (205660 => 205661)
--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp 2016-09-08 21:09:04 UTC (rev 205660)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp 2016-09-08 21:16:38 UTC (rev 205661)
@@ -220,11 +220,6 @@
m_hasAlpha = alpha;
}
-void ImageFrame::setColorProfile(const ColorProfile& colorProfile)
-{
- m_colorProfile = colorProfile;
-}
-
void ImageFrame::setStatus(FrameStatus status)
{
m_status = status;
Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h (205660 => 205661)
--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2016-09-08 21:09:04 UTC (rev 205660)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2016-09-08 21:16:38 UTC (rev 205661)
@@ -110,7 +110,6 @@
bool premultiplyAlpha() const { return m_premultiplyAlpha; }
void setHasAlpha(bool alpha);
- void setColorProfile(const ColorProfile&);
void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; }
void setStatus(FrameStatus status);
void setDuration(unsigned duration) { m_duration = duration; }
@@ -214,8 +213,6 @@
Vector<PixelData> m_backingStore;
PixelData* m_bytes; // The memory is backed by m_backingStore.
IntSize m_size;
- // FIXME: Do we need m_colorProfile anymore?
- ColorProfile m_colorProfile;
bool m_hasAlpha;
IntRect m_originalFrameRect; // This will always just be the entire
// buffer except for GIF frames whose
@@ -381,8 +378,6 @@
RefPtr<SharedBuffer> m_data; // The encoded data.
Vector<ImageFrame, 1> m_frameBufferCache;
- // FIXME: Do we need m_colorProfile any more, for any port?
- ColorProfile m_colorProfile;
bool m_scaled { false };
Vector<int> m_scaledColumns;
Vector<int> m_scaledRows;
Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (205660 => 205661)
--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp 2016-09-08 21:09:04 UTC (rev 205660)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp 2016-09-08 21:16:38 UTC (rev 205661)
@@ -196,36 +196,6 @@
return ImageOrientation();
}
-static ColorProfile readColorProfile(jpeg_decompress_struct* info)
-{
-#if USE(ICCJPEG)
- JOCTET* profile;
- unsigned int profileLength;
-
- if (!read_icc_profile(info, &profile, &profileLength))
- return ColorProfile();
-
- // Only accept RGB color profiles from input class devices.
- bool ignoreProfile = false;
- char* profileData = reinterpret_cast<char*>(profile);
- if (profileLength < ImageDecoder::iccColorProfileHeaderLength)
- ignoreProfile = true;
- else if (!ImageDecoder::rgbColorProfile(profileData, profileLength))
- ignoreProfile = true;
- else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength))
- ignoreProfile = true;
-
- ColorProfile colorProfile;
- if (!ignoreProfile)
- colorProfile.append(profileData, profileLength);
- free(profile);
- return colorProfile;
-#else
- UNUSED_PARAM(info);
- return ColorProfile();
-#endif
-}
-
class JPEGImageReader {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -363,13 +333,6 @@
if (m_decoder->willDownSample() && turboSwizzled(m_info.out_color_space))
m_info.out_color_space = JCS_RGB;
#endif
- // Allow color management of the decoded RGBA pixels if possible.
- if (!m_decoder->ignoresGammaAndColorProfile()) {
- ColorProfile rgbInputDeviceColorProfile = readColorProfile(info());
- if (!rgbInputDeviceColorProfile.isEmpty())
- m_decoder->setColorProfile(rgbInputDeviceColorProfile);
- }
-
// Don't allocate a giant and superfluous memory buffer when the
// image is a sequential JPEG.
m_info.buffered_image = jpeg_has_multiple_scans(&m_info);
@@ -660,7 +623,6 @@
// The buffer is transparent outside the decoded area while the image is
// loading. The completed image will be marked fully opaque in jpegComplete().
buffer.setHasAlpha(true);
- buffer.setColorProfile(m_colorProfile);
// For JPEGs, the frame always fills the entire image.
buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h (205660 => 205661)
--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h 2016-09-08 21:09:04 UTC (rev 205660)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h 2016-09-08 21:16:38 UTC (rev 205661)
@@ -66,7 +66,6 @@
bool outputScanlines();
void jpegComplete();
- void setColorProfile(const ColorProfile& colorProfile) { m_colorProfile = colorProfile; }
void setOrientation(ImageOrientation orientation) { m_orientation = orientation; }
private:
Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp (205660 => 205661)
--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp 2016-09-08 21:09:04 UTC (rev 205660)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp 2016-09-08 21:16:38 UTC (rev 205661)
@@ -276,37 +276,6 @@
return ImageDecoder::setFailed();
}
-static void readColorProfile(png_structp png, png_infop info, ColorProfile& colorProfile)
-{
- ASSERT(colorProfile.isEmpty());
-
-#ifdef PNG_iCCP_SUPPORTED
- char* profileName;
- int compressionType;
-#if (PNG_LIBPNG_VER < 10500)
- png_charp profile;
-#else
- png_bytep profile;
-#endif
- png_uint_32 profileLength;
- if (!png_get_iCCP(png, info, &profileName, &compressionType, &profile, &profileLength))
- return;
-
- // Only accept RGB color profiles from input class devices.
- bool ignoreProfile = false;
- char* profileData = reinterpret_cast<char*>(profile);
- if (profileLength < ImageDecoder::iccColorProfileHeaderLength)
- ignoreProfile = true;
- else if (!ImageDecoder::rgbColorProfile(profileData, profileLength))
- ignoreProfile = true;
- else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileLength))
- ignoreProfile = true;
-
- if (!ignoreProfile)
- colorProfile.append(profileData, profileLength);
-#endif
-}
-
void PNGImageDecoder::headerAvailable()
{
png_structp png = m_reader->pngPtr();
@@ -405,16 +374,6 @@
if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png);
- if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreGammaAndColorProfile) {
- // We only support color profiles for color PALETTE and RGB[A] PNG. Supporting
- // color profiles for gray-scale images is slightly tricky, at least using the
- // CoreGraphics ICC library, because we expand gray-scale images to RGB but we
- // do not similarly transform the color profile. We'd either need to transform
- // the color profile or we'd need to decode into a gray-scale image buffer and
- // hand that to CoreGraphics.
- readColorProfile(png, info, m_colorProfile);
- }
-
// Deal with gamma and keep it under our control.
double gamma;
if (!m_ignoreGammaAndColorProfile && png_get_gAMA(png, info, &gamma)) {
@@ -506,7 +465,6 @@
buffer.setStatus(ImageFrame::FramePartial);
buffer.setHasAlpha(false);
- buffer.setColorProfile(m_colorProfile);
#if ENABLE(APNG)
if (m_currentFrame)