Merge branch 'qtquick2' of scm.dev.nokia.troll.no:qt/qtdeclarative-staging into qtquick2
authorEckhart Koppen <eckhart.koppen@nokia.com>
Fri, 13 May 2011 20:00:00 +0000 (23:00 +0300)
committerEckhart Koppen <eckhart.koppen@nokia.com>
Fri, 13 May 2011 20:00:00 +0000 (23:00 +0300)
src/declarative/items/qsgpainteditem.cpp
src/declarative/scenegraph/util/qsgpainternode.cpp
src/declarative/scenegraph/util/qsgpainternode_p.h

index 800e37b..775405c 100644 (file)
@@ -419,7 +419,8 @@ void QSGPaintedItem::setRenderTarget(RenderTarget target)
     \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.
 */
 
 /*!
index d3dae11..bcf63ab 100644 (file)
@@ -127,7 +127,6 @@ QSGPainterNode::QSGPainterNode(QSGPaintedItem *item)
     setMaterial(&m_materialO);
     setOpaqueMaterial(&m_material);
     setGeometry(&m_geometry);
-    setFlag(UsePreprocess);
 }
 
 QSGPainterNode::~QSGPainterNode()
@@ -137,11 +136,8 @@ 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;
@@ -181,7 +177,6 @@ void QSGPainterNode::preprocess()
         QGLFramebufferObject::blitFramebuffer(m_fbo, dirtyRect, m_multisampledFbo, dirtyRect);
     }
 
-    m_dirtyContents = false;
     m_dirtyRect = QRect();
 }
 
@@ -194,9 +189,13 @@ void QSGPainterNode::update()
     if (m_dirtyTexture)
         updateTexture();
 
+    if (m_dirtyContents)
+        paint();
+
     m_dirtyGeometry = false;
     m_dirtyRenderTarget = false;
     m_dirtyTexture = false;
+    m_dirtyContents = false;
 }
 
 void QSGPainterNode::updateTexture()
index f2fdbe5..0fba6e9 100644 (file)
@@ -101,7 +101,7 @@ public:
 
     void update();
 
-    void preprocess();
+    void paint();
 
 private:
     void updateTexture();