summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/qt/ImageBufferQt.cpp
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/platform/graphics/qt/ImageBufferQt.cpp
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/platform/graphics/qt/ImageBufferQt.cpp')
-rw-r--r--WebCore/platform/graphics/qt/ImageBufferQt.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index e46913c..a546def 100644
--- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -234,33 +234,43 @@ void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint&
unsigned srcBytesPerRow = 4 * source->width();
- bool isPainting = data.m_painter->isActive();
- if (isPainting)
- data.m_painter->end();
+ QRect destRect(destx, desty, endx - destx, endy - desty);
- QImage image = data.m_pixmap.toImage();
- if (multiplied == Unmultiplied)
- image = image.convertToFormat(QImage::Format_ARGB32);
- else
- image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ QImage::Format format = multiplied == Unmultiplied ? QImage::Format_ARGB32 : QImage::Format_ARGB32_Premultiplied;
+ QImage image(destRect.size(), format);
unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4;
for (int y = 0; y < numRows; ++y) {
- quint32* scanLine = reinterpret_cast<quint32*>(image.scanLine(y + desty));
+ quint32* scanLine = reinterpret_cast<quint32*>(image.scanLine(y));
for (int x = 0; x < numColumns; x++) {
// ImageData stores the pixels in RGBA while QImage is ARGB
quint32 pixel = reinterpret_cast<quint32*>(srcRows + 4 * x)[0];
pixel = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) | (pixel & 0xff00ff00);
- scanLine[x + destx] = pixel;
+ scanLine[x] = pixel;
}
srcRows += srcBytesPerRow;
}
- data.m_pixmap = QPixmap::fromImage(image);
-
- if (isPainting)
+ bool isPainting = data.m_painter->isActive();
+ if (!isPainting)
data.m_painter->begin(&data.m_pixmap);
+ else {
+ data.m_painter->save();
+
+ // putImageData() should be unaffected by painter state
+ data.m_painter->resetTransform();
+ data.m_painter->setOpacity(1.0);
+ data.m_painter->setClipping(false);
+ }
+
+ data.m_painter->setCompositionMode(QPainter::CompositionMode_Source);
+ data.m_painter->drawImage(destRect, image);
+
+ if (!isPainting)
+ data.m_painter->end();
+ else
+ data.m_painter->restore();
}
void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint)