Revert "[Tizen] Implement partial update"
[platform/core/uifw/dali-core.git] / dali / internal / update / nodes / node.cpp
index f5259db..d80d7c4 100755 (executable)
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/common/constants.h>
 
-namespace //Unnamed namespace
+namespace
 {
 //Memory pool used to allocate new nodes. Memory used by this pool will be released when process dies
 // or DALI library is unloaded
 Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Node> gNodeMemoryPool;
 #ifdef DEBUG_ENABLED
-// keep track of nodes created / deleted, to ensure we have 0 when the process exits or DALi library is unloaded
-int32_t gNodeCount =0;
+// keep track of nodes alive, to ensure we have 0 when the process exits or DALi library is unloaded
+int32_t gNodeCount = 0;
 
 // Called when the process is about to exit, Node count should be zero at this point.
 void __attribute__ ((destructor)) ShutDown(void)
@@ -40,7 +40,7 @@ void __attribute__ ((destructor)) ShutDown(void)
 DALI_ASSERT_DEBUG( (gNodeCount == 0) && "Node memory leak");
 }
 #endif
-}
+} // Unnamed namespace
 
 namespace Dali
 {
@@ -51,12 +51,13 @@ namespace Internal
 namespace SceneGraph
 {
 
-const PositionInheritanceMode Node::DEFAULT_POSITION_INHERITANCE_MODE( INHERIT_PARENT_POSITION );
 const ColorMode Node::DEFAULT_COLOR_MODE( USE_OWN_MULTIPLY_PARENT_ALPHA );
 
-Node* Node::New( uint32_t id )
+uint32_t Node::mNodeCounter = 0;        ///< A counter to provide unique node ids, up-to 4 billion
+
+Node* Node::New()
 {
-  return new ( gNodeMemoryPool.AllocateRawThreadSafe() ) Node( id );
+  return new ( gNodeMemoryPool.AllocateRawThreadSafe() ) Node;
 }
 
 void Node::Delete( Node* node )
@@ -77,7 +78,7 @@ void Node::Delete( Node* node )
   }
 }
 
-Node::Node( uint32_t id )
+Node::Node()
 : mTransformManager( NULL ),
   mTransformId( INVALID_TRANSFORM_ID ),
   mParentOrigin( TRANSFORM_PROPERTY_PARENT_ORIGIN ),
@@ -95,7 +96,7 @@ Node::Node( uint32_t id )
   mWorldMatrix(),
   mWorldColor( Color::WHITE ),
   mClippingSortModifier( 0u ),
-  mId( id ),
+  mId( ++mNodeCounter ),
   mParent( NULL ),
   mExclusiveRenderTask( NULL ),
   mChildren(),
@@ -138,6 +139,11 @@ void Node::OnDestroy()
   PropertyOwner::Destroy();
 }
 
+uint32_t Node::GetId() const
+{
+  return mId;
+}
+
 void Node::CreateTransform( SceneGraph::TransformManager* transformManager )
 {
   //Create a new transform
@@ -279,7 +285,7 @@ void Node::AddRenderer( Renderer* renderer )
   mRenderer.PushBack( renderer );
 }
 
-void Node::RemoveRenderer( Renderer* renderer )
+void Node::RemoveRenderer( const Renderer* renderer )
 {
   RendererContainer::SizeType rendererCount( mRenderer.Size() );
   for( RendererContainer::SizeType i = 0; i < rendererCount; ++i )