summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-08-18 16:01:58 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-23 07:31:38 +0200
commite30f56ee23b62eb5cd33505b544e7d1fa2766211 (patch)
tree3d398f187b4ea9d74a93c17ab5e6fd24580875cc
parent6a35e8a13900665ab77a0caed59de1df3e89aa6c (diff)
Add console debugging for particles
Enable with the environment variable QML_PARTICLES_DEBUG. Change-Id: I8aee2702e17f4ec6d18d8def9d57c5238d4c28ae Reviewed-on: http://codereview.qt.nokia.com/3136 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
-rw-r--r--src/declarative/particles/qsgimageparticle.cpp16
-rw-r--r--src/declarative/particles/qsgimageparticle_p.h1
2 files changed, 16 insertions, 1 deletions
diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp
index 6827d2da86..43e44e2afb 100644
--- a/src/declarative/particles/qsgimageparticle.cpp
+++ b/src/declarative/particles/qsgimageparticle.cpp
@@ -54,6 +54,9 @@
QT_BEGIN_NAMESPACE
+//###Switch to define later, for now user-friendly (no compilation) debugging is worth it
+DEFINE_BOOL_CONFIG_OPTION(qmlParticlesDebug, QML_PARTICLES_DEBUG)
+
const float CONV = 0.017453292519943295;
class TabledMaterialData
{
@@ -464,8 +467,10 @@ QSGImageParticle::QSGImageParticle(QSGItem* parent)
, m_bloat(false)
, perfLevel(Unknown)
, m_lastLevel(Unknown)
+ , m_debugMode(false)
{
setFlag(ItemHasContents);
+ m_debugMode = qmlParticlesDebug();
}
QSGImageParticle::~QSGImageParticle()
@@ -1067,7 +1072,16 @@ void QSGImageParticle::prepareNextFrame()
m_rootNode = buildParticleNodes();
if (m_rootNode == 0)
return;
- //qDebug() << "Feature level: " << perfLevel;
+ if(m_debugMode){
+ qDebug() << "QSGImageParticle Feature level: " << perfLevel;
+ qDebug() << "QSGImageParticle Nodes: ";
+ int count = 0;
+ foreach(int i, m_nodes.keys()){
+ qDebug() << "Group " << i << " (" << m_system->m_groupData[i]->size() << " particles)";
+ count += m_system->m_groupData[i]->size();
+ }
+ qDebug() << "Total count: " << count;
+ }
}
qint64 timeStamp = m_system->systemSync(this);
diff --git a/src/declarative/particles/qsgimageparticle_p.h b/src/declarative/particles/qsgimageparticle_p.h
index fe799f567b..ae80434abb 100644
--- a/src/declarative/particles/qsgimageparticle_p.h
+++ b/src/declarative/particles/qsgimageparticle_p.h
@@ -341,6 +341,7 @@ private:
PerformanceLevel perfLevel;
PerformanceLevel m_lastLevel;
+ bool m_debugMode;
};
QT_END_NAMESPACE