[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:28:12 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e09168ad7071627ca593a673b5266854c5da6d4b
Author: ariya at webkit.org <ariya at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 24 09:58:01 2010 +0000

    [Qt] Blur shadow for rectangle fill
    https://bugs.webkit.org/show_bug.cgi?id=44488
    
    Patch by Ariya Hidayat <ariya at sencha.com> on 2010-08-24
    Reviewed by Simon Hausmann.
    
    Refactor fillRect() function to support blur radius in the shadow.
    
    * platform/graphics/qt/GraphicsContextQt.cpp:
    (WebCore::GraphicsContext::fillRect):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9ce8e7c..d2988f2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-24  Ariya Hidayat  <ariya at sencha.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Blur shadow for rectangle fill
+        https://bugs.webkit.org/show_bug.cgi?id=44488
+
+        Refactor fillRect() function to support blur radius in the shadow.
+
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::fillRect):
+
 2010-08-24  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index f56c54c..67b55ed 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -645,55 +645,50 @@ void GraphicsContext::fillRect(const FloatRect& rect)
         return;
 
     QPainter* p = m_data->p();
-    FloatRect normalizedRect = rect.normalized();
-
-    QRectF shadowDestRect;
-    QImage* shadowImage = 0;
-    QPainter* pShadow = 0;
-
-    if (m_data->hasShadow()) {
-        shadowImage = new QImage(roundedIntSize(normalizedRect.size()), QImage::Format_ARGB32_Premultiplied);
-        pShadow = new QPainter(shadowImage);
-        shadowDestRect = normalizedRect;
-        shadowDestRect.translate(m_data->shadow.offset);
-
-        pShadow->setCompositionMode(QPainter::CompositionMode_Source);
-        pShadow->fillRect(shadowImage->rect(), m_data->shadow.color);
-        pShadow->setCompositionMode(QPainter::CompositionMode_DestinationIn);
-    }
+    QRectF normalizedRect = rect.normalized();
+    ContextShadow* shadow = contextShadow();
 
     if (m_common->state.fillPattern) {
         AffineTransform affine;
         QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine));
         QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame();
-
-        if (m_data->hasShadow()) {
-            drawRepeatPattern(pShadow, image, FloatRect(static_cast<QRectF>(shadowImage->rect())), m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
-            pShadow->end();
-            p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect());
+        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
+        if (shadowPainter) {
+            drawRepeatPattern(shadowPainter, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
+            shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn);
+            shadowPainter->fillRect(normalizedRect, shadow->color);
+            shadow->endShadowLayer(p);
         }
         drawRepeatPattern(p, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
     } else if (m_common->state.fillGradient) {
         QBrush brush(*m_common->state.fillGradient->platformGradient());
         brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
-
-        if (m_data->hasShadow()) {
-            pShadow->fillRect(shadowImage->rect(), brush);
-            pShadow->end();
-            p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect());
+        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
+        if (shadowPainter) {
+            shadowPainter->fillRect(normalizedRect, brush);
+            shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn);
+            shadowPainter->fillRect(normalizedRect, shadow->color);
+            shadow->endShadowLayer(p);
         }
         p->fillRect(normalizedRect, brush);
     } else {
         if (m_data->hasShadow()) {
-            pShadow->fillRect(shadowImage->rect(), p->brush());
-            pShadow->end();
-            p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect());
+            if (shadow->type == ContextShadow::BlurShadow) {
+                QPainter* shadowPainter = shadow->beginShadowLayer(p, normalizedRect);
+                if (shadowPainter) {
+                    shadowPainter->fillRect(normalizedRect, p->brush());
+                    shadow->endShadowLayer(p);
+                }
+            } else {
+                // Solid rectangle fill with no blur shadow can be done faster
+                // without using the shadow layer at all.
+                QColor shadowColor = shadow->color;
+                shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF());
+                p->fillRect(normalizedRect.translated(shadow->offset), shadowColor);
+            }
         }
         p->fillRect(normalizedRect, p->brush());
     }
-
-    delete shadowImage;
-    delete pShadow;
 }
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list