From: Charles Yin Date: Mon, 16 May 2011 00:14:34 +0000 (+1000) Subject: add toImage() function to QSGPainterNode X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=166829bbde8d1b4518b9854562c0e5b0ace6bf69;p=konrad%2Fqtdeclarative.git add toImage() function to QSGPainterNode --- diff --git a/src/declarative/scenegraph/util/qsgpainternode.cpp b/src/declarative/scenegraph/util/qsgpainternode.cpp index bcf63ab..b3f163c 100644 --- a/src/declarative/scenegraph/util/qsgpainternode.cpp +++ b/src/declarative/scenegraph/util/qsgpainternode.cpp @@ -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 diff --git a/src/declarative/scenegraph/util/qsgpainternode_p.h b/src/declarative/scenegraph/util/qsgpainternode_p.h index 0fba6e9..625a0cb 100644 --- a/src/declarative/scenegraph/util/qsgpainternode_p.h +++ b/src/declarative/scenegraph/util/qsgpainternode_p.h @@ -99,6 +99,7 @@ public: void setContentsScale(qreal s); qreal contentsScale() const { return m_contentsScale; } + QImage toImage() const; void update(); void paint();