aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2014-08-12 16:14:23 +0200
committerLars Knoll <lars.knoll@digia.com>2014-08-13 14:27:15 +0300
commite32867f1c2918b452781055affc7c4563f25121c (patch)
tree953e2e9686362aa96b4a8ca81a62a34ae145b04c
parent03a38f4609a69f6a8b3a5ed776f62d0277935709 (diff)
Do not paint fully transparent nodes
With the current renderer we paint everything, including nodes that are fully transparent. Granted since the thing we paint is also transparent it doesn't effect the output other than wasting cycles. A limit of the current approach is that we can not easily drop branches of the tree to be rendered when a parent node is fully transparent. This also fixes the opacity node implementation in general to respect any previously set opacity. Change-Id: I993fcd4db5b714a3e8caf60135add0bb660c0b80 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--softwarecontext/renderingvisitor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/softwarecontext/renderingvisitor.cpp b/softwarecontext/renderingvisitor.cpp
index dcad6b35ae..f64139eab0 100644
--- a/softwarecontext/renderingvisitor.cpp
+++ b/softwarecontext/renderingvisitor.cpp
@@ -68,7 +68,12 @@ void RenderingVisitor::endVisit(QSGGeometryNode *node)
bool RenderingVisitor::visit(QSGOpacityNode *node)
{
painter->save();
- painter->setOpacity(node->opacity());
+
+ const qreal newOpacity = painter->opacity() * node->opacity();
+ if (qFuzzyIsNull(newOpacity))
+ return false;
+
+ painter->setOpacity(newOpacity);
return true;
}