From dee3ce49e3e1e46c82f024283b51d85734cbb3ff Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Tue, 22 Nov 2016 18:01:54 +0000 Subject: [PATCH 1/1] Stop copying Property::Maps in ImageView SetProperty Change-Id: I120dece3cad2bd5b0de1e7a3c94096cecc968d57 --- .../controls/image-view/image-view-impl.cpp | 40 ++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) 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 f19f390..29442fd 100644 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -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 ); + } } } } -- 2.7.4