From b570d384c0704ea12364e353493eeb6f1ae34cd3 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 7 Dec 2012 23:05:48 -0600 Subject: Work towards supporting front-to-back reordering of opaque items. Change-Id: Ic3b9defa6ac61409adcfb2b5cb8167698ed00255 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp | 4 ++-- src/quick/scenegraph/qsgdefaultimagenode.cpp | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp index 85564590df..86f43a5830 100644 --- a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp @@ -69,7 +69,7 @@ static bool nodeLessThan(QSGNode *nodeA, QSGNode *nodeB) if (nodeA->type() != QSGNode::GeometryNodeType) return nodeA < nodeB; QSGGeometryNode *a = static_cast(nodeA); - QSGGeometryNode *b = static_cast(nodeA); + QSGGeometryNode *b = static_cast(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(nodeA); - QSGGeometryNode *b = static_cast(nodeA); + QSGGeometryNode *b = static_cast(nodeB); // Sort by clip... if (a->clipList() != b->clipList()) diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp index d9c04e1959..da2dfcda64 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp @@ -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); -- cgit v1.2.3