X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fnodes%2Fnode.cpp;h=d80d7c45fbfd455128c423c2c05a85d04f02761e;hb=e08e2992259823c5f9832ad959ffa510b0445a6c;hp=5030a03f96d8b1c3726f2188fdac6a273803f003;hpb=6d1cfb307eea9fcae35878fa977d43feffd3f84c;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/nodes/node.cpp b/dali/internal/update/nodes/node.cpp old mode 100644 new mode 100755 index 5030a03..d80d7c4 --- a/dali/internal/update/nodes/node.cpp +++ b/dali/internal/update/nodes/node.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -25,14 +25,14 @@ #include #include -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 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; +// 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,13 +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 ); +uint32_t Node::mNodeCounter = 0; ///< A counter to provide unique node ids, up-to 4 billion Node* Node::New() { - return new ( gNodeMemoryPool.AllocateRawThreadSafe() ) Node(); + return new ( gNodeMemoryPool.AllocateRawThreadSafe() ) Node; } void Node::Delete( Node* node ) @@ -88,6 +88,7 @@ Node::Node() mOrientation(), // Initialized to identity by default mScale( TRANSFORM_PROPERTY_SCALE ), mVisible( true ), + mCulled( false ), mColor( Color::WHITE ), mWorldPosition( TRANSFORM_PROPERTY_WORLD_POSITION, Vector3( 0.0f,0.0f,0.0f ) ), // Zero initialized by default mWorldScale( TRANSFORM_PROPERTY_WORLD_SCALE, Vector3( 1.0f,1.0f,1.0f ) ), @@ -95,14 +96,15 @@ Node::Node() mWorldMatrix(), mWorldColor( Color::WHITE ), mClippingSortModifier( 0u ), + mId( ++mNodeCounter ), mParent( NULL ), mExclusiveRenderTask( NULL ), mChildren(), mClippingDepth( 0u ), mScissorDepth( 0u ), mDepthIndex( 0u ), + mDirtyFlags( NodePropertyFlags::ALL ), mRegenerateUniformMap( 0 ), - mDirtyFlags( AllFlags ), mDrawMode( DrawMode::NORMAL ), mColorMode( DEFAULT_COLOR_MODE ), mClippingMode( ClippingMode::DISABLED ), @@ -137,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 @@ -182,14 +189,14 @@ void Node::RemoveUniformMapping( const std::string& uniformName ) void Node::PrepareRender( BufferIndex bufferIndex ) { - if(mRegenerateUniformMap != 0 ) + if( mRegenerateUniformMap != 0 ) { if( mRegenerateUniformMap == 2 ) { CollectedUniformMap& localMap = mCollectedUniformMap[ bufferIndex ]; localMap.Resize(0); - for( unsigned int i=0, count=mUniformMaps.Count(); i::type; - mDirtyFlags = NothingFlag; + return static_cast( static_cast( mDirtyFlags ) | + ( static_cast( parentFlags ) & static_cast( InheritedDirtyFlags ) ) ); +} + +void Node::ResetDirtyFlags( BufferIndex updateBufferIndex ) +{ + mDirtyFlags = NodePropertyFlags::NOTHING; } void Node::SetParent( Node& parentNode ) @@ -360,22 +375,6 @@ void Node::RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex ) } // namespace SceneGraph -template <> -void OwnerPointer::Reset() -{ - if( mObject != NULL ) - { - Dali::Internal::SceneGraph::Node::Delete( mObject ); - mObject = NULL; - } -} - } // namespace Internal -template <> -void OwnerContainer::Delete(Dali::Internal::SceneGraph::Node* pointer) -{ - Dali::Internal::SceneGraph::Node::Delete( pointer ); -} - } // namespace Dali