Changeset 70424 in webkit


Ignore:
Timestamp:
Oct 24, 2010 2:08:20 PM (13 years ago)
Author:
andreas.kling@nokia.com
Message:

2010-10-24 Andreas Kling <kling@webkit.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] ImageBuffer::platformTransformColorSpace is unnecessarily slow
https://bugs.webkit.org/show_bug.cgi?id=48211

Grab the QImage::bits() and do direct access instead of going through
QImage::pixel() and QImage::setPixel().

This is a performance optimization, so no new tests.

  • platform/graphics/qt/ImageBufferQt.cpp: (WebCore::ImageBuffer::platformTransformColorSpace):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r70421 r70424  
     12010-10-24  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] ImageBuffer::platformTransformColorSpace is unnecessarily slow
     6        https://bugs.webkit.org/show_bug.cgi?id=48211
     7
     8        Grab the QImage::bits() and do direct access instead of going through
     9        QImage::pixel() and QImage::setPixel().
     10
     11        This is a performance optimization, so no new tests.
     12
     13        * platform/graphics/qt/ImageBufferQt.cpp:
     14        (WebCore::ImageBuffer::platformTransformColorSpace):
     15
    1162010-10-24  Dirk Schulze  <krit@webkit.org>
    217
  • trunk/WebCore/platform/graphics/qt/ImageBufferQt.cpp

    r70143 r70424  
    158158    ASSERT(!image.isNull());
    159159
     160    uchar* bits = image.bits();
     161    const int bytesPerLine = image.bytesPerLine();
     162
    160163    for (int y = 0; y < m_size.height(); ++y) {
    161         for (int x = 0; x < m_size.width(); x++) {
    162             QRgb value = image.pixel(x, y);
    163             value = qRgba(lookUpTable[qRed(value)],
    164                           lookUpTable[qGreen(value)],
    165                           lookUpTable[qBlue(value)],
    166                           qAlpha(value));
    167             image.setPixel(x, y, value);
     164        quint32* scanLine = reinterpret_cast_ptr<quint32*>(bits + y * bytesPerLine);
     165        for (int x = 0; x < m_size.width(); ++x) {
     166            QRgb& pixel = scanLine[x];
     167            pixel = qRgba(lookUpTable[qRed(pixel)],
     168                          lookUpTable[qGreen(pixel)],
     169                          lookUpTable[qBlue(pixel)],
     170                          qAlpha(pixel));
    168171        }
    169172    }
Note: See TracChangeset for help on using the changeset viewer.