From 4ed6dc168df9f847235529aa22d90e316f99a71f Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Mon, 28 Nov 2016 12:01:01 +0000 Subject: [PATCH] Visuals call SetProperties internally for 2-stage initialization Change-Id: I7da559f150e09d51e88a0c94ee651f572da0d190 --- .../internal/visuals/border/border-visual.cpp | 6 +++-- .../internal/visuals/border/border-visual.h | 3 ++- .../internal/visuals/color/color-visual.cpp | 6 +++-- dali-toolkit/internal/visuals/color/color-visual.h | 3 ++- .../internal/visuals/gradient/gradient-visual.cpp | 6 +++-- .../internal/visuals/gradient/gradient-visual.h | 3 ++- .../internal/visuals/image/batch-image-visual.cpp | 4 +++- .../internal/visuals/image/batch-image-visual.h | 4 +++- .../internal/visuals/image/image-visual.cpp | 22 +++++++++++++++++- dali-toolkit/internal/visuals/image/image-visual.h | 21 +++++++++++++++++ dali-toolkit/internal/visuals/mesh/mesh-visual.cpp | 6 +++-- dali-toolkit/internal/visuals/mesh/mesh-visual.h | 3 ++- .../internal/visuals/npatch/npatch-visual.cpp | 13 +++++++++-- .../internal/visuals/npatch/npatch-visual.h | 13 +++++++++++ .../visuals/primitive/primitive-visual.cpp | 6 +++-- .../internal/visuals/primitive/primitive-visual.h | 3 ++- dali-toolkit/internal/visuals/svg/svg-visual.cpp | 12 +++++++++- dali-toolkit/internal/visuals/svg/svg-visual.h | 14 +++++++++++ dali-toolkit/internal/visuals/text/text-visual.cpp | 6 +++-- dali-toolkit/internal/visuals/text/text-visual.h | 3 ++- .../internal/visuals/visual-factory-impl.cpp | 27 +++++++++------------- 21 files changed, 144 insertions(+), 40 deletions(-) diff --git a/dali-toolkit/internal/visuals/border/border-visual.cpp b/dali-toolkit/internal/visuals/border/border-visual.cpp index ac5cf01..3811a64 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.cpp +++ b/dali-toolkit/internal/visuals/border/border-visual.cpp @@ -119,9 +119,11 @@ const char* FRAGMENT_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER( ); } -BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache ) +BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - return new BorderVisual( factoryCache ); + BorderVisualPtr borderVisualPtr( new BorderVisual( factoryCache ) ); + borderVisualPtr->SetProperties( properties ); + return borderVisualPtr; } BorderVisual::BorderVisual( VisualFactoryCache& factoryCache ) diff --git a/dali-toolkit/internal/visuals/border/border-visual.h b/dali-toolkit/internal/visuals/border/border-visual.h index 4016fd8..c9d6465 100644 --- a/dali-toolkit/internal/visuals/border/border-visual.h +++ b/dali-toolkit/internal/visuals/border/border-visual.h @@ -56,9 +56,10 @@ public: * @brief Create a new border visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static BorderVisualPtr New( VisualFactoryCache& factoryCache ); + static BorderVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties ); protected: diff --git a/dali-toolkit/internal/visuals/color/color-visual.cpp b/dali-toolkit/internal/visuals/color/color-visual.cpp index 781fdf7..08dfd20 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.cpp +++ b/dali-toolkit/internal/visuals/color/color-visual.cpp @@ -80,9 +80,11 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( ); } -ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache ) +ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - return new ColorVisual( factoryCache ); + ColorVisualPtr colorVisualPtr( new ColorVisual( factoryCache ) ); + colorVisualPtr->SetProperties( properties ); + return colorVisualPtr; } ColorVisual::ColorVisual( VisualFactoryCache& factoryCache ) diff --git a/dali-toolkit/internal/visuals/color/color-visual.h b/dali-toolkit/internal/visuals/color/color-visual.h index ebe2768..99758d1 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.h +++ b/dali-toolkit/internal/visuals/color/color-visual.h @@ -53,9 +53,10 @@ public: * @brief Create a new color visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static ColorVisualPtr New( VisualFactoryCache& factoryCache ); + static ColorVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties ); public: // from Visual diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp index f573c1c..80c899f 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.cpp @@ -215,9 +215,11 @@ Dali::WrapMode::Type GetWrapMode( Toolkit::GradientVisual::SpreadMethod::Type sp } // unnamed namespace -GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache ) +GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - return new GradientVisual( factoryCache ); + GradientVisualPtr gradientVisualPtr( new GradientVisual( factoryCache ) ); + gradientVisualPtr->SetProperties( properties ); + return gradientVisualPtr; } GradientVisual::GradientVisual( VisualFactoryCache& factoryCache ) diff --git a/dali-toolkit/internal/visuals/gradient/gradient-visual.h b/dali-toolkit/internal/visuals/gradient/gradient-visual.h index 6248f0f..c64b588 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient-visual.h +++ b/dali-toolkit/internal/visuals/gradient/gradient-visual.h @@ -88,9 +88,10 @@ public: * @brief Create a new gradient visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static GradientVisualPtr New( VisualFactoryCache& factoryCache ); + static GradientVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties ); public: // from Visual diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp index 18ca0c7..f5b4392 100644 --- a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp @@ -89,10 +89,12 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( } // unnamed namespace -BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url ) +BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties ) { BatchImageVisualPtr visual = new BatchImageVisual( factoryCache ); visual->mImageUrl = url; + visual->SetProperties( properties ); + return visual; } diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.h b/dali-toolkit/internal/visuals/image/batch-image-visual.h index 4e8614f..84953f5 100644 --- a/dali-toolkit/internal/visuals/image/batch-image-visual.h +++ b/dali-toolkit/internal/visuals/image/batch-image-visual.h @@ -43,9 +43,11 @@ public: * @brief Create a new batch-image visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] url The URL of the image to use + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url ); + static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties = Property::Map() ); public: // from Visual diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 4f2fb6e..69a1094 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -203,6 +203,18 @@ Geometry CreateGeometry( VisualFactoryCache& factoryCache, ImageDimensions gridS ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, + const Property::Map& properties, + ImageDimensions size, + FittingMode::Type fittingMode, + Dali::SamplingMode::Type samplingMode ) +{ + ImageVisualPtr imageVisualPtr( new ImageVisual( factoryCache, imageUrl, size, fittingMode, samplingMode ) ); + imageVisualPtr->SetProperties( properties ); + return imageVisualPtr; +} + +ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, + const std::string& imageUrl, ImageDimensions size, FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode ) @@ -272,11 +284,14 @@ void ImageVisual::DoSetProperties( const Property::Map& propertyMap ) mSamplingMode = Dali::SamplingMode::Type( value ); } + // Use a variable to detect if the width or height have been modified by the property map. + bool desiredSizeSpecified = false; int desiredWidth = 0; Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH ); if( desiredWidthValue ) { desiredWidthValue->Get( desiredWidth ); + desiredSizeSpecified = true; } int desiredHeight = 0; @@ -284,9 +299,14 @@ void ImageVisual::DoSetProperties( const Property::Map& propertyMap ) if( desiredHeightValue ) { desiredHeightValue->Get( desiredHeight ); + desiredSizeSpecified = true; } - mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); + // Only update the desired size if specified in the property map. + if( desiredSizeSpecified ) + { + mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); + } Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME ); if( pixelAreaValue ) diff --git a/dali-toolkit/internal/visuals/image/image-visual.h b/dali-toolkit/internal/visuals/image/image-visual.h index e34d011..56c45fb 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.h +++ b/dali-toolkit/internal/visuals/image/image-visual.h @@ -86,9 +86,30 @@ public: * * @param[in] factoryCache The VisualFactoryCache object * @param[in] imageUrl The URL of the image resource to use + * @param[in] properties A Property::Map containing settings for this visual * @param[in] size The width and height to fit the loaded image to. * @param[in] fittingMode The FittingMode of the resource to load * @param[in] samplingMode The SamplingMode of the resource to load + * @return A smart-pointer to the newly allocated visual. + */ + static ImageVisualPtr New( VisualFactoryCache& factoryCache, + const std::string& imageUrl, + const Property::Map& properties, + ImageDimensions size = ImageDimensions(), + FittingMode::Type fittingMode = FittingMode::DEFAULT, + Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR ); + + /** + * @brief Create a new image visual with a URL. + * + * The visual will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage + * + * @param[in] factoryCache The VisualFactoryCache object + * @param[in] imageUrl The URL of the image resource to use + * @param[in] size The width and height to fit the loaded image to. + * @param[in] fittingMode The FittingMode of the resource to load + * @param[in] samplingMode The SamplingMode of the resource to load + * @return A smart-pointer to the newly allocated visual. */ static ImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, diff --git a/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp b/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp index 9e503f6..41b99ad 100644 --- a/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp +++ b/dali-toolkit/internal/visuals/mesh/mesh-visual.cpp @@ -344,9 +344,11 @@ const char* NORMAL_MAP_FRAGMENT_SHADER = DALI_COMPOSE_SHADER( } // unnamed namespace -MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache ) +MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - return new MeshVisual( factoryCache ); + MeshVisualPtr meshVisualPtr( new MeshVisual( factoryCache ) ); + meshVisualPtr->SetProperties( properties ); + return meshVisualPtr; } MeshVisual::MeshVisual( VisualFactoryCache& factoryCache ) diff --git a/dali-toolkit/internal/visuals/mesh/mesh-visual.h b/dali-toolkit/internal/visuals/mesh/mesh-visual.h index 8a9010c..c28b1b2 100644 --- a/dali-toolkit/internal/visuals/mesh/mesh-visual.h +++ b/dali-toolkit/internal/visuals/mesh/mesh-visual.h @@ -63,9 +63,10 @@ public: * @brief Create a new mesh visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static MeshVisualPtr New( VisualFactoryCache& factoryCache ); + static MeshVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties ); public: // from Visual diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp index 8751c3e..3af7b72 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp @@ -226,9 +226,18 @@ void RegisterStretchProperties( Renderer& renderer, const char * uniformName, co /////////////////NPatchVisual//////////////// +NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties ) +{ + NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) ); + nPatchVisual->mImageUrl = imageUrl; + nPatchVisual->SetProperties( properties ); + + return nPatchVisual; +} + NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl ) { - NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache ); + NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) ); nPatchVisual->mImageUrl = imageUrl; return nPatchVisual; @@ -236,7 +245,7 @@ NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std:: NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image ) { - NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache ); + NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) ); nPatchVisual->mImageUrl = image.GetUrl(); return nPatchVisual; diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.h b/dali-toolkit/internal/visuals/npatch/npatch-visual.h index 91972aa..0a0465f 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.h +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.h @@ -64,6 +64,19 @@ public: * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object * @param[in] imageUrl The URL to 9 patch image resource to use + * @param[in] properties A Property::Map containing settings for this visual + * @return A smart-pointer to the newly allocated visual. + */ + static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties ); + + /** + * @brief Create an N-patch visual using an image URL. + * + * The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] imageUrl The URL to 9 patch image resource to use + * @return A smart-pointer to the newly allocated visual. */ static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl ); diff --git a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp index 43c69cc..e949728 100644 --- a/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp +++ b/dali-toolkit/internal/visuals/primitive/primitive-visual.cpp @@ -178,9 +178,11 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( } // unnamed namespace -PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache ) +PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - return new PrimitiveVisual( factoryCache ); + PrimitiveVisualPtr primitiveVisualPtr( new PrimitiveVisual( factoryCache ) ); + primitiveVisualPtr->SetProperties( properties ); + return primitiveVisualPtr; } PrimitiveVisual::PrimitiveVisual( VisualFactoryCache& factoryCache ) diff --git a/dali-toolkit/internal/visuals/primitive/primitive-visual.h b/dali-toolkit/internal/visuals/primitive/primitive-visual.h index 006440a..7792321 100644 --- a/dali-toolkit/internal/visuals/primitive/primitive-visual.h +++ b/dali-toolkit/internal/visuals/primitive/primitive-visual.h @@ -105,9 +105,10 @@ public: * @brief Create a new primitive visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache ); + static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties ); public: // from Visual diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.cpp b/dali-toolkit/internal/visuals/svg/svg-visual.cpp index b375932..5dbb80f 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.cpp +++ b/dali-toolkit/internal/visuals/svg/svg-visual.cpp @@ -54,10 +54,20 @@ namespace Toolkit namespace Internal { +SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties ) +{ + SvgVisualPtr svgVisual( new SvgVisual( factoryCache ) ); + svgVisual->ParseFromUrl( imageUrl ); + svgVisual->SetProperties( properties ); + + return svgVisual; +} + SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl ) { - SvgVisual* svgVisual = new SvgVisual( factoryCache ); + SvgVisualPtr svgVisual( new SvgVisual( factoryCache ) ); svgVisual->ParseFromUrl( imageUrl ); + return svgVisual; } diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.h b/dali-toolkit/internal/visuals/svg/svg-visual.h index 2dc5226..26e7208 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.h +++ b/dali-toolkit/internal/visuals/svg/svg-visual.h @@ -61,6 +61,20 @@ public: * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object * @param[in] imageUrl The URL to svg resource to use + * @param[in] properties A Property::Map containing settings for this visual + * @return A smart-pointer to the newly allocated visual. + */ + static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties ); + + /** + * @brief Create the SVG Visual using the image URL. + * + * The visual will parse the SVG image once it is set. + * And rasterize it into BufferImage synchronously when the associated actor is put on stage, and destroy the BufferImage when it is off stage + * + * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] imageUrl The URL to svg resource to use + * @return A smart-pointer to the newly allocated visual. */ static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl ); diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index 03bcfae..7a8ad7a 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -134,9 +134,11 @@ const char* FRAGMENT_SHADER_ATLAS_CLAMP = DALI_COMPOSE_SHADER( } // unnamed namespace -TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache ) +TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties ) { - return new TextVisual( factoryCache ); + TextVisualPtr TextVisualPtr( new TextVisual( factoryCache ) ); + TextVisualPtr->SetProperties( properties ); + return TextVisualPtr; } float TextVisual::GetHeightForWidth( float width ) diff --git a/dali-toolkit/internal/visuals/text/text-visual.h b/dali-toolkit/internal/visuals/text/text-visual.h index c5b0efd..5ce01ed 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.h +++ b/dali-toolkit/internal/visuals/text/text-visual.h @@ -71,9 +71,10 @@ public: * @brief Create a new text visual. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static TextVisualPtr New( VisualFactoryCache& factoryCache ); + static TextVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties ); public: // from Visual::Base diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 9fab730..c9e1852 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -117,19 +117,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; } @@ -143,11 +143,11 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property UrlType::Type type = ResolveUrlType( imageUrl ); if( UrlType::N_PATCH == type ) { - visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl ); + visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } else if( UrlType::SVG == type ) { - visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl ); + visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } else // Regular image { @@ -160,12 +160,11 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property if( batchingEnabled ) { - visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl ); - break; + visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } else { - visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl ); + visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap ); } } } @@ -175,13 +174,13 @@ 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; } @@ -193,17 +192,13 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property case Toolkit::DevelVisual::TEXT: { - visualPtr = TextVisual::New( *( mFactoryCache.Get() ) ); + visualPtr = TextVisual::New( *( mFactoryCache.Get() ), propertyMap ); break; } } } - if( visualPtr ) - { - visualPtr->SetProperties( propertyMap ); - } - else + if( !visualPtr ) { DALI_LOG_ERROR( "Renderer type unknown\n" ); } -- 2.7.4