[4.0] Changed Update to reset only target properties each frame
[platform/core/uifw/dali-core.git] / dali / internal / update / manager / update-manager.h
index d603eb6..ccecef8 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
 #include <dali/internal/common/shader-saver.h>
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/update/animation/scene-graph-animation.h>
+#include <dali/internal/update/common/property-resetter.h>
 #include <dali/internal/update/common/scene-graph-buffers.h>
 #include <dali/internal/update/common/scene-graph-property-notification.h>
 #include <dali/internal/update/nodes/node.h>
@@ -238,6 +239,13 @@ public:
    */
   bool IsAnimationRunning() const;
 
+  /**
+   * Add a property resetter. UpdateManager takes ownership of the object.
+   * It will be killed by UpdateManager when the associated animator or
+   * constraint has finished; or the property owner of the property is destroyed.
+   */
+  void AddPropertyResetter( OwnerPointer<PropertyResetterBase>& propertyResetter );
+
   // Property Notification
 
   /**
@@ -1294,6 +1302,18 @@ inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDe
   new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
 }
 
+inline void AddResetterMessage( UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter )
+{
+  typedef MessageValue1< UpdateManager, OwnerPointer<PropertyResetterBase> > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
+}
+
+
 } // namespace SceneGraph
 
 } // namespace Internal