[Tizen] Restore behavior of Uploaded and LoadingFinished signal
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / image-view / image-view-impl.cpp
index 9af610b..e4d3677 100755 (executable)
@@ -207,6 +207,22 @@ void ImageView::SetDepthIndex( int depthIndex )
   }
 }
 
+void ImageView::OnStageConnection( int depth )
+{
+  if( mImage )
+  {
+    mImage.UploadedSignal().Emit( mImage );
+  }
+
+  Dali::ResourceImage resourceImage = Dali::ResourceImage::DownCast( mImage );
+  if( resourceImage )
+  {
+    resourceImage.LoadingFinishedSignal().Emit( resourceImage );
+  }
+
+  Control::OnStageConnection( depth ); // Enabled visuals will be put on stage
+}
+
 Vector3 ImageView::GetNaturalSize()
 {
   if( mVisual )
@@ -286,7 +302,8 @@ void ImageView::OnRelayout( const Vector2& size, RelayoutContainer& container )
 
       // scale to fit the padded area
       auto finalSize =
-             naturalSize * std::min((paddedSize.width / naturalSize.width), (paddedSize.height / naturalSize.height));
+             naturalSize * std::min( ( naturalSize.width  ? ( paddedSize.width  / naturalSize.width  ) : 0 ),
+                                     ( naturalSize.height ? ( paddedSize.height / naturalSize.height ) : 0 ) );
 
       // calculate final offset within the padded area
       auto finalOffset = Vector2(padding.start, padding.top) + (paddedSize - finalSize) * .5f;