Diff
Modified: trunk/Source/WebCore/ChangeLog (118908 => 118909)
--- trunk/Source/WebCore/ChangeLog 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/ChangeLog 2012-05-30 09:37:01 UTC (rev 118909)
@@ -1,3 +1,46 @@
+2012-05-30 Zoltan Horvath <[email protected]>
+
+ [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 - and the platform - 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 (except Qt-MAC and Qt-WIN platform) for libpng-dev and libjpeg-dev packages,
+ because PNG and JPEG imagedecoders need not only these libraries, but their headers also. Qmake-config
+ tests for these libraries were introduced in r110045.
+
+ Notice: with using libjpeg-turbo as a system library I measured 10% performance improvement on Methanol benchmark
+ (collection of popular sites, page-loading benchmark) with this patch.
+
+ 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: Remove ImageDecoder::create, since it is no longer needed.
+ (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. Add guards
+ for JPEG, PNG, ICO decoder for Qt-MAC and Qt-WIN platform.
+ * 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-23 Kinuko Yasuda <[email protected]>
REGRESSION: We should allow null modificationTime when snapshot metadata is given
Modified: trunk/Source/WebCore/Target.pri (118908 => 118909)
--- trunk/Source/WebCore/Target.pri 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/Target.pri 2012-05-30 09:37:01 UTC (rev 118909)
@@ -1091,7 +1091,6 @@
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 \
@@ -1144,6 +1143,11 @@
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/KillRingNone.cpp \
platform/KURL.cpp \
platform/Language.cpp \
@@ -2300,6 +2304,13 @@
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/ico/ICOImageDecoder.h \
+ platform/image-decoders/gif/GIFImageDecoder.h \
+ platform/image-decoders/gif/GIFImageReader.h \
+ platform/image-decoders/jpeg/JPEGImageDecoder.h \
+ platform/image-decoders/png/PNGImageDecoder.h \
platform/KillRing.h \
platform/KURL.h \
platform/Length.h \
@@ -2877,6 +2888,7 @@
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 \
@@ -4052,33 +4064,19 @@
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
+contains(DEFINES, HAVE_LIBPNG=1) {
+ SOURCES += platform/image-decoders/ico/ICOImageDecoder.cpp \
+ platform/image-decoders/png/PNGImageDecoder.cpp
+}
- 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, HAVE_LIBJPEG=1) {
+ SOURCES += platform/image-decoders/jpeg/JPEGImageDecoder.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 ) {
Modified: trunk/Source/WebCore/WebCore.pri (118908 => 118909)
--- trunk/Source/WebCore/WebCore.pri 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/WebCore.pri 2012-05-30 09:37:01 UTC (rev 118909)
@@ -65,6 +65,11 @@
$$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/ico \
+ $$SOURCE_DIR/platform/image-decoders/gif \
+ $$SOURCE_DIR/platform/image-decoders/jpeg \
+ $$SOURCE_DIR/platform/image-decoders/png \
$$SOURCE_DIR/platform/leveldb \
$$SOURCE_DIR/platform/mock \
$$SOURCE_DIR/platform/network \
@@ -223,26 +228,30 @@
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
+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 library not found!")
+haveQt(5) {
+ # Qt5 allows us to use config tests to check for the presence of these libraries
+ contains(config_test_libjpeg, yes) {
+ DEFINES += HAVE_LIBJPEG=1
+ LIBS += -ljpeg
+ } else {
+ warning("JPEG library not found! QImageDecoder will decode JPEG images.")
}
-
- LIBS += -ljpeg -lpng
-
- contains(DEFINES, WTF_USE_WEBP=1) {
- INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp
- LIBS += -lwebp
+ contains(config_test_libpng, yes) {
+ DEFINES += HAVE_LIBPNG=1
+ LIBS += -lpng
+ } else {
+ warning("PNG library not found! QImageDecoder will decode PNG images.")
}
+} else {
+ !win32-*:!mac {
+ DEFINES += HAVE_LIBJPEG=1 HAVE_LIBPNG=1
+ LIBS += -ljpeg -lpng
+ }
}
win32-*|wince* {
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (118908 => 118909)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2012-05-30 09:37:01 UTC (rev 118909)
@@ -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 @@
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,22 @@
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)
#endif
}
@@ -283,14 +283,14 @@
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");
Modified: trunk/Source/WebCore/platform/graphics/ImageSource.cpp (118908 => 118909)
--- trunk/Source/WebCore/platform/graphics/ImageSource.cpp 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.cpp 2012-05-30 09:37:01 UTC (rev 118909)
@@ -29,11 +29,7 @@
#include "config.h"
#include "ImageSource.h"
-#if PLATFORM(QT)
-#include "ImageDecoderQt.h"
-#else
#include "ImageDecoder.h"
-#endif
#include "ImageOrientation.h"
#include "NotImplemented.h"
Modified: trunk/Source/WebCore/platform/graphics/ImageSource.h (118908 => 118909)
--- trunk/Source/WebCore/platform/graphics/ImageSource.h 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/platform/graphics/ImageSource.h 2012-05-30 09:37:01 UTC (rev 118909)
@@ -70,10 +70,6 @@
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;
@@ -93,6 +89,8 @@
class ImageDecoder;
typedef ImageDecoder* NativeImageSourcePtr;
typedef void* NativeImagePtr;
+#elif PLATFORM(QT)
+typedef QPixmap* NativeImagePtr;
#endif
#endif
Modified: trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp (118908 => 118909)
--- trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp 2012-05-30 09:37:01 UTC (rev 118909)
@@ -31,21 +31,10 @@
#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 @@
String ImageDecoderQt::filenameExtension() const
{
return String(m_format.constData(), m_format.length());
-};
+}
ImageFrame* ImageDecoderQt::frameBufferAtIndex(size_t index)
{
@@ -194,21 +183,28 @@
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 (pixmap.isNull()) {
+ 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());
+
+ 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 @@
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
Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp (118908 => 118909)
--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp 2012-05-30 09:37:01 UTC (rev 118909)
@@ -20,22 +20,24 @@
*/
#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;
namespace WebCore {
@@ -107,11 +109,18 @@
if (matchesGIFSignature(contents))
return new GIFImageDecoder(alphaOption, gammaAndColorProfileOption);
+#if !PLATFORM(QT) || (PLATFORM(QT) && HAVE(LIBPNG))
if (matchesPNGSignature(contents))
return new PNGImageDecoder(alphaOption, gammaAndColorProfileOption);
+ if (matchesICOSignature(contents) || matchesCURSignature(contents))
+ return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption);
+#endif
+
+#if !PLATFORM(QT) || (PLATFORM(QT) && HAVE(LIBJPEG))
if (matchesJPEGSignature(contents))
return new JPEGImageDecoder(alphaOption, gammaAndColorProfileOption);
+#endif
#if USE(WEBP)
if (matchesWebPSignature(contents))
@@ -121,9 +130,9 @@
if (matchesBMPSignature(contents))
return new BMPImageDecoder(alphaOption, gammaAndColorProfileOption);
- if (matchesICOSignature(contents) || matchesCURSignature(contents))
- return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption);
-
+#if PLATFORM(QT)
+ return new ImageDecoderQt(alphaOption, gammaAndColorProfileOption);
+#endif
return 0;
}
Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h (118908 => 118909)
--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2012-05-30 09:37:01 UTC (rev 118909)
@@ -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 @@
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;
@@ -136,19 +133,10 @@
{
#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:
int width() const;
int height() const;
@@ -180,11 +168,6 @@
#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
Vector<PixelData> m_backingStore;
PixelData* m_bytes; // The memory is backed by m_backingStore.
Deleted: trunk/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp (118908 => 118909)
--- trunk/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp 2012-05-30 09:37:01 UTC (rev 118909)
@@ -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)
-
-}
Modified: trunk/Source/WebKit/blackberry/ChangeLog (118908 => 118909)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-05-30 09:37:01 UTC (rev 118909)
@@ -1,3 +1,14 @@
+2012-05-30 Zoltan Horvath <[email protected]>
+
+ [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder
+ https://bugs.webkit.org/show_bug.cgi?id=80400
+
+ Get rid of QT_IMAGE_DECODER flag.
+
+ Reviewed by Simon Hausmann.
+
+ * WebCoreSupport/AboutDataEnableFeatures.in:
+
2012-05-29 Max Feil <[email protected]>
[BlackBerry] The Page's deviceScaleFactor() is not being properly maintained
Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in (118908 => 118909)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in 2012-05-30 09:34:44 UTC (rev 118908)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in 2012-05-30 09:37:01 UTC (rev 118909)
@@ -107,7 +107,6 @@
POINTER_LOCK
PROGRESS_TAG
PURGEABLE_MEMORY
-QT_IMAGE_DECODER
QUOTA
REGEXP_TRACING
REGISTER_PROTOCOL_HANDLER