[dali_1.4.17] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / image-view / image-view-impl.cpp
index 5e520d8..b2814a4 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -120,14 +120,14 @@ void ImageView::SetImage( Image image )
   }
   else
   {
-    // Unregister the exsiting visual
+    // Unregister the existing visual
     DevelControl::UnregisterVisual( *this, Toolkit::ImageView::Property::IMAGE );
 
     // Trigger a size negotiation request that may be needed when unregistering a visual.
     RelayoutRequest();
   }
 
-  Toolkit::DevelControl::RequestLayout( *this );
+  // Signal that a Relayout may be needed
 }
 
 void ImageView::SetImage( const Property::Map& map )
@@ -163,7 +163,7 @@ void ImageView::SetImage( const Property::Map& map )
     RelayoutRequest();
   }
 
-  Toolkit::DevelControl::RequestLayout( *this );
+  // Signal that a Relayout may be needed
 }
 
 void ImageView::SetImage( const std::string& url, ImageDimensions size )
@@ -200,7 +200,7 @@ void ImageView::SetImage( const std::string& url, ImageDimensions size )
     RelayoutRequest();
   }
 
-  Toolkit::DevelControl::RequestLayout( *this );
+  // Signal that a Relayout may be needed
 }
 
 Image ImageView::GetImage() const
@@ -344,7 +344,7 @@ void ImageView::OnResourceReady( Toolkit::Control control )
 {
   // Visual ready so update visual attached to this ImageView, following call to RelayoutRequest will use this visual.
   mVisual = DevelControl::GetVisual( *this, Toolkit::ImageView::Property::IMAGE );
-  Toolkit::DevelControl::RequestLayout( *this );
+  // Signal that a Relayout may be needed
 }
 
 ///////////////////////////////////////////////////////////
@@ -394,19 +394,23 @@ void ImageView::SetProperty( BaseObject* object, Property::Index index, const Pr
             // the property map contains only the custom shader
             else if( ( map->Count() == 1u )&&( shaderValue ) )
             {
-              impl.mShaderMap = *( shaderValue->GetMap() );
-
-              if( !impl.mUrl.empty() )
-              {
-                impl.SetImage( impl.mUrl, impl.mImageSize );
-              }
-              else if( impl.mImage )
-              {
-                impl.SetImage( impl.mImage );
-              }
-              else if( !impl.mPropertyMap.Empty() )
+              Property::Map* shaderMap = shaderValue->GetMap();
+              if( shaderMap )
               {
-                impl.SetImage( impl.mPropertyMap );
+                impl.mShaderMap = *shaderMap;
+
+                if( !impl.mUrl.empty() )
+                {
+                  impl.SetImage( impl.mUrl, impl.mImageSize );
+                }
+                else if( impl.mImage )
+                {
+                  impl.SetImage( impl.mImage );
+                }
+                else if( !impl.mPropertyMap.Empty() )
+                {
+                  impl.SetImage( impl.mPropertyMap );
+                }
               }
             }
           }
@@ -459,9 +463,15 @@ Property::Value ImageView::GetProperty( BaseObject* object, Property::Index prop
           Scripting::CreatePropertyMap( impl.mImage, map );
           value = map;
         }
-        else if( !impl.mPropertyMap.Empty() )
+        else
         {
-          value = impl.mPropertyMap;
+          Property::Map map;
+          Toolkit::Visual::Base visual = DevelControl::GetVisual( impl, Toolkit::ImageView::Property::IMAGE );
+          if( visual )
+          {
+            visual.CreatePropertyMap( map );
+          }
+          value = map;
         }
         break;
       }