X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-factory-impl.cpp;h=909cfcc03d3efeaeedbd980fea49fa11a7684849;hp=d7e4b97c09b88e06fd225cb0aaa1e92a90882aed;hb=0a98cc9159a2b5868987ec7f0b31b76f3dc10259;hpb=8c0b17fb124c735b31c441873da4d7ffc4b15eb5 diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index d7e4b97..909cfcc 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -23,22 +23,22 @@ #include #include #include -#include #include // INTERNAL INCLUDES #include -#include +#include +#include #include #include #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -56,18 +56,6 @@ namespace Internal namespace { -DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_TYPE ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, BORDER ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, COLOR ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, GRADIENT ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, IMAGE ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, MESH ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, PRIMITIVE ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, WIREFRAME ) -DALI_ENUM_TO_STRING_TABLE_END( VISUAL_TYPE ) - -const char * const VISUAL_TYPE( "visualType" ); -const char * const BATCHING_ENABLED( "batchingEnabled" ); BaseHandle Create() { BaseHandle handle = Toolkit::VisualFactory::Get(); @@ -97,16 +85,10 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property mFactoryCache = new VisualFactoryCache(); } - // Return a new WireframeVisual if we have debug enabled - if( mDebugEnabled ) - { - return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() ); - } - Visual::BasePtr visualPtr; - Property::Value* typeValue = propertyMap.Find( Toolkit::VisualProperty::TYPE, VISUAL_TYPE ); - Toolkit::Visual::Type visualType = Toolkit::Visual::IMAGE; // Default to IMAGE type. + Property::Value* typeValue = propertyMap.Find( Toolkit::DevelVisual::Property::TYPE, VISUAL_TYPE ); + Toolkit::DevelVisual::Type visualType = Toolkit::DevelVisual::IMAGE; // Default to IMAGE type. if( typeValue ) { Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType ); @@ -116,19 +98,19 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property { case Toolkit::Visual::BORDER: { - visualPtr = BorderVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = BorderVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } case Toolkit::Visual::COLOR: { - visualPtr = ColorVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = ColorVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } case Toolkit::Visual::GRADIENT: { - visualPtr = GradientVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = GradientVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } @@ -142,30 +124,19 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property UrlType::Type type = ResolveUrlType( imageUrl ); if( UrlType::N_PATCH == type ) { - visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } else if( UrlType::SVG == type ) { - visualPtr = SvgVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); + } + else if( UrlType::GIF == type ) + { + visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } else // Regular image { - bool batchingEnabled( false ); - Property::Value* batchingEnabledValue = propertyMap.Find( Toolkit::ImageVisual::Property::BATCHING_ENABLED, BATCHING_ENABLED ); - if( batchingEnabledValue ) - { - batchingEnabledValue->Get( batchingEnabled ); - } - - if( batchingEnabled ) - { - visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ) ); - break; - } - else - { - visualPtr = ImageVisual::New( *( mFactoryCache.Get() ) ); - } + visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } } @@ -174,36 +145,38 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property case Toolkit::Visual::MESH: { - visualPtr = MeshVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = MeshVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } case Toolkit::Visual::PRIMITIVE: { - visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } case Toolkit::Visual::WIREFRAME: { - visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } - case Toolkit::Visual::TEXT: + case Toolkit::DevelVisual::TEXT: { - visualPtr = TextVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = TextVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } } - if( visualPtr ) + if( !visualPtr ) { - visualPtr->SetProperties( propertyMap ); + DALI_LOG_ERROR( "Renderer type unknown\n" ); } - else + + if( mDebugEnabled && visualType != Toolkit::DevelVisual::WIREFRAME ) { - DALI_LOG_ERROR( "Renderer type unknown\n" ); + //Create a WireframeVisual if we have debug enabled + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), visualPtr, propertyMap ); } return Toolkit::Visual::Base( visualPtr.Get() ); @@ -216,11 +189,6 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image ) mFactoryCache = new VisualFactoryCache(); } - if( mDebugEnabled ) - { - return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() ); - } - Visual::BasePtr visualPtr; NinePatchImage npatchImage = NinePatchImage::DownCast( image ); @@ -233,6 +201,12 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image ) visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), image ); } + if( mDebugEnabled ) + { + //Create a WireframeVisual if we have debug enabled + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), visualPtr ); + } + return Toolkit::Visual::Base( visualPtr.Get() ); } @@ -243,11 +217,6 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image mFactoryCache = new VisualFactoryCache(); } - if( mDebugEnabled ) - { - return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() ); - } - Visual::BasePtr visualPtr; // first resolve url type to know which visual to create @@ -258,13 +227,23 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image } else if( UrlType::SVG == type ) { - visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), url, size ); + visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), url ); + } + else if( UrlType::GIF == type ) + { + visualPtr = AnimatedImageVisual::New( *( mFactoryCache.Get() ), url ); } else // Regular image { visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), url, size ); } + if( mDebugEnabled ) + { + //Create a WireframeVisual if we have debug enabled + visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ), visualPtr ); + } + return Toolkit::Visual::Base( visualPtr.Get() ); }