diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-12 15:02:42 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-06-12 15:56:12 +0200 |
commit | 728879def455979bb091773d4dedd4ee3277e635 (patch) | |
tree | fce4b156a1315b121035dc818f4b8228fe1a85b3 /src/particles/qquickcustomaffector.cpp | |
parent | a3b88ec8988247c8d36a8786a557bd160a9131ba (diff) |
Convert v8::Array usage in particles to V4
Change-Id: Ib3c39903bf8f8507d68f94baea81b3bf642ce8f6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/particles/qquickcustomaffector.cpp')
-rw-r--r-- | src/particles/qquickcustomaffector.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp index 37db984e92..40d0df1a22 100644 --- a/src/particles/qquickcustomaffector.cpp +++ b/src/particles/qquickcustomaffector.cpp @@ -143,13 +143,16 @@ void QQuickCustomAffector::affectSystem(qreal dt) if (m_onceOff) dt = 1.0; - v8::Handle<v8::Array> array = v8::Array::New(toAffect.size()); + QQmlEngine *qmlEngine = ::qmlEngine(this); + QV4::ExecutionEngine *v4 = QV8Engine::getV4(qmlEngine->handle()); + + QV4::ArrayObject *array = v4->newArrayObject(toAffect.size()); for (int i=0; i<toAffect.size(); i++) - array->Set(i, toAffect[i]->v4Value().toValue()); + array->putIndexed(i, toAffect[i]->v4Value().toValue()); if (dt >= simulationCutoff || dt <= simulationDelta) { affectProperties(toAffect, dt); - emit affectParticles(QQmlV4Handle(array->v4Value()), dt); + emit affectParticles(QQmlV4Handle(QV4::Value::fromObject(array)), dt); } else { int realTime = m_system->timeInt; m_system->timeInt -= dt * 1000.0; @@ -157,12 +160,12 @@ void QQuickCustomAffector::affectSystem(qreal dt) m_system->timeInt += simulationDelta * 1000.0; dt -= simulationDelta; affectProperties(toAffect, simulationDelta); - emit affectParticles(QQmlV4Handle(array->v4Value()), simulationDelta); + emit affectParticles(QQmlV4Handle(QV4::Value::fromObject(array)), simulationDelta); } m_system->timeInt = realTime; if (dt > 0.0) { affectProperties(toAffect, dt); - emit affectParticles(QQmlV4Handle(array->v4Value()), dt); + emit affectParticles(QQmlV4Handle(QV4::Value::fromObject(array)), dt); } } |