[Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder
authorzoltan@webkit.org <zoltan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 May 2012 12:10:26 +0000 (12:10 +0000)
committerzoltan@webkit.org <zoltan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 May 2012 12:10:26 +0000 (12:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80400

Source/WebCore:

This change modifies the default ImageDecoder for Qt-port from QImageDecoder to WebCore ImageDecoder.
The new behavior is to use QImageDecoder only if WebCoreImageDecoder doesn't support the requested
image type.
The WTF_USE_QT_IMAGE_DECODER macro has been removed, since it is no longer needed.

This change adds build depedency for libpng-dev and libjpeg-dev packages, becuase PNG and JPEG imagedecoders
need not only these libraries, but their headers also. Qmake-config tests for these libraries were
introduced in r110045.

Reviewed by Simon Hausmann.

No new tests needed.

* Target.pri: Move WebCore ImageDecoder files out of guards. Remove ImageFrameQt.cpp from sources.
* WebCore.pri: Move WebCore ImageDecoder include paths out of guards.
* platform/MIMETypeRegistry.cpp:
(WebCore::initializeSupportedImageMIMETypes): Add WebCore supported and Qt supported MIME types.
(WebCore::initializeSupportedImageMIMETypesForEncoding): Use Qt supported MIME types.
* platform/graphics/ImageSource.cpp: Remove unnecessary includes.
* platform/graphics/ImageSource.h: Remove unnecessary typedefs.
(WebCore):
* platform/graphics/qt/ImageDecoderQt.cpp:
(WebCore::ImageDecoderQt::filenameExtension): Remove unnecessary semicolon.
(WebCore::ImageDecoderQt::internalHandleCurrentImage): Use QImage and ImageFrame instead of QPixmap.
(WebCore):
(WebCore::ImageFrame::asNewNativeImage): Moved here from removed ImageFrameQt.cpp.
* platform/image-decoders/ImageDecoder.cpp: Reorganize the includes of the header.
(WebCore::ImageDecoder::create): Add platform macro guarded fallback case for QImageDecoder.
* platform/image-decoders/ImageDecoder.h: Remove Qt-specific codes.
(WebCore::ImageFrame::getAddr): Remove Qt-specific case, since it is no longer needed.
(ImageFrame):
* platform/image-decoders/qt/ImageFrameQt.cpp: Removed. Dead code, other code has been moved to
ImageDecoderQt.cpp.

Source/WebKit/blackberry:

Get rid off QT_IMAGE_DECODER flag.

Reviewed by Simon Hausmann.

* WebCoreSupport/AboutDataEnableFeatures.in:

Tools:

Remove WTF_USE_QT_IMAGE_DECODER macro.

Reviewed by Simon Hausmann.

* qmake/mkspecs/features/features.prf:

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

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Target.pri [changed mode: 0644->0755]
Source/WebCore/WebCore.pri [changed mode: 0644->0755]
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebCore/platform/graphics/ImageSource.cpp [changed mode: 0644->0755]
Source/WebCore/platform/graphics/ImageSource.h [changed mode: 0644->0755]
Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp [changed mode: 0644->0755]
Source/WebCore/platform/graphics/qt/ImageDecoderQt.h [changed mode: 0644->0755]
Source/WebCore/platform/image-decoders/ImageDecoder.cpp [changed mode: 0644->0755]
Source/WebCore/platform/image-decoders/ImageDecoder.h [changed mode: 0644->0755]
Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp [deleted file]
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in
Tools/ChangeLog
Tools/qmake/mkspecs/features/features.prf

index 6661858..70707fc 100644 (file)
@@ -1,3 +1,42 @@
+2012-05-04  Zoltan Horvath  <zoltan@webkit.org>
+
+        [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder
+        https://bugs.webkit.org/show_bug.cgi?id=80400
+
+        This change modifies the default ImageDecoder for Qt-port from QImageDecoder to WebCore ImageDecoder.
+        The new behavior is to use QImageDecoder only if WebCoreImageDecoder doesn't support the requested
+        image type.
+        The WTF_USE_QT_IMAGE_DECODER macro has been removed, since it is no longer needed.
+
+        This change adds build depedency for libpng-dev and libjpeg-dev packages, becuase PNG and JPEG imagedecoders
+        need not only these libraries, but their headers also. Qmake-config tests for these libraries were
+        introduced in r110045.
+
+        Reviewed by Simon Hausmann.
+
+        No new tests needed.
+
+        * Target.pri: Move WebCore ImageDecoder files out of guards. Remove ImageFrameQt.cpp from sources.
+        * WebCore.pri: Move WebCore ImageDecoder include paths out of guards.
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::initializeSupportedImageMIMETypes): Add WebCore supported and Qt supported MIME types.
+        (WebCore::initializeSupportedImageMIMETypesForEncoding): Use Qt supported MIME types.
+        * platform/graphics/ImageSource.cpp: Remove unnecessary includes.
+        * platform/graphics/ImageSource.h: Remove unnecessary typedefs.
+        (WebCore):
+        * platform/graphics/qt/ImageDecoderQt.cpp:
+        (WebCore::ImageDecoderQt::filenameExtension): Remove unnecessary semicolon.
+        (WebCore::ImageDecoderQt::internalHandleCurrentImage): Use QImage and ImageFrame instead of QPixmap.
+        (WebCore):
+        (WebCore::ImageFrame::asNewNativeImage): Moved here from removed ImageFrameQt.cpp.
+        * platform/image-decoders/ImageDecoder.cpp: Reorganize the includes of the header.
+        (WebCore::ImageDecoder::create): Add platform macro guarded fallback case for QImageDecoder.
+        * platform/image-decoders/ImageDecoder.h: Remove Qt-specific codes.
+        (WebCore::ImageFrame::getAddr): Remove Qt-specific case, since it is no longer needed.
+        (ImageFrame):
+        * platform/image-decoders/qt/ImageFrameQt.cpp: Removed. Dead code, other code has been moved to
+        ImageDecoderQt.cpp.
+
 2012-05-03  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Web Inspector: createRawLocationByURL is too slow if a big number of evals happen.
old mode 100644 (file)
new mode 100755 (executable)
index ecb1963..cd49b51
@@ -1080,7 +1080,6 @@ SOURCES += \
     platform/FileStream.cpp \
     platform/FileSystem.cpp \
     platform/HistogramSupport.cpp \
-    platform/image-decoders/qt/ImageFrameQt.cpp \
     platform/graphics/FontDescription.cpp \
     platform/graphics/FontFallbackList.cpp \
     platform/graphics/FontFamily.cpp \
@@ -1133,6 +1132,14 @@ SOURCES += \
     platform/graphics/transforms/TransformOperations.cpp \
     platform/graphics/transforms/TransformState.cpp \
     platform/graphics/transforms/TranslateTransformOperation.cpp \
+    platform/image-decoders/ImageDecoder.cpp \
+    platform/image-decoders/bmp/BMPImageDecoder.cpp \
+    platform/image-decoders/bmp/BMPImageReader.cpp \
+    platform/image-decoders/gif/GIFImageDecoder.cpp \
+    platform/image-decoders/gif/GIFImageReader.cpp\
+    platform/image-decoders/ico/ICOImageDecoder.cpp \
+    platform/image-decoders/jpeg/JPEGImageDecoder.cpp \
+    platform/image-decoders/png/PNGImageDecoder.cpp \
     platform/KillRingNone.cpp \
     platform/KURL.cpp \
     platform/Language.cpp \
@@ -2279,6 +2286,13 @@ HEADERS += \
     platform/graphics/transforms/TransformOperations.h \
     platform/graphics/transforms/TransformState.h \
     platform/graphics/transforms/TranslateTransformOperation.h \
+    platform/image-decoders/bmp/BMPImageDecoder.h \
+    platform/image-decoders/bmp/BMPImageReader.h \
+    platform/image-decoders/gif/GIFImageDecoder.h \
+    platform/image-decoders/gif/GIFImageReader.h\
+    platform/image-decoders/ico/ICOImageDecoder.h \
+    platform/image-decoders/jpeg/JPEGImageDecoder.h \
+    platform/image-decoders/png/PNGImageDecoder.h \
     platform/KillRing.h \
     platform/KURL.h \
     platform/Length.h \
@@ -2852,6 +2866,7 @@ SOURCES += \
     platform/graphics/qt/GraphicsContextQt.cpp \
     platform/graphics/qt/IconQt.cpp \
     platform/graphics/qt/ImageBufferQt.cpp \
+    platform/graphics/qt/ImageDecoderQt.cpp \
     platform/graphics/qt/ImageQt.cpp \
     platform/graphics/qt/IntPointQt.cpp \
     platform/graphics/qt/IntRectQt.cpp \
@@ -4023,33 +4038,10 @@ contains(DEFINES, ENABLE_MHTML=1) {
         page/PageSerializer.cpp
 }
 
-contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=1) {
-    HEADERS += platform/graphics/qt/ImageDecoderQt.h
-    SOURCES += platform/graphics/qt/ImageDecoderQt.cpp
-} else {
-    HEADERS += \
-        platform/image-decoders/bmp/BMPImageDecoder.h \
-        platform/image-decoders/bmp/BMPImageReader.h \
-        platform/image-decoders/gif/GIFImageDecoder.h \
-        platform/image-decoders/gif/GIFImageReader.h\
-        platform/image-decoders/ico/ICOImageDecoder.h \
-        platform/image-decoders/jpeg/JPEGImageDecoder.h \
-        platform/image-decoders/png/PNGImageDecoder.h
-
-    SOURCES += \
-        platform/image-decoders/ImageDecoder.cpp \
-        platform/image-decoders/bmp/BMPImageDecoder.cpp \
-        platform/image-decoders/bmp/BMPImageReader.cpp \
-        platform/image-decoders/gif/GIFImageDecoder.cpp \
-        platform/image-decoders/gif/GIFImageReader.cpp\
-        platform/image-decoders/ico/ICOImageDecoder.cpp \
-        platform/image-decoders/jpeg/JPEGImageDecoder.cpp \
-        platform/image-decoders/png/PNGImageDecoder.cpp
-
-    contains(DEFINES, WTF_USE_WEBP=1) {
-        HEADERS += platform/image-decoders/webp/WEBPImageDecoder.h
-        SOURCES += platform/image-decoders/webp/WEBPImageDecoder.cpp
-    }
+contains(DEFINES, WTF_USE_WEBP=1) {
+    INCLUDEPATH += platform/image-decoders/webp
+    HEADERS += platform/image-decoders/webp/WEBPImageDecoder.h
+    SOURCES += platform/image-decoders/webp/WEBPImageDecoder.cpp
 }
 
 !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) {
old mode 100644 (file)
new mode 100755 (executable)
index 6f31472..ca7e683
@@ -64,6 +64,11 @@ INCLUDEPATH += \
     $$SOURCE_DIR/platform/graphics/texmap \
     $$SOURCE_DIR/platform/graphics/transforms \
     $$SOURCE_DIR/platform/image-decoders \
+    $$SOURCE_DIR/platform/image-decoders/bmp \
+    $$SOURCE_DIR/platform/image-decoders/gif \
+    $$SOURCE_DIR/platform/image-decoders/ico \
+    $$SOURCE_DIR/platform/image-decoders/jpeg \
+    $$SOURCE_DIR/platform/image-decoders/png \
     $$SOURCE_DIR/platform/leveldb \
     $$SOURCE_DIR/platform/mock \
     $$SOURCE_DIR/platform/network \
@@ -222,28 +227,19 @@ contains(DEFINES, WTF_USE_TEXTURE_MAPPER_GL=1)|contains(DEFINES, ENABLE_WEBGL=1)
     LIBS += -lsqlite3
 }
 
-contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=0) {
-    INCLUDEPATH += \
-        $$SOURCE_DIR/platform/image-decoders/bmp \
-        $$SOURCE_DIR/platform/image-decoders/gif \
-        $$SOURCE_DIR/platform/image-decoders/ico \
-        $$SOURCE_DIR/platform/image-decoders/jpeg \
-        $$SOURCE_DIR/platform/image-decoders/png
-
-    haveQt(5) {
-        # Qt5 allows us to use config tests to check for the presence of these libraries
-        !contains(config_test_libjpeg, yes): error("JPEG library not found!")
-        !contains(config_test_libpng, yes): error("PNG 1.2 library not found!")
-    }
-
-    LIBS += -ljpeg -lpng12
+contains(DEFINES, WTF_USE_WEBP=1) {
+    INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp
+    LIBS += -lwebp
+}
 
-    contains(DEFINES, WTF_USE_WEBP=1) {
-        INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp
-        LIBS += -lwebp
-    }
+haveQt(5) {
+    # Qt5 allows us to use config tests to check for the presence of these libraries
+    !contains(config_test_libjpeg, yes): error("JPEG library not found!")
+    !contains(config_test_libpng, yes): error("PNG 1.2 library not found!")
 }
 
+LIBS += -ljpeg -lpng12
+
 win32-*|wince* {
     DLLDESTDIR = $${ROOT_BUILD_DIR}/bin
 
index b4830cd..f669865 100755 (executable)
@@ -39,9 +39,9 @@
 #include <ApplicationServices/ApplicationServices.h>
 #include <wtf/RetainPtr.h>
 #endif
-#if PLATFORM(QT) && USE(QT_IMAGE_DECODER)
-#include <qimagereader.h>
-#include <qimagewriter.h>
+#if PLATFORM(QT)
+#include <QImageReader>
+#include <QImageWriter>
 #endif
 
 #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
@@ -227,22 +227,6 @@ static void initializeSupportedImageMIMETypes()
     supportedImageMIMETypes->remove("application/pdf");
     supportedImageMIMETypes->remove("application/postscript");
 
-#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)
-    QList<QByteArray> formats = QImageReader::supportedImageFormats();
-    for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) {
-#if ENABLE(SVG)
-        /*
-         * Qt has support for SVG, but we want to use KSVG2
-         */
-        if (formats.at(i).toLower().startsWith("svg"))
-            continue;
-#endif
-        String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
-        if (!mimeType.isEmpty()) {
-            supportedImageMIMETypes->add(mimeType);
-            supportedImageResourceMIMETypes->add(mimeType);
-        }
-    }
 #else
     // assume that all implementations at least support the following standard
     // image types:
@@ -259,6 +243,21 @@ static void initializeSupportedImageMIMETypes()
         supportedImageMIMETypes->add(types[i]);
         supportedImageResourceMIMETypes->add(types[i]);
     }
+#if PLATFORM(QT)
+    QList<QByteArray> formats = QImageReader::supportedImageFormats();
+    for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) {
+#if ENABLE(SVG)
+        // Qt has support for SVG, but we want to use KSVG2
+        if (formats.at(i).toLower().startsWith("svg"))
+            continue;
+#endif // ENABLE(SVG)
+        String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
+        if (!mimeType.isEmpty()) {
+            supportedImageMIMETypes->add(mimeType);
+            supportedImageResourceMIMETypes->add(mimeType);
+        }
+    }
+#endif // PLATFORM(QT)
 #if PLATFORM(BLACKBERRY)
     supportedImageMIMETypes->add("image/pjpeg");
     supportedImageResourceMIMETypes->add("image/pjpeg");
@@ -287,14 +286,14 @@ static void initializeSupportedImageMIMETypesForEncoding()
     supportedImageMIMETypesForEncoding->add("image/jpeg");
     supportedImageMIMETypesForEncoding->add("image/gif");
 #endif
-#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)
+#elif PLATFORM(QT)
     QList<QByteArray> formats = QImageWriter::supportedImageFormats();
     for (int i = 0; i < formats.size(); ++i) {
         String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
         if (!mimeType.isEmpty())
             supportedImageMIMETypesForEncoding->add(mimeType);
     }
-#elif PLATFORM(GTK) || (PLATFORM(QT) && !USE(QT_IMAGE_DECODER))
+#elif PLATFORM(GTK)
     supportedImageMIMETypesForEncoding->add("image/png");
     supportedImageMIMETypesForEncoding->add("image/jpeg");
     supportedImageMIMETypesForEncoding->add("image/tiff");
old mode 100644 (file)
new mode 100755 (executable)
index ff9fe0d..75ed5a1
 #include "config.h"
 #include "ImageSource.h"
 
-#if PLATFORM(QT)
-#include "ImageDecoderQt.h"
-#else
 #include "ImageDecoder.h"
-#endif
 
 #include "ImageOrientation.h"
 #include "NotImplemented.h"
old mode 100644 (file)
new mode 100755 (executable)
index 307737f..8356472
@@ -75,10 +75,6 @@ class ImageDecoder;
 class TiledImageOpenVG;
 typedef ImageDecoder* NativeImageSourcePtr;
 typedef TiledImageOpenVG* NativeImagePtr;
-#elif PLATFORM(QT)
-class ImageDecoderQt;
-typedef ImageDecoderQt* NativeImageSourcePtr;
-typedef QPixmap* NativeImagePtr;
 #else
 class ImageDecoder;
 typedef ImageDecoder* NativeImageSourcePtr;
@@ -98,6 +94,8 @@ typedef RefPtr<SharedBitmap> NativeImagePtr;
 class ImageDecoder;
 typedef ImageDecoder* NativeImageSourcePtr;
 typedef void* NativeImagePtr;
+#elif PLATFORM(QT)
+typedef QPixmap* NativeImagePtr;
 #endif
 #endif
 
old mode 100644 (file)
new mode 100755 (executable)
index 1f93aa3..151e3d1
 
 #include <QtCore/QByteArray>
 #include <QtCore/QBuffer>
-
 #include <QtGui/QImageReader>
-#include <qdebug.h>
 
 namespace WebCore {
 
-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(alphaOption, gammaAndColorProfileOption);
-}
-
 ImageDecoderQt::ImageDecoderQt(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
     : ImageDecoder(alphaOption, gammaAndColorProfileOption)
     , m_repetitionCount(cAnimationNone)
@@ -129,7 +118,7 @@ int ImageDecoderQt::repetitionCount() const
 String ImageDecoderQt::filenameExtension() const
 {
     return String(m_format.constData(), m_format.length());
-};
+}
 
 ImageFrame* ImageDecoderQt::frameBufferAtIndex(size_t index)
 {
@@ -194,21 +183,28 @@ void ImageDecoderQt::internalReadImage(size_t frameIndex)
 
 bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex)
 {
-    QPixmap pixmap = QPixmap::fromImageReader(m_reader.get());
+    ImageFrame* const buffer = &m_frameBufferCache[frameIndex];
+    QSize imageSize = m_reader->size();
+
+    if (!buffer->setSize(imageSize.width(), imageSize.height()))
+        return false;
+
+    QImage image(reinterpret_cast<uchar*>(buffer->getAddr(0, 0)), imageSize.width(), imageSize.height(), sizeof(ImageFrame::PixelData) * imageSize.width(), m_reader->imageFormat());
 
-    if (pixmap.isNull()) {
+    buffer->setDuration(m_reader->nextImageDelay());
+    m_reader->read(&image);
+
+    if (image.isNull()) {
         frameCount();
         repetitionCount();
         clearPointers();
         return false;
     }
 
-    // now into the ImageFrame - even if the image is not
-    ImageFrame* const buffer = &m_frameBufferCache[frameIndex];
-    buffer->setOriginalFrameRect(m_reader->currentImageRect());
+    buffer->setOriginalFrameRect(image.rect());
+    buffer->setHasAlpha(image.hasAlphaChannel());
     buffer->setStatus(ImageFrame::FrameComplete);
-    buffer->setDuration(m_reader->nextImageDelay());
-    buffer->setPixmap(pixmap);
+
     return true;
 }
 
@@ -245,6 +241,20 @@ void ImageDecoderQt::clearPointers()
     m_reader.clear();
     m_buffer.clear();
 }
+
+NativeImagePtr ImageFrame::asNewNativeImage() const
+{
+    QImage::Format format;
+    if (m_hasAlpha)
+        format = m_premultiplyAlpha ?  QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32;
+    else
+        format = QImage::Format_RGB32;
+
+    QImage img(reinterpret_cast<uchar*>(m_bytes), m_size.width(), m_size.height(), sizeof(PixelData) * m_size.width(), format);
+
+    return new QPixmap(QPixmap::fromImage(img));
+}
+
 }
 
 // vim: ts=4 sw=4 et
old mode 100644 (file)
new mode 100755 (executable)
index d9e9690..3da6c42
  */
 
 #include "config.h"
-
 #include "ImageDecoder.h"
 
-#include <algorithm>
-#include <cmath>
-
 #include "BMPImageDecoder.h"
 #include "GIFImageDecoder.h"
 #include "ICOImageDecoder.h"
+#if PLATFORM(QT)
+#include "ImageDecoderQt.h"
+#endif
 #include "JPEGImageDecoder.h"
 #include "PNGImageDecoder.h"
+#include "SharedBuffer.h"
 #if USE(WEBP)
 #include "WEBPImageDecoder.h"
 #endif
-#include "SharedBuffer.h"
+
+#include <algorithm>
+#include <cmath>
 
 using namespace std;
 
@@ -124,6 +126,9 @@ ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaO
     if (matchesICOSignature(contents) || matchesCURSignature(contents))
         return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption);
 
+#if PLATFORM(QT)
+    return new ImageDecoderQt(alphaOption, gammaAndColorProfileOption);
+#endif
     return 0;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 20122ff..0c40fa6
@@ -40,9 +40,6 @@
 #if USE(SKIA)
 #include "NativeImageSkia.h"
 #include "SkColorPriv.h"
-#elif PLATFORM(QT)
-#include <QPixmap>
-#include <QImage>
 #endif
 
 namespace WebCore {
@@ -64,7 +61,7 @@ namespace WebCore {
             DisposeOverwritePrevious  // Clear frame to previous framebuffer
                                       // contents
         };
-#if USE(SKIA) || (PLATFORM(QT) && USE(QT_IMAGE_DECODER))
+#if USE(SKIA)
         typedef uint32_t PixelData;
 #else
         typedef unsigned PixelData;
@@ -140,19 +137,10 @@ namespace WebCore {
         {
 #if USE(SKIA)
             return m_bitmap.bitmap().getAddr32(x, y);
-#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)
-            m_image = m_pixmap.toImage();
-            m_pixmap = QPixmap();
-            return reinterpret_cast_ptr<QRgb*>(m_image.scanLine(y)) + x;
 #else
             return m_bytes + (y * width()) + x;
 #endif
         }
-
-#if PLATFORM(QT) && USE(QT_IMAGE_DECODER)
-        void setPixmap(const QPixmap& pixmap);
-#endif
-
     private:
 #if USE(CG)
         typedef RetainPtr<CFMutableDataRef> NativeBackingStore;
@@ -190,11 +178,6 @@ namespace WebCore {
 #if PLATFORM(CHROMIUM) && OS(DARWIN)
         ColorProfile m_colorProfile;
 #endif
-#elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)
-        mutable QPixmap m_pixmap;
-        mutable QImage m_image;
-        bool m_hasAlpha;
-        IntSize m_size;
 #else
         NativeBackingStore m_backingStore;
         PixelData* m_bytes; // The memory is backed by m_backingStore.
diff --git a/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp b/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp
deleted file mode 100644 (file)
index 999ac29..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Google, Inc.
- * Copyright (C) 2009 Holger Hans Peter Freyther
- *
- * 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 "NotImplemented.h"
-
-namespace WebCore {
-
-#if USE(QT_IMAGE_DECODER)
-
-ImageFrame::ImageFrame()
-    : m_hasAlpha(false) 
-    , m_size()
-    , m_status(FrameEmpty)
-    , m_duration(0)
-    , m_disposalMethod(DisposeNotSpecified)
-    , m_premultiplyAlpha(true)
-{
-}
-
-ImageFrame& ImageFrame::operator=(const ImageFrame& other)
-{
-    if (this == &other)
-        return *this;
-
-    copyBitmapData(other);
-    setOriginalFrameRect(other.originalFrameRect());
-    setStatus(other.status());
-    setDuration(other.duration());
-    setDisposalMethod(other.disposalMethod());
-    setPremultiplyAlpha(other.premultiplyAlpha());
-    return *this;
-}
-
-void ImageFrame::clearPixelData()
-{
-    m_pixmap = QPixmap();
-    m_image = QImage();
-    m_status = FrameEmpty;
-    // NOTE: Do not reset other members here; clearFrameBufferCache()
-    // calls this to free the bitmap data, but other functions like
-    // initFrameBuffer() and frameComplete() may still need to read
-    // other metadata out of this frame later.
-}
-
-void ImageFrame::zeroFillPixelData()
-{
-    if (m_pixmap.isNull() && !m_image.isNull()) {
-        m_pixmap = QPixmap(m_image.width(), m_image.height());
-        m_image = QImage();
-    }
-    m_pixmap.fill(QColor(0, 0, 0, 0));
-}
-
-bool ImageFrame::copyBitmapData(const ImageFrame& other)
-{
-    if (this == &other)
-        return true;
-
-    m_image = other.m_image;
-    m_pixmap = other.m_pixmap;
-    m_size = other.m_size;
-    m_hasAlpha = other.m_hasAlpha;
-    return true;
-}
-
-bool ImageFrame::setSize(int newWidth, int newHeight)
-{
-    // setSize() should only be called once, it leaks memory otherwise.
-    ASSERT(!width() && !height());
-
-    m_size = IntSize(newWidth, newHeight);
-    m_image = QImage();
-    m_pixmap = QPixmap(newWidth, newHeight);
-    if (m_pixmap.isNull())
-        return false;
-
-    zeroFillPixelData();
-    return true;
-}
-
-QPixmap* ImageFrame::asNewNativeImage() const
-{
-    if (m_pixmap.isNull() && !m_image.isNull()) {
-        m_pixmap = QPixmap::fromImage(m_image);
-        m_image = QImage();
-    }
-    return new QPixmap(m_pixmap);
-}
-
-bool ImageFrame::hasAlpha() const
-{
-    return m_hasAlpha;
-}
-
-void ImageFrame::setHasAlpha(bool alpha)
-{
-    m_hasAlpha = alpha;
-}
-
-void ImageFrame::setColorProfile(const ColorProfile& colorProfile)
-{
-    notImplemented();
-}
-
-void ImageFrame::setStatus(FrameStatus status)
-{
-    m_status = status;
-}
-
-// The image must not have format 8888 pre multiplied...
-void ImageFrame::setPixmap(const QPixmap& pixmap)
-{
-    m_pixmap = pixmap;
-    m_image = QImage();
-    m_size = pixmap.size();
-    m_hasAlpha = pixmap.hasAlphaChannel();
-}
-
-int ImageFrame::width() const
-{
-    return m_size.width();
-}
-
-int ImageFrame::height() const
-{
-    return m_size.height();
-}
-
-#else
-
-QPixmap* ImageFrame::asNewNativeImage() const
-{
-    QImage::Format fmt;
-    if (m_hasAlpha)
-        fmt = m_premultiplyAlpha ?  QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32;
-    else
-        fmt = QImage::Format_RGB32;
-
-    QImage img(reinterpret_cast<uchar*>(m_bytes), m_size.width(), m_size.height(), sizeof(PixelData) * m_size.width(), fmt);
-
-    return new QPixmap(QPixmap::fromImage(img));
-}
-
-#endif // USE(QT_IMAGE_DECODER)
-
-}
index f32aaf1..2b2e6ec 100644 (file)
@@ -1,3 +1,14 @@
+2012-05-04  Zoltan Horvath  <zoltan@webkit.org>
+
+        [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder
+        https://bugs.webkit.org/show_bug.cgi?id=80400
+
+        Get rid off QT_IMAGE_DECODER flag.
+
+        Reviewed by Simon Hausmann.
+
+        * WebCoreSupport/AboutDataEnableFeatures.in:
+
 2012-05-03  Fady Samuel  <fsamuel@chromium.org>
 
         Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
index 32e9738..8a0adf7 100644 (file)
@@ -107,7 +107,6 @@ PLUGIN_PROXY_FOR_VIDEO
 POINTER_LOCK
 PROGRESS_TAG
 PURGEABLE_MEMORY
-QT_IMAGE_DECODER
 QUOTA
 REGEXP_TRACING
 REGISTER_PROTOCOL_HANDLER
index b2c71ed..da28417 100644 (file)
@@ -1,3 +1,14 @@
+2012-05-04  Zoltan Horvath  <zoltan@webkit.org>
+
+        [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder
+        https://bugs.webkit.org/show_bug.cgi?id=80400
+
+        Remove WTF_USE_QT_IMAGE_DECODER macro.
+
+        Reviewed by Simon Hausmann.
+
+        * qmake/mkspecs/features/features.prf:
+
 2012-05-03  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL] DRT should obey layoutTestController's addURLToRedirect()
index 44f6131..2ad6c5a 100644 (file)
@@ -115,9 +115,6 @@ haveQt(5) {
 !contains(DEFINES, ENABLE_FAST_MOBILE_SCROLLING=.): DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1
 !contains(DEFINES, ENABLE_PAGE_VISIBILITY_API=.): DEFINES += ENABLE_PAGE_VISIBILITY_API=1
 
-# Policy decisions: for using a particular third-party library or optional OS service
-!contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=.): DEFINES += WTF_USE_QT_IMAGE_DECODER=1
-
 # Enabled in Source/JavaScriptCore/wtf/Platform.h if not set
 # We have to do the same to be able to disable the feature in build-webkit
 !contains(DEFINES, ENABLE_FTPDIR=.): DEFINES += ENABLE_FTPDIR=1