diff options
Diffstat (limited to 'src/declarative/scenegraph/coreapi/qsgrenderer.cpp')
-rw-r--r-- | src/declarative/scenegraph/coreapi/qsgrenderer.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/declarative/scenegraph/coreapi/qsgrenderer.cpp b/src/declarative/scenegraph/coreapi/qsgrenderer.cpp index cc24cc066b..48c34d39dd 100644 --- a/src/declarative/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/declarative/scenegraph/coreapi/qsgrenderer.cpp @@ -122,7 +122,7 @@ QSGRenderer::QSGRenderer(QSGContext *context) : QObject() , m_clear_color(Qt::transparent) , m_clear_mode(ClearColorBuffer | ClearDepthBuffer) - , m_render_opacity(1) + , m_current_opacity(1) , m_context(context) , m_root_node(0) , m_node_updater(0) @@ -264,12 +264,12 @@ void QSGRenderer::renderScene(const Bindable &bindable) #endif } -void QSGRenderer::setProjectMatrixToDeviceRect() +void QSGRenderer::setProjectionMatrixToDeviceRect() { - setProjectMatrixToRect(m_device_rect); + setProjectionMatrixToRect(m_device_rect); } -void QSGRenderer::setProjectMatrixToRect(const QRectF &rect) +void QSGRenderer::setProjectionMatrixToRect(const QRectF &rect) { QMatrix4x4 matrix; matrix.ortho(rect.x(), @@ -278,10 +278,10 @@ void QSGRenderer::setProjectMatrixToRect(const QRectF &rect) rect.y(), qreal(0.01), -1); - setProjectMatrix(matrix); + setProjectionMatrix(matrix); } -void QSGRenderer::setProjectMatrix(const QMatrix4x4 &matrix) +void QSGRenderer::setProjectionMatrix(const QMatrix4x4 &matrix) { m_projection_matrix = matrix; // Mirrored relative to the usual Qt coordinate system with origin in the top left corner. @@ -293,6 +293,14 @@ void QSGRenderer::setClearColor(const QColor &color) m_clear_color = color; } +/*! + Updates internal data structures and emits the sceneGraphChanged() signal. + + If \a flags contains the QSGNode::DirtyNodeRemoved flag, the node might be + in the process of being destroyed. It is then not safe to downcast the node + pointer. +*/ + void QSGRenderer::nodeChanged(QSGNode *node, QSGNode::DirtyFlags flags) { Q_UNUSED(node); @@ -346,16 +354,16 @@ void QSGRenderer::preprocess() void QSGRenderer::addNodesToPreprocess(QSGNode *node) { - for (int i = 0; i < node->childCount(); ++i) - addNodesToPreprocess(node->childAtIndex(i)); + for (QSGNode *c = node->firstChild(); c; c = c->nextSibling()) + addNodesToPreprocess(c); if (node->flags() & QSGNode::UsePreprocess) m_nodes_to_preprocess.insert(node); } void QSGRenderer::removeNodesToPreprocess(QSGNode *node) { - for (int i = 0; i < node->childCount(); ++i) - removeNodesToPreprocess(node->childAtIndex(i)); + for (QSGNode *c = node->firstChild(); c; c = c->nextSibling()) + removeNodesToPreprocess(c); if (node->flags() & QSGNode::UsePreprocess) m_nodes_to_preprocess.remove(node); } @@ -384,11 +392,9 @@ QSGRenderer::ClipType QSGRenderer::updateStencilClip(const QSGClipNode *clip) int clipDepth = 0; QRect clipRect; while (clip) { - QMatrix4x4 matrix = m_projectionMatrix.top(); + QMatrix4x4 m = m_current_projection_matrix; if (clip->matrix()) - matrix *= *clip->matrix(); - - const QMatrix4x4 &m = matrix; + m *= *clip->matrix(); // TODO: Check for multisampling and pixel grid alignment. bool canUseScissor = clip->isRectangular() |