X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fsize-negotiation%2Frelayout-controller-impl.cpp;h=87d864533cc26ddb00557d0389765773fa8864dd;hb=403f5989d41f4e5c5a657e24020fe32c77fc1414;hp=eebc9817e149f93a67bf97909c42bb33d14dd120;hpb=719bb2f6939effe2a07155544667789553105518;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp index eebc981..87d8645 100644 --- a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp +++ b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 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. @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #if defined(DEBUG_ENABLED) #include -#include #endif // defined(DEBUG_ENABLED) // INTERNAL INCLUDES @@ -31,7 +30,6 @@ #include #include #include -#include #include namespace Dali @@ -76,8 +74,8 @@ void PrintChildren( Dali::Actor actor, int level ) DALI_LOG_INFO( gLogFilter, Debug::Verbose, output.str().c_str() ); ++level; - unsigned int numChildren = actor.GetChildCount(); - for( unsigned int i=0; iIsEnabledFor( Debug::Verbose ) ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "---------- ROOT LAYER ----------\n" ); + PrintChildren( Stage::GetCurrent()->GetRootLayer(), 0 ); } } @@ -111,7 +110,6 @@ RelayoutController::RelayoutController( Integration::RenderController& controlle mRelayoutInfoAllocator(), mSlotDelegate( this ), mRelayoutStack( new MemoryPoolRelayoutContainer( mRelayoutInfoAllocator ) ), - mStageSize(), // zero initialized mRelayoutConnection( false ), mRelayoutFlag( false ), mEnabled( false ), @@ -132,17 +130,12 @@ RelayoutController* RelayoutController::Get() return &ThreadLocalStorage::Get().GetRelayoutController(); } -void RelayoutController::SetStageSize( unsigned int width, unsigned int height ) -{ - mStageSize.width = width; - mStageSize.height = height; -} - -void RelayoutController::QueueActor( Dali::Actor& actor, RelayoutContainer& actors, Vector2 size ) +void RelayoutController::QueueActor( Internal::Actor* actor, RelayoutContainer& actors, Vector2 size ) { - if( GetImplementation( actor ).RelayoutRequired() ) + if( actor && actor->RelayoutRequired() ) { - actors.Add( actor, size ); + Dali::Actor actorHandle = Dali::Actor( actor ); + actors.Add( actorHandle, size ); } } @@ -159,7 +152,7 @@ void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type di topOfSubTreeStack.push_back( actor ); // Propagate on all dimensions - for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) { if( dimension & ( 1 << i ) ) { @@ -199,7 +192,7 @@ void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type di if ( !mProcessingCoreEvents ) { - mRenderController.RequestProcessEventsOnIdle(); + mRenderController.RequestProcessEventsOnIdle( false ); } } @@ -210,21 +203,6 @@ void RelayoutController::OnApplicationSceneCreated() // Open relayout controller to receive relayout requests mEnabled = true; - // Spread the dirty flag through whole tree - don't need to explicity - // add request on rootLayer as it will automatically be added below. - Dali::Stage stage = Dali::Stage::GetCurrent(); - Dali::Actor rootLayer = stage.GetRootLayer(); - RequestRelayoutTree( rootLayer ); - - // Also add request on the root of system overlay - Dali::Internal::SystemOverlay* systemOverlay = GetImplementation(stage).GetSystemOverlayInternal(); - if( systemOverlay ) - { - Dali::Internal::Actor& systemOverlayInternalRoot = systemOverlay->GetDefaultRootActor(); - Dali::Actor systemOverlayRoot = Dali::Actor(&systemOverlayInternalRoot); - RequestRelayoutTree( systemOverlayRoot ); - } - // Flag request for end of frame Request(); } @@ -253,7 +231,7 @@ void RelayoutController::RequestRelayoutTree( Dali::Actor& actor ) } // Propagate down to children - for( unsigned int i = 0; i < actor.GetChildCount(); ++i ) + for( uint32_t i = 0; i < actor.GetChildCount(); ++i ) { Dali::Actor child = actor.GetChildAt( i ); @@ -273,7 +251,7 @@ void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimen // Check for dimension dependecy: width for height/height for width etc // Check each possible dimension and see if it is dependent on the input one - for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) { Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i ); @@ -293,9 +271,9 @@ void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimen { // Store the highest parent reached bool found = false; - for( unsigned int i = 0, count = topOfSubTreeStack.size(); i < count; ++i ) + for( auto&& element : topOfSubTreeStack ) { - if( topOfSubTreeStack[ i ] == parent ) + if( element == parent ) { found = true; break; @@ -347,7 +325,7 @@ void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dim // Check for dimension dependecy: width for height/height for width etc // Check each possible dimension and see if it is dependent on the input one - for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) { Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i ); @@ -370,7 +348,7 @@ void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dim } // Propagate down to children - for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i ) + for( uint32_t i = 0, childCount = actor.GetChildCount(); i < childCount; ++i ) { Dali::Actor child = actor.GetChildAt( i ); Actor& childImpl = GetImplementation( child ); @@ -385,13 +363,13 @@ void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dim void RelayoutController::AddRequest( Dali::Actor& actor ) { - BaseObject* actorPtr = &GetImplementation( actor ); + Internal::Actor* actorPtr = &GetImplementation( actor ); // Only add the rootActor if it is not already recorded bool found = false; - for( unsigned int i = 0, count = mDirtyLayoutSubTrees.Size(); i < count; ++i ) + for( auto&& item : mDirtyLayoutSubTrees ) { - if( mDirtyLayoutSubTrees[ i ] == actorPtr ) + if( item == actorPtr ) { found = true; break; @@ -406,7 +384,7 @@ void RelayoutController::AddRequest( Dali::Actor& actor ) void RelayoutController::RemoveRequest( Dali::Actor& actor ) { - BaseObject* actorPtr = &GetImplementation( actor ); + Internal::Actor* actorPtr = &GetImplementation( actor ); // Remove actor from dirty sub trees for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it ) @@ -425,8 +403,7 @@ void RelayoutController::Request() if( !mRelayoutConnection ) { - Dali::Stage stage = Dali::Stage::GetCurrent(); - stage.GetObjectRegistry().ObjectDestroyedSignal().Connect( mSlotDelegate, &RelayoutController::OnObjectDestroyed ); + ThreadLocalStorage::Get().GetObjectRegistry().ObjectDestroyedSignal().Connect( mSlotDelegate, &RelayoutController::OnObjectDestroyed ); mRelayoutConnection = true; } @@ -452,19 +429,16 @@ void RelayoutController::Relayout() // These controls are paired with the parent/stage size and added to the stack. for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it ) { - BaseObject* dirtyActor = *it; + Internal::Actor* dirtyActor = *it; // Need to test if actor is valid (could have been deleted and had the pointer cleared) if( dirtyActor ) { - // We know that BaseObject is a base class of Internal::Actor but need to instruct the compiler to do the cast - Dali::Actor actor = Dali::Actor( reinterpret_cast( dirtyActor ) ); - // Only negotiate actors that are on stage - if( actor.OnStage() ) + if( dirtyActor->OnStage() ) { - Dali::Actor parent = actor.GetParent(); - QueueActor( actor, *mRelayoutStack, ( parent ) ? Vector2( parent.GetTargetSize() ) : mStageSize ); + Internal::Actor* parent = dirtyActor->GetParent(); + QueueActor( dirtyActor, *mRelayoutStack, ( parent ) ? Vector2( parent->GetTargetSize() ) : dirtyActor->GetScene().GetSize() ); } } } @@ -492,6 +466,9 @@ void RelayoutController::Relayout() // has to fill with all the actors it has not done any size negotiation for. actorImpl.NegotiateSize( size, *mRelayoutStack ); + + // Reset the flag so that size negotiation will respect the actor's original resize policy + actorImpl.SetUseAssignedSize( false ); } }