X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-base-impl.cpp;h=9cd41e074869c0c48a41277f5506dc23b68b3a5e;hp=922f561353fee06c84ab40e43ce238bb010ba02e;hb=f871dce5373ce3d4f414963a68505eefc0d49cd2;hpb=04dface1b4b122e8eef10026bf0a45d621d5f3d7 diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index 922f561..9cd41e0 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 @@ -59,9 +59,9 @@ void Visual::Base::SetCustomShader( const Property::Map& 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,7 +71,17 @@ 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::SetName( const std::string& name ) @@ -94,7 +104,12 @@ const Vector2& Visual::Base::GetSize() const return mImpl->mSize; } -void Visual::Base::GetNaturalSize( Vector2& naturalSize ) const +float Visual::Base::GetHeightForWidth( float width ) const +{ + return 0.f; +} + +void Visual::Base::GetNaturalSize( Vector2& naturalSize ) { naturalSize = Vector2::ZERO; } @@ -119,14 +134,17 @@ void Visual::Base::SetOnStage( Actor& actor ) // 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 ) { - if( GetIsOnStage() ) + if( IsOnStage() ) { DoSetOffStage( actor ); @@ -134,6 +152,20 @@ void Visual::Base::SetOffStage( Actor& actor ) } } +void Visual::Base::CreatePropertyMap( Property::Map& map ) const +{ + DoCreatePropertyMap( map ); + + if( mImpl->mCustomShader ) + { + mImpl->mCustomShader->CreatePropertyMap( map ); + } + + Property::Map transform; + mImpl->mTransform.GetPropertyMap( transform ); + map.Insert( Toolkit::Visual::DevelProperty::TRANSFORM, transform ); +} + void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled ) { if(preMultipled) @@ -162,22 +194,12 @@ void Visual::Base::DoSetOffStage( Actor& actor ) mImpl->mRenderer.Reset(); } -void Visual::Base::CreatePropertyMap( Property::Map& map ) const -{ - DoCreatePropertyMap( map ); - - if( mImpl->mCustomShader ) - { - mImpl->mCustomShader->CreatePropertyMap( map ); - } -} - -bool Visual::Base::GetIsOnStage() const +bool Visual::Base::IsOnStage() const { return mImpl->mFlags & Impl::IS_ON_STAGE; } -bool Visual::Base::GetIsFromCache() const +bool Visual::Base::IsFromCache() const { return mImpl->mFlags & Impl::IS_FROM_CACHE; } @@ -190,6 +212,16 @@ void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Propert if( index < VISUAL_PROPERTY_START_INDEX ) { + if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM ) + { + Property::Map* map = propertyValue.GetMap(); + if( map ) + { + mImpl->mTransform.SetPropertyMap( *map ); + OnSetTransform(); + } + } + // TODO set the properties of the visual base. } else @@ -208,6 +240,12 @@ Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index ) if( index < VISUAL_PROPERTY_START_INDEX ) { + if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM ) + { + Property::Map map; + mImpl->mTransform.GetPropertyMap( map ); + return map; + } // TODO retrieve the properties of the visual base. } else