- mImpl->mBackgroundRenderer.RemoveAndReset( self );
- Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get();
- mImpl->mBackgroundRenderer = factory.GetControlRenderer( map );
- if( mImpl->mBackgroundRenderer && self.OnStage() ) // Request control renderer with a property map might return an empty handle
+ Toolkit::Visual::Base backgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
+
+ // if new visual created, replace existing one
+ if( backgroundVisual )
+ {
+ if( self.OnStage() )
+ {
+ mImpl->mBackgroundVisual.RemoveAndReset( self );
+ backgroundVisual.SetOnStage( self );
+ }
+ mImpl->mBackgroundVisual = backgroundVisual;
+ mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
+ }
+ // ...otherwise process map and apply it to the existing visual
+ else if( mImpl->mBackgroundVisual )