Work towards supporting front-to-back reordering of opaque items.
authorMichael Brasser <michael.brasser@live.com>
Sat, 8 Dec 2012 05:05:48 +0000 (23:05 -0600)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 12 Dec 2012 02:54:17 +0000 (03:54 +0100)
Change-Id: Ic3b9defa6ac61409adcfb2b5cb8167698ed00255
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp
src/quick/scenegraph/qsgdefaultimagenode.cpp

index 8556459..86f43a5 100644 (file)
@@ -69,7 +69,7 @@ static bool nodeLessThan(QSGNode *nodeA, QSGNode *nodeB)
     if (nodeA->type() != QSGNode::GeometryNodeType)
         return nodeA < nodeB;
     QSGGeometryNode *a = static_cast<QSGGeometryNode *>(nodeA);
-    QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeA);
+    QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeB);
 
     // Sort by clip...
     if (a->clipList() != b->clipList())
@@ -97,7 +97,7 @@ static bool nodeLessThanWithRenderOrder(QSGNode *nodeA, QSGNode *nodeB)
     if (nodeA->type() != QSGNode::GeometryNodeType)
         return nodeA < nodeB;
     QSGGeometryNode *a = static_cast<QSGGeometryNode *>(nodeA);
-    QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeA);
+    QSGGeometryNode *b = static_cast<QSGGeometryNode *>(nodeB);
 
     // Sort by clip...
     if (a->clipList() != b->clipList())
index d9c04e1..da2dfcd 100644 (file)
@@ -305,8 +305,8 @@ void QSGDefaultImageNode::setTexture(QSGTexture *texture)
     m_materialO.setTexture(texture);
     m_smoothMaterial.setTexture(texture);
     // Texture cleanup
-//    if (!texture.isNull())
-//        m_material.setBlending(texture->hasAlphaChannel());
+    if (texture)
+        m_material.setFlag(QSGMaterial::Blending, texture->hasAlphaChannel());
     markDirty(DirtyMaterial);
 
     // Because the texture can be a different part of the atlas, we need to update it...
@@ -355,12 +355,11 @@ void QSGDefaultImageNode::preprocess()
         doDirty = t->updateTexture();
         updateGeometry();
     }
-// ### texture cleanup
-//    bool alpha = m_material.blending();
-//    if (!m_material->texture().isNull() && alpha != m_material.texture()->hasAlphaChannel()) {
-//        m_material.setBlending(!alpha);
-//        doDirty = true;
-//    }
+    bool alpha = m_material.flags() & QSGMaterial::Blending;
+    if (m_material.texture() && alpha != m_material.texture()->hasAlphaChannel()) {
+        m_material.setFlag(QSGMaterial::Blending, !alpha);
+        doDirty = true;
+    }
 
     if (doDirty)
         markDirty(DirtyMaterial);