Title: [109664] trunk/Source/WebKit2
Revision
109664
Author
[email protected]
Date
2012-03-03 11:26:39 -0800 (Sat, 03 Mar 2012)

Log Message

[Qt] Use the existing inheritedOpacity/matrix properties of QSGNode
https://bugs.webkit.org/show_bug.cgi?id=79543

Use QSGNode::inheritedOpacity() and QSGNode::matrix().
Also, remove flags from changedStates() that we don't actually touch.
This is covered by existing API tests.

Reviewed by Kenneth Rohde Christiansen.

* UIProcess/API/qt/qquickwebpage.cpp:
(QQuickWebPagePrivate::paintToCurrentGLContext):
(PageProxyNode::changedStates):
(PageProxyNode::render):
* UIProcess/API/qt/qquickwebpage_p_p.h:
(QQuickWebPagePrivate):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (109663 => 109664)


--- trunk/Source/WebKit2/ChangeLog	2012-03-03 19:13:56 UTC (rev 109663)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-03 19:26:39 UTC (rev 109664)
@@ -1,3 +1,21 @@
+2012-03-03  No'am Rosenthal  <[email protected]>
+
+        [Qt] Use the existing inheritedOpacity/matrix properties of QSGNode
+        https://bugs.webkit.org/show_bug.cgi?id=79543
+
+        Use QSGNode::inheritedOpacity() and QSGNode::matrix().
+        Also, remove flags from changedStates() that we don't actually touch.
+        This is covered by existing API tests.
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * UIProcess/API/qt/qquickwebpage.cpp:
+        (QQuickWebPagePrivate::paintToCurrentGLContext):
+        (PageProxyNode::changedStates):
+        (PageProxyNode::render):
+        * UIProcess/API/qt/qquickwebpage_p_p.h:
+        (QQuickWebPagePrivate):
+
 2012-03-03  Anders Carlsson  <[email protected]>
 
         Fix build with newer versions of clang.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp (109663 => 109664)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2012-03-03 19:13:56 UTC (rev 109663)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2012-03-03 19:26:39 UTC (rev 109664)
@@ -63,18 +63,6 @@
     eventHandler.reset(new QtWebPageEventHandler(toAPI(webPageProxy), q, viewportItem));
 }
 
-static float computeEffectiveOpacity(const QQuickItem* item)
-{
-    if (!item)
-        return 1;
-
-    float opacity = item->opacity();
-    if (opacity < 0.01)
-        return 0;
-
-    return opacity * computeEffectiveOpacity(item->parentItem());
-}
-
 void QQuickWebPagePrivate::setDrawingAreaSize(const QSize& size)
 {
     DrawingAreaProxy* drawingArea = webPageProxy->drawingArea();
@@ -89,15 +77,11 @@
         webPageProxy->drawingArea()->paintLayerTree(painter);
 }
 
-void QQuickWebPagePrivate::paintToCurrentGLContext()
+void QQuickWebPagePrivate::paintToCurrentGLContext(const QTransform& transform, float opacity)
 {
     if (!q->isVisible())
         return;
 
-    QTransform transform = q->itemTransform(0, 0);
-    transform.scale(contentsScale, contentsScale);
-
-    float opacity = computeEffectiveOpacity(q);
     QRectF clipRect = viewportItem->mapRectToScene(viewportItem->boundingRect());
 
     if (!clipRect.isValid())
@@ -107,7 +91,7 @@
     if (!drawingArea)
         return;
 
-    drawingArea->paintToCurrentGLContext(transform, opacity, clipRect);
+    drawingArea->paintToCurrentGLContext(QTransform(transform).scale(contentsScale, contentsScale), opacity, clipRect);
 }
 
 struct PageProxyNode : public QSGRenderNode {
@@ -118,14 +102,15 @@
 
     virtual StateFlags changedStates()
     {
-        return StateFlags(DepthState) | StencilState | ScissorState | ColorState | BlendState
-               | CullState | ViewportState;
+        return StateFlags(StencilState) | ColorState | BlendState;
     }
 
-    virtual void render(const RenderState &)
+    virtual void render(const RenderState&)
     {
-        if (m_pagePrivate)
-            m_pagePrivate->paintToCurrentGLContext();
+        if (!m_pagePrivate)
+            return;
+        QTransform transform = matrix() ? matrix()->toTransform() : QTransform();
+        m_pagePrivate->paintToCurrentGLContext(transform, inheritedOpacity());
     }
 
     ~PageProxyNode()

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h (109663 => 109664)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h	2012-03-03 19:13:56 UTC (rev 109663)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h	2012-03-03 19:26:39 UTC (rev 109664)
@@ -41,7 +41,7 @@
 
     void updateSize();
 
-    void paintToCurrentGLContext();
+    void paintToCurrentGLContext(const QTransform&, float opacity);
     void paint(QPainter*);
     void resetPaintNode();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to