Skip to content
Permalink
Browse files
2010-07-19 Andreas Kling <andreas.kling@nokia.com>
        Reviewed by Kenneth Rohde Christiansen.

        [Qt] Avoid QImage::pixel() in getImageData()
        https://bugs.webkit.org/show_bug.cgi?id=42463

        * platform/graphics/qt/ImageBufferQt.cpp:
        (WebCore::getImageData): Use QImage::scanLine() instead
        of fetching data pixel-by-pixel.


Canonical link: https://commits.webkit.org/54492@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63652 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Jul 19, 2010
1 parent a11d8de commit 833de1a5f45b06bc8301d26da11aa0a12fb24234
Showing with 17 additions and 1 deletion.
  1. +11 −0 WebCore/ChangeLog
  2. +6 −1 WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -1,3 +1,14 @@
2010-07-19 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Avoid QImage::pixel() in getImageData()
https://bugs.webkit.org/show_bug.cgi?id=42463

* platform/graphics/qt/ImageBufferQt.cpp:
(WebCore::getImageData): Use QImage::scanLine() instead
of fetching data pixel-by-pixel.

2010-07-19 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.
@@ -186,8 +186,13 @@ PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& i
unsigned destBytesPerRow = 4 * rect.width();
unsigned char* destRows = data + desty * destBytesPerRow + destx * 4;
for (int y = 0; y < numRows; ++y) {
#if QT_VERSION >= 0x040700
const quint32* scanLine = reinterpret_cast<const quint32*>(image.constScanLine(y + originy));
#else
quint32* scanLine = reinterpret_cast<quint32*>(image.scanLine(y + originy));
#endif
for (int x = 0; x < numColumns; x++) {
QRgb value = image.pixel(x + originx, y + originy);
QRgb value = scanLine[x + originx];
int basex = x * 4;

destRows[basex] = qRed(value);

0 comments on commit 833de1a

Please sign in to comment.