+ if( Stage::IsInstalled() )
+ {
+ if( mMaskingData )
+ {
+ // TextureManager could have been deleted before the actor that contains this
+ // ImageVisual is destroyed (e.g. due to stage shutdown). Ensure the stage
+ // is still valid before accessing texture manager.
+ if( mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID )
+ {
+ TextureManager& textureManager = mFactoryCache.GetTextureManager();
+ textureManager.Remove( mMaskingData->mAlphaMaskId );
+ }
+ }
+
+ // ImageVisual destroyed so remove texture unless ReleasePolicy is set to never release
+ if( ( mTextureId != TextureManager::INVALID_TEXTURE_ID ) && ( mReleasePolicy != DevelImageVisual::ReleasePolicy::NEVER ) )
+ {
+ RemoveTexture();
+ }
+ }
+}
+
+void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
+{
+ // Url is already received in constructor
+ for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
+ {
+ KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
+ if( keyValue.first.type == Property::Key::INDEX )
+ {
+ DoSetProperty( keyValue.first.indexKey, keyValue.second );
+ }
+ else
+ {
+ if( keyValue.first == IMAGE_FITTING_MODE )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::FITTING_MODE, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_SAMPLING_MODE )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::SAMPLING_MODE, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_DESIRED_WIDTH )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_WIDTH, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_DESIRED_HEIGHT )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, keyValue.second );
+ }
+ else if( keyValue.first == PIXEL_AREA_UNIFORM_NAME )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::PIXEL_AREA, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_WRAP_MODE_U )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::WRAP_MODE_U, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_WRAP_MODE_V )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::WRAP_MODE_V, keyValue.second );
+ }
+ else if( keyValue.first == SYNCHRONOUS_LOADING )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_ATLASING )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::ATLASING, keyValue.second );
+ }
+ else if( keyValue.first == ALPHA_MASK_URL )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::ALPHA_MASK_URL, keyValue.second );
+ }
+ else if( keyValue.first == MASK_CONTENT_SCALE_NAME )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE, keyValue.second );
+ }
+ else if( keyValue.first == CROP_TO_MASK_NAME )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::CROP_TO_MASK, keyValue.second );
+ }
+ else if ( keyValue.first == LOAD_POLICY_NAME )
+ {
+ DoSetProperty( Toolkit::DevelImageVisual::Property::LOAD_POLICY, keyValue.second );
+ }
+ else if( keyValue.first == RELEASE_POLICY_NAME )
+ {
+ DoSetProperty( Toolkit::DevelImageVisual::Property::RELEASE_POLICY, keyValue.second );
+ }
+ }
+ }
+
+ // Load image immediately if LOAD_POLICY requires it
+ if ( mLoadPolicy == DevelImageVisual::LoadPolicy::IMMEDIATE )
+ {
+ auto attemptAtlasing = mAttemptAtlasing;
+ LoadTexture( attemptAtlasing, mAtlasRect, mTextures );
+ }