[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
ariya at webkit.org
ariya at webkit.org
Wed Dec 22 12:12:42 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit be339ba94aa7018bab5f8dd92a6eddc8d35ef3f1
Author: ariya at webkit.org <ariya at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 17 08:32:54 2010 +0000
2010-08-17 Ariya Hidayat <ariya at sencha.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Reduce the size of the shadow buffer to the clip region
https://bugs.webkit.org/show_bug.cgi?id=44091
Instead of allocating the buffer image (for the blur support) as big
as the rectangle which casts the shadow, we limit the size to the
current clip region.
* platform/graphics/qt/ContextShadow.cpp:
(WebCore::ContextShadow::drawShadowRect):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ef8a91b..6e1edff 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-17 Ariya Hidayat <ariya at sencha.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Reduce the size of the shadow buffer to the clip region
+ https://bugs.webkit.org/show_bug.cgi?id=44091
+
+ Instead of allocating the buffer image (for the blur support) as big
+ as the rectangle which casts the shadow, we limit the size to the
+ current clip region.
+
+ * platform/graphics/qt/ContextShadow.cpp:
+ (WebCore::ContextShadow::drawShadowRect):
+
2010-08-17 Philippe Normand <pnormand at igalia.com>
Reviewed by Martin Robinson.
diff --git a/WebCore/platform/graphics/qt/ContextShadow.cpp b/WebCore/platform/graphics/qt/ContextShadow.cpp
index 6eff278..0511218 100644
--- a/WebCore/platform/graphics/qt/ContextShadow.cpp
+++ b/WebCore/platform/graphics/qt/ContextShadow.cpp
@@ -209,21 +209,42 @@ void ContextShadow::drawShadowRect(QPainter* p, const QRectF& rect)
return;
if (type == BlurShadow) {
+ QRectF shadowRect = rect.translated(offset);
+
// We expand the area by the blur radius * 2 to give extra space
// for the blur transition.
int extra = blurRadius * 2;
- QRect imageRect = rect.toAlignedRect().adjusted(-extra, -extra, extra, extra);
+ QRectF bufferRect = shadowRect.adjusted(-extra, -extra, extra, extra);
+ QRect alignedBufferRect = bufferRect.toAlignedRect();
+
+ QRect clipRect;
+ if (p->hasClipping())
+ clipRect = p->clipRegion().boundingRect();
+ else
+ clipRect = p->transform().inverted().mapRect(p->window());
+
+ if (!clipRect.contains(alignedBufferRect)) {
- QImage shadowImage(imageRect.size(), QImage::Format_ARGB32_Premultiplied);
+ // No need to have the buffer larger that the clip.
+ alignedBufferRect = alignedBufferRect.intersected(clipRect);
+ if (alignedBufferRect.isEmpty())
+ return;
+
+ // We adjust again because the pixels at the borders are still
+ // potentially affected by the pixels outside the buffer.
+ alignedBufferRect.adjust(-extra, -extra, extra, extra);
+ }
+
+ QImage shadowImage(alignedBufferRect.size(), QImage::Format_ARGB32_Premultiplied);
shadowImage.fill(Qt::transparent);
QPainter shadowPainter(&shadowImage);
- shadowPainter.fillRect(rect.x() - imageRect.x(), rect.y() - imageRect.y(),
- rect.width(), rect.height(), color);
+
+ shadowPainter.fillRect(shadowRect.translated(-alignedBufferRect.topLeft()), color);
shadowPainter.end();
shadowBlur(shadowImage, blurRadius, color);
- p->drawImage(imageRect.topLeft() + offset, shadowImage);
+ p->drawImage(alignedBufferRect.topLeft(), shadowImage);
return;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list