Title: [121435] trunk/Source/WebCore
Revision
121435
Author
[email protected]
Date
2012-06-28 09:14:54 -0700 (Thu, 28 Jun 2012)

Log Message

[Qt] Make GC's fill{Rounded}Rect use optimized shadow blur code
https://bugs.webkit.org/show_bug.cgi?id=90082

Patch by Bruno de Oliveira Abinader <[email protected]> on 2012-06-28
Reviewed by Noam Rosenthal.

ShadowBlur::drawRectShadow makes use of optimized tiles-based drawPattern, which
is not present when using {begin/end}shadowLayer.

* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::pushTransparencyLayerInternal):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121434 => 121435)


--- trunk/Source/WebCore/ChangeLog	2012-06-28 16:05:43 UTC (rev 121434)
+++ trunk/Source/WebCore/ChangeLog	2012-06-28 16:14:54 UTC (rev 121435)
@@ -1,3 +1,18 @@
+2012-06-28  Bruno de Oliveira Abinader  <[email protected]>
+
+        [Qt] Make GC's fill{Rounded}Rect use optimized shadow blur code
+        https://bugs.webkit.org/show_bug.cgi?id=90082
+
+        Reviewed by Noam Rosenthal.
+
+        ShadowBlur::drawRectShadow makes use of optimized tiles-based drawPattern, which
+        is not present when using {begin/end}shadowLayer.
+
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        (WebCore::GraphicsContext::pushTransparencyLayerInternal):
+
 2012-06-28  Rahul Tiwari  <[email protected]>
 
         Web Inspector: Provide context menu 'Delete all watch expressions.'

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp (121434 => 121435)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2012-06-28 16:05:43 UTC (rev 121434)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2012-06-28 16:14:54 UTC (rev 121435)
@@ -703,28 +703,19 @@
     if (paintingDisabled() || !color.isValid())
         return;
 
-    m_data->solidColor.setColor(color);
+    QRectF platformRect(rect);
     QPainter* p = m_data->p();
-    QRectF normalizedRect = rect.normalized();
-
     if (hasShadow()) {
         ShadowBlur* shadow = shadowBlur();
         if (shadow->mustUseShadowBlur(this)) {
-            GraphicsContext* shadowContext = shadow->beginShadowLayer(this, normalizedRect);
-            if (shadowContext) {
-                QPainter* shadowPainter = shadowContext->platformContext();
-                shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
-                shadowPainter->fillRect(normalizedRect, m_state.shadowColor);
-                shadow->endShadowLayer(this);
-            }
+            shadow->drawRectShadow(this, platformRect, RoundedRect::Radii());
         } else {
             QColor shadowColor = m_state.shadowColor;
             shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF());
-            p->fillRect(normalizedRect.translated(QPointF(m_state.shadowOffset.width(), m_state.shadowOffset.height())), shadowColor);
+            p->fillRect(platformRect.translated(QPointF(m_state.shadowOffset.width(), m_state.shadowOffset.height())), shadowColor);
         }
     }
-
-    p->fillRect(normalizedRect, m_data->solidColor);
+    p->fillRect(platformRect, QColor(color));
 }
 
 void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)
@@ -738,13 +729,7 @@
     if (hasShadow()) {
         ShadowBlur* shadow = shadowBlur();
         if (shadow->mustUseShadowBlur(this)) {
-            GraphicsContext* shadowContext = shadow->beginShadowLayer(this, rect);
-            if (shadowContext) {
-                QPainter* shadowPainter = shadowContext->platformContext();
-                shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
-                shadowPainter->fillPath(path.platformPath(), QColor(m_state.shadowColor));
-                shadow->endShadowLayer(this);
-            }
+            shadow->drawRectShadow(this, rect, RoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight));
         } else {
             const QPointF shadowOffset(m_state.shadowOffset.width(), m_state.shadowOffset.height());
             p->translate(shadowOffset);
@@ -1045,7 +1030,10 @@
 {
     QPainter* p = m_data->p();
 
-    QRect deviceClip = p->transform().mapRect(rect);
+    QTransform deviceTransform = p->transform();
+    QRect deviceClip = deviceTransform.mapRect(rect);
+
+    alphaMask = alphaMask.transformed(deviceTransform);
     if (alphaMask.width() != deviceClip.width() || alphaMask.height() != deviceClip.height())
         alphaMask = alphaMask.scaled(deviceClip.width(), deviceClip.height());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to