X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fimage%2Fbatch-image-visual.cpp;h=0af5b4129e56793e81dbe7667a27754b5f408efe;hp=2aba159e504bc111506f4dfdb80bb802ae6511c4;hb=9217ec0c1d483607ed6c8f08a1d9c238657ba5d6;hpb=8c0b17fb124c735b31c441873da4d7ffc4b15eb5 diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp index 2aba159..0af5b41 100644 --- a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp @@ -31,7 +31,7 @@ // INTERNAL HEADER #include -#include +#include #include #include #include @@ -88,13 +88,16 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( } // unnamed namespace -BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache ) +BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url ) { - return new BatchImageVisual( factoryCache ); + BatchImageVisualPtr visual = new BatchImageVisual( factoryCache ); + visual->mImageUrl = url; + return visual; } BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache ) : Visual::Base( factoryCache ), + mImageUrl(""), mDesiredSize() { } @@ -105,37 +108,26 @@ BatchImageVisual::~BatchImageVisual() 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 ); - } + desiredWidthValue->Get( desiredWidth ); + } - mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); + int desiredHeight = 0; + Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT ); + if( desiredHeightValue ) + { + desiredHeightValue->Get( desiredHeight ); } -} -void BatchImageVisual::SetSize( const Vector2& size ) -{ - Visual::Base::SetSize( size ); + mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); } -void BatchImageVisual::GetNaturalSize( Vector2& naturalSize ) const +void BatchImageVisual::GetNaturalSize( Vector2& naturalSize ) { if( mDesiredSize.GetWidth() > 0 && mDesiredSize.GetHeight() > 0 ) { @@ -235,7 +227,7 @@ void BatchImageVisual::DoSetOffStage( Actor& actor ) void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const { map.Clear(); - map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE ); + map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE ); if( !mImageUrl.empty() ) { @@ -246,17 +238,6 @@ 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 ); @@ -278,6 +259,14 @@ void BatchImageVisual::CleanCache(const std::string& url) } } +void BatchImageVisual::OnSetTransform() +{ + if( mImpl->mRenderer ) + { + //Register transform properties + mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT ); + } +} } // namespace Internal