Changeset 65227 in webkit


Ignore:
Timestamp:
Aug 12, 2010 2:43:50 AM (14 years ago)
Author:
Simon Hausmann
Message:

[Qt] Decode images directly to QPixmap
https://bugs.webkit.org/show_bug.cgi?id=40797

Patch by Benjamin Poulain <benjamin.poulain@nokia.com> on 2010-08-12
Reviewed by Simon Hausmann.

Use the new API of Qt 4.7 to decode data from the image
reader directly to QPixmap.

This allow us to use JDCT_IFAST when decoding jpeg images
to pixmap, and to decode animated GIF images, while still
using in-place conversion of color space.

  • platform/graphics/qt/ImageDecoderQt.cpp:

(WebCore::ImageDecoderQt::setData):
(WebCore::ImageDecoderQt::internalHandleCurrentImage):

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65226 r65227  
     12010-08-12  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] Decode images directly to QPixmap
     6        https://bugs.webkit.org/show_bug.cgi?id=40797
     7
     8        Use the new API of Qt 4.7 to decode data from the image
     9        reader directly to QPixmap.
     10
     11        This allow us to use JDCT_IFAST when decoding jpeg images
     12        to pixmap, and to decode animated GIF images, while still
     13        using in-place conversion of color space.
     14
     15        * platform/graphics/qt/ImageDecoderQt.cpp:
     16        (WebCore::ImageDecoderQt::setData):
     17        (WebCore::ImageDecoderQt::internalHandleCurrentImage):
     18
    1192010-07-14  Marcus Bulach  <bulach@chromium.org>
    220
  • trunk/WebCore/platform/graphics/qt/ImageDecoderQt.cpp

    r61534 r65227  
    7979    m_reader.set(new QImageReader(m_buffer.get(), m_format));
    8080
     81    // This will force the JPEG decoder to use JDCT_IFAST
     82    m_reader->setQuality(49);
     83
    8184    // QImageReader only allows retrieving the format before reading the image
    8285    m_format = m_reader->format();
     
    187190{
    188191    QPixmap pixmap;
    189     bool pixmapLoaded;
    190     const int imageCount = m_reader->imageCount();
    191     if (imageCount == 0 || imageCount == 1)
    192         pixmapLoaded = pixmap.loadFromData((const uchar*)(m_data->data()), m_data->size(), m_format);
    193     else {
    194         QImage img;
    195         const bool imageLoaded = m_reader->read(&img);
    196         if (imageLoaded) {
    197             pixmap = QPixmap::fromImage(img);
    198             pixmapLoaded = true;
    199         }
    200     }
    201 
    202     if (!pixmapLoaded) {
     192
     193#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
     194    pixmap = QPixmap::fromImageReader(m_reader.get());
     195#else
     196    QImage img;
     197    if (m_reader->read(&img))
     198        pixmap = QPixmap::fromImage(img);
     199#endif
     200
     201    if (pixmap.isNull()) {
    203202        frameCount();
    204203        repetitionCount();
Note: See TracChangeset for help on using the changeset viewer.