From 554566788f585caaef14d929cee6557ad929e06e Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 1 Mar 2016 12:39:09 +0100 Subject: Particles: inline 4 methods. And when in the area, remove 3 unused functions. Benchmark: start samegame, click '1 player', quit. Valgrind result: removes/inlines ~90,000 calls. Change-Id: If911b19b46bf163f7fe678623c068f960296f17e Reviewed-by: Lars Knoll Reviewed-by: Robin Burchell --- src/particles/qquickparticlesystem.cpp | 38 +--------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) (limited to 'src/particles/qquickparticlesystem.cpp') diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp index c0306e9025..e91ab40ffa 100644 --- a/src/particles/qquickparticlesystem.cpp +++ b/src/particles/qquickparticlesystem.cpp @@ -199,24 +199,8 @@ DEFINE_BOOL_CONFIG_OPTION(qmlParticlesDebug, QML_PARTICLES_DEBUG) Discards all currently existing particles. */ -const qreal EPSILON = 0.001; -//Utility functions for when within 1ms is close enough -bool timeEqualOrGreater(qreal a, qreal b) -{ - return (a+EPSILON >= b); -} - -bool timeLess(qreal a, qreal b) -{ - return (a-EPSILON < b); -} -bool timeEqual(qreal a, qreal b) -{ - return (a+EPSILON > b) && (a-EPSILON < b); -} - -int roundedTime(qreal a) +static inline int roundedTime(qreal a) {// in ms return (int)qRound(a*1000.0); } @@ -344,11 +328,6 @@ QQuickParticleGroupData::~QQuickParticleGroupData() delete d; } -int QQuickParticleGroupData::size() -{ - return m_size; -} - QString QQuickParticleGroupData::name()//### Worth caching as well? { return m_system->groupIds.key(index); @@ -652,21 +631,6 @@ void QQuickParticleData::debugDump() << "Time: " << t << "," <timeInt / 1000.0) ; } -bool QQuickParticleData::stillAlive() -{ - if (!system) - return false; - return (t + lifeSpan - EPSILON) > ((qreal)system->timeInt/1000.0); -} - -bool QQuickParticleData::alive() -{ - if (!system) - return false; - qreal st = ((qreal)system->timeInt/1000.0); - return (t + EPSILON) < st && (t + lifeSpan - EPSILON) > st; -} - float QQuickParticleData::curSize() { if (!system || !lifeSpan) -- cgit v1.2.3