[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zmo at google.com zmo at google.com
Wed Dec 22 15:55:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ac07f23e3dae4228b777474699c6fac645ec3852
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 16 21:23:41 2010 +0000

    2010-11-11  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            Implement UNPACK_COLORSPACE_CONVERSION_WEBGL
            https://bugs.webkit.org/show_bug.cgi?id=47196
    
            * src/WebImageDecoder.cpp:
            (WebKit::WebImageDecoder::init): Add ignoreGammaAndColorProfile parameter.
    2010-11-11  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            Implement UNPACK_COLORSPACE_CONVERSION_WEBGL
            https://bugs.webkit.org/show_bug.cgi?id=47196
    
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::texImage2DImpl): Apply UNPACK_COLORSPACE_CONVERSION settings to image uploading.
            (WebCore::WebGLRenderingContext::texSubImage2DImpl): Ditto.
            * platform/graphics/GraphicsContext3D.cpp:
            (WebCore::GraphicsContext3D::extractImageData): Ditto.
            * platform/graphics/GraphicsContext3D.h:
            * platform/graphics/ImageSource.cpp:
            (WebCore::ImageSource::ImageSource): Add ignoreGammaColorProfile parameter.
            (WebCore::ImageSource::setData): Ditto.
            * platform/graphics/ImageSource.h:
            * platform/graphics/cg/GraphicsContext3DCG.cpp:
            (WebCore::GraphicsContext3D::getImageData): Ditto.
            * platform/graphics/cg/ImageSourceCG.cpp:
            (WebCore::ImageSource::ImageSource): Ditto.
            * platform/graphics/qt/GraphicsContext3DQt.cpp:
            (WebCore::GraphicsContext3D::getImageData): Ditto.
            * platform/graphics/qt/ImageDecoderQt.cpp:
            (WebCore::ImageDecoder::create): Ditto.
            (WebCore::ImageDecoderQt::ImageDecoderQt): Ditto.
            * platform/graphics/qt/ImageDecoderQt.h:
            * platform/graphics/skia/GraphicsContext3DSkia.cpp:
            (WebCore::GraphicsContext3D::getImageData): Ditto.
            * platform/image-decoders/ImageDecoder.cpp:
            (WebCore::ImageDecoder::create): Ditto.
            * platform/image-decoders/ImageDecoder.h:
            (WebCore::ImageDecoder::ImageDecoder): Ditto.
            * platform/image-decoders/bmp/BMPImageDecoder.cpp:
            (WebCore::BMPImageDecoder::BMPImageDecoder):
            * platform/image-decoders/bmp/BMPImageDecoder.h:
            * platform/image-decoders/gif/GIFImageDecoder.cpp:
            (WebCore::GIFImageDecoder::GIFImageDecoder): Ditto.
            * platform/image-decoders/gif/GIFImageDecoder.h:
            * platform/image-decoders/ico/ICOImageDecoder.cpp:
            (WebCore::ICOImageDecoder::ICOImageDecoder): Ditto.
            (WebCore::ICOImageDecoder::decodeAtIndex): Ditto.
            * platform/image-decoders/ico/ICOImageDecoder.h:
            * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
            (WebCore::JPEGImageDecoder::JPEGImageDecoder): Ditto.
            * platform/image-decoders/jpeg/JPEGImageDecoder.h:
            * platform/image-decoders/png/PNGImageDecoder.cpp:
            (WebCore::PNGImageDecoder::PNGImageDecoder): Ditto.
            (WebCore::PNGImageDecoder::headerAvailable): Ignore gamma settings if ignoreGammaAndColorProfile is true.
            * platform/image-decoders/png/PNGImageDecoder.h:
            * platform/image-decoders/webp/WEBPImageDecoder.cpp:
            (WebCore::WEBPImageDecoder::WEBPImageDecoder): Add ignoreGammaAndColorProfile parameter.
            * platform/image-decoders/webp/WEBPImageDecoder.h:
    2010-11-11  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            Implement UNPACK_COLORSPACE_CONVERSION_WEBGL
            https://bugs.webkit.org/show_bug.cgi?id=47196
    
            * fast/canvas/webgl/gl-teximage-expected.txt:
            * fast/canvas/webgl/gl-teximage.html: Testing that if UNPACK_COLORSPACE_CONVERSION is NONE, gamma settings are not applied to images.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72130 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2a77a24..19c4c2c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-11  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Implement UNPACK_COLORSPACE_CONVERSION_WEBGL
+        https://bugs.webkit.org/show_bug.cgi?id=47196
+
+        * fast/canvas/webgl/gl-teximage-expected.txt:
+        * fast/canvas/webgl/gl-teximage.html: Testing that if UNPACK_COLORSPACE_CONVERSION is NONE, gamma settings are not applied to images.
+
 2010-11-16  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt b/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt
index 2451b3b..6075bef 100644
--- a/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/gl-teximage-expected.txt
@@ -38,6 +38,14 @@ PASS There should be 32 unique values in channel 1. Found 32
 PASS There should be 32 unique values in channel 2. Found 32
 PASS There should be 2 unique values in channel 3. Found 2
 
+Check that gamma settings don't effect 8bit pngs
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+PASS pixels should be same regardless of gamma settings.
+PASS pixels should be same regardless of gamma settings.
+PASS pixels should be same regardless of gamma settings.
+PASS pixels should be same regardless of gamma settings.
+PASS pixels should be same regardless of gamma settings.
+
 check pixels are UN pre-multiplied
 PASS getError was expected value: NO_ERROR : Should be no errors from setup.
 PASS Half the pixels in channel 0 should be >= 128,128,128. found 50%
diff --git a/LayoutTests/fast/canvas/webgl/gl-teximage.html b/LayoutTests/fast/canvas/webgl/gl-teximage.html
index 530e080..2a45120 100644
--- a/LayoutTests/fast/canvas/webgl/gl-teximage.html
+++ b/LayoutTests/fast/canvas/webgl/gl-teximage.html
@@ -162,10 +162,9 @@ function runTests(imgs) {
     }
   }
 
-// FIXME(zmo): fix the gamma correction and add back the commented out tests below.
-/*
   debug("");
   debug("Check that gamma settings don't effect 8bit pngs");
+  gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
   gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE,
                 imgs['resources/gray-ramp-default-gamma.png']);
   glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
@@ -193,7 +192,6 @@ function runTests(imgs) {
     }
     assertMsg(same, "pixels should be same regardless of gamma settings.");
   }
-*/
 
   debug("");
   debug("check pixels are UN pre-multiplied");
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 00b28e1..e744b66 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,57 @@
+2010-11-11  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Implement UNPACK_COLORSPACE_CONVERSION_WEBGL
+        https://bugs.webkit.org/show_bug.cgi?id=47196
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::texImage2DImpl): Apply UNPACK_COLORSPACE_CONVERSION settings to image uploading.
+        (WebCore::WebGLRenderingContext::texSubImage2DImpl): Ditto.
+        * platform/graphics/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3D::extractImageData): Ditto.
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/ImageSource.cpp:
+        (WebCore::ImageSource::ImageSource): Add ignoreGammaColorProfile parameter.
+        (WebCore::ImageSource::setData): Ditto.
+        * platform/graphics/ImageSource.h:
+        * platform/graphics/cg/GraphicsContext3DCG.cpp:
+        (WebCore::GraphicsContext3D::getImageData): Ditto.
+        * platform/graphics/cg/ImageSourceCG.cpp:
+        (WebCore::ImageSource::ImageSource): Ditto.
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3D::getImageData): Ditto.
+        * platform/graphics/qt/ImageDecoderQt.cpp:
+        (WebCore::ImageDecoder::create): Ditto.
+        (WebCore::ImageDecoderQt::ImageDecoderQt): Ditto.
+        * platform/graphics/qt/ImageDecoderQt.h:
+        * platform/graphics/skia/GraphicsContext3DSkia.cpp:
+        (WebCore::GraphicsContext3D::getImageData): Ditto.
+        * platform/image-decoders/ImageDecoder.cpp:
+        (WebCore::ImageDecoder::create): Ditto.
+        * platform/image-decoders/ImageDecoder.h:
+        (WebCore::ImageDecoder::ImageDecoder): Ditto.
+        * platform/image-decoders/bmp/BMPImageDecoder.cpp:
+        (WebCore::BMPImageDecoder::BMPImageDecoder):
+        * platform/image-decoders/bmp/BMPImageDecoder.h:
+        * platform/image-decoders/gif/GIFImageDecoder.cpp:
+        (WebCore::GIFImageDecoder::GIFImageDecoder): Ditto.
+        * platform/image-decoders/gif/GIFImageDecoder.h:
+        * platform/image-decoders/ico/ICOImageDecoder.cpp:
+        (WebCore::ICOImageDecoder::ICOImageDecoder): Ditto.
+        (WebCore::ICOImageDecoder::decodeAtIndex): Ditto.
+        * platform/image-decoders/ico/ICOImageDecoder.h:
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        (WebCore::JPEGImageDecoder::JPEGImageDecoder): Ditto.
+        * platform/image-decoders/jpeg/JPEGImageDecoder.h:
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        (WebCore::PNGImageDecoder::PNGImageDecoder): Ditto.
+        (WebCore::PNGImageDecoder::headerAvailable): Ignore gamma settings if ignoreGammaAndColorProfile is true.
+        * platform/image-decoders/png/PNGImageDecoder.h:
+        * platform/image-decoders/webp/WEBPImageDecoder.cpp:
+        (WebCore::WEBPImageDecoder::WEBPImageDecoder): Add ignoreGammaAndColorProfile parameter.
+        * platform/image-decoders/webp/WEBPImageDecoder.h:
+
 2010-11-16  Eric Carlson  <eric.carlson at apple.com>
 
         Unreviewed attempt to fix GTK build after http://trac.webkit.org/changeset/72117
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index af34c4d..0cbbc8e 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -2455,7 +2455,7 @@ void WebGLRenderingContext::texImage2DImpl(unsigned target, unsigned level, unsi
 {
     ec = 0;
     Vector<uint8_t> data;
-    if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlpha, data)) {
+    if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE, data)) {
         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
     }
@@ -2641,7 +2641,7 @@ void WebGLRenderingContext::texSubImage2DImpl(unsigned target, unsigned level, u
     if (isContextLost())
         return;
     Vector<uint8_t> data;
-    if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlpha, data)) {
+    if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE, data)) {
         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
     }
diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp
index 2a65128..d0ee639 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/GraphicsContext3D.cpp
@@ -97,11 +97,12 @@ bool GraphicsContext3D::extractImageData(Image* image,
                                          unsigned int type,
                                          bool flipY,
                                          bool premultiplyAlpha,
+                                         bool ignoreGammaAndColorProfile,
                                          Vector<uint8_t>& data)
 {
     if (!image)
         return false;
-    if (!getImageData(image, format, type, premultiplyAlpha, data))
+    if (!getImageData(image, format, type, premultiplyAlpha, ignoreGammaAndColorProfile, data))
         return false;
     if (flipY) {
         unsigned long componentsPerPixel, bytesPerComponent;
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index c1fffdf..c2d5c24 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -488,13 +488,14 @@ public:
 
     // Extracts the contents of the given Image into the passed Vector,
     // packing the pixel data according to the given format and type,
-    // and obeying the flipY and premultiplyAlpha flags. Returns true
-    // upon success.
+    // and obeying the flipY, premultiplyAlpha, and ignoreGammaAndColorProfile
+    // flags. Returns true upon success.
     bool extractImageData(Image* image,
                           unsigned int format,
                           unsigned int type,
                           bool flipY,
                           bool premultiplyAlpha,
+                          bool ignoreGammaAndColorProfile,
                           Vector<uint8_t>& data);
 
     // Extracts the contents of the given ImageData into the passed Vector,
@@ -803,12 +804,16 @@ public:
     // extraction process. This premultiplication occurs before
     // any packing of pixel data.
     //
+    // If ignoreGammaAndColorProfile is true, gamma correction and ICC
+    // profile won't be applied.
+    //
     // No vertical flip of the image data is performed by this
     // method.
     bool getImageData(Image* image,
                       unsigned int format,
                       unsigned int type,
                       bool premultiplyAlpha,
+                      bool ignoreGammaAndColorProfile,
                       Vector<uint8_t>& outputVector);
 
     // Possible alpha operations that may need to occur during
diff --git a/WebCore/platform/graphics/ImageSource.cpp b/WebCore/platform/graphics/ImageSource.cpp
index c6d97fe..d1a944a 100644
--- a/WebCore/platform/graphics/ImageSource.cpp
+++ b/WebCore/platform/graphics/ImageSource.cpp
@@ -41,9 +41,10 @@ namespace WebCore {
 unsigned ImageSource::s_maxPixelsPerDecodedImage = 1024 * 1024;
 #endif
 
-ImageSource::ImageSource(bool premultiplyAlpha)
+ImageSource::ImageSource(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
     : m_decoder(0)
     , m_premultiplyAlpha(premultiplyAlpha)
+    , m_ignoreGammaAndColorProfile(ignoreGammaAndColorProfile)
 {
 }
 
@@ -78,7 +79,7 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
     // If insufficient bytes are available to determine the image type, no decoder plugin will be
     // made.
     if (!m_decoder) {
-        m_decoder = static_cast<NativeImageSourcePtr>(ImageDecoder::create(*data, m_premultiplyAlpha));
+        m_decoder = static_cast<NativeImageSourcePtr>(ImageDecoder::create(*data, m_premultiplyAlpha, m_ignoreGammaAndColorProfile));
 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
         if (m_decoder && s_maxPixelsPerDecodedImage)
             m_decoder->setMaxNumPixels(s_maxPixelsPerDecodedImage);
diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h
index 899ed38..aeb1561 100644
--- a/WebCore/platform/graphics/ImageSource.h
+++ b/WebCore/platform/graphics/ImageSource.h
@@ -119,7 +119,7 @@ const int cAnimationNone = -2;
 
 class ImageSource : public Noncopyable {
 public:
-    ImageSource(bool premultiplyAlpha = true);
+    ImageSource(bool premultiplyAlpha = true, bool ignoreGammaAndColorProfile = false);
     ~ImageSource();
 
     // Tells the ImageSource that the Image no longer cares about decoded frame
@@ -178,6 +178,7 @@ public:
 private:
     NativeImageSourcePtr m_decoder;
     bool m_premultiplyAlpha;
+    bool m_ignoreGammaAndColorProfile;
 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
     static unsigned s_maxPixelsPerDecodedImage;
 #endif
diff --git a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
index 0c6acf9..7a58eed 100644
--- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
@@ -91,6 +91,7 @@ bool GraphicsContext3D::getImageData(Image* image,
                                      unsigned int format,
                                      unsigned int type,
                                      bool premultiplyAlpha,
+                                     bool ignoreGammaAndColorProfile,
                                      Vector<uint8_t>& outputVector)
 {
     if (!image)
@@ -98,7 +99,7 @@ bool GraphicsContext3D::getImageData(Image* image,
     CGImageRef cgImage;
     RetainPtr<CGImageRef> decodedImage;
     if (image->data()) {
-        ImageSource decoder(false);
+        ImageSource decoder(false, ignoreGammaAndColorProfile);
         decoder.setData(image->data(), true);
         if (!decoder.frameCount())
             return false;
diff --git a/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/WebCore/platform/graphics/cg/ImageSourceCG.cpp
index 5fa4896..f01c442 100644
--- a/WebCore/platform/graphics/cg/ImageSourceCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageSourceCG.cpp
@@ -63,10 +63,11 @@ void sharedBufferRelease(void* info)
 }
 #endif
 
-ImageSource::ImageSource(bool premultiplyAlpha)
+ImageSource::ImageSource(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
     : m_decoder(0)
     // FIXME: m_premultiplyAlpha is ignored in cg at the moment.
     , m_premultiplyAlpha(premultiplyAlpha)
+    , m_ignoreGammaAndColorProfile(ignoreGammaAndColorProfile)
 {
 }
 
diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index 26db220..2ba358f 100644
--- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -1646,8 +1646,10 @@ bool GraphicsContext3D::getImageData(Image* image,
                                      unsigned int format,
                                      unsigned int type,
                                      bool premultiplyAlpha,
+                                     bool ignoreGammaAndColorProfile,
                                      Vector<uint8_t>& outputVector)
 {
+    UNUSED_PARAM(ignoreGammaAndColorProfile);
     if (!image)
         return false;
     QPixmap* nativePixmap = image->nativeImageForCurrentFrame();
diff --git a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
index 02bb110..2dd239f 100644
--- a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
@@ -37,17 +37,17 @@
 
 namespace WebCore {
 
-ImageDecoder* ImageDecoder::create(const SharedBuffer& data, bool premultiplyAlpha)
+ImageDecoder* ImageDecoder::create(const SharedBuffer& data, bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
 {
     // We need at least 4 bytes to figure out what kind of image we're dealing with.
     if (data.size() < 4)
         return 0;
 
-    return new ImageDecoderQt(premultiplyAlpha);
+    return new ImageDecoderQt(premultiplyAlpha, ignoreGammaAndColorProfile);
 }
 
-ImageDecoderQt::ImageDecoderQt(bool premultiplyAlpha)
-    : ImageDecoder(premultiplyAlpha)
+ImageDecoderQt::ImageDecoderQt(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
     , m_repetitionCount(cAnimationNone)
 {
 }
diff --git a/WebCore/platform/graphics/qt/ImageDecoderQt.h b/WebCore/platform/graphics/qt/ImageDecoderQt.h
index 5014d53..914c020 100644
--- a/WebCore/platform/graphics/qt/ImageDecoderQt.h
+++ b/WebCore/platform/graphics/qt/ImageDecoderQt.h
@@ -41,7 +41,7 @@ namespace WebCore {
 class ImageDecoderQt : public ImageDecoder
 {
 public:
-    ImageDecoderQt(bool premultiplyAlpha);
+    ImageDecoderQt(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
     ~ImageDecoderQt();
 
     virtual void setData(SharedBuffer* data, bool allDataReceived);
diff --git a/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp
index d825dd2..cbe6775 100644
--- a/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp
@@ -44,6 +44,7 @@ bool GraphicsContext3D::getImageData(Image* image,
                                      unsigned int format,
                                      unsigned int type,
                                      bool premultiplyAlpha,
+                                     bool ignoreGammaAndColorProfile,
                                      Vector<uint8_t>& outputVector)
 {
     if (!image)
@@ -52,7 +53,7 @@ bool GraphicsContext3D::getImageData(Image* image,
     NativeImageSkia* skiaImage = 0;
     AlphaOp neededAlphaOp = AlphaDoNothing;
     if (image->data()) {
-        ImageSource decoder(false);
+        ImageSource decoder(false, ignoreGammaAndColorProfile);
         decoder.setData(image->data(), true);
         if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
             return false;
diff --git a/WebCore/platform/image-decoders/ImageDecoder.cpp b/WebCore/platform/image-decoders/ImageDecoder.cpp
index 204f3af..5554fa3 100644
--- a/WebCore/platform/image-decoders/ImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/ImageDecoder.cpp
@@ -53,7 +53,7 @@ static unsigned copyFromSharedBuffer(char* buffer, unsigned bufferLength, const
     return bytesExtracted;
 }
 
-ImageDecoder* ImageDecoder::create(const SharedBuffer& data, bool premultiplyAlpha)
+ImageDecoder* ImageDecoder::create(const SharedBuffer& data, bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
 {
     // We need at least 4 bytes to figure out what kind of image we're dealing
     // with.
@@ -65,15 +65,15 @@ ImageDecoder* ImageDecoder::create(const SharedBuffer& data, bool premultiplyAlp
 
     // GIFs begin with GIF8(7 or 9).
     if (strncmp(contents, "GIF8", 4) == 0)
-        return new GIFImageDecoder(premultiplyAlpha);
+        return new GIFImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
 
     // Test for PNG.
     if (!memcmp(contents, "\x89\x50\x4E\x47", 4))
-        return new PNGImageDecoder(premultiplyAlpha);
+        return new PNGImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
 
     // JPEG
     if (!memcmp(contents, "\xFF\xD8\xFF", 3))
-        return new JPEGImageDecoder(premultiplyAlpha);
+        return new JPEGImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
 
 #if USE(WEBP)
     if (!memcmp(contents, "RIFF", 4)) {
@@ -83,19 +83,19 @@ ImageDecoder* ImageDecoder::create(const SharedBuffer& data, bool premultiplyAlp
         unsigned length = copyFromSharedBuffer(header, webpExtraMarker, data, webpExtraMarkeroffset);
         if (length >= webpExtraMarker) {
             if (!memcmp(header, "WEBPVP", webpExtraMarker))
-                return new WEBPImageDecoder(premultiplyAlpha);
+                return new WEBPImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
         }
     }
 #endif
 
     // BMP
     if (strncmp(contents, "BM", 2) == 0)
-        return new BMPImageDecoder(premultiplyAlpha);
+        return new BMPImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
 
     // ICOs always begin with a 2-byte 0 followed by a 2-byte 1.
     // CURs begin with 2-byte 0 followed by 2-byte 2.
     if (!memcmp(contents, "\x00\x00\x01\x00", 4) || !memcmp(contents, "\x00\x00\x02\x00", 4))
-        return new ICOImageDecoder(premultiplyAlpha);
+        return new ICOImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
 
     // Give up. We don't know what the heck this is.
     return 0;
diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h
index 08ce854..68c6e31 100644
--- a/WebCore/platform/image-decoders/ImageDecoder.h
+++ b/WebCore/platform/image-decoders/ImageDecoder.h
@@ -223,9 +223,10 @@ namespace WebCore {
     // m_maxNumPixels. (Not supported by all image decoders yet)
     class ImageDecoder : public Noncopyable {
     public:
-        ImageDecoder(bool premultiplyAlpha)
+        ImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
             : m_scaled(false)
             , m_premultiplyAlpha(premultiplyAlpha)
+            , m_ignoreGammaAndColorProfile(ignoreGammaAndColorProfile)
             , m_sizeAvailable(false)
             , m_maxNumPixels(-1)
             , m_isAllDataReceived(false)
@@ -238,7 +239,7 @@ namespace WebCore {
         // Factory function to create an ImageDecoder.  Ports that subclass
         // ImageDecoder can provide their own implementation of this to avoid
         // needing to write a dedicated setData() implementation.
-        static ImageDecoder* create(const SharedBuffer& data, bool premultiplyAlpha);
+        static ImageDecoder* create(const SharedBuffer& data, bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
 
         // The the filename extension usually associated with an undecoded image
         // of this type.
@@ -354,6 +355,7 @@ namespace WebCore {
         Vector<int> m_scaledColumns;
         Vector<int> m_scaledRows;
         bool m_premultiplyAlpha;
+        bool m_ignoreGammaAndColorProfile;
 
     private:
         // Some code paths compute the size of the image as "width * height * 4"
diff --git a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
index 1c117a8..219a1e2 100644
--- a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
@@ -40,8 +40,8 @@ namespace WebCore {
 // don't pack).
 static const size_t sizeOfFileHeader = 14;
 
-BMPImageDecoder::BMPImageDecoder(bool premultiplyAlpha)
-    : ImageDecoder(premultiplyAlpha)
+BMPImageDecoder::BMPImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
     , m_decodedOffset(0)
 {
 }
diff --git a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h
index 3996bf9..695fab4 100644
--- a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h
+++ b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h
@@ -39,7 +39,7 @@ namespace WebCore {
     // This class decodes the BMP image format.
     class BMPImageDecoder : public ImageDecoder {
     public:
-        BMPImageDecoder(bool premultiplyAlpha);
+        BMPImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
 
         // ImageDecoder
         virtual String filenameExtension() const { return "bmp"; }
diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
index 18cd903..dfdf35e 100644
--- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -29,8 +29,8 @@
 
 namespace WebCore {
 
-GIFImageDecoder::GIFImageDecoder(bool premultiplyAlpha)
-    : ImageDecoder(premultiplyAlpha)
+GIFImageDecoder::GIFImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
     , m_alreadyScannedThisDataForFrameCount(true)
     , m_repetitionCount(cAnimationLoopOnce)
     , m_readOffset(0)
diff --git a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h
index b011e1e..5b4ca10 100644
--- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.h
+++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.h
@@ -36,7 +36,7 @@ namespace WebCore {
     // This class decodes the GIF image format.
     class GIFImageDecoder : public ImageDecoder {
     public:
-        GIFImageDecoder(bool premultiplyAlpha);
+        GIFImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
         virtual ~GIFImageDecoder();
 
         enum GIFQuery { GIFFullQuery, GIFSizeQuery, GIFFrameCountQuery };
diff --git a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
index 453efd2..b07cf92 100644
--- a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
@@ -44,8 +44,8 @@ namespace WebCore {
 static const size_t sizeOfDirectory = 6;
 static const size_t sizeOfDirEntry = 16;
 
-ICOImageDecoder::ICOImageDecoder(bool premultiplyAlpha)
-    : ImageDecoder(premultiplyAlpha)
+ICOImageDecoder::ICOImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
     , m_decodedOffset(0)
 {
 }
@@ -201,7 +201,7 @@ bool ICOImageDecoder::decodeAtIndex(size_t index)
     }
 
     if (!m_pngDecoders[index]) {
-        m_pngDecoders[index].set(new PNGImageDecoder(m_premultiplyAlpha));
+        m_pngDecoders[index].set(new PNGImageDecoder(m_premultiplyAlpha, m_ignoreGammaAndColorProfile));
         setDataForPNGDecoderAtIndex(index);
     }
     // Fail if the size the PNGImageDecoder calculated does not match the size
diff --git a/WebCore/platform/image-decoders/ico/ICOImageDecoder.h b/WebCore/platform/image-decoders/ico/ICOImageDecoder.h
index e2ee9e3..dc631f4 100644
--- a/WebCore/platform/image-decoders/ico/ICOImageDecoder.h
+++ b/WebCore/platform/image-decoders/ico/ICOImageDecoder.h
@@ -40,7 +40,7 @@ namespace WebCore {
     // This class decodes the ICO and CUR image formats.
     class ICOImageDecoder : public ImageDecoder {
     public:
-        ICOImageDecoder(bool premultiplyAlpha);
+        ICOImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
         virtual ~ICOImageDecoder();
 
         // ImageDecoder
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index da35739..d1de2ca 100644
--- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -392,8 +392,8 @@ void term_source(j_decompress_ptr jd)
     src->decoder->decoder()->jpegComplete();
 }
 
-JPEGImageDecoder::JPEGImageDecoder(bool premultiplyAlpha)
-    : ImageDecoder(premultiplyAlpha)
+JPEGImageDecoder::JPEGImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
 {
 }
 
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
index e942b01..a60b387 100644
--- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
+++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
@@ -37,7 +37,7 @@ namespace WebCore {
     // This class decodes the JPEG image format.
     class JPEGImageDecoder : public ImageDecoder {
     public:
-        JPEGImageDecoder(bool premultiplyAlpha);
+        JPEGImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
         virtual ~JPEGImageDecoder();
 
         // ImageDecoder
diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
index 193527b..8b81896 100644
--- a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -169,8 +169,8 @@ private:
     unsigned m_currentBufferSize;
 };
 
-PNGImageDecoder::PNGImageDecoder(bool premultiplyAlpha)
-    : ImageDecoder(premultiplyAlpha)
+PNGImageDecoder::PNGImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
     , m_doNothingOnFailure(false)
 {
 }
@@ -296,7 +296,7 @@ void PNGImageDecoder::headerAvailable()
 
     // Deal with gamma and keep it under our control.
     double gamma;
-    if (png_get_gAMA(png, info, &gamma)) {
+    if (!m_ignoreGammaAndColorProfile && png_get_gAMA(png, info, &gamma)) {
         if ((gamma <= 0.0) || (gamma > cMaxGamma)) {
             gamma = cInverseGamma;
             png_set_gAMA(png, info, gamma);
diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.h b/WebCore/platform/image-decoders/png/PNGImageDecoder.h
index 763b88f..68b0c1f 100644
--- a/WebCore/platform/image-decoders/png/PNGImageDecoder.h
+++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.h
@@ -36,7 +36,7 @@ namespace WebCore {
     // This class decodes the PNG image format.
     class PNGImageDecoder : public ImageDecoder {
     public:
-        PNGImageDecoder(bool premultiplyAlpha);
+        PNGImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
         virtual ~PNGImageDecoder();
 
         // ImageDecoder
diff --git a/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp b/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
index 2275fc7..0fc0bd5 100644
--- a/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -35,8 +35,8 @@
 
 namespace WebCore {
 
-WEBPImageDecoder::WEBPImageDecoder(bool premultiplyAlpha)
-    : ImageDecoder(premultiplyAlpha)
+WEBPImageDecoder::WEBPImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
 {
 }
 
diff --git a/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h b/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h
index 266c0ff..57b1dae 100644
--- a/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h
+++ b/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h
@@ -37,7 +37,7 @@ namespace WebCore {
 
 class WEBPImageDecoder : public ImageDecoder {
 public:
-    WEBPImageDecoder(bool premultiplyAlpha);
+    WEBPImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
     virtual ~WEBPImageDecoder();
     virtual String filenameExtension() const { return "vp8"; }
     virtual bool isSizeAvailable();
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 396e5f4..5ff6275 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-11  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Implement UNPACK_COLORSPACE_CONVERSION_WEBGL
+        https://bugs.webkit.org/show_bug.cgi?id=47196
+
+        * src/WebImageDecoder.cpp:
+        (WebKit::WebImageDecoder::init): Add ignoreGammaAndColorProfile parameter.
+
 2010-11-12  Zhenyao Mo  <zmo at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebKit/chromium/src/WebImageDecoder.cpp b/WebKit/chromium/src/WebImageDecoder.cpp
index 160deee..0cfd458 100644
--- a/WebKit/chromium/src/WebImageDecoder.cpp
+++ b/WebKit/chromium/src/WebImageDecoder.cpp
@@ -56,10 +56,10 @@ void WebImageDecoder::init(Type type)
 {
     switch (type) {
     case TypeBMP:
-        m_private = new BMPImageDecoder(true);
+        m_private = new BMPImageDecoder(true, false);
         break;
     case TypeICO:
-        m_private = new ICOImageDecoder(true);
+        m_private = new ICOImageDecoder(true, false);
         break;
     }
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list