[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-owner.h
old mode 100644 (file)
new mode 100755 (executable)
index ffce83f..637d82b
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H
+#define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
  *
  */
 
-// EXTERNAL INCLUDES
-
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-vector.h>
+#include <dali/devel-api/common/owner-container.h>
 #include <dali/internal/common/message.h>
-#include <dali/internal/common/owner-container.h>
 #include <dali/internal/update/common/property-base.h>
 #include <dali/internal/update/common/scene-graph-buffers.h>
+#include <dali/internal/update/common/uniform-map.h>
 #include <dali/internal/update/animation/scene-graph-constraint-declarations.h>
 
+
 namespace Dali
 {
 
@@ -55,10 +55,15 @@ public:
   public:
 
     /**
+     * Called when the observable object is connected to the scene graph.
+     * @param[in] owner A reference to the connected PropertyOwner
+     */
+    virtual void PropertyOwnerConnected( PropertyOwner& owner ) = 0;
+
+    /**
      * Called when the observable object is disconnected from the scene graph.
      * @param[in] currentBufferIndex The buffer to reset.
-     * @post The observer is automatically disconnected
-     * (observer will not receive the PropertyOwnerDestroyed callback after this)
+     * @param[in] owner A reference to the disconnected PropertyOwner
      */
     virtual void PropertyOwnerDisconnected( BufferIndex updateBufferIndex, PropertyOwner& owner ) = 0;
 
@@ -69,6 +74,14 @@ public:
      * may not be called (i.e. when shutting down).
      */
     virtual void PropertyOwnerDestroyed( PropertyOwner& owner ) = 0;
+
+  protected:
+
+    /**
+     * Virtual destructor, no deletion through this interface
+     */
+    virtual ~Observer() {}
+
   };
 
   /**
@@ -110,7 +123,13 @@ public:
   void Destroy();
 
   /**
-   * Disconnect all observers and remove constraints.
+   * Notify all observers that the object has been connected
+   * This occurs when the object is connected to the scene-graph during UpdateManager::Update().
+   */
+  void ConnectToSceneGraph();
+
+  /**
+   * Notify all observers that the object has been disconnected and remove constraints.
    * This occurs when the object is disconnected from the scene-graph during UpdateManager::Update().
    * @param[in] currentBufferIndex The current update buffer.
    */
@@ -121,7 +140,7 @@ public:
    * @post The PropertyOwner takes ownership of the property.
    * @param[in] property A pointer to a newly allocated property.
    */
-  void InstallCustomProperty(PropertyBase* property);
+  void InstallCustomProperty( OwnerPointer<PropertyBase>& property );
 
   /**
    * Retrieve the custom properties owned by the object.
@@ -141,12 +160,6 @@ public:
     return mCustomProperties;
   }
 
-  /**
-   * Reset animatable properties to the corresponding base values.
-   * @param[in] currentBufferIndex The buffer to reset.
-   * @post The ResetDefaultProperties method is called, during which derived classes can reset default properties.
-   */
-  void ResetToBaseValues( BufferIndex updateBufferIndex );
 
   // Constraints
 
@@ -154,7 +167,7 @@ public:
    * Apply a constraint.
    * @param[in] constraint The constraint to apply.
    */
-  void ApplyConstraint( ConstraintBase* constraint );
+  void ApplyConstraint( OwnerPointer<ConstraintBase>& constraint );
 
   /**
    * Begin removal of constraints.
@@ -168,6 +181,44 @@ public:
    */
   ConstraintOwnerContainer& GetConstraints();
 
+  /**
+   * @copydoc UniformMap::Add
+   */
+  virtual void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
+
+  /**
+   * @copydoc UniformMap::Remove
+   */
+  virtual void RemoveUniformMapping( const std::string& uniformName );
+
+  /**
+   * Get the mappings table
+   */
+  const UniformMap& GetUniformMap() const;
+
+  /**
+   * @copydoc UniformMap::AddUniformMapObserver
+   */
+  void AddUniformMapObserver( UniformMap::Observer& observer );
+
+  /**
+   * @copydoc UniformMap::RemoveUniformMapObserver
+   */
+  void RemoveUniformMapObserver( UniformMap::Observer& observer );
+
+  /**
+   * Set whether property has changed to run following a render.
+   * @param[in] value Set to true if the property has changed
+   */
+  virtual void SetPropertyDirty( bool value );
+
+  /**
+   * Query the property status following rendering of a frame.
+   * @return True if the property has changed
+   */
+  virtual bool IsPropertyDirty() const;
+
+
 protected:
 
   /**
@@ -183,15 +234,11 @@ private:
   // Undefined
   PropertyOwner& operator=(const PropertyOwner& rhs);
 
-  /**
-   * Called after ResetToBaseValues; derived classes should reset any default properties.
-   * @param[in] currentBufferIndex The buffer to reset.
-   */
-  virtual void ResetDefaultProperties( BufferIndex updateBufferIndex ) {}
-
 protected:
 
   OwnedPropertyContainer mCustomProperties; ///< Properties provided with InstallCustomProperty()
+  UniformMap mUniformMaps; ///< Container of owned uniform maps
+  bool mPropertyDirty:1; ///< Required for marking it dirty in case of partial update.
 
 private:
 
@@ -202,7 +249,6 @@ private:
   ObserverContainer mObservers; ///< Container of observer raw-pointers (not owned)
 
   ConstraintOwnerContainer mConstraints; ///< Container of owned constraints
-
 };
 
 } // namespace SceneGraph
@@ -211,4 +257,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H