X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=9bf179ff61ae2f58cc8cf74b3a18364fbb028709;hb=559cb1e4e4e511235de326b496510a93941ac9a2;hp=b6ea20b467db4f17dc899da9dbf08b81ef107376;hpb=c14b41ce41b9128d953166c54fc063462a4c3384;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index b6ea20b..9bf179f 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -39,8 +39,11 @@ #include #include #include +#include #include #include +#include +#include namespace Dali { @@ -457,11 +460,29 @@ Vector4 Control::GetBackgroundColor() const void Control::SetBackground( const Property::Map& map ) { Actor self( Self() ); - InitializeVisual( self, mImpl->mBackgroundVisual, map ); - if( mImpl->mBackgroundVisual ) + 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 ) + { + Property::Value* premultipliedAlpha = map.Find( Toolkit::DevelVisual::Property::PREMULTIPLIED_ALPHA, Toolkit::Internal::PREMULTIPLIED_ALPHA ); + if( premultipliedAlpha ) + { + bool value( premultipliedAlpha->Get() ); + Toolkit::GetImplementation( mImpl->mBackgroundVisual ).EnablePreMultipliedAlpha( value ); + } + } } void Control::SetBackgroundImage( Image image )