diff options
author | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-03-01 12:39:09 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-03-04 10:43:23 +0000 |
commit | 554566788f585caaef14d929cee6557ad929e06e (patch) | |
tree | a1d571e23933a9f66ed49a789a932a666dc0ed89 /src/particles/qquickparticlesystem.cpp | |
parent | 62ecfe55f414d0d04a4344bc6934b4b01408190f (diff) |
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 <lars.knoll@theqtcompany.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/particles/qquickparticlesystem.cpp')
-rw-r--r-- | src/particles/qquickparticlesystem.cpp | 38 |
1 files changed, 1 insertions, 37 deletions
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 << "," <<lifeSpan << ";" << (system->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) |