Reduce memory consumption of TextLabel by reducing texture size
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-factory-impl.h
index d3a28d0..257b03c 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_VISUAL_FACTORY_IMPL_H
 
 /*
- * 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.
@@ -66,6 +66,11 @@ public:
    */
   Toolkit::Visual::Base CreateVisual( const std::string& image, ImageDimensions size );
 
+  /**
+   * @return the reference to texture manager
+   */
+  Internal::TextureManager& GetTextureManager();
+
 protected:
 
   /**
@@ -105,7 +110,10 @@ private:
 template< class ParameterType0, class ParameterType1 >
 void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType0& param0, ParameterType1& param1 )
 {
-  visual.RemoveAndReset( actor );
+  if( actor )
+  {
+    Toolkit::GetImplementation(visual).SetOffStage( actor );
+  }
   visual = Toolkit::VisualFactory::Get().CreateVisual( param0, param1 );
   if( visual && actor && actor.OnStage() )
   {
@@ -125,7 +133,10 @@ void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterTyp
 template< class ParameterType >
 void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType& param )
 {
-  visual.RemoveAndReset( actor );
+  if( actor && visual )
+  {
+    Toolkit::GetImplementation(visual).SetOffStage( actor );
+  }
   visual =  Toolkit::VisualFactory::Get().CreateVisual( param );
   if( visual && actor && actor.OnStage() )
   {