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

zmo at google.com zmo at google.com
Wed Dec 22 18:26:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit da0531cfc7bfe91fb490ff6e29490158beea37db
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 11 01:19:20 2010 +0000

    2010-12-10  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Adam Barth.
    
            Use enums instead of booleans in ImageSource/ImageDecoder constructors
            https://bugs.webkit.org/show_bug.cgi?id=50818
    
            * src/WebImageDecoder.cpp:
            (WebKit::WebImageDecoder::init): Use enums instead of boolean in ImageDecoder constructor.
    2010-12-10  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Adam Barth.
    
            Use enums instead of booleans in ImageSource/ImageDecoder constructors
            https://bugs.webkit.org/show_bug.cgi?id=50818
    
            This patch basically defines two enum type in ImageSource: AlphaOption
            and GammaAndColorProfileOption and use them as ImageSource and ImageDecoder
            constructor parameters instead of boolean typs.
    
            * platform/graphics/ImageSource.cpp:
            (WebCore::ImageSource::ImageSource):
            (WebCore::ImageSource::setData):
            * platform/graphics/ImageSource.h: Define the two enum types.
            * platform/graphics/cg/GraphicsContext3DCG.cpp:
            (WebCore::GraphicsContext3D::getImageData):
            * platform/graphics/cg/ImageSourceCG.cpp:
            (WebCore::ImageSource::ImageSource):
            * platform/graphics/qt/ImageDecoderQt.cpp:
            (WebCore::ImageDecoder::create):
            (WebCore::ImageDecoderQt::ImageDecoderQt):
            * platform/graphics/qt/ImageDecoderQt.h:
            * platform/graphics/skia/GraphicsContext3DSkia.cpp:
            (WebCore::GraphicsContext3D::getImageData):
            * platform/image-decoders/ImageDecoder.cpp:
            (WebCore::ImageDecoder::create):
            * platform/image-decoders/ImageDecoder.h:
            (WebCore::ImageDecoder::ImageDecoder):
            * platform/image-decoders/bmp/BMPImageDecoder.cpp:
            (WebCore::BMPImageDecoder::BMPImageDecoder):
            * platform/image-decoders/bmp/BMPImageDecoder.h:
            * platform/image-decoders/gif/GIFImageDecoder.cpp:
            (WebCore::GIFImageDecoder::GIFImageDecoder):
            * platform/image-decoders/gif/GIFImageDecoder.h:
            * platform/image-decoders/ico/ICOImageDecoder.cpp:
            (WebCore::ICOImageDecoder::ICOImageDecoder):
            (WebCore::ICOImageDecoder::decodeAtIndex):
            * platform/image-decoders/ico/ICOImageDecoder.h:
            * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
            (WebCore::JPEGImageDecoder::JPEGImageDecoder):
            * platform/image-decoders/jpeg/JPEGImageDecoder.h:
            * platform/image-decoders/png/PNGImageDecoder.cpp:
            (WebCore::PNGImageDecoder::PNGImageDecoder):
            * platform/image-decoders/png/PNGImageDecoder.h:
            * platform/image-decoders/webp/WEBPImageDecoder.cpp:
            (WebCore::WEBPImageDecoder::WEBPImageDecoder):
            * platform/image-decoders/webp/WEBPImageDecoder.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73819 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7c4ffb1..55beb10 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,52 @@
+2010-12-10  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Adam Barth.
+
+        Use enums instead of booleans in ImageSource/ImageDecoder constructors
+        https://bugs.webkit.org/show_bug.cgi?id=50818
+
+        This patch basically defines two enum type in ImageSource: AlphaOption
+        and GammaAndColorProfileOption and use them as ImageSource and ImageDecoder
+        constructor parameters instead of boolean typs.
+
+        * platform/graphics/ImageSource.cpp:
+        (WebCore::ImageSource::ImageSource):
+        (WebCore::ImageSource::setData):
+        * platform/graphics/ImageSource.h: Define the two enum types.
+        * platform/graphics/cg/GraphicsContext3DCG.cpp:
+        (WebCore::GraphicsContext3D::getImageData):
+        * platform/graphics/cg/ImageSourceCG.cpp:
+        (WebCore::ImageSource::ImageSource):
+        * platform/graphics/qt/ImageDecoderQt.cpp:
+        (WebCore::ImageDecoder::create):
+        (WebCore::ImageDecoderQt::ImageDecoderQt):
+        * platform/graphics/qt/ImageDecoderQt.h:
+        * platform/graphics/skia/GraphicsContext3DSkia.cpp:
+        (WebCore::GraphicsContext3D::getImageData):
+        * platform/image-decoders/ImageDecoder.cpp:
+        (WebCore::ImageDecoder::create):
+        * platform/image-decoders/ImageDecoder.h:
+        (WebCore::ImageDecoder::ImageDecoder):
+        * platform/image-decoders/bmp/BMPImageDecoder.cpp:
+        (WebCore::BMPImageDecoder::BMPImageDecoder):
+        * platform/image-decoders/bmp/BMPImageDecoder.h:
+        * platform/image-decoders/gif/GIFImageDecoder.cpp:
+        (WebCore::GIFImageDecoder::GIFImageDecoder):
+        * platform/image-decoders/gif/GIFImageDecoder.h:
+        * platform/image-decoders/ico/ICOImageDecoder.cpp:
+        (WebCore::ICOImageDecoder::ICOImageDecoder):
+        (WebCore::ICOImageDecoder::decodeAtIndex):
+        * platform/image-decoders/ico/ICOImageDecoder.h:
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        (WebCore::JPEGImageDecoder::JPEGImageDecoder):
+        * platform/image-decoders/jpeg/JPEGImageDecoder.h:
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        (WebCore::PNGImageDecoder::PNGImageDecoder):
+        * platform/image-decoders/png/PNGImageDecoder.h:
+        * platform/image-decoders/webp/WEBPImageDecoder.cpp:
+        (WebCore::WEBPImageDecoder::WEBPImageDecoder):
+        * platform/image-decoders/webp/WEBPImageDecoder.h:
+
 2010-12-10  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/ImageSource.cpp b/WebCore/platform/graphics/ImageSource.cpp
index 1fe96f8..92553c5 100644
--- a/WebCore/platform/graphics/ImageSource.cpp
+++ b/WebCore/platform/graphics/ImageSource.cpp
@@ -41,10 +41,10 @@ namespace WebCore {
 unsigned ImageSource::s_maxPixelsPerDecodedImage = 1024 * 1024;
 #endif
 
-ImageSource::ImageSource(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
     : m_decoder(0)
-    , m_premultiplyAlpha(premultiplyAlpha)
-    , m_ignoreGammaAndColorProfile(ignoreGammaAndColorProfile)
+    , m_alphaOption(alphaOption)
+    , m_gammaAndColorProfileOption(gammaAndColorProfileOption)
 {
 }
 
@@ -79,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_ignoreGammaAndColorProfile));
+        m_decoder = static_cast<NativeImageSourcePtr>(ImageDecoder::create(*data, m_alphaOption, m_gammaAndColorProfileOption));
 #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 aeb1561..7018a5c 100644
--- a/WebCore/platform/graphics/ImageSource.h
+++ b/WebCore/platform/graphics/ImageSource.h
@@ -119,7 +119,17 @@ const int cAnimationNone = -2;
 
 class ImageSource : public Noncopyable {
 public:
-    ImageSource(bool premultiplyAlpha = true, bool ignoreGammaAndColorProfile = false);
+    enum AlphaOption {
+        AlphaPremultiplied,
+        AlphaNotPremultiplied
+    };
+
+    enum GammaAndColorProfileOption {
+        GammaAndColorProfileApplied,
+        GammaAndColorProfileIgnored
+    };
+
+    ImageSource(AlphaOption alphaOption = AlphaPremultiplied, GammaAndColorProfileOption gammaAndColorProfileOption = GammaAndColorProfileApplied);
     ~ImageSource();
 
     // Tells the ImageSource that the Image no longer cares about decoded frame
@@ -177,8 +187,8 @@ public:
 
 private:
     NativeImageSourcePtr m_decoder;
-    bool m_premultiplyAlpha;
-    bool m_ignoreGammaAndColorProfile;
+    AlphaOption m_alphaOption;
+    GammaAndColorProfileOption m_gammaAndColorProfileOption;
 #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 7a58eed..f997277 100644
--- a/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
@@ -99,7 +99,8 @@ bool GraphicsContext3D::getImageData(Image* image,
     CGImageRef cgImage;
     RetainPtr<CGImageRef> decodedImage;
     if (image->data()) {
-        ImageSource decoder(false, ignoreGammaAndColorProfile);
+        ImageSource decoder(ImageSource::AlphaNotPremultiplied,
+                            ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied);
         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 29b62d7..4ed8684 100644
--- a/WebCore/platform/graphics/cg/ImageSourceCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageSourceCG.cpp
@@ -63,11 +63,11 @@ void sharedBufferRelease(void* info)
 }
 #endif
 
-ImageSource::ImageSource(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
     : m_decoder(0)
     // FIXME: m_premultiplyAlpha is ignored in cg at the moment.
-    , m_premultiplyAlpha(premultiplyAlpha)
-    , m_ignoreGammaAndColorProfile(ignoreGammaAndColorProfile)
+    , m_alphaOption(alphaOption)
+    , m_gammaAndColorProfileOption(gammaAndColorProfileOption)
 {
 }
 
diff --git a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
index 2dd239f..2bbb9ce 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, bool ignoreGammaAndColorProfile)
+ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
 {
     // 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, ignoreGammaAndColorProfile);
+    return new ImageDecoderQt(alphaOption, gammaAndColorProfileOption);
 }
 
-ImageDecoderQt::ImageDecoderQt(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
+ImageDecoderQt::ImageDecoderQt(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
+    : ImageDecoder(alphaOption, gammaAndColorProfileOption)
     , m_repetitionCount(cAnimationNone)
 {
 }
diff --git a/WebCore/platform/graphics/qt/ImageDecoderQt.h b/WebCore/platform/graphics/qt/ImageDecoderQt.h
index 914c020..23fb79a 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, bool ignoreGammaAndColorProfile);
+    ImageDecoderQt(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
     ~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 cbe6775..8b7ac86 100644
--- a/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContext3DSkia.cpp
@@ -53,7 +53,8 @@ bool GraphicsContext3D::getImageData(Image* image,
     NativeImageSkia* skiaImage = 0;
     AlphaOp neededAlphaOp = AlphaDoNothing;
     if (image->data()) {
-        ImageSource decoder(false, ignoreGammaAndColorProfile);
+        ImageSource decoder(ImageSource::AlphaNotPremultiplied,
+                            ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied);
         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 5554fa3..58a7981 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, bool ignoreGammaAndColorProfile)
+ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
 {
     // 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, ignoreGammaAndColorProfile);
+        return new GIFImageDecoder(alphaOption, gammaAndColorProfileOption);
 
     // Test for PNG.
     if (!memcmp(contents, "\x89\x50\x4E\x47", 4))
-        return new PNGImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
+        return new PNGImageDecoder(alphaOption, gammaAndColorProfileOption);
 
     // JPEG
     if (!memcmp(contents, "\xFF\xD8\xFF", 3))
-        return new JPEGImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
+        return new JPEGImageDecoder(alphaOption, gammaAndColorProfileOption);
 
 #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, ignoreGammaAndColorProfile);
+                return new WEBPImageDecoder(alphaOption, gammaAndColorProfileOption);
         }
     }
 #endif
 
     // BMP
     if (strncmp(contents, "BM", 2) == 0)
-        return new BMPImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile);
+        return new BMPImageDecoder(alphaOption, gammaAndColorProfileOption);
 
     // 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, ignoreGammaAndColorProfile);
+        return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption);
 
     // 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 f209dda..6e257c5 100644
--- a/WebCore/platform/image-decoders/ImageDecoder.h
+++ b/WebCore/platform/image-decoders/ImageDecoder.h
@@ -223,10 +223,10 @@ namespace WebCore {
     // m_maxNumPixels. (Not supported by all image decoders yet)
     class ImageDecoder : public Noncopyable {
     public:
-        ImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
+        ImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
             : m_scaled(false)
-            , m_premultiplyAlpha(premultiplyAlpha)
-            , m_ignoreGammaAndColorProfile(ignoreGammaAndColorProfile)
+            , m_premultiplyAlpha(alphaOption == ImageSource::AlphaPremultiplied)
+            , m_ignoreGammaAndColorProfile(gammaAndColorProfileOption == ImageSource::GammaAndColorProfileIgnored)
             , m_sizeAvailable(false)
             , m_maxNumPixels(-1)
             , m_isAllDataReceived(false)
@@ -239,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, bool ignoreGammaAndColorProfile);
+        static ImageDecoder* create(const SharedBuffer& data, ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
 
         // The the filename extension usually associated with an undecoded image
         // of this type.
diff --git a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
index 219a1e2..220a1ed 100644
--- a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp
@@ -40,8 +40,9 @@ namespace WebCore {
 // don't pack).
 static const size_t sizeOfFileHeader = 14;
 
-BMPImageDecoder::BMPImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
+BMPImageDecoder::BMPImageDecoder(ImageSource::AlphaOption alphaOption,
+                                 ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
+    : ImageDecoder(alphaOption, gammaAndColorProfileOption)
     , m_decodedOffset(0)
 {
 }
diff --git a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.h
index 695fab4..5f4ed82 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, bool ignoreGammaAndColorProfile);
+        BMPImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
 
         // 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 dfdf35e..e92f264 100644
--- a/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -29,8 +29,9 @@
 
 namespace WebCore {
 
-GIFImageDecoder::GIFImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
+GIFImageDecoder::GIFImageDecoder(ImageSource::AlphaOption alphaOption,
+                                 ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
+    : ImageDecoder(alphaOption, gammaAndColorProfileOption)
     , 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 5b4ca10..64240d4 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, bool ignoreGammaAndColorProfile);
+        GIFImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
         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 b07cf92..92a7dcf 100644
--- a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp
@@ -44,8 +44,9 @@ namespace WebCore {
 static const size_t sizeOfDirectory = 6;
 static const size_t sizeOfDirEntry = 16;
 
-ICOImageDecoder::ICOImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
+ICOImageDecoder::ICOImageDecoder(ImageSource::AlphaOption alphaOption,
+                                 ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
+    : ImageDecoder(alphaOption, gammaAndColorProfileOption)
     , m_decodedOffset(0)
 {
 }
@@ -201,7 +202,9 @@ bool ICOImageDecoder::decodeAtIndex(size_t index)
     }
 
     if (!m_pngDecoders[index]) {
-        m_pngDecoders[index].set(new PNGImageDecoder(m_premultiplyAlpha, m_ignoreGammaAndColorProfile));
+        m_pngDecoders[index].set(
+            new PNGImageDecoder(m_premultiplyAlpha ? ImageSource::AlphaPremultiplied : ImageSource::AlphaNotPremultiplied,
+                                m_ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied));
         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 dc631f4..c2af6a3 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, bool ignoreGammaAndColorProfile);
+        ICOImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
         virtual ~ICOImageDecoder();
 
         // ImageDecoder
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index a2b9f8e..632d428 100644
--- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -398,8 +398,9 @@ void term_source(j_decompress_ptr jd)
     src->decoder->decoder()->jpegComplete();
 }
 
-JPEGImageDecoder::JPEGImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
+JPEGImageDecoder::JPEGImageDecoder(ImageSource::AlphaOption alphaOption,
+                                   ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
+    : ImageDecoder(alphaOption, gammaAndColorProfileOption)
 {
 }
 
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h
index a60b387..63f29ab 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, bool ignoreGammaAndColorProfile);
+        JPEGImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
         virtual ~JPEGImageDecoder();
 
         // ImageDecoder
diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
index 794a474..3fe4d3c 100644
--- a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -169,8 +169,9 @@ private:
     unsigned m_currentBufferSize;
 };
 
-PNGImageDecoder::PNGImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
+PNGImageDecoder::PNGImageDecoder(ImageSource::AlphaOption alphaOption,
+                                 ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
+    : ImageDecoder(alphaOption, gammaAndColorProfileOption)
     , m_doNothingOnFailure(false)
 {
 }
diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.h b/WebCore/platform/image-decoders/png/PNGImageDecoder.h
index 68b0c1f..1e8902f 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, bool ignoreGammaAndColorProfile);
+        PNGImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
         virtual ~PNGImageDecoder();
 
         // ImageDecoder
diff --git a/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp b/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
index 0fc0bd5..a988d9c 100644
--- a/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -35,8 +35,9 @@
 
 namespace WebCore {
 
-WEBPImageDecoder::WEBPImageDecoder(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
-    : ImageDecoder(premultiplyAlpha, ignoreGammaAndColorProfile)
+WEBPImageDecoder::WEBPImageDecoder(ImageSource::AlphaOption alphaOption,
+                                   ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
+    : ImageDecoder(alphaOption, gammaAndColorProfileOption)
 {
 }
 
diff --git a/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h b/WebCore/platform/image-decoders/webp/WEBPImageDecoder.h
index 57b1dae..6cf8870 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, bool ignoreGammaAndColorProfile);
+    WEBPImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
     virtual ~WEBPImageDecoder();
     virtual String filenameExtension() const { return "vp8"; }
     virtual bool isSizeAvailable();
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index c92aca6..94c712a 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,13 @@
+2010-12-10  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Adam Barth.
+
+        Use enums instead of booleans in ImageSource/ImageDecoder constructors
+        https://bugs.webkit.org/show_bug.cgi?id=50818
+
+        * src/WebImageDecoder.cpp:
+        (WebKit::WebImageDecoder::init): Use enums instead of boolean in ImageDecoder constructor.
+
 2010-12-10  Kenneth Russell  <kbr at google.com>
 
         Reviewed by James Robinson.
diff --git a/WebKit/chromium/src/WebImageDecoder.cpp b/WebKit/chromium/src/WebImageDecoder.cpp
index 0cfd458..a17897c 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, false);
+        m_private = new BMPImageDecoder(ImageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileApplied);
         break;
     case TypeICO:
-        m_private = new ICOImageDecoder(true, false);
+        m_private = new ICOImageDecoder(ImageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileApplied);
         break;
     }
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list