add toImage() function to QSGPainterNode
authorCharles Yin <charles.yin@nokia.com>
Mon, 16 May 2011 00:14:34 +0000 (10:14 +1000)
committerCharles Yin <charles.yin@nokia.com>
Mon, 16 May 2011 00:14:34 +0000 (10:14 +1000)
src/declarative/scenegraph/util/qsgpainternode.cpp
src/declarative/scenegraph/util/qsgpainternode_p.h

index bcf63ab..b3f163c 100644 (file)
@@ -407,5 +407,12 @@ void QSGPainterNode::setContentsScale(qreal s)
     markDirty(DirtyMaterial);
 }
 
+QImage QSGPainterNode::toImage() const
+{
+    if (m_actualRenderTarget == QSGPaintedItem::Image)
+        return m_image;
+    else
+        return m_fbo->toImage();
+}
 
 QT_END_NAMESPACE
index 0fba6e9..625a0cb 100644 (file)
@@ -99,6 +99,7 @@ public:
     void setContentsScale(qreal s);
     qreal contentsScale() const { return m_contentsScale; }
 
+    QImage toImage() const;
     void update();
 
     void paint();