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.h;h=030512edecaf6dfed20c962538139056eb0882ba;hp=f6e8d9ca3a9826bf0ee3dbbc8f6876348a94414e;hb=863244a09761c6e22a224299b6155a285e21d6ec;hpb=11ed6421771d05113ae1a6510167d8c2557ac20e diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.h b/dali-toolkit/internal/visuals/visual-factory-impl.h index f6e8d9c..030512e 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.h +++ b/dali-toolkit/internal/visuals/visual-factory-impl.h @@ -23,6 +23,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -36,9 +37,6 @@ namespace Internal class VisualFactoryCache; typedef IntrusivePtr VisualFactoryCachePtr; -class ImageAtlasManager; -typedef IntrusivePtr ImageAtlasManagerPtr; - /** * @copydoc Toolkit::VisualFactory */ @@ -68,12 +66,6 @@ public: */ Toolkit::Visual::Base CreateVisual( const std::string& image, ImageDimensions size ); -public: - /** - * @brief Returns an image to be used when a visual has failed to correctly render - */ - static Image GetBrokenVisualImage(); - protected: /** @@ -84,11 +76,6 @@ protected: private: /** - * Prepare the atlas manager - */ - void CreateAtlasManager(); - - /** * Undefined copy constructor. */ VisualFactory(const VisualFactory&); @@ -101,10 +88,57 @@ private: private: VisualFactoryCachePtr mFactoryCache; - ImageAtlasManagerPtr mAtlasManager; bool mDebugEnabled; }; +/** + * @brief Template to allow discard old visual, get new one and set it on stage if possible + * + * @tparam ParameterType0 The type of first argument passed to the CreateVisual() + * @tparam ParameterType1 The type of second argument passed to the CreateVisual() + * @SINCE_1_0.39 + * @param[in] actor Actor for which the visual will be replaced + * @param[in,out] visual The visual to be replaced + * @param[in] param0 First template based argument passed to the visual factory + * @param[in] param1 Second template based argument passed to the visual factory + */ +template< class ParameterType0, class ParameterType1 > +void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType0& param0, ParameterType1& param1 ) +{ + if( actor ) + { + Toolkit::GetImplementation(visual).SetOffStage( actor ); + } + visual = Toolkit::VisualFactory::Get().CreateVisual( param0, param1 ); + if( visual && actor && actor.OnStage() ) + { + Toolkit::GetImplementation(visual).SetOnStage(actor); + } +} + +/** + * @brief Template to allow discard old visual, get new one and set it on stage if possible + * + * @tparam ParameterType The type of argument passed to the CreateVisual() + * @SINCE_1_0.39 + * @param[in] actor Actor for which the visual will be replaced + * @param[in,out] visual The visual to be replaced + * @param[in] param Template based argument passed to the visual factory + */ +template< class ParameterType > +void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType& param ) +{ + if( actor && visual ) + { + Toolkit::GetImplementation(visual).SetOffStage( actor ); + } + visual = Toolkit::VisualFactory::Get().CreateVisual( param ); + if( visual && actor && actor.OnStage() ) + { + Toolkit::GetImplementation(visual).SetOnStage(actor); + } +} + } // namespace Internal inline const Internal::VisualFactory& GetImplementation(const Toolkit::VisualFactory& factory)