diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-10-29 06:21:39 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-10-29 06:21:39 (GMT) |
commit | 1dce8e5fa590a5264d7e5d8a5898bde72022c911 (patch) | |
tree | 64049dd475ccb888e0fa52efe618b55eec42d5fd /src | |
parent | bcafd3739844fb7b22de3a92dd8c00e384eaa122 (diff) | |
download | Qt-1dce8e5fa590a5264d7e5d8a5898bde72022c911.zip Qt-1dce8e5fa590a5264d7e5d8a5898bde72022c911.tar.gz Qt-1dce8e5fa590a5264d7e5d8a5898bde72022c911.tar.bz2 |
Save a little more memory.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/extra/qfxparticles.cpp | 8 | ||||
-rw-r--r-- | src/declarative/util/qmlpropertychanges.cpp | 9 | ||||
-rw-r--r-- | src/declarative/util/qmlspringfollow.cpp | 11 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index 8e77c34..80255b9 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -359,7 +359,6 @@ public: qreal minX; qreal maxY; qreal minY; - QVarLengthArray<QDrawPixmaps::Data, 50> pixmapData; QFxParticlesPrivate* d; }; @@ -384,7 +383,6 @@ public: { Q_Q(QFxParticles); paintItem = new QFxParticlesPainter(this, q); - paintItem->pixmapData.resize(count); } void tick(int time); @@ -702,8 +700,6 @@ void QFxParticles::setCount(int cnt) int oldCount = d->count; d->count = cnt; - if (cnt > oldCount) - d->paintItem->pixmapData.resize(d->count); d->addParticleTime = 0; d->addParticleCount = d->particles.count(); if (!oldCount && d->clock.state() != QAbstractAnimation::Running && d->count) { @@ -1104,6 +1100,10 @@ void QFxParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, Q const int myX = x() + parentItem()->x(); const int myY = y() + parentItem()->y(); + static QVarLengthArray<QDrawPixmaps::Data, 256> pixmapData; + if (pixmapData.count() < d->particles.count()) + pixmapData.resize(d->particles.count()); + const QRectF sourceRect = d->image.rect(); for (int i = 0; i < d->particles.count(); ++i) { const QFxParticle &particle = d->particles.at(i); diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 7e1f15c..0ac168b 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -127,11 +127,12 @@ public: QObject *object; QByteArray data; - bool decoded; - void decode(); - bool restore; - bool isExplicit; + bool decoded : 1; + bool restore : 1; + bool isExplicit : 1; + + void decode(); QList<QPair<QByteArray, QVariant> > properties; QList<QPair<QByteArray, QmlExpression *> > expressions; diff --git a/src/declarative/util/qmlspringfollow.cpp b/src/declarative/util/qmlspringfollow.cpp index 569cc48..3b2526b 100644 --- a/src/declarative/util/qmlspringfollow.cpp +++ b/src/declarative/util/qmlspringfollow.cpp @@ -56,8 +56,8 @@ class QmlSpringFollowPrivate : public QObjectPrivate public: QmlSpringFollowPrivate() : sourceValue(0), maxVelocity(0), lastTime(0) - , mass(1.0), useMass(false), spring(0.), damping(0.), velocity(0), epsilon(0.01) - , modulus(0.0), haveModulus(false), enabled(true), mode(Track), clock(this) {} + , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01) + , modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {} QmlMetaProperty property; qreal currentValue; @@ -66,14 +66,15 @@ public: qreal velocityms; int lastTime; qreal mass; - bool useMass; qreal spring; qreal damping; qreal velocity; qreal epsilon; qreal modulus; - bool haveModulus; - bool enabled; + + bool useMass : 1; + bool haveModulus : 1; + bool enabled : 1; enum Mode { Track, |