\note The QML Scene Graph uses two separate threads, the main thread does things such as
processing events or updating animations while a second thread does the actual OpenGL rendering.
As a consequence, paint() is not called from the main GUI thread but from the GL enabled
- renderer thread.
+ renderer thread. At the moment paint() is called, the GUI thread is blocked and this is
+ therefore thread-safe.
*/
/*!
setMaterial(&m_materialO);
setOpaqueMaterial(&m_material);
setGeometry(&m_geometry);
- setFlag(UsePreprocess);
}
QSGPainterNode::~QSGPainterNode()
delete m_multisampledFbo;
}
-void QSGPainterNode::preprocess()
+void QSGPainterNode::paint()
{
- if (!m_dirtyContents)
- return;
-
QRect dirtyRect = m_dirtyRect.isNull() ? QRect(0, 0, m_size.width(), m_size.height()) : m_dirtyRect;
QPainter painter;
QGLFramebufferObject::blitFramebuffer(m_fbo, dirtyRect, m_multisampledFbo, dirtyRect);
}
- m_dirtyContents = false;
m_dirtyRect = QRect();
}
if (m_dirtyTexture)
updateTexture();
+ if (m_dirtyContents)
+ paint();
+
m_dirtyGeometry = false;
m_dirtyRenderTarget = false;
m_dirtyTexture = false;
+ m_dirtyContents = false;
}
void QSGPainterNode::updateTexture()