Stop copying Property::Maps in ImageView SetProperty 00/99400/2
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 22 Nov 2016 18:01:54 +0000 (18:01 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 22 Nov 2016 18:03:28 +0000 (10:03 -0800)
Change-Id: I120dece3cad2bd5b0de1e7a3c94096cecc968d57

dali-toolkit/internal/controls/image-view/image-view-impl.cpp

index f19f390..29442fd 100644 (file)
@@ -293,33 +293,37 @@ void ImageView::SetProperty( BaseObject* object, Property::Index index, const Pr
       case Toolkit::ImageView::Property::IMAGE:
       {
         std::string imageUrl;
-        Property::Map map;
+        Property::Map* map;
         if( value.Get( imageUrl ) )
         {
           impl.SetImage( imageUrl, ImageDimensions() );
         }
         // if its not a string then get a Property::Map from the property if possible.
-        else if( value.Get( map ) )
+        else
         {
-          Property::Value* shaderValue = map.Find( Toolkit::VisualProperty::SHADER, CUSTOM_SHADER );
-          // set image only if property map contains image information other than custom shader
-          if( map.Count() > 1u ||  !shaderValue )
+          map = value.GetMap();
+          if( map )
           {
-            impl.SetImage( map );
-          }
-          // the property map contains only the custom shader
-          else if(  impl.mVisual && map.Count() == 1u &&  shaderValue )
-          {
-            Property::Map shaderMap;
-            if( shaderValue->Get( shaderMap ) )
+            Property::Value* shaderValue = map->Find( Toolkit::VisualProperty::SHADER, CUSTOM_SHADER );
+            // set image only if property map contains image information other than custom shader
+            if( map->Count() > 1u ||  !shaderValue )
+            {
+              impl.SetImage( *map );
+            }
+            // the property map contains only the custom shader
+            else if( ( impl.mVisual )&&( map->Count() == 1u )&&( shaderValue ) )
             {
-              Internal::Visual::Base& visual = Toolkit::GetImplementation( impl.mVisual );
-              visual.SetCustomShader( shaderMap );
-              if( imageView.OnStage() )
+              Property::Map* shaderMap = shaderValue->GetMap();
+              if( shaderMap )
               {
-                // force to create new core renderer to use the newly set shader
-                visual.SetOffStage( imageView );
-                visual.SetOnStage( imageView );
+                Internal::Visual::Base& visual = Toolkit::GetImplementation( impl.mVisual );
+                visual.SetCustomShader( *shaderMap );
+                if( imageView.OnStage() )
+                {
+                  // force to create new core renderer to use the newly set shader
+                  visual.SetOffStage( imageView );
+                  visual.SetOnStage( imageView );
+                }
               }
             }
           }