2010-10-23 Dimitri Glazkov <dglazkov@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Oct 2010 17:05:21 +0000 (17:05 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Oct 2010 17:05:21 +0000 (17:05 +0000)
        Unreviewed, rolling out r70369.
        http://trac.webkit.org/changeset/70369
        https://bugs.webkit.org/show_bug.cgi?id=47974

        Caused weird artifacts in expected results.

        * wtf/Platform.h:
2010-10-23  Dimitri Glazkov  <dglazkov@chromium.org>

        Unreviewed, rolling out r70369.
        http://trac.webkit.org/changeset/70369
        https://bugs.webkit.org/show_bug.cgi?id=47974

        Caused weird artifacts in expected results.

        * WebCore.gyp/WebCore.gyp:
        * WebCore.gypi:
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::createImage):
        * platform/graphics/ImageSource.h:
        * platform/image-decoders/ImageDecoder.cpp:
        (WebCore::RGBA32Buffer::operator=):
        (WebCore::RGBA32Buffer::clear):
        (WebCore::RGBA32Buffer::zeroFill):
        (WebCore::RGBA32Buffer::copyBitmapData):
        (WebCore::RGBA32Buffer::setSize):
        * platform/image-decoders/ImageDecoder.h:
        (WebCore::RGBA32Buffer::getAddr):
        * platform/image-decoders/cairo/ImageDecoderCairo.cpp:
        (WebCore::RGBA32Buffer::asNewNativeImage):
        * platform/image-decoders/cg/ImageDecoderCG.cpp: Removed.
        * platform/image-decoders/haiku/ImageDecoderHaiku.cpp:
        (WebCore::RGBA32Buffer::asNewNativeImage):
        * platform/image-decoders/openvg/ImageDecoderOpenVG.cpp:
        (WebCore::RGBA32Buffer::asNewNativeImage):
        * platform/image-decoders/wx/ImageDecoderWx.cpp:
        (WebCore::RGBA32Buffer::asNewNativeImage):

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

14 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/wtf/Platform.h
WebCore/ChangeLog
WebCore/WebCore.gyp/WebCore.gyp
WebCore/WebCore.gypi
WebCore/loader/CachedImage.cpp
WebCore/platform/graphics/ImageSource.h
WebCore/platform/image-decoders/ImageDecoder.cpp
WebCore/platform/image-decoders/ImageDecoder.h
WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp
WebCore/platform/image-decoders/cg/ImageDecoderCG.cpp [deleted file]
WebCore/platform/image-decoders/haiku/ImageDecoderHaiku.cpp
WebCore/platform/image-decoders/openvg/ImageDecoderOpenVG.cpp
WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp

index e0be518..22cd854 100644 (file)
@@ -1,3 +1,13 @@
+2010-10-23  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Unreviewed, rolling out r70369.
+        http://trac.webkit.org/changeset/70369
+        https://bugs.webkit.org/show_bug.cgi?id=47974
+
+        Caused weird artifacts in expected results.
+
+        * wtf/Platform.h:
+
 2010-10-23  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Xan Lopez.
index 842d812..946192b 100644 (file)
 #endif
 #endif
 
-#if PLATFORM(CHROMIUM)
-#define WTF_USE_WEBKIT_IMAGE_DECODERS 1
-#endif
-
 #if PLATFORM(BREWMP)
 #define WTF_PLATFORM_SKIA 1
 #endif
index f872036..667559a 100644 (file)
@@ -1,3 +1,34 @@
+2010-10-23  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Unreviewed, rolling out r70369.
+        http://trac.webkit.org/changeset/70369
+        https://bugs.webkit.org/show_bug.cgi?id=47974
+
+        Caused weird artifacts in expected results.
+
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+        * loader/CachedImage.cpp:
+        (WebCore::CachedImage::createImage):
+        * platform/graphics/ImageSource.h:
+        * platform/image-decoders/ImageDecoder.cpp:
+        (WebCore::RGBA32Buffer::operator=):
+        (WebCore::RGBA32Buffer::clear):
+        (WebCore::RGBA32Buffer::zeroFill):
+        (WebCore::RGBA32Buffer::copyBitmapData):
+        (WebCore::RGBA32Buffer::setSize):
+        * platform/image-decoders/ImageDecoder.h:
+        (WebCore::RGBA32Buffer::getAddr):
+        * platform/image-decoders/cairo/ImageDecoderCairo.cpp:
+        (WebCore::RGBA32Buffer::asNewNativeImage):
+        * platform/image-decoders/cg/ImageDecoderCG.cpp: Removed.
+        * platform/image-decoders/haiku/ImageDecoderHaiku.cpp:
+        (WebCore::RGBA32Buffer::asNewNativeImage):
+        * platform/image-decoders/openvg/ImageDecoderOpenVG.cpp:
+        (WebCore::RGBA32Buffer::asNewNativeImage):
+        * platform/image-decoders/wx/ImageDecoderWx.cpp:
+        (WebCore::RGBA32Buffer::asNewNativeImage):
+
 2010-10-23  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Andreas Kling.
index ce77c8f..7c28ba7 100644 (file)
             # platform/graphics/chromium, included by regex above, instead.
             ['exclude', 'platform/graphics/chromium/ImageChromium\\.cpp$'],
 
-            # The Mac does not use ImageSourceCG.cpp from platform/graphics/cg
-            # even though it is included by regex above.
-            ['exclude', 'platform/graphics/cg/ImageSourceCG\\.cpp$'],
-            ['exclude', 'platform/graphics/cg/PDFDocumentImage\\.cpp$'],
+            # The Mac uses ImageSourceCG.cpp from platform/graphics/cg, included
+            # by regex above, instead.
+            ['exclude', 'platform/graphics/ImageSource\\.cpp$'],
 
-            # ImageDecoderSkia is not used on mac.  ImageDecoderCG is used instead.
+            # Skia image-decoders are also not used on mac.  CoreGraphics
+            # is used directly instead.
+            ['exclude', 'platform/image-decoders/ImageDecoder\\.h$'],
+            ['exclude', 'platform/image-decoders/bmp/BMPImageDecoder\\.(cpp|h)$'],
+            ['exclude', 'platform/image-decoders/bmp/BMPImageReader\\.(cpp|h)$'],
+            ['exclude', 'platform/image-decoders/gif/GIFImageDecoder\\.(cpp|h)$'],
+            ['exclude', 'platform/image-decoders/gif/GIFImageReader\\.(cpp|h)$'],
+            ['exclude', 'platform/image-decoders/ico/ICOImageDecoder\\.(cpp|h)$'],
+            ['exclude', 'platform/image-decoders/jpeg/JPEGImageDecoder\\.(cpp|h)$'],
+            ['exclude', 'platform/image-decoders/webp/WEBPImageDecoder\\.(cpp|h)$'],
+            ['exclude', 'platform/image-decoders/png/PNGImageDecoder\\.(cpp|h)$'],
             ['exclude', 'platform/image-decoders/skia/ImageDecoderSkia\\.cpp$'],
-            ['include', 'platform/image-decoders/cg/ImageDecoderCG\\.cpp$'],
+            ['exclude', 'platform/image-decoders/xbm/XBMImageDecoder\\.(cpp|h)$'],
 
             # Again, Skia is not used on Mac.
             ['exclude', 'platform/chromium/DragImageChromiumSkia\\.cpp$'],
index c5ef729..4a417f3 100644 (file)
             'platform/image-decoders/bmp/BMPImageReader.cpp',
             'platform/image-decoders/bmp/BMPImageReader.h',
             'platform/image-decoders/cairo/ImageDecoderCairo.cpp',
-            'platform/image-decoders/cg/ImageDecoderCG.cpp',
             'platform/image-decoders/gif/GIFImageDecoder.cpp',
             'platform/image-decoders/gif/GIFImageDecoder.h',
             'platform/image-decoders/gif/GIFImageReader.cpp',
index 9f6abef..2c18f35 100644 (file)
@@ -237,7 +237,7 @@ inline void CachedImage::createImage()
     // Create the image if it doesn't yet exist.
     if (m_image)
         return;
-#if PLATFORM(CG) && !USE(WEBKIT_IMAGE_DECODERS)
+#if PLATFORM(CG)
     if (m_response.mimeType() == "application/pdf") {
         m_image = PDFDocumentImage::create();
         return;
index 899ed38..19952b1 100644 (file)
@@ -63,12 +63,7 @@ class IntSize;
 class SharedBuffer;
 
 #if PLATFORM(CG)
-#if USE(WEBKIT_IMAGE_DECODERS)
-class ImageDecoder;
-typedef ImageDecoder* NativeImageSourcePtr;
-#else
 typedef CGImageSourceRef NativeImageSourcePtr;
-#endif
 typedef CGImageRef NativeImagePtr;
 #elif PLATFORM(OPENVG)
 class ImageDecoder;
index 9ffbbf5..58c71f8 100644 (file)
@@ -117,7 +117,7 @@ RGBA32Buffer& RGBA32Buffer::operator=(const RGBA32Buffer& other)
     if (this == &other)
         return *this;
 
-    copyReferenceToBitmapData(other);
+    copyBitmapData(other);
     setRect(other.rect());
     setStatus(other.status());
     setDuration(other.duration());
@@ -128,8 +128,7 @@ RGBA32Buffer& RGBA32Buffer::operator=(const RGBA32Buffer& other)
 
 void RGBA32Buffer::clear()
 {
-    m_backingStore.clear();
-    m_bytes = 0;
+    m_bytes.clear();
     m_status = FrameEmpty;
     // NOTE: Do not reset other members here; clearFrameBufferCache() calls this
     // to free the bitmap data, but other functions like initFrameBuffer() and
@@ -139,25 +138,16 @@ void RGBA32Buffer::clear()
 
 void RGBA32Buffer::zeroFill()
 {
-    memset(m_bytes, 0, m_size.width() * m_size.height() * sizeof(PixelData));
+    m_bytes.fill(0);
     m_hasAlpha = true;
 }
 
-#if !PLATFORM(CF)
-
-void RGBA32Buffer::copyReferenceToBitmapData(const RGBA32Buffer& other)
-{
-    ASSERT(this != &other);
-    copyBitmapData(other);
-}
-
 bool RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other)
 {
     if (this == &other)
         return true;
 
-    m_backingStore = other.m_backingStore;
-    m_bytes = m_backingStore.data();
+    m_bytes = other.m_bytes;
     m_size = other.m_size;
     setHasAlpha(other.m_hasAlpha);
     return true;
@@ -167,8 +157,7 @@ bool RGBA32Buffer::setSize(int newWidth, int newHeight)
 {
     // NOTE: This has no way to check for allocation failure if the requested
     // size was too big...
-    m_backingStore.resize(newWidth * newHeight);
-    m_bytes = m_backingStore.data();
+    m_bytes.resize(newWidth * newHeight);
     m_size = IntSize(newWidth, newHeight);
 
     // Zero the image.
@@ -177,8 +166,6 @@ bool RGBA32Buffer::setSize(int newWidth, int newHeight)
     return true;
 }
 
-#endif
-
 bool RGBA32Buffer::hasAlpha() const
 {
     return m_hasAlpha;
index b07c72b..b97d864 100644 (file)
@@ -85,11 +85,7 @@ namespace WebCore {
 
         // Creates a new copy of the image data in |other|, so the two images
         // can be modified independently.  Returns whether the copy succeeded.
-        bool copyBitmapData(const RGBA32Buffer&);
-
-        // Creates a new reference to the image data in |other|.  The two images
-        // share a common backing store.
-        void copyReferenceToBitmapData(const RGBA32Buffer&);
+        bool copyBitmapData(const RGBA32Buffer& other);
 
         // Copies the pixel data at [(startX, startY), (endX, startY)) to the
         // same X-coordinates on each subsequent row up to but not including
@@ -141,12 +137,6 @@ namespace WebCore {
 #endif
 
     private:
-#if PLATFORM(CF)
-        typedef RetainPtr<CFMutableDataRef> NativeBackingStore;
-#else
-        typedef Vector<PixelData> NativeBackingStore;
-#endif
-
         int width() const;
         int height() const;
 
@@ -159,7 +149,7 @@ namespace WebCore {
             m_pixmap = QPixmap();
             return reinterpret_cast_ptr<QRgb*>(m_image.scanLine(y)) + x;
 #else
-            return m_bytes + (y * width()) + x;
+            return m_bytes.data() + (y * width()) + x;
 #endif
         }
 
@@ -186,25 +176,26 @@ namespace WebCore {
         bool m_hasAlpha;
         IntSize m_size;
 #else
-        NativeBackingStore m_backingStore;
-        PixelData* m_bytes; // The memory is backed by m_backingStore.
-        IntSize m_size; // The size of the buffer.  This should be the
-                        // same as ImageDecoder::m_size.
-        bool m_hasAlpha; // Whether or not any of the pixels in the buffer
-                         // have transparency.
+        Vector<PixelData> m_bytes;
+        IntSize m_size;       // The size of the buffer.  This should be the
+                              // same as ImageDecoder::m_size.
+        bool m_hasAlpha;      // Whether or not any of the pixels in the buffer
+                              // have transparency.
 #endif
-        IntRect m_rect; // The rect of the original specified frame within
-                        // the overall buffer.  This will always just be
-                        // the entire buffer except for GIF frames whose
-                        // original rect was smaller than the overall
-                        // image size.
+        IntRect m_rect;       // The rect of the original specified frame within
+                              // the overall buffer.  This will always just be
+                              // the entire buffer except for GIF frames whose
+                              // original rect was smaller than the overall
+                              // image size.
         FrameStatus m_status; // Whether or not this frame is completely
                               // finished decoding.
-        unsigned m_duration; // The animation delay.
-        FrameDisposalMethod m_disposalMethod; // What to do with this frame's data when
-                                              // initializing the next frame.
-        bool m_premultiplyAlpha; // Whether to premultiply alpha into R, G, B
-                                 // channels; by default it's true.
+        unsigned m_duration;  // The animation delay.
+        FrameDisposalMethod m_disposalMethod;
+                              // What to do with this frame's data when
+                              // initializing the next frame.
+        bool m_premultiplyAlpha;
+                              // Whether to premultiply alpha into R, G, B
+                              // channels; by default it's true.
     };
 
     // The ImageDecoder class represents a base class for specific image format
index d741882..203205d 100644 (file)
@@ -34,7 +34,7 @@ NativeImagePtr RGBA32Buffer::asNewNativeImage() const
 {
     return cairo_image_surface_create_for_data(
         reinterpret_cast<unsigned char*>(const_cast<PixelData*>(
-            m_bytes)), CAIRO_FORMAT_ARGB32, width(), height(),
+            m_bytes.data())), CAIRO_FORMAT_ARGB32, width(), height(),
         width() * sizeof(PixelData));
 }
 
diff --git a/WebCore/platform/image-decoders/cg/ImageDecoderCG.cpp b/WebCore/platform/image-decoders/cg/ImageDecoderCG.cpp
deleted file mode 100644 (file)
index 2fac7da..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2010 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "ImageDecoder.h"
-
-#include <CoreGraphics/CGColorSpace.h>
-#include <CoreGraphics/CGImage.h>
-
-namespace WebCore {
-
-void RGBA32Buffer::copyReferenceToBitmapData(const RGBA32Buffer& other)
-{
-    ASSERT(this != &other);
-    m_backingStore = other.m_backingStore;
-    m_bytes = reinterpret_cast<PixelData*>(CFDataGetMutableBytePtr(m_backingStore.get()));
-    // FIXME: The rest of this function seems redundant with RGBA32Buffer::copyBitmapData.
-    m_size = other.m_size;
-    setHasAlpha(other.m_hasAlpha);
-}
-
-bool RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other)
-{
-    if (this == &other)
-        return true;
-
-    m_backingStore.adoptCF(CFDataCreateMutableCopy(kCFAllocatorDefault, 0, other.m_backingStore.get()));
-    m_bytes = reinterpret_cast<PixelData*>(CFDataGetMutableBytePtr(m_backingStore.get()));
-    m_size = other.m_size;
-    setHasAlpha(other.m_hasAlpha);
-    return true;
-}
-
-bool RGBA32Buffer::setSize(int newWidth, int newHeight)
-{
-    m_backingStore.adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
-    CFDataSetLength(m_backingStore.get(), newWidth * newHeight * sizeof(PixelData));
-    m_bytes = reinterpret_cast<PixelData*>(CFDataGetMutableBytePtr(m_backingStore.get()));
-    m_size = IntSize(newWidth, newHeight);
-
-    zeroFill();
-    return true;
-}
-
-NativeImagePtr RGBA32Buffer::asNewNativeImage() const
-{
-    // FIXME: Figure out the right color space.
-    DEFINE_STATIC_LOCAL(RetainPtr<CGColorSpaceRef>, deviceColorSpace, (AdoptCF, CGColorSpaceCreateDeviceRGB()));
-    RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(m_backingStore.get()));
-
-    CGImageAlphaInfo alphaInfo = m_premultiplyAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaFirst;
-
-    return CGImageCreate(width(), height(), 8, 32, width() * sizeof(PixelData), deviceColorSpace.get(),
-        alphaInfo | kCGBitmapByteOrder32Host, dataProvider.get(), 0, false, kCGRenderingIntentDefault);
-}
-
-} // namespace WebCore
index 47302f7..7f00db2 100644 (file)
@@ -36,7 +36,7 @@ NativeImagePtr RGBA32Buffer::asNewNativeImage() const
     int bytesPerRow = width() * sizeof(PixelData);
     OwnPtr<BBitmap> bitmap(new BBitmap(BRect(0, 0, width() - 1, height() - 1), 0, B_RGBA32, bytesPerRow));
 
-    const uint8* source = reinterpret_cast<const uint8*>(m_bytes);
+    const uint8* source = reinterpret_cast<const uint8*>(m_bytes.data());
     uint8* destination = reinterpret_cast<uint8*>(bitmap->Bits());
     int h = height();
     int w = width();
index 061c5ab..3d8f749 100644 (file)
@@ -59,7 +59,7 @@ NativeImagePtr RGBA32Buffer::asNewNativeImage() const
                 tileRect.width(), tileRect.height(), VG_IMAGE_QUALITY_FASTER);
             ASSERT_VG_NO_ERROR();
 
-            PixelData* pixelData = const_cast<PixelData*>(m_bytes);
+            PixelData* pixelData = const_cast<PixelData*>(m_bytes.data());
             pixelData += (tileRect.y() * width()) + tileRect.x();
 
             vgImageSubData(image, reinterpret_cast<unsigned char*>(pixelData),
index 966eb90..e6e45b7 100644 (file)
@@ -48,12 +48,12 @@ NativeImagePtr RGBA32Buffer::asNewNativeImage() const
         // NB: It appears that the data is in BGRA format instead of RGBA format.
         // This code works properly on both ppc and intel, meaning the issue is
         // likely not an issue of byte order getting mixed up on different archs. 
-        const unsigned char* bytes = (const unsigned char*)m_bytes;
+        const unsigned char* bytes = (const unsigned char*)m_bytes.data();
         int rowCounter = 0;
         long pixelCounter = 0;
         WxPixelData::Iterator p(data);
         WxPixelData::Iterator rowStart = p; 
-        for (size_t i = 0; i < m_size.width() * m_size.height() * sizeof(PixelData); i += sizeof(PixelData)) {
+        for (size_t i = 0; i < m_bytes.size() * sizeof(PixelData); i += sizeof(PixelData)) {
                 p.Red() = bytes[i + 2];
                 p.Green() = bytes[i + 1];
                 p.Blue() = bytes[i + 0];