Revert "[Tizen] Add codes for Dali Windows Backend"
[platform/core/uifw/dali-core.git] / dali / internal / update / nodes / node.cpp
index f462feb..aa7f777 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 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.
@@ -30,6 +30,16 @@ namespace //Unnamed 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
+int gNodeCount =0;
+
+// Called when the process is about to exit, Node count should be zero at this point.
+void __attribute__ ((destructor)) ShutDown(void)
+{
+DALI_ASSERT_DEBUG( (gNodeCount == 0) && "Node memory leak");
+}
+#endif
 }
 
 namespace Dali
@@ -89,6 +99,7 @@ Node::Node()
   mExclusiveRenderTask( NULL ),
   mChildren(),
   mClippingDepth( 0u ),
+  mScissorDepth( 0u ),
   mDepthIndex( 0u ),
   mRegenerateUniformMap( 0 ),
   mDirtyFlags( AllFlags ),
@@ -96,10 +107,16 @@ Node::Node()
   mColorMode( DEFAULT_COLOR_MODE ),
   mClippingMode( ClippingMode::DISABLED ),
   mIsRoot( false ),
-  mIsLayer( false )
+  mIsLayer( false ),
+  mPositionUsesAnchorPoint( true )
 {
   mUniformMapChanged[0] = 0u;
   mUniformMapChanged[1] = 0u;
+
+#ifdef DEBUG_ENABLED
+  gNodeCount++;
+#endif
+
 }
 
 Node::~Node()
@@ -108,6 +125,10 @@ Node::~Node()
   {
     mTransformManager->RemoveTransform(mTransformId);
   }
+
+#ifdef DEBUG_ENABLED
+  gNodeCount--;
+#endif
 }
 
 void Node::OnDestroy()
@@ -135,6 +156,9 @@ void Node::CreateTransform( SceneGraph::TransformManager* transformManager )
   mWorldScale.Initialize( transformManager, mTransformId );
   mWorldOrientation.Initialize( transformManager, mTransformId );
   mWorldMatrix.Initialize( transformManager, mTransformId );
+
+  //Set whether the position should use the anchor point
+  transformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
 }
 
 void Node::SetRoot(bool isRoot)
@@ -144,7 +168,7 @@ void Node::SetRoot(bool isRoot)
   mIsRoot = isRoot;
 }
 
-void Node::AddUniformMapping( UniformPropertyMapping* map )
+void Node::AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map )
 {
   PropertyOwner::AddUniformMapping( map );
   mRegenerateUniformMap = 2;
@@ -286,11 +310,8 @@ int Node::GetDirtyFlags() const
   return flags;
 }
 
-void Node::ResetDefaultProperties( BufferIndex updateBufferIndex )
+void Node::ResetDirtyFlags( BufferIndex updateBufferIndex )
 {
-  mVisible.ResetToBaseValue( updateBufferIndex );
-  mColor.ResetToBaseValue( updateBufferIndex );
-
   mDirtyFlags = NothingFlag;
 }