[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
noam.rosenthal at nokia.com
noam.rosenthal at nokia.com
Sun Feb 20 23:05:36 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 6cbc9242c844677d6736395ac468c1b10969f15f
Author: noam.rosenthal at nokia.com <noam.rosenthal at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 17 08:50:11 2011 +0000
2011-01-17 No'am Rosenthal <noam.rosenthal at nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Background image rendering is slow
https://bugs.webkit.org/show_bug.cgi?id=50527
When tiling a scaled pixmap in Image::drawPattern, scale the tile
first and only then draw it to the target. Do so only when drawing
more than one tile.
Tests in fast/backgrounds/size cover this.
* platform/graphics/qt/ImageQt.cpp:
(WebCore::Image::drawPattern):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index d4216b2..c94c74c 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2011-01-17 No'am Rosenthal <noam.rosenthal at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Background image rendering is slow
+ https://bugs.webkit.org/show_bug.cgi?id=50527
+
+ When tiling a scaled pixmap in Image::drawPattern, scale the tile
+ first and only then draw it to the target. Do so only when drawing
+ more than one tile.
+
+ Tests in fast/backgrounds/size cover this.
+
+ * platform/graphics/qt/ImageQt.cpp:
+ (WebCore::Image::drawPattern):
+
2011-01-17 Laszlo Gombos <laszlo.1.gombos at nokia.com>
Reviewed by Simon Hausmann.
diff --git a/Source/WebCore/platform/graphics/qt/ImageQt.cpp b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
index b66a1ca..58f82ef 100644
--- a/Source/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -125,8 +125,30 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
if (!pixmap.hasAlpha() && p->compositionMode() == QPainter::CompositionMode_SourceOver)
p->setCompositionMode(QPainter::CompositionMode_Source);
- /* Translate the coordinates as phase is not in world matrix coordinate space but the tile rect origin is. */
QTransform transform(patternTransform);
+
+ // If this would draw more than one scaled tile, we scale the pixmap first and then use the result to draw.
+ if (transform.type() == QTransform::TxScale) {
+ QRectF tileRectInTargetCoords = (transform * QTransform().translate(phase.x(), phase.y())).mapRect(tr);
+
+ bool tileWillBePaintedOnlyOnce = tileRectInTargetCoords.contains(dr);
+ if (!tileWillBePaintedOnlyOnce) {
+ QSizeF scaledSize(float(pixmap.width()) * transform.m11(), float(pixmap.height()) * transform.m22());
+ QPixmap scaledPixmap(scaledSize.toSize());
+ if (pixmap.hasAlpha())
+ scaledPixmap.fill(Qt::transparent);
+ {
+ QPainter painter(&scaledPixmap);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+ painter.setRenderHints(p->renderHints());
+ painter.drawPixmap(QRect(0, 0, scaledPixmap.width(), scaledPixmap.height()), pixmap);
+ }
+ pixmap = scaledPixmap;
+ transform = QTransform::fromTranslate(transform.dx(), transform.dy());
+ }
+ }
+
+ /* Translate the coordinates as phase is not in world matrix coordinate space but the tile rect origin is. */
transform *= QTransform().translate(phase.x(), phase.y());
transform.translate(tr.x(), tr.y());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list