X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-base-impl.cpp;h=a32b8e55df21a7080160bbd142e71587cc97ecbb;hb=ddf213d6be29c945105fdeba076ba7ce98acd9ba;hp=86d2114168ce11740c628c6b7dbc6f56cd9bcfe0;hpb=07bdc775bf08ac2f53c8f6a3a8856077a299959b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index 86d2114..a32b8e5 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-impl.cpp @@ -23,7 +23,7 @@ #include //INTERNAL HEARDER -#include +#include #include #include @@ -55,13 +55,13 @@ void Visual::Base::SetCustomShader( const Property::Map& shaderMap ) } else { - mImpl->mCustomShader = new Impl::CustomShader( shaderMap ); + mImpl->mCustomShader = new Impl::CustomShader( shaderMap ); } } -void Visual::Base::Initialize( Actor& actor, const Property::Map& propertyMap ) +void Visual::Base::SetProperties( const Property::Map& propertyMap ) { - Property::Value* customShaderValue = propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER ); + Property::Value* customShaderValue = propertyMap.Find( VisualProperty::SHADER, CUSTOM_SHADER ); if( customShaderValue ) { Property::Map shaderMap; @@ -71,17 +71,34 @@ void Visual::Base::Initialize( Actor& actor, const Property::Map& propertyMap ) } } - DoInitialize( actor, propertyMap ); + Property::Value* transform = propertyMap.Find( Toolkit::Visual::DevelProperty::TRANSFORM, TRANSFORM ); + if( transform ) + { + Property::Map map; + if( transform->Get( map ) ) + { + mImpl->mTransform.SetPropertyMap( map ); + } + } + + DoSetProperties( propertyMap ); } -void Visual::Base::SetSize( const Vector2& size ) +void Visual::Base::SetTransformAndSize( const Property::Map& transform, Size controlSize ) { - mImpl->mSize = size; + mImpl->mControlSize = controlSize; + mImpl->mTransform.SetPropertyMap( transform ); + OnSetTransform(); } -const Vector2& Visual::Base::GetSize() const +void Visual::Base::SetName( const std::string& name ) { - return mImpl->mSize; + mImpl->mName = name; +} + +const std::string& Visual::Base::GetName() +{ + return mImpl->mName; } float Visual::Base::GetHeightForWidth( float width ) const @@ -89,7 +106,7 @@ float Visual::Base::GetHeightForWidth( float width ) const return 0.f; } -void Visual::Base::GetNaturalSize( Vector2& naturalSize ) const +void Visual::Base::GetNaturalSize( Vector2& naturalSize ) { naturalSize = Vector2::ZERO; } @@ -110,13 +127,19 @@ float Visual::Base::GetDepthIndex() const void Visual::Base::SetOnStage( Actor& actor ) { - // To display the actor correctly, renderer should not be added to actor until all required resources are ready. - // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing. - DoSetOnStage( actor ); + if( !IsOnStage() ) + { + // To display the actor correctly, renderer should not be added to actor until all required resources are ready. + // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing. + DoSetOnStage( actor ); - mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); - mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex ); - mImpl->mFlags |= Impl::IS_ON_STAGE; + if( mImpl->mRenderer ) + { + mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); + mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex ); + mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists + } + } } void Visual::Base::SetOffStage( Actor& actor ) @@ -137,6 +160,10 @@ void Visual::Base::CreatePropertyMap( Property::Map& map ) const { mImpl->mCustomShader->CreatePropertyMap( map ); } + + Property::Map transform; + mImpl->mTransform.GetPropertyMap( transform ); + map.Insert( Toolkit::Visual::DevelProperty::TRANSFORM, transform ); } void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled ) @@ -177,42 +204,6 @@ bool Visual::Base::IsFromCache() const return mImpl->mFlags & Impl::IS_FROM_CACHE; } -void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) -{ - DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) && - ( index > VISUAL_PROPERTY_BASE_START_INDEX ) && // Change the type of visual is not allowed. - "Property index is out of bounds" ); - - if( index < VISUAL_PROPERTY_START_INDEX ) - { - // TODO set the properties of the visual base. - } - else - { - DoSetProperty( index, propertyValue ); - } -} - -Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index ) -{ - DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) && - ( index >= VISUAL_PROPERTY_BASE_START_INDEX ) && - "Property index is out of bounds" ); - - Dali::Property::Value value; - - if( index < VISUAL_PROPERTY_START_INDEX ) - { - // TODO retrieve the properties of the visual base. - } - else - { - value = DoGetProperty( index ); - } - - return value; -} - } // namespace Internal } // namespace Toolkit