From: Gunnar Sletta Date: Wed, 5 Oct 2011 10:51:38 +0000 (+0200) Subject: Don't accidentally use atlas images in particle nodes X-Git-Tag: qt-v5.0.0-alpha1~1466 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8058fd80b712c802c23c36812b3dec47dce15676;p=profile%2Fivi%2Fqtdeclarative.git Don't accidentally use atlas images in particle nodes Change-Id: I3058d9262bbc32c873ba26e51b04668f89ed060a Reviewed-on: http://codereview.qt-project.org/6039 Reviewed-by: Qt Sanity Bot Reviewed-by: Kim M. Kalland --- diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp index f0304b4..3646506 100644 --- a/src/declarative/particles/qsgimageparticle.cpp +++ b/src/declarative/particles/qsgimageparticle.cpp @@ -51,6 +51,7 @@ #include "qsgspriteengine_p.h" #include #include +#include QT_BEGIN_NAMESPACE //###Switch to define later, for now user-friendly (no compilation) debugging is worth it @@ -1137,7 +1138,7 @@ QSGGeometryNode* QSGImageParticle::buildParticleNodes() if (colortable.isNull()) colortable = QImage(QStringLiteral(":defaultshaders/identitytable.png")); Q_ASSERT(!colortable.isNull()); - getState(m_material)->colorTable = sceneGraphEngine()->createTextureFromImage(colortable); + getState(m_material)->colorTable = QSGPlainTexture::fromImage(colortable); fillUniformArrayFromImage(getState(m_material)->sizeTable, sizetable, UNIFORM_ARRAY_SIZE); fillUniformArrayFromImage(getState(m_material)->opacityTable, opacitytable, UNIFORM_ARRAY_SIZE); case Deformable: @@ -1149,7 +1150,7 @@ QSGGeometryNode* QSGImageParticle::buildParticleNodes() default://Also Simple if (!m_material) m_material = SimpleMaterial::createMaterial(); - getState(m_material)->texture = sceneGraphEngine()->createTextureFromImage(image); + getState(m_material)->texture = QSGPlainTexture::fromImage(image); getState(m_material)->texture->setFiltering(QSGTexture::Linear); getState(m_material)->entry = (qreal) m_entryEffect; m_material->setFlag(QSGMaterial::Blending); diff --git a/src/declarative/scenegraph/util/qsgtexture_p.h b/src/declarative/scenegraph/util/qsgtexture_p.h index 460c0e8..f14508f 100644 --- a/src/declarative/scenegraph/util/qsgtexture_p.h +++ b/src/declarative/scenegraph/util/qsgtexture_p.h @@ -92,6 +92,12 @@ public: virtual void bind(); + static QSGPlainTexture *fromImage(const QImage &image) { + QSGPlainTexture *t = new QSGPlainTexture(); + t->setImage(image); + return t; + } + protected: QImage m_image;