+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady \n");
+
+ // A resource is ready, check if is in the replacement visual container
+ // Iterate through all visuals in replacement container and store indexes of ready visuals
+ Dali::Vector <Property::Index> readyVisuals;
+ Actor self = mControlImpl.Self();
+
+ for( auto replacementVisualIter = mReplacementVisuals.Begin();
+ replacementVisualIter < mReplacementVisuals.End(); ++replacementVisualIter )
+ {
+ const Toolkit::Visual::Base replacementVisual = (*replacementVisualIter)->visual;
+ const Internal::Visual::Base& replacementVisualImpl = Toolkit::GetImplementation( replacementVisual );
+
+ if( replacementVisualImpl.IsResourceReady() )
+ {
+ // Check if new replacement visual (index) is already queued for replacement and swap old for new.
+ RegisteredVisualContainer::Iterator registeredVisualsIter;
+ if( FindVisual( (*replacementVisualIter)->index, mVisuals, registeredVisualsIter ) )
+ {
+ Property::Index readyVisualIndex = (*replacementVisualIter)->index;
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady: %d Ready to replace\n", readyVisualIndex );
+ readyVisuals.PushBack( readyVisualIndex );
+ // Remove current shown visual from stage and from registered visuals container
+ Toolkit::GetImplementation((*registeredVisualsIter)->visual).SetOffStage( self );
+ mVisuals.Erase( registeredVisualsIter );
+ }
+ }
+ }
+
+ for( auto readyVisualsIter = readyVisuals.Begin(); readyVisualsIter != readyVisuals.End(); readyVisualsIter++ )
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady: %d Matched\n", (*readyVisualsIter) );
+ // Move new visual to be shown from replacement container into the control's registered visuals container
+ // Replacement visual has already been set on stage when it was added to replacement container
+ RegisteredVisualContainer::Iterator readyReplacementVisual;
+ if( FindVisual( (*readyVisualsIter) , mReplacementVisuals, readyReplacementVisual ) )
+ {
+ MoveVisual( readyReplacementVisual, mReplacementVisuals, mVisuals ); // Erases visual from replacement queue
+ }
+ // A visual has been replaced so control will most likely need relayouting
+ mControlImpl.RelayoutRequest();
+ }