X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fimage%2Fbatch-image-visual.cpp;h=90d2b5300fc8abc7d08c3b480b813cd6bd59394c;hb=d1cfad4519366d33c73f7152451735e664ad241c;hp=10418b7aa54f969458d463ae3d8b954b2e8ef56d;hpb=0de4495ae0ad22b60ce3d1257e30628ea518f377;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp index 10418b7..90d2b53 100644 --- a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp @@ -31,6 +31,7 @@ // INTERNAL HEADER #include +#include #include #include #include @@ -85,11 +86,19 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( }\n ); -} //unnamed namespace +} // unnamed namespace + +BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url ) +{ + BatchImageVisualPtr visual = new BatchImageVisual( factoryCache ); + visual->mImageUrl = url; + return visual; +} BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache ) - : Visual::Base( factoryCache ), - mDesiredSize() +: Visual::Base( factoryCache ), + mImageUrl(""), + mDesiredSize() { } @@ -97,50 +106,25 @@ BatchImageVisual::~BatchImageVisual() { } -void BatchImageVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap ) +void BatchImageVisual::DoSetProperties( const Property::Map& propertyMap ) { - std::string oldImageUrl = mImageUrl; - Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME ); + // url already passed in constructor - if( imageURLValue ) + int desiredWidth = 0; + Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH ); + if( desiredWidthValue ) { - imageURLValue->Get( mImageUrl ); - - int desiredWidth = 0; - Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH ); - if( desiredWidthValue ) - { - desiredWidthValue->Get( desiredWidth ); - } - - int desiredHeight = 0; - Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT ); - if( desiredHeightValue ) - { - desiredHeightValue->Get( desiredHeight ); - } - - mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); + desiredWidthValue->Get( desiredWidth ); } - // Remove old renderer if exit. - if( mImpl->mRenderer ) + int desiredHeight = 0; + Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT ); + if( desiredHeightValue ) { - if( actor ) // Remove old renderer from actor. - { - actor.RemoveRenderer( mImpl->mRenderer ); - } - if( !oldImageUrl.empty() ) // Clean old renderer from cache. - { - CleanCache( oldImageUrl ); - } + desiredHeightValue->Get( desiredHeight ); } - // If actor is on stage, create new renderer and apply to actor. - if( actor && actor.OnStage() ) - { - SetOnStage( actor ); - } + mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); } void BatchImageVisual::SetSize( const Vector2& size ) @@ -148,7 +132,7 @@ void BatchImageVisual::SetSize( const Vector2& size ) Visual::Base::SetSize( size ); } -void BatchImageVisual::GetNaturalSize( Vector2& naturalSize ) const +void BatchImageVisual::GetNaturalSize( Vector2& naturalSize ) { if( mDesiredSize.GetWidth() > 0 && mDesiredSize.GetHeight() > 0 ) { @@ -248,7 +232,7 @@ void BatchImageVisual::DoSetOffStage( Actor& actor ) void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const { map.Clear(); - map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE ); + map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE ); if( !mImageUrl.empty() ) { @@ -259,6 +243,17 @@ void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const } } +void BatchImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) +{ + // TODO +} + +Dali::Property::Value BatchImageVisual::DoGetProperty( Dali::Property::Index index ) +{ + // TODO + return Dali::Property::Value(); +} + Shader BatchImageVisual::GetBatchShader( VisualFactoryCache& factoryCache ) { Shader shader = factoryCache.GetShader( VisualFactoryCache::BATCH_IMAGE_SHADER );