Remove libqcms support
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Feb 2016 17:36:41 +0000 (17:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Feb 2016 17:36:41 +0000 (17:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154707

Patch by Martin Robinson <mrobinson@igalia.com> on 2016-02-26
Reviewed by Žan Doberšek.

No new tests. This change simply removes dead code.

* platform/image-decoders/ImageDecoder.h: Remove QCMS support.
(WebCore::ImageDecoder::qcmsOutputDeviceProfile): Deleted.
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp: Remove QCMS support.
(WebCore::JPEGImageReader::JPEGImageReader): Deleted.
(WebCore::JPEGImageReader::close): Deleted.
(WebCore::JPEGImageReader::decode): Deleted.
(WebCore::JPEGImageReader::colorTransform): Deleted.
(WebCore::JPEGImageReader::createColorTransform): Deleted.
(WebCore::JPEGImageDecoder::outputScanlines): Deleted.
* platform/image-decoders/png/PNGImageDecoder.cpp: Remove QCMS support.
(WebCore::PNGImageReader::PNGImageReader): Deleted.
(WebCore::PNGImageReader::close): Deleted.
(WebCore::PNGImageReader::rowBuffer): Deleted.
(WebCore::PNGImageReader::createRowBuffer): Deleted.
(WebCore::PNGImageReader::colorTransform): Deleted.
(WebCore::PNGImageReader::createColorTransform): Deleted.
(WebCore::PNGImageDecoder::headerAvailable): Deleted.
(WebCore::PNGImageDecoder::rowAvailable): Deleted.
(WebCore::PNGImageDecoder::frameComplete): Deleted.
* platform/image-decoders/webp/WEBPImageDecoder.cpp: Remove QCMS support.
(WebCore::WEBPImageDecoder::decode): Remove QCMS support.
(WebCore::WEBPImageDecoder::WEBPImageDecoder): Deleted.
(WebCore::WEBPImageDecoder::clear): Deleted.
(WebCore::WEBPImageDecoder::createColorTransform): Deleted.
(WebCore::WEBPImageDecoder::readColorProfile): Deleted.
(WebCore::WEBPImageDecoder::applyColorProfile): Deleted.
* platform/image-decoders/webp/WEBPImageDecoder.h: Remove QCMS support.
(WebCore::WEBPImageDecoder::colorTransform): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/image-decoders/ImageDecoder.h
Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h

index d495da3..b7f8120 100644 (file)
@@ -1,3 +1,41 @@
+2016-02-26  Martin Robinson  <mrobinson@igalia.com>
+
+        Remove libqcms support
+        https://bugs.webkit.org/show_bug.cgi?id=154707
+
+        Reviewed by Žan Doberšek.
+
+        No new tests. This change simply removes dead code.
+
+        * platform/image-decoders/ImageDecoder.h: Remove QCMS support.
+        (WebCore::ImageDecoder::qcmsOutputDeviceProfile): Deleted.
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: Remove QCMS support.
+        (WebCore::JPEGImageReader::JPEGImageReader): Deleted.
+        (WebCore::JPEGImageReader::close): Deleted.
+        (WebCore::JPEGImageReader::decode): Deleted.
+        (WebCore::JPEGImageReader::colorTransform): Deleted.
+        (WebCore::JPEGImageReader::createColorTransform): Deleted.
+        (WebCore::JPEGImageDecoder::outputScanlines): Deleted.
+        * platform/image-decoders/png/PNGImageDecoder.cpp: Remove QCMS support.
+        (WebCore::PNGImageReader::PNGImageReader): Deleted.
+        (WebCore::PNGImageReader::close): Deleted.
+        (WebCore::PNGImageReader::rowBuffer): Deleted.
+        (WebCore::PNGImageReader::createRowBuffer): Deleted.
+        (WebCore::PNGImageReader::colorTransform): Deleted.
+        (WebCore::PNGImageReader::createColorTransform): Deleted.
+        (WebCore::PNGImageDecoder::headerAvailable): Deleted.
+        (WebCore::PNGImageDecoder::rowAvailable): Deleted.
+        (WebCore::PNGImageDecoder::frameComplete): Deleted.
+        * platform/image-decoders/webp/WEBPImageDecoder.cpp: Remove QCMS support.
+        (WebCore::WEBPImageDecoder::decode): Remove QCMS support.
+        (WebCore::WEBPImageDecoder::WEBPImageDecoder): Deleted.
+        (WebCore::WEBPImageDecoder::clear): Deleted.
+        (WebCore::WEBPImageDecoder::createColorTransform): Deleted.
+        (WebCore::WEBPImageDecoder::readColorProfile): Deleted.
+        (WebCore::WEBPImageDecoder::applyColorProfile): Deleted.
+        * platform/image-decoders/webp/WEBPImageDecoder.h: Remove QCMS support.
+        (WebCore::WEBPImageDecoder::colorTransform): Deleted.
+
 2016-02-26  Zalan Bujtas  <zalan@apple.com>
 
         RenderTheme::controlSize* methods should take const RenderStyle&.
index 2c01fdd..fc87f83 100644 (file)
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
-#if USE(QCMSLIB)
-#include "qcms.h"
-#if OS(DARWIN)
-#include "GraphicsContextCG.h"
-#include <ApplicationServices/ApplicationServices.h>
-#include <wtf/RetainPtr.h>
-#endif
-#endif
-
 namespace WebCore {
 
     // ImageFrame represents the decoded image data.  This buffer is what all
@@ -346,38 +337,6 @@ namespace WebCore {
             return !memcmp(&profileData[12], "mntr", 4) || !memcmp(&profileData[12], "scnr", 4);
         }
 
-#if USE(QCMSLIB)
-        static qcms_profile* qcmsOutputDeviceProfile()
-        {
-            static qcms_profile* outputDeviceProfile = 0;
-
-            static bool qcmsInitialized = false;
-            if (!qcmsInitialized) {
-                qcmsInitialized = true;
-                // FIXME: Add optional ICCv4 support.
-#if OS(DARWIN)
-                RetainPtr<CGColorSpaceRef> monitorColorSpace = adoptCF(CGDisplayCopyColorSpace(CGMainDisplayID()));
-                CFDataRef iccProfile(CGColorSpaceCopyICCProfile(monitorColorSpace.get()));
-                if (iccProfile) {
-                    size_t length = CFDataGetLength(iccProfile);
-                    const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile);
-                    outputDeviceProfile = qcms_profile_from_memory(systemProfile, length);
-                    CFRelease(iccProfile);
-                }
-#endif
-                if (outputDeviceProfile && qcms_profile_is_bogus(outputDeviceProfile)) {
-                    qcms_profile_release(outputDeviceProfile);
-                    outputDeviceProfile = 0;
-                }
-                if (!outputDeviceProfile)
-                    outputDeviceProfile = qcms_profile_sRGB();
-                if (outputDeviceProfile)
-                    qcms_profile_precache_output_transform(outputDeviceProfile);
-            }
-            return outputDeviceProfile;
-        }
-#endif
-
         // Sets the "decode failure" flag.  For caller convenience (since so
         // many callers want to return false after calling this), returns false
         // to enable easy tailcalling.  Subclasses may override this to also
index bbe709c..ee66ac1 100644 (file)
@@ -44,9 +44,6 @@ extern "C" {
 #if USE(ICCJPEG)
 #include <iccjpeg.h>
 #endif
-#if USE(QCMSLIB)
-#include <qcms.h>
-#endif
 #include <setjmp.h>
 }
 
@@ -238,9 +235,6 @@ public:
         , m_bytesToSkip(0)
         , m_state(JPEG_HEADER)
         , m_samples(0)
-#if USE(QCMSLIB)
-        , m_transform(0)
-#endif
     {
         memset(&m_info, 0, sizeof(jpeg_decompress_struct));
 
@@ -291,11 +285,6 @@ public:
             fastFree(src);
         m_info.src = 0;
 
-#if USE(QCMSLIB)
-        if (m_transform)
-            qcms_transform_release(m_transform);
-        m_transform = 0;
-#endif
         jpeg_destroy_decompress(&m_info);
     }
 
@@ -379,14 +368,6 @@ public:
                 ColorProfile rgbInputDeviceColorProfile = readColorProfile(info());
                 if (!rgbInputDeviceColorProfile.isEmpty())
                     m_decoder->setColorProfile(rgbInputDeviceColorProfile);
-#if USE(QCMSLIB)
-                createColorTransform(rgbInputDeviceColorProfile, colorSpaceHasAlpha(m_info.out_color_space));
-#if defined(TURBO_JPEG_RGB_SWIZZLE)
-                // Input RGBA data to qcms. Note: restored to BGRA on output.
-                if (m_transform && m_info.out_color_space == JCS_EXT_BGRA)
-                    m_info.out_color_space = JCS_EXT_RGBA;
-#endif
-#endif
             }
 
             // Don't allocate a giant and superfluous memory buffer when the
@@ -511,31 +492,6 @@ public:
     jpeg_decompress_struct* info() { return &m_info; }
     JSAMPARRAY samples() const { return m_samples; }
     JPEGImageDecoder* decoder() { return m_decoder; }
-#if USE(QCMSLIB)
-    qcms_transform* colorTransform() const { return m_transform; }
-
-    void createColorTransform(const ColorProfile& colorProfile, bool hasAlpha)
-    {
-        if (m_transform)
-            qcms_transform_release(m_transform);
-        m_transform = 0;
-
-        if (colorProfile.isEmpty())
-            return;
-        qcms_profile* deviceProfile = ImageDecoder::qcmsOutputDeviceProfile();
-        if (!deviceProfile)
-            return;
-        qcms_profile* inputProfile = qcms_profile_from_memory(colorProfile.data(), colorProfile.size());
-        if (!inputProfile)
-            return;
-        // We currently only support color profiles for RGB profiled images.
-        ASSERT(icSigRgbData == qcms_profile_get_color_space(inputProfile));
-        qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8;
-        // FIXME: Don't force perceptual intent if the image profile contains an intent.
-        m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProfile, dataFormat, QCMS_INTENT_PERCEPTUAL);
-        qcms_profile_release(inputProfile);
-    }
-#endif
 
 private:
     JPEGImageDecoder* m_decoder;
@@ -548,10 +504,6 @@ private:
     jstate m_state;
 
     JSAMPARRAY m_samples;
-
-#if USE(QCMSLIB)
-    qcms_transform* m_transform;
-#endif
 };
 
 // Override the standard error method in the IJG JPEG decoder code.
@@ -679,11 +631,6 @@ bool JPEGImageDecoder::outputScanlines(ImageFrame& buffer)
         if (destY < 0)
             continue;
 
-#if USE(QCMSLIB)
-        if (m_reader->colorTransform() && colorSpace == JCS_RGB)
-            qcms_transform_data(m_reader->colorTransform(), *samples, *samples, info->output_width);
-#endif
-
         ImageFrame::PixelData* currentAddress = buffer.getAddr(0, destY);
         for (int x = 0; x < width; ++x) {
             setPixel<colorSpace>(buffer, currentAddress, samples, isScaled ? m_scaledColumns[x] : x);
@@ -727,10 +674,6 @@ bool JPEGImageDecoder::outputScanlines()
             unsigned char* row = reinterpret_cast<unsigned char*>(buffer.getAddr(0, info->output_scanline));
             if (jpeg_read_scanlines(info, &row, 1) != 1)
                 return false;
-#if USE(QCMSLIB)
-            if (qcms_transform* transform = m_reader->colorTransform())
-                qcms_transform_data_type(transform, row, row, info->output_width, rgbOutputColorSpace() == JCS_EXT_BGRA ? QCMS_OUTPUT_BGRX : QCMS_OUTPUT_RGBX);
-#endif
          }
          return true;
      }
index 59b739a..e644a71 100644 (file)
 #include <png.h>
 #include <wtf/StdLibExtras.h>
 
-#if USE(QCMSLIB)
-#include <qcms.h>
-#endif
-
 #if defined(PNG_LIBPNG_VER_MAJOR) && defined(PNG_LIBPNG_VER_MINOR) && (PNG_LIBPNG_VER_MAJOR > 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4))
 #define JMPBUF(png_ptr) png_jmpbuf(png_ptr)
 #else
@@ -125,10 +121,6 @@ public:
         , m_decodingSizeOnly(false)
         , m_hasAlpha(false)
         , m_interlaceBuffer(0)
-#if USE(QCMSLIB)
-        , m_transform(0)
-        , m_rowBuffer()
-#endif
     {
         m_png = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, decodingFailed, decodingWarning);
         m_info = png_create_info_struct(m_png);
@@ -151,11 +143,6 @@ public:
         if (m_png && m_info)
             // This will zero the pointers.
             png_destroy_read_struct(&m_png, &m_info, 0);
-#if USE(QCMSLIB)
-        if (m_transform)
-            qcms_transform_release(m_transform);
-        m_transform = 0;
-#endif
         delete[] m_interlaceBuffer;
         m_interlaceBuffer = 0;
         m_readOffset = 0;
@@ -195,33 +182,6 @@ public:
 
     png_bytep interlaceBuffer() const { return m_interlaceBuffer; }
     void createInterlaceBuffer(int size) { m_interlaceBuffer = new png_byte[size]; }
-#if USE(QCMSLIB)
-    png_bytep rowBuffer() const { return m_rowBuffer.get(); }
-    void createRowBuffer(int size) { m_rowBuffer = std::make_unique<png_byte[]>(size); }
-    qcms_transform* colorTransform() const { return m_transform; }
-
-    void createColorTransform(const ColorProfile& colorProfile, bool hasAlpha)
-    {
-        if (m_transform)
-            qcms_transform_release(m_transform);
-        m_transform = 0;
-
-        if (colorProfile.isEmpty())
-            return;
-        qcms_profile* deviceProfile = ImageDecoder::qcmsOutputDeviceProfile();
-        if (!deviceProfile)
-            return;
-        qcms_profile* inputProfile = qcms_profile_from_memory(colorProfile.data(), colorProfile.size());
-        if (!inputProfile)
-            return;
-        // We currently only support color profiles for RGB and RGBA images.
-        ASSERT(icSigRgbData == qcms_profile_get_color_space(inputProfile));
-        qcms_data_type dataFormat = hasAlpha ? QCMS_DATA_RGBA_8 : QCMS_DATA_RGB_8;
-        // FIXME: Don't force perceptual intent if the image profile contains an intent.
-        m_transform = qcms_transform_create(inputProfile, dataFormat, deviceProfile, dataFormat, QCMS_INTENT_PERCEPTUAL);
-        qcms_profile_release(inputProfile);
-    }
-#endif
 
 private:
     png_structp m_png;
@@ -231,10 +191,6 @@ private:
     bool m_decodingSizeOnly;
     bool m_hasAlpha;
     png_bytep m_interlaceBuffer;
-#if USE(QCMSLIB)
-    qcms_transform* m_transform;
-    std::unique_ptr<png_byte[]> m_rowBuffer;
-#endif
 };
 
 PNGImageDecoder::PNGImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
@@ -457,11 +413,6 @@ void PNGImageDecoder::headerAvailable()
         // 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);
-#if USE(QCMSLIB)
-        bool decodedImageHasAlpha = (colorType & PNG_COLOR_MASK_ALPHA) || trnsCount;
-        m_reader->createColorTransform(m_colorProfile, decodedImageHasAlpha);
-        m_colorProfile.clear();
-#endif
     }
 
     // Deal with gamma and keep it under our control.
@@ -553,15 +504,6 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex,
             }
         }
 
-#if USE(QCMSLIB)
-        if (m_reader->colorTransform() && !m_currentFrame) {
-            m_reader->createRowBuffer(colorChannels * size().width());
-            if (!m_reader->rowBuffer()) {
-                longjmp(JMPBUF(png), 1);
-                return;
-            }
-        }
-#endif
         buffer.setStatus(ImageFrame::FramePartial);
         buffer.setHasAlpha(false);
         buffer.setColorProfile(m_colorProfile);
@@ -630,13 +572,6 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex,
         png_progressive_combine_row(m_reader->pngPtr(), row, rowBuffer);
     }
 
-#if USE(QCMSLIB)
-    if (qcms_transform* transform = m_reader->colorTransform()) {
-        qcms_transform_data(transform, row, m_reader->rowBuffer(), size().width());
-        row = m_reader->rowBuffer();
-    }
-#endif
-
     // Write the decoded row pixels to the frame buffer.
     ImageFrame::PixelData* address = buffer.getAddr(0, y);
     int width = scaledSize().width();
@@ -961,12 +896,6 @@ void PNGImageDecoder::frameComplete()
 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
         for (int y = 0; y < rect.maxY() - rect.y(); ++y) {
             png_bytep row = interlaceBuffer + (m_scaled ? m_scaledRows[y] : y) * colorChannels * size().width();
-#if USE(QCMSLIB)
-            if (qcms_transform* transform = m_reader->colorTransform()) {
-                qcms_transform_data(transform, row, m_reader->rowBuffer(), size().width());
-                row = m_reader->rowBuffer();
-            }
-#endif
             ImageFrame::PixelData* address = buffer.getAddr(rect.x(), y + rect.y());
             for (int x = 0; x < rect.maxX() - rect.x(); ++x) {
                 png_bytep pixel = row + (m_scaled ? m_scaledColumns[x] : x) * colorChannels;
@@ -983,12 +912,6 @@ void PNGImageDecoder::frameComplete()
         png_bytep row = interlaceBuffer;
         for (int y = rect.y(); y < rect.maxY(); ++y, row += colorChannels * size().width()) {
             png_bytep pixel = row;
-#if USE(QCMSLIB)
-            if (qcms_transform* transform = m_reader->colorTransform()) {
-                qcms_transform_data(transform, row, m_reader->rowBuffer(), size().width());
-                pixel = m_reader->rowBuffer();
-            }
-#endif
             ImageFrame::PixelData* address = buffer.getAddr(rect.x(), y);
             for (int x = rect.x(); x < rect.maxX(); ++x, pixel += colorChannels) {
                 unsigned alpha = hasAlpha ? pixel[3] : 255;
index c0bcf1e..c892960 100644 (file)
 
 #if USE(WEBP)
 
-#ifdef QCMS_WEBP_COLOR_CORRECTION
-#include <qcms.h>
-#include <webp/demux.h>
-#else
-#undef ICCP_FLAG
-#define ICCP_FLAG 0
-#endif
-
 // Backward emulation for earlier versions than 0.1.99.
 #if (WEBP_DECODER_ABI_VERSION < 0x0163)
 #define MODE_rgbA MODE_RGBA
@@ -59,11 +51,6 @@ WEBPImageDecoder::WEBPImageDecoder(ImageSource::AlphaOption alphaOption,
     , m_decoder(0)
     , m_hasAlpha(false)
     , m_formatFlags(0)
-#ifdef QCMS_WEBP_COLOR_CORRECTION
-    , m_haveReadProfile(false)
-    , m_transform(0)
-    , m_decodedHeight(0)
-#endif
 {
 }
 
@@ -74,11 +61,6 @@ WEBPImageDecoder::~WEBPImageDecoder()
 
 void WEBPImageDecoder::clear()
 {
-#ifdef QCMS_WEBP_COLOR_CORRECTION
-    if (m_transform)
-        qcms_transform_release(m_transform);
-    m_transform = 0;
-#endif
     if (m_decoder)
         WebPIDelete(m_decoder);
     m_decoder = 0;
@@ -108,94 +90,6 @@ ImageFrame* WEBPImageDecoder::frameBufferAtIndex(size_t index)
     return &frame;
 }
 
-#ifdef QCMS_WEBP_COLOR_CORRECTION
-
-void WEBPImageDecoder::createColorTransform(const char* data, size_t size)
-{
-    if (m_transform)
-        qcms_transform_release(m_transform);
-    m_transform = 0;
-
-    qcms_profile* deviceProfile = ImageDecoder::qcmsOutputDeviceProfile();
-    if (!deviceProfile)
-        return;
-    qcms_profile* inputProfile = qcms_profile_from_memory(data, size);
-    if (!inputProfile)
-        return;
-
-    // We currently only support color profiles for RGB profiled images.
-    ASSERT(icSigRgbData == qcms_profile_get_color_space(inputProfile));
-    // The input image pixels are RGBA format.
-    qcms_data_type format = QCMS_DATA_RGBA_8;
-    // FIXME: Don't force perceptual intent if the image profile contains an intent.
-    m_transform = qcms_transform_create(inputProfile, format, deviceProfile, QCMS_DATA_RGBA_8, QCMS_INTENT_PERCEPTUAL);
-
-    qcms_profile_release(inputProfile);
-}
-
-void WEBPImageDecoder::readColorProfile(const uint8_t* data, size_t size)
-{
-    WebPChunkIterator chunkIterator;
-    WebPData inputData = { data, size };
-    WebPDemuxState state;
-
-    WebPDemuxer* demuxer = WebPDemuxPartial(&inputData, &state);
-    if (!WebPDemuxGetChunk(demuxer, "ICCP", 1, &chunkIterator)) {
-        WebPDemuxReleaseChunkIterator(&chunkIterator);
-        WebPDemuxDelete(demuxer);
-        return;
-    }
-
-    const char* profileData = reinterpret_cast<const char*>(chunkIterator.chunk.bytes);
-    size_t profileSize = chunkIterator.chunk.size;
-
-    // Only accept RGB color profiles from input class devices.
-    bool ignoreProfile = false;
-    if (profileSize < ImageDecoder::iccColorProfileHeaderLength)
-        ignoreProfile = true;
-    else if (!ImageDecoder::rgbColorProfile(profileData, profileSize))
-        ignoreProfile = true;
-    else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileSize))
-        ignoreProfile = true;
-
-    if (!ignoreProfile)
-        createColorTransform(profileData, profileSize);
-
-    WebPDemuxReleaseChunkIterator(&chunkIterator);
-    WebPDemuxDelete(demuxer);
-}
-
-void WEBPImageDecoder::applyColorProfile(const uint8_t* data, size_t size, ImageFrame& buffer)
-{
-    int width;
-    int decodedHeight;
-    if (!WebPIDecGetRGB(m_decoder, &decodedHeight, &width, 0, 0))
-        return; // See also https://bugs.webkit.org/show_bug.cgi?id=74062
-    if (decodedHeight <= 0)
-        return;
-
-    if (!m_haveReadProfile) {
-        readColorProfile(data, size);
-        m_haveReadProfile = true;
-    }
-
-    ASSERT(width == scaledSize().width());
-    ASSERT(decodedHeight <= scaledSize().height());
-
-    for (int y = m_decodedHeight; y < decodedHeight; ++y) {
-        uint8_t* row = reinterpret_cast<uint8_t*>(buffer.getAddr(0, y));
-        if (qcms_transform* transform = colorTransform())
-            qcms_transform_data_type(transform, row, row, width, QCMS_OUTPUT_RGBX);
-        uint8_t* pixel = row;
-        for (int x = 0; x < width; ++x, pixel += 4)
-            buffer.setRGBA(x, y, pixel[0], pixel[1], pixel[2], pixel[3]);
-    }
-
-    m_decodedHeight = decodedHeight;
-}
-
-#endif // QCMS_WEBP_COLOR_CORRECTION
-
 bool WEBPImageDecoder::decode(bool onlySize)
 {
     if (failed())
@@ -209,22 +103,7 @@ bool WEBPImageDecoder::decode(bool onlySize)
         if (dataSize < imageHeaderSize)
             return false;
         int width, height;
-#ifdef QCMS_WEBP_COLOR_CORRECTION
-        WebPData inputData = { dataBytes, dataSize };
-        WebPDemuxState state;
-        WebPDemuxer* demuxer = WebPDemuxPartial(&inputData, &state);
-        if (!demuxer)
-            return setFailed();
-
-        width = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH);
-        height = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT);
-        m_formatFlags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS);
-        m_hasAlpha = !!(m_formatFlags & ALPHA_FLAG);
-
-        WebPDemuxDelete(demuxer);
-        if (state <= WEBP_DEMUX_PARSING_HEADER)
-            return false;
-#elif (WEBP_DECODER_ABI_VERSION >= 0x0163)
+#if (WEBP_DECODER_ABI_VERSION >= 0x0163)
         WebPBitstreamFeatures features;
         if (WebPGetFeatures(dataBytes, dataSize, &features) != VP8_STATUS_OK)
             return setFailed();
@@ -261,8 +140,6 @@ bool WEBPImageDecoder::decode(bool onlySize)
         WEBP_CSP_MODE mode = outputMode(m_hasAlpha);
         if (!m_premultiplyAlpha)
             mode = outputMode(false);
-        if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile())
-            mode = MODE_RGBA; // Decode to RGBA for input to libqcms.
         int rowStride = size().width() * sizeof(ImageFrame::PixelData);
         uint8_t* output = reinterpret_cast<uint8_t*>(buffer.getAddr(0, 0));
         int outputSize = size().height() * rowStride;
@@ -273,14 +150,10 @@ bool WEBPImageDecoder::decode(bool onlySize)
 
     switch (WebPIUpdate(m_decoder, dataBytes, dataSize)) {
     case VP8_STATUS_OK:
-        if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile()) 
-            applyColorProfile(dataBytes, dataSize, buffer);
         buffer.setStatus(ImageFrame::FrameComplete);
         clear();
         return true;
     case VP8_STATUS_SUSPENDED:
-        if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile()) 
-            applyColorProfile(dataBytes, dataSize, buffer);
         return false;
     default:
         clear();                         
index 00bb9e4..731fc36 100644 (file)
@@ -34,9 +34,6 @@
 #if USE(WEBP)
 
 #include "webp/decode.h"
-#if USE(QCMSLIB) && (WEBP_DECODER_ABI_VERSION > 0x200)
-#define QCMS_WEBP_COLOR_CORRECTION
-#endif
 
 namespace WebCore {
 
@@ -56,18 +53,7 @@ private:
     bool m_hasAlpha;
     int m_formatFlags;
 
-#ifdef QCMS_WEBP_COLOR_CORRECTION
-    qcms_transform* colorTransform() const { return m_transform; }
-    void createColorTransform(const char* data, size_t);
-    void readColorProfile(const uint8_t* data, size_t);
-    void applyColorProfile(const uint8_t* data, size_t, ImageFrame&);
-
-    bool m_haveReadProfile;
-    qcms_transform* m_transform;
-    int m_decodedHeight;
-#else
     void applyColorProfile(const uint8_t*, size_t, ImageFrame&) { };
-#endif
     void clear();
 };