X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-factory-impl.cpp;h=3aef5bc9ee81878eaa203e4d94c92a002d100c69;hb=4d305b893731daafafc293b92dc4fa25a896e929;hp=8a5d24554913e9379874ebe1ee102918d7639cb8;hpb=8cfc7965881ba756bca7bdde98b548200a649bd4;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 8a5d245..3aef5bc 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,31 +119,42 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property { Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME ); std::string imageUrl; - if( imageURLValue && imageURLValue->Get( imageUrl ) ) + if( imageURLValue ) { - VisualUrl visualUrl( imageUrl ); - - switch( visualUrl.GetType() ) + if( imageURLValue->Get( imageUrl ) ) { - case VisualUrl::N_PATCH: - { - visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); - break; - } - case VisualUrl::SVG: - { - visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); - break; - } - case VisualUrl::GIF: + VisualUrl visualUrl( imageUrl ); + + switch( visualUrl.GetType() ) { - visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); - break; + case VisualUrl::N_PATCH: + { + visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); + break; + } + case VisualUrl::SVG: + { + visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); + break; + } + case VisualUrl::GIF: + { + visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); + break; + } + case VisualUrl::REGULAR_IMAGE: + { + visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); + break; + } } - case VisualUrl::REGULAR_IMAGE: + } + else + { + Property::Array* array = imageURLValue->GetArray(); + if( array ) { - visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), visualUrl, propertyMap ); - break; + visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), *array, propertyMap ); } } } @@ -200,9 +211,20 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property { Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME ); std::string imageUrl; - if( imageURLValue && imageURLValue->Get( imageUrl ) ) + if( imageURLValue ) { - visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + if( imageURLValue->Get( imageUrl ) ) + { + visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + } + else + { + Property::Array* array = imageURLValue->GetArray(); + if( array ) + { + visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), *array, propertyMap ); + } + } } break; } @@ -294,6 +316,15 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image return Toolkit::Visual::Base( visualPtr.Get() ); } +Internal::TextureManager& VisualFactory::GetTextureManager() +{ + if( !mFactoryCache ) + { + mFactoryCache = new VisualFactoryCache(); + } + return mFactoryCache->GetTextureManager(); +} + } // namespace Internal } // namespace Toolkit