From af5f94a8b3c76aa46401d9ddf49483367f3f7772 Mon Sep 17 00:00:00 2001 From: Xiangyin Ma Date: Wed, 21 Dec 2016 14:47:07 +0000 Subject: [PATCH] Fix a bug in control background setting Change-Id: I25eef3eff01496eb28ac12be79443e783fb09168 --- dali-toolkit/public-api/controls/control-impl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index e9a866e..e0e1383 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -460,12 +460,16 @@ Vector4 Control::GetBackgroundColor() const void Control::SetBackground( const Property::Map& map ) { Actor self( Self() ); - Toolkit::Visual::Base backgroundVisual; - InitializeVisual( self, backgroundVisual, map ); + 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 ); } -- 2.7.4