From e32867f1c2918b452781055affc7c4563f25121c Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 12 Aug 2014 16:14:23 +0200 Subject: 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 --- softwarecontext/renderingvisitor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3