Mark material as dirty after changing color's opacity in Rectangle.
authorGunnar Sletta <gunnar.sletta@jollamobile.com>
Fri, 25 Apr 2014 13:34:55 +0000 (15:34 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 30 Apr 2014 08:13:35 +0000 (10:13 +0200)
Change-Id: I8037908bb2ba494001c516e2c7606c3bb54a14d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/quick/scenegraph/qsgdefaultrectanglenode.cpp

index 810a503..467f454 100644 (file)
@@ -289,10 +289,22 @@ void QSGDefaultRectangleNode::update()
     if (m_dirty_geometry) {
         updateGeometry();
         m_dirty_geometry = false;
+
+        QSGNode::DirtyState state = QSGNode::DirtyGeometry;
+        // smoothed material is always blended, so no change in material state
+        if (material() == &m_material) {
+            bool wasBlending = (m_material.flags() & QSGMaterial::Blending);
+            bool isBlending = (m_gradient_stops.size() > 0 && !m_gradient_is_opaque)
+                               || (m_color.alpha() < 255 && m_color.alpha() != 0)
+                               || (m_pen_width > 0 && m_border_color.alpha() < 255);
+            if (wasBlending != isBlending) {
+                m_material.setFlag(QSGMaterial::Blending, isBlending);
+                state |= QSGNode::DirtyMaterial;
+            }
+        }
+
+        markDirty(state);
     }
-    m_material.setFlag(QSGMaterial::Blending, (m_gradient_stops.size() > 0 && !m_gradient_is_opaque)
-                                               || (m_color.alpha() < 255 && m_color.alpha() != 0)
-                                               || (m_pen_width > 0 && m_border_color.alpha() < 255));
 }
 
 void QSGDefaultRectangleNode::updateGeometry()
@@ -770,8 +782,6 @@ void QSGDefaultRectangleNode::updateGeometry()
             Q_ASSERT(outerAATail == indexCount);
         }
     }
-
-    markDirty(DirtyGeometry);
 }