Merge changes I7066e6c1,I3f0c228e into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 9 Dec 2016 16:41:14 +0000 (08:41 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 9 Dec 2016 16:41:15 +0000 (08:41 -0800)
* changes:
  Implement default height for width and width for height for visuals and remove obsolete code from ImageView
  Stop unnecessary copying of property maps in ImageView::SetImage

1  2 
dali-toolkit/internal/visuals/visual-base-impl.cpp

@@@ -90,7 -90,7 +90,7 @@@ void Visual::Base::SetProperties( cons
  
        case DevelVisual::Property::PREMULTIPLIED_ALPHA:
        {
 -        bool premultipliedAlpha( premultipliedAlpha );
 +        bool premultipliedAlpha = false;
          if( value.Get( premultipliedAlpha ) )
          {
            EnablePreMultipliedAlpha( premultipliedAlpha );
@@@ -120,9 -120,28 +120,28 @@@ const std::string& Visual::Base::GetNam
    return mImpl->mName;
  }
  
- float Visual::Base::GetHeightForWidth( float width ) const
+ float Visual::Base::GetHeightForWidth( float width )
  {
-   return 0.f;
+   float aspectCorrectedHeight = 0.f;
+   Vector2 naturalSize;
+   GetNaturalSize( naturalSize );
+   if( naturalSize.width )
+   {
+     aspectCorrectedHeight = naturalSize.height * width / naturalSize.width;
+   }
+   return aspectCorrectedHeight;
+ }
+ float Visual::Base::GetWidthForHeight( float height )
+ {
+   float aspectCorrectedWidth = 0.f;
+   Vector2 naturalSize;
+   GetNaturalSize( naturalSize );
+   if( naturalSize.height > 0.0f )
+   {
+     aspectCorrectedWidth = naturalSize.width * height / naturalSize.height;
+   }
+   return aspectCorrectedWidth;
  }
  
  void Visual::Base::GetNaturalSize( Vector2& naturalSize )