Fix minor coverity issues
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / particle-system / particle-emitter-impl.cpp
index 3cf8bf5..150d857 100644 (file)
@@ -51,9 +51,10 @@ public:
   ~FrameCallback() = default;
 
 private:
-  void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
+  bool Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
   {
     mEmitter->Update();
+    return true;
   }
 
   Internal::ParticleEmitter* mEmitter;
@@ -88,13 +89,21 @@ void ParticleEmitter::SetRenderer(const ParticleSystem::ParticleRenderer& render
 
 void ParticleEmitter::SetParticleCount(uint32_t maxParticleCount)
 {
-  // Default particle list has no data streams, it will replace old list
-  mParticleList = ParticleSystem::ParticleList::New(maxParticleCount,
-                                                    ParticleStream::POSITION_STREAM_BIT |
-                                                      ParticleStream::COLOR_STREAM_BIT |
-                                                      ParticleStream::VELOCITY_STREAM_BIT |
-                                                      ParticleStream::SCALE_STREAM_BIT |
-                                                      ParticleStream::LIFETIME_STREAM_BIT);
+  if(!mParticleList || maxParticleCount != GetImplementation(mParticleList).GetParticleCount())
+  {
+    // Default particle list has no data streams, it will replace old list
+    mParticleList = ParticleSystem::ParticleList::New(maxParticleCount,
+                                                      ParticleStream::POSITION_STREAM_BIT |
+                                                        ParticleStream::COLOR_STREAM_BIT |
+                                                        ParticleStream::VELOCITY_STREAM_BIT |
+                                                        ParticleStream::SCALE_STREAM_BIT |
+                                                        ParticleStream::LIFETIME_STREAM_BIT);
+  }
+}
+
+uint32_t ParticleEmitter::GetParticleCount()
+{
+  return GetImplementation(mParticleList).GetParticleCount();
 }
 
 ParticleSystem::ParticleList& ParticleEmitter::GetParticleList()