Diff
Modified: trunk/Source/WebCore/ChangeLog (108791 => 108792)
--- trunk/Source/WebCore/ChangeLog 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/ChangeLog 2012-02-24 14:48:55 UTC (rev 108792)
@@ -1,3 +1,39 @@
+2012-02-24 Zoltan Horvath <[email protected]>
+
+ [Qt] Allow to use WebCore imagedecoders
+ https://bugs.webkit.org/show_bug.cgi?id=32410
+
+ Add ENABLE(QT_IMAGE_DECODER) guards around Qt imagedecoders and set it to default.
+ By passing ENABLE_QT_IMAGE_DECODER=0 define to the build system, WebKit will build
+ with WebCore's imagedecoders.
+
+ I added NO_RETURN attribute and PLATFORM(QT) conditionals to 2 functions of PNG and
+ JPEG decoders to avoid compiler warnings because in Qt-port we treat warning as errors (-Werror).
+
+ I'm continuing the refactoring of this area and try to use Qt imagedecoders only in
+ cases when WebCore doesn't support the image format.
+
+ Reviewed by Simon Hausmann.
+
+ No behavior change, no need new tests.
+
+ * Target.pri:
+ * WebCore.pri:
+ * platform/MIMETypeRegistry.cpp:
+ (WebCore::initializeSupportedImageMIMETypes):
+ (WebCore::initializeSupportedImageMIMETypesForEncoding):
+ * platform/image-decoders/ImageDecoder.h:
+ (WebCore::ImageFrame::getAddr):
+ (ImageFrame):
+ * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+ NO_RETURN has been added to a function to avoid warning message.
+ * platform/image-decoders/png/PNGImageDecoder.cpp:
+ NO_RETURN has been added to a function to avoid warning message.
+ (WebCore):
+ * platform/image-decoders/qt/ImageFrameQt.cpp:
+ (WebCore):
+ (WebCore::ImageFrame::asNewNativeImage):
+
2012-02-24 Lynn Neir <[email protected]>
[Windows, WinCairo] Handle indeterminate checkbox state
Modified: trunk/Source/WebCore/Target.pri (108791 => 108792)
--- trunk/Source/WebCore/Target.pri 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/Target.pri 2012-02-24 14:48:55 UTC (rev 108792)
@@ -2194,7 +2194,6 @@
platform/graphics/Region.h \
platform/graphics/RoundedRect.h \
platform/graphics/qt/FontCustomPlatformData.h \
- platform/graphics/qt/ImageDecoderQt.h \
platform/graphics/qt/StillImageQt.h \
platform/graphics/qt/TransparencyLayer.h \
platform/graphics/SegmentedFontData.h \
@@ -2805,7 +2804,6 @@
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 \
@@ -3941,6 +3939,35 @@
page/PageSerializer.cpp
}
+contains(DEFINES, ENABLE_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
+ }
+}
+
!system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) {
# Build sqlite3 into WebCore from source
# somewhat copied from $$QT_SOURCE_TREE/src/plugins/sqldrivers/sqlite/sqlite.pro
Modified: trunk/Source/WebCore/WebCore.pri (108791 => 108792)
--- trunk/Source/WebCore/WebCore.pri 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/WebCore.pri 2012-02-24 14:48:55 UTC (rev 108792)
@@ -203,6 +203,22 @@
LIBS += -lsqlite3
}
+contains(DEFINES, ENABLE_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
+
+ LIBS += -ljpeg -lpng12
+
+ contains(DEFINES, WTF_USE_WEBP=1) {
+ INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp
+ LIBS += -lwebp
+ }
+}
+
win32-*|wince* {
DLLDESTDIR = $${ROOT_BUILD_DIR}/bin
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (108791 => 108792)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2012-02-24 14:48:55 UTC (rev 108792)
@@ -39,7 +39,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <wtf/RetainPtr.h>
#endif
-#if PLATFORM(QT)
+#if PLATFORM(QT) && ENABLE(QT_IMAGE_DECODER)
#include <qimagereader.h>
#include <qimagewriter.h>
#endif
@@ -229,7 +229,7 @@
supportedImageMIMETypes->remove("application/pdf");
supportedImageMIMETypes->remove("application/postscript");
-#elif PLATFORM(QT)
+#elif PLATFORM(QT) && ENABLE(QT_IMAGE_DECODER)
QList<QByteArray> formats = QImageReader::supportedImageFormats();
for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) {
#if ENABLE(SVG)
@@ -289,7 +289,7 @@
supportedImageMIMETypesForEncoding->add("image/jpeg");
supportedImageMIMETypesForEncoding->add("image/gif");
#endif
-#elif PLATFORM(QT)
+#elif PLATFORM(QT) && ENABLE(QT_IMAGE_DECODER)
QList<QByteArray> formats = QImageWriter::supportedImageFormats();
for (int i = 0; i < formats.size(); ++i) {
String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());
Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp (108791 => 108792)
--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp 2012-02-24 14:48:55 UTC (rev 108792)
@@ -31,7 +31,9 @@
#include "ICOImageDecoder.h"
#include "JPEGImageDecoder.h"
#include "PNGImageDecoder.h"
+#if USE(WEBP)
#include "WEBPImageDecoder.h"
+#endif
#include "SharedBuffer.h"
using namespace std;
Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h (108791 => 108792)
--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2012-02-24 14:48:55 UTC (rev 108792)
@@ -64,7 +64,7 @@
DisposeOverwritePrevious // Clear frame to previous framebuffer
// contents
};
-#if USE(SKIA) || PLATFORM(QT)
+#if USE(SKIA) || (PLATFORM(QT) && ENABLE(QT_IMAGE_DECODER))
typedef uint32_t PixelData;
#else
typedef unsigned PixelData;
@@ -140,7 +140,7 @@
{
#if USE(SKIA)
return m_bitmap.bitmap().getAddr32(x, y);
-#elif PLATFORM(QT)
+#elif PLATFORM(QT) && ENABLE(QT_IMAGE_DECODER)
m_image = m_pixmap.toImage();
m_pixmap = QPixmap();
return reinterpret_cast_ptr<QRgb*>(m_image.scanLine(y)) + x;
@@ -149,7 +149,7 @@
#endif
}
-#if PLATFORM(QT)
+#if PLATFORM(QT) && ENABLE(QT_IMAGE_DECODER)
void setPixmap(const QPixmap& pixmap);
#endif
@@ -190,7 +190,7 @@
#if PLATFORM(CHROMIUM) && OS(DARWIN)
ColorProfile m_colorProfile;
#endif
-#elif PLATFORM(QT)
+#elif PLATFORM(QT) && ENABLE(QT_IMAGE_DECODER)
mutable QPixmap m_pixmap;
mutable QImage m_image;
bool m_hasAlpha;
Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (108791 => 108792)
--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp 2012-02-24 14:48:55 UTC (rev 108792)
@@ -103,7 +103,11 @@
boolean fill_input_buffer(j_decompress_ptr jd);
void skip_input_data(j_decompress_ptr jd, long num_bytes);
void term_source(j_decompress_ptr jd);
+#if PLATFORM(QT)
+void error_exit(j_common_ptr) NO_RETURN;
+#else
void error_exit(j_common_ptr cinfo);
+#endif
// Implementation of a JPEG src object that understands our state machine
struct decoder_source_mgr {
Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp (108791 => 108792)
--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp 2012-02-24 14:48:55 UTC (rev 108792)
@@ -64,6 +64,9 @@
const unsigned long cMaxPNGSize = 1000000UL;
// Called if the decoding of the image fails.
+#if PLATFORM(QT)
+static void PNGAPI decodingFailed(png_structp, png_const_charp) NO_RETURN;
+#endif
static void PNGAPI decodingFailed(png_structp png, png_const_charp)
{
longjmp(JMPBUF(png), 1);
Modified: trunk/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp (108791 => 108792)
--- trunk/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Source/WebCore/platform/image-decoders/qt/ImageFrameQt.cpp 2012-02-24 14:48:55 UTC (rev 108792)
@@ -30,11 +30,25 @@
#include "NotImplemented.h"
-#include <QPixmap>
-#include <stdio.h>
-
namespace WebCore {
+#if !ENABLE(QT_IMAGE_DECODER)
+
+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));
+}
+
+#else
+
ImageFrame::ImageFrame()
: m_hasAlpha(false)
, m_size()
@@ -154,4 +168,6 @@
return m_size.height();
}
+#endif
+
}
Modified: trunk/Tools/ChangeLog (108791 => 108792)
--- trunk/Tools/ChangeLog 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Tools/ChangeLog 2012-02-24 14:48:55 UTC (rev 108792)
@@ -1,3 +1,14 @@
+2012-02-24 Zoltan Horvath <[email protected]>
+
+ [Qt] Allow to use WebCore imagedecoders
+ https://bugs.webkit.org/show_bug.cgi?id=32410
+
+ Add ENABLE_QT_IMAGE_DECODER macro, it's enabled by default.
+
+ Reviewed by Simon Hausmann.
+
+ * qmake/mkspecs/features/features.prf:
+
2012-02-24 Balazs Kelemen <[email protected]>
[Qt] Add Qt5 way to force 96 DPI for tests
Modified: trunk/Tools/qmake/mkspecs/features/features.prf (108791 => 108792)
--- trunk/Tools/qmake/mkspecs/features/features.prf 2012-02-24 14:46:23 UTC (rev 108791)
+++ trunk/Tools/qmake/mkspecs/features/features.prf 2012-02-24 14:48:55 UTC (rev 108792)
@@ -86,6 +86,7 @@
!contains(DEFINES, ENABLE_VIDEO_TRACK=.): DEFINES += ENABLE_VIDEO_TRACK=0
!contains(DEFINES, ENABLE_TOUCH_ICON_LOADING=.): DEFINES += ENABLE_TOUCH_ICON_LOADING=0
!contains(DEFINES, ENABLE_ANIMATION_API=.): DEFINES += ENABLE_ANIMATION_API=0
+!contains(DEFINES, ENABLE_QT_IMAGE_DECODER=.): DEFINES += ENABLE_QT_IMAGE_DECODER=1
# Enabled in Source/_javascript_Core/wtf/Platform.h if not set
# We have to do the same to be able to disable the feature in build-webkit