From 8058fd80b712c802c23c36812b3dec47dce15676 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 5 Oct 2011 12:51:38 +0200 Subject: [PATCH] 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 --- src/declarative/particles/qsgimageparticle.cpp | 5 +++-- src/declarative/scenegraph/util/qsgtexture_p.h | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) 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; -- 2.7.4