X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fimage-view%2Fimage-view-impl.cpp;h=e47d1cd22bbf045db498c508d359d097cce7445c;hp=c7f1d8c289175b054fe285dada0afdea2535c514;hb=76dead7c21ac57622ca1a70c156efddc017059cf;hpb=6da8438e9ac7350d9cc6f69b35cbcc4ab3987da1 diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp index c7f1d8c..e47d1cd 100644 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -66,7 +66,9 @@ Toolkit::ImageView ImageView::New() void ImageView::SetImage( Image image ) { - if( mImage != image ) + if( ( mImage != image ) || + ! mUrl.empty() || // If we're changing from a URL type to an Image type + ! mPropertyMap.Empty() ) // If we're changing from a property map type to an Image type { mUrl.clear(); mPropertyMap.Clear(); @@ -76,11 +78,15 @@ void ImageView::SetImage( Image image ) Actor self = Self(); Toolkit::RendererFactory::Get().ResetRenderer( mRenderer, self, image ); mImageSize = image ? ImageDimensions( image.GetWidth(), image.GetHeight() ) : ImageDimensions( 0, 0 ); + + RelayoutRequest(); } } void ImageView::SetImage( Property::Map map ) { + mUrl.clear(); + mImage.Reset(); mPropertyMap = map; Actor self = Self(); @@ -101,21 +107,34 @@ void ImageView::SetImage( Property::Map map ) } mImageSize = ImageDimensions( width, height ); + + RelayoutRequest(); } -void ImageView::SetImage( const std::string& url ) +void ImageView::SetImage( const std::string& url, ImageDimensions size ) { - if( mUrl != url ) + if( ( mUrl != url ) || + mImage || // If we're changing from an Image type to a URL type + ! mPropertyMap.Empty() ) // If we're changing from a property map type to a URL type { mImage.Reset(); mPropertyMap.Clear(); mUrl = url; + if( size.GetWidth() == 0u && size.GetHeight() == 0u ) + { + mImageSize = ResourceImage::GetImageSize( mUrl ); + } + else + { + mImageSize = size; + } + Actor self = Self(); - Toolkit::RendererFactory::Get().ResetRenderer( mRenderer, self, mUrl ); + Toolkit::RendererFactory::Get().ResetRenderer( mRenderer, self, mUrl, mImageSize ); - mImageSize = ResourceImage::GetImageSize( mUrl ); + RelayoutRequest(); } } @@ -209,7 +228,7 @@ void ImageView::SetProperty( BaseObject* object, Property::Index index, const Pr if( value.Get( imageUrl ) ) { ImageView& impl = GetImpl( imageView ); - impl.SetImage( imageUrl ); + impl.SetImage( imageUrl, ImageDimensions() ); } // if its not a string then get a Property::Map from the property if possible.