Changeset 116085 in webkit
- Timestamp:
- May 4, 2012 5:10:26 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116077 r116085 1 2012-05-04 Zoltan Horvath <zoltan@webkit.org> 2 3 [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder 4 https://bugs.webkit.org/show_bug.cgi?id=80400 5 6 This change modifies the default ImageDecoder for Qt-port from QImageDecoder to WebCore ImageDecoder. 7 The new behavior is to use QImageDecoder only if WebCoreImageDecoder doesn't support the requested 8 image type. 9 The WTF_USE_QT_IMAGE_DECODER macro has been removed, since it is no longer needed. 10 11 This change adds build depedency for libpng-dev and libjpeg-dev packages, becuase PNG and JPEG imagedecoders 12 need not only these libraries, but their headers also. Qmake-config tests for these libraries were 13 introduced in r110045. 14 15 Reviewed by Simon Hausmann. 16 17 No new tests needed. 18 19 * Target.pri: Move WebCore ImageDecoder files out of guards. Remove ImageFrameQt.cpp from sources. 20 * WebCore.pri: Move WebCore ImageDecoder include paths out of guards. 21 * platform/MIMETypeRegistry.cpp: 22 (WebCore::initializeSupportedImageMIMETypes): Add WebCore supported and Qt supported MIME types. 23 (WebCore::initializeSupportedImageMIMETypesForEncoding): Use Qt supported MIME types. 24 * platform/graphics/ImageSource.cpp: Remove unnecessary includes. 25 * platform/graphics/ImageSource.h: Remove unnecessary typedefs. 26 (WebCore): 27 * platform/graphics/qt/ImageDecoderQt.cpp: 28 (WebCore::ImageDecoderQt::filenameExtension): Remove unnecessary semicolon. 29 (WebCore::ImageDecoderQt::internalHandleCurrentImage): Use QImage and ImageFrame instead of QPixmap. 30 (WebCore): 31 (WebCore::ImageFrame::asNewNativeImage): Moved here from removed ImageFrameQt.cpp. 32 * platform/image-decoders/ImageDecoder.cpp: Reorganize the includes of the header. 33 (WebCore::ImageDecoder::create): Add platform macro guarded fallback case for QImageDecoder. 34 * platform/image-decoders/ImageDecoder.h: Remove Qt-specific codes. 35 (WebCore::ImageFrame::getAddr): Remove Qt-specific case, since it is no longer needed. 36 (ImageFrame): 37 * platform/image-decoders/qt/ImageFrameQt.cpp: Removed. Dead code, other code has been moved to 38 ImageDecoderQt.cpp. 39 1 40 2012-05-03 Ilya Tikhonovsky <loislo@chromium.org> 2 41 -
trunk/Source/WebCore/Target.pri
-
Property
svn:executable
set to
*
r115943 r116085 1081 1081 platform/FileSystem.cpp \ 1082 1082 platform/HistogramSupport.cpp \ 1083 platform/image-decoders/qt/ImageFrameQt.cpp \1084 1083 platform/graphics/FontDescription.cpp \ 1085 1084 platform/graphics/FontFallbackList.cpp \ … … 1134 1133 platform/graphics/transforms/TransformState.cpp \ 1135 1134 platform/graphics/transforms/TranslateTransformOperation.cpp \ 1135 platform/image-decoders/ImageDecoder.cpp \ 1136 platform/image-decoders/bmp/BMPImageDecoder.cpp \ 1137 platform/image-decoders/bmp/BMPImageReader.cpp \ 1138 platform/image-decoders/gif/GIFImageDecoder.cpp \ 1139 platform/image-decoders/gif/GIFImageReader.cpp\ 1140 platform/image-decoders/ico/ICOImageDecoder.cpp \ 1141 platform/image-decoders/jpeg/JPEGImageDecoder.cpp \ 1142 platform/image-decoders/png/PNGImageDecoder.cpp \ 1136 1143 platform/KillRingNone.cpp \ 1137 1144 platform/KURL.cpp \ … … 2280 2287 platform/graphics/transforms/TransformState.h \ 2281 2288 platform/graphics/transforms/TranslateTransformOperation.h \ 2289 platform/image-decoders/bmp/BMPImageDecoder.h \ 2290 platform/image-decoders/bmp/BMPImageReader.h \ 2291 platform/image-decoders/gif/GIFImageDecoder.h \ 2292 platform/image-decoders/gif/GIFImageReader.h\ 2293 platform/image-decoders/ico/ICOImageDecoder.h \ 2294 platform/image-decoders/jpeg/JPEGImageDecoder.h \ 2295 platform/image-decoders/png/PNGImageDecoder.h \ 2282 2296 platform/KillRing.h \ 2283 2297 platform/KURL.h \ … … 2853 2867 platform/graphics/qt/IconQt.cpp \ 2854 2868 platform/graphics/qt/ImageBufferQt.cpp \ 2869 platform/graphics/qt/ImageDecoderQt.cpp \ 2855 2870 platform/graphics/qt/ImageQt.cpp \ 2856 2871 platform/graphics/qt/IntPointQt.cpp \ … … 4024 4039 } 4025 4040 4026 contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=1) { 4027 HEADERS += platform/graphics/qt/ImageDecoderQt.h 4028 SOURCES += platform/graphics/qt/ImageDecoderQt.cpp 4029 } else { 4030 HEADERS += \ 4031 platform/image-decoders/bmp/BMPImageDecoder.h \ 4032 platform/image-decoders/bmp/BMPImageReader.h \ 4033 platform/image-decoders/gif/GIFImageDecoder.h \ 4034 platform/image-decoders/gif/GIFImageReader.h\ 4035 platform/image-decoders/ico/ICOImageDecoder.h \ 4036 platform/image-decoders/jpeg/JPEGImageDecoder.h \ 4037 platform/image-decoders/png/PNGImageDecoder.h 4038 4039 SOURCES += \ 4040 platform/image-decoders/ImageDecoder.cpp \ 4041 platform/image-decoders/bmp/BMPImageDecoder.cpp \ 4042 platform/image-decoders/bmp/BMPImageReader.cpp \ 4043 platform/image-decoders/gif/GIFImageDecoder.cpp \ 4044 platform/image-decoders/gif/GIFImageReader.cpp\ 4045 platform/image-decoders/ico/ICOImageDecoder.cpp \ 4046 platform/image-decoders/jpeg/JPEGImageDecoder.cpp \ 4047 platform/image-decoders/png/PNGImageDecoder.cpp 4048 4049 contains(DEFINES, WTF_USE_WEBP=1) { 4050 HEADERS += platform/image-decoders/webp/WEBPImageDecoder.h 4051 SOURCES += platform/image-decoders/webp/WEBPImageDecoder.cpp 4052 } 4041 contains(DEFINES, WTF_USE_WEBP=1) { 4042 INCLUDEPATH += platform/image-decoders/webp 4043 HEADERS += platform/image-decoders/webp/WEBPImageDecoder.h 4044 SOURCES += platform/image-decoders/webp/WEBPImageDecoder.cpp 4053 4045 } 4054 4046 -
Property
svn:executable
set to
-
trunk/Source/WebCore/WebCore.pri
-
Property
svn:executable
set to
*
r115812 r116085 65 65 $$SOURCE_DIR/platform/graphics/transforms \ 66 66 $$SOURCE_DIR/platform/image-decoders \ 67 $$SOURCE_DIR/platform/image-decoders/bmp \ 68 $$SOURCE_DIR/platform/image-decoders/gif \ 69 $$SOURCE_DIR/platform/image-decoders/ico \ 70 $$SOURCE_DIR/platform/image-decoders/jpeg \ 71 $$SOURCE_DIR/platform/image-decoders/png \ 67 72 $$SOURCE_DIR/platform/leveldb \ 68 73 $$SOURCE_DIR/platform/mock \ … … 223 228 } 224 229 225 contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=0) { 226 INCLUDEPATH += \ 227 $$SOURCE_DIR/platform/image-decoders/bmp \ 228 $$SOURCE_DIR/platform/image-decoders/gif \ 229 $$SOURCE_DIR/platform/image-decoders/ico \ 230 $$SOURCE_DIR/platform/image-decoders/jpeg \ 231 $$SOURCE_DIR/platform/image-decoders/png 232 233 haveQt(5) { 234 # Qt5 allows us to use config tests to check for the presence of these libraries 235 !contains(config_test_libjpeg, yes): error("JPEG library not found!") 236 !contains(config_test_libpng, yes): error("PNG 1.2 library not found!") 237 } 238 239 LIBS += -ljpeg -lpng12 240 241 contains(DEFINES, WTF_USE_WEBP=1) { 242 INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp 243 LIBS += -lwebp 244 } 245 } 230 contains(DEFINES, WTF_USE_WEBP=1) { 231 INCLUDEPATH += $$SOURCE_DIR/platform/image-decoders/webp 232 LIBS += -lwebp 233 } 234 235 haveQt(5) { 236 # Qt5 allows us to use config tests to check for the presence of these libraries 237 !contains(config_test_libjpeg, yes): error("JPEG library not found!") 238 !contains(config_test_libpng, yes): error("PNG 1.2 library not found!") 239 } 240 241 LIBS += -ljpeg -lpng12 246 242 247 243 win32-*|wince* { -
Property
svn:executable
set to
-
trunk/Source/WebCore/platform/MIMETypeRegistry.cpp
r113960 r116085 40 40 #include <wtf/RetainPtr.h> 41 41 #endif 42 #if PLATFORM(QT) && USE(QT_IMAGE_DECODER)43 #include < qimagereader.h>44 #include < qimagewriter.h>42 #if PLATFORM(QT) 43 #include <QImageReader> 44 #include <QImageWriter> 45 45 #endif 46 46 … … 228 228 supportedImageMIMETypes->remove("application/postscript"); 229 229 230 #elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)231 QList<QByteArray> formats = QImageReader::supportedImageFormats();232 for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) {233 #if ENABLE(SVG)234 /*235 * Qt has support for SVG, but we want to use KSVG2236 */237 if (formats.at(i).toLower().startsWith("svg"))238 continue;239 #endif240 String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData());241 if (!mimeType.isEmpty()) {242 supportedImageMIMETypes->add(mimeType);243 supportedImageResourceMIMETypes->add(mimeType);244 }245 }246 230 #else 247 231 // assume that all implementations at least support the following standard … … 260 244 supportedImageResourceMIMETypes->add(types[i]); 261 245 } 246 #if PLATFORM(QT) 247 QList<QByteArray> formats = QImageReader::supportedImageFormats(); 248 for (size_t i = 0; i < static_cast<size_t>(formats.size()); ++i) { 249 #if ENABLE(SVG) 250 // Qt has support for SVG, but we want to use KSVG2 251 if (formats.at(i).toLower().startsWith("svg")) 252 continue; 253 #endif // ENABLE(SVG) 254 String mimeType = MIMETypeRegistry::getMIMETypeForExtension(formats.at(i).constData()); 255 if (!mimeType.isEmpty()) { 256 supportedImageMIMETypes->add(mimeType); 257 supportedImageResourceMIMETypes->add(mimeType); 258 } 259 } 260 #endif // PLATFORM(QT) 262 261 #if PLATFORM(BLACKBERRY) 263 262 supportedImageMIMETypes->add("image/pjpeg"); … … 288 287 supportedImageMIMETypesForEncoding->add("image/gif"); 289 288 #endif 290 #elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)289 #elif PLATFORM(QT) 291 290 QList<QByteArray> formats = QImageWriter::supportedImageFormats(); 292 291 for (int i = 0; i < formats.size(); ++i) { … … 295 294 supportedImageMIMETypesForEncoding->add(mimeType); 296 295 } 297 #elif PLATFORM(GTK) || (PLATFORM(QT) && !USE(QT_IMAGE_DECODER))296 #elif PLATFORM(GTK) 298 297 supportedImageMIMETypesForEncoding->add("image/png"); 299 298 supportedImageMIMETypesForEncoding->add("image/jpeg"); -
trunk/Source/WebCore/platform/graphics/ImageSource.cpp
-
Property
svn:executable
set to
*
r113486 r116085 30 30 #include "ImageSource.h" 31 31 32 #if PLATFORM(QT)33 #include "ImageDecoderQt.h"34 #else35 32 #include "ImageDecoder.h" 36 #endif37 33 38 34 #include "ImageOrientation.h" -
Property
svn:executable
set to
-
trunk/Source/WebCore/platform/graphics/ImageSource.h
-
Property
svn:executable
set to
*
r115385 r116085 76 76 typedef ImageDecoder* NativeImageSourcePtr; 77 77 typedef TiledImageOpenVG* NativeImagePtr; 78 #elif PLATFORM(QT)79 class ImageDecoderQt;80 typedef ImageDecoderQt* NativeImageSourcePtr;81 typedef QPixmap* NativeImagePtr;82 78 #else 83 79 class ImageDecoder; … … 99 95 typedef ImageDecoder* NativeImageSourcePtr; 100 96 typedef void* NativeImagePtr; 97 #elif PLATFORM(QT) 98 typedef QPixmap* NativeImagePtr; 101 99 #endif 102 100 #endif -
Property
svn:executable
set to
-
trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.cpp
-
Property
svn:executable
set to
*
r85343 r116085 32 32 #include <QtCore/QByteArray> 33 33 #include <QtCore/QBuffer> 34 35 34 #include <QtGui/QImageReader> 36 #include <qdebug.h>37 35 38 36 namespace WebCore { 39 40 ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)41 {42 // We need at least 4 bytes to figure out what kind of image we're dealing with.43 if (data.size() < 4)44 return 0;45 46 return new ImageDecoderQt(alphaOption, gammaAndColorProfileOption);47 }48 37 49 38 ImageDecoderQt::ImageDecoderQt(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption) … … 130 119 { 131 120 return String(m_format.constData(), m_format.length()); 132 } ;121 } 133 122 134 123 ImageFrame* ImageDecoderQt::frameBufferAtIndex(size_t index) … … 195 184 bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex) 196 185 { 197 QPixmap pixmap = QPixmap::fromImageReader(m_reader.get()); 198 199 if (pixmap.isNull()) { 186 ImageFrame* const buffer = &m_frameBufferCache[frameIndex]; 187 QSize imageSize = m_reader->size(); 188 189 if (!buffer->setSize(imageSize.width(), imageSize.height())) 190 return false; 191 192 QImage image(reinterpret_cast<uchar*>(buffer->getAddr(0, 0)), imageSize.width(), imageSize.height(), sizeof(ImageFrame::PixelData) * imageSize.width(), m_reader->imageFormat()); 193 194 buffer->setDuration(m_reader->nextImageDelay()); 195 m_reader->read(&image); 196 197 if (image.isNull()) { 200 198 frameCount(); 201 199 repetitionCount(); … … 204 202 } 205 203 206 // now into the ImageFrame - even if the image is not 207 ImageFrame* const buffer = &m_frameBufferCache[frameIndex]; 208 buffer->setOriginalFrameRect(m_reader->currentImageRect()); 204 buffer->setOriginalFrameRect(image.rect()); 205 buffer->setHasAlpha(image.hasAlphaChannel()); 209 206 buffer->setStatus(ImageFrame::FrameComplete); 210 buffer->setDuration(m_reader->nextImageDelay()); 211 buffer->setPixmap(pixmap); 207 212 208 return true; 213 209 } … … 246 242 m_buffer.clear(); 247 243 } 244 245 NativeImagePtr ImageFrame::asNewNativeImage() const 246 { 247 QImage::Format format; 248 if (m_hasAlpha) 249 format = m_premultiplyAlpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32; 250 else 251 format = QImage::Format_RGB32; 252 253 QImage img(reinterpret_cast<uchar*>(m_bytes), m_size.width(), m_size.height(), sizeof(PixelData) * m_size.width(), format); 254 255 return new QPixmap(QPixmap::fromImage(img)); 256 } 257 248 258 } 249 259 -
Property
svn:executable
set to
-
trunk/Source/WebCore/platform/graphics/qt/ImageDecoderQt.h
-
Property
svn:executable
set to
*
-
Property
svn:executable
set to
-
trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp
-
Property
svn:executable
set to
*
r108792 r116085 21 21 22 22 #include "config.h" 23 24 23 #include "ImageDecoder.h" 25 26 #include <algorithm>27 #include <cmath>28 24 29 25 #include "BMPImageDecoder.h" 30 26 #include "GIFImageDecoder.h" 31 27 #include "ICOImageDecoder.h" 28 #if PLATFORM(QT) 29 #include "ImageDecoderQt.h" 30 #endif 32 31 #include "JPEGImageDecoder.h" 33 32 #include "PNGImageDecoder.h" 33 #include "SharedBuffer.h" 34 34 #if USE(WEBP) 35 35 #include "WEBPImageDecoder.h" 36 36 #endif 37 #include "SharedBuffer.h" 37 38 #include <algorithm> 39 #include <cmath> 38 40 39 41 using namespace std; … … 125 127 return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption); 126 128 129 #if PLATFORM(QT) 130 return new ImageDecoderQt(alphaOption, gammaAndColorProfileOption); 131 #endif 127 132 return 0; 128 133 } -
Property
svn:executable
set to
-
trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h
-
Property
svn:executable
set to
*
r108981 r116085 41 41 #include "NativeImageSkia.h" 42 42 #include "SkColorPriv.h" 43 #elif PLATFORM(QT)44 #include <QPixmap>45 #include <QImage>46 43 #endif 47 44 … … 65 62 // contents 66 63 }; 67 #if USE(SKIA) || (PLATFORM(QT) && USE(QT_IMAGE_DECODER))64 #if USE(SKIA) 68 65 typedef uint32_t PixelData; 69 66 #else … … 141 138 #if USE(SKIA) 142 139 return m_bitmap.bitmap().getAddr32(x, y); 143 #elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)144 m_image = m_pixmap.toImage();145 m_pixmap = QPixmap();146 return reinterpret_cast_ptr<QRgb*>(m_image.scanLine(y)) + x;147 140 #else 148 141 return m_bytes + (y * width()) + x; 149 142 #endif 150 143 } 151 152 #if PLATFORM(QT) && USE(QT_IMAGE_DECODER)153 void setPixmap(const QPixmap& pixmap);154 #endif155 156 144 private: 157 145 #if USE(CG) … … 191 179 ColorProfile m_colorProfile; 192 180 #endif 193 #elif PLATFORM(QT) && USE(QT_IMAGE_DECODER)194 mutable QPixmap m_pixmap;195 mutable QImage m_image;196 bool m_hasAlpha;197 IntSize m_size;198 181 #else 199 182 NativeBackingStore m_backingStore; -
Property
svn:executable
set to
-
trunk/Source/WebKit/blackberry/ChangeLog
r115998 r116085 1 2012-05-04 Zoltan Horvath <zoltan@webkit.org> 2 3 [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder 4 https://bugs.webkit.org/show_bug.cgi?id=80400 5 6 Get rid off QT_IMAGE_DECODER flag. 7 8 Reviewed by Simon Hausmann. 9 10 * WebCoreSupport/AboutDataEnableFeatures.in: 11 1 12 2012-05-03 Fady Samuel <fsamuel@chromium.org> 2 13 -
trunk/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in
r113672 r116085 108 108 PROGRESS_TAG 109 109 PURGEABLE_MEMORY 110 QT_IMAGE_DECODER111 110 QUOTA 112 111 REGEXP_TRACING -
trunk/Tools/ChangeLog
r116073 r116085 1 2012-05-04 Zoltan Horvath <zoltan@webkit.org> 2 3 [Qt] Set WebCore imagedecoders as default and add fallback to QImageDecoder 4 https://bugs.webkit.org/show_bug.cgi?id=80400 5 6 Remove WTF_USE_QT_IMAGE_DECODER macro. 7 8 Reviewed by Simon Hausmann. 9 10 * qmake/mkspecs/features/features.prf: 11 1 12 2012-05-03 Christophe Dumez <christophe.dumez@intel.com> 2 13 -
trunk/Tools/qmake/mkspecs/features/features.prf
r115821 r116085 115 115 !contains(DEFINES, ENABLE_FAST_MOBILE_SCROLLING=.): DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1 116 116 !contains(DEFINES, ENABLE_PAGE_VISIBILITY_API=.): DEFINES += ENABLE_PAGE_VISIBILITY_API=1 117 118 # Policy decisions: for using a particular third-party library or optional OS service119 !contains(DEFINES, WTF_USE_QT_IMAGE_DECODER=.): DEFINES += WTF_USE_QT_IMAGE_DECODER=1120 117 121 118 # Enabled in Source/JavaScriptCore/wtf/Platform.h if not set
Note: See TracChangeset
for help on using the changeset viewer.