mLoadPolicy( DevelImageVisual::LoadPolicy::ATTACHED ),
mReleasePolicy( DevelImageVisual::ReleasePolicy::DESTROYED ),
mAttemptAtlasing( false ),
- mLoading( false )
+ mLoading( false ),
+ mOrientationCorrection( true )
{
}
{
DoSetProperty( Toolkit::DevelImageVisual::Property::RELEASE_POLICY, keyValue.second );
}
+ else if( keyValue.first == ORIENTATION_CORRECTION_NAME )
+ {
+ DoSetProperty( Toolkit::DevelImageVisual::Property::ORIENTATION_CORRECTION, keyValue.second );
+ }
}
}
if ( mLoadPolicy == DevelImageVisual::LoadPolicy::IMMEDIATE )
{
auto attemptAtlasing = mAttemptAtlasing;
- LoadTexture( attemptAtlasing, mAtlasRect, mTextures );
+ LoadTexture( attemptAtlasing, mAtlasRect, mTextures, mOrientationCorrection );
}
}
case Toolkit::ImageVisual::Property::ATLASING:
{
- bool atlasing = false;
- mAttemptAtlasing = value.Get( atlasing );
+ value.Get( mAttemptAtlasing );
break;
}
int loadPolicy;
Scripting::GetEnumerationProperty( value, LOAD_POLICY_TABLE, LOAD_POLICY_TABLE_COUNT, loadPolicy );
mLoadPolicy = DevelImageVisual::LoadPolicy::Type( loadPolicy );
+ break;
+ }
+ case Toolkit::DevelImageVisual::Property::ORIENTATION_CORRECTION:
+ {
+ bool orientationCorrection( mOrientationCorrection );
+ if( value.Get( orientationCorrection ) )
+ {
+ mOrientationCorrection = orientationCorrection;
+ }
+ break;
}
}
}
return mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
}
-void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures )
+void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection )
{
TextureManager& textureManager = mFactoryCache.GetTextureManager();
textures = textureManager.LoadTexture( mImageUrl, mDesiredSize, mFittingMode, mSamplingMode,
mMaskingData, IsSynchronousResourceLoading(), mTextureId,
atlasRect, atlasing, mLoading, mWrapModeU,
- mWrapModeV, textureObserver, atlasUploadObserver, atlasManager );
+ mWrapModeV, textureObserver, atlasUploadObserver, atlasManager, mOrientationCorrection );
}
void ImageVisual::InitializeRenderer()
if( mTextureId == TextureManager::INVALID_TEXTURE_ID && ! mTextures ) // Only load the texture once
{
- LoadTexture( attemptAtlasing, mAtlasRect, mTextures );
+ LoadTexture( attemptAtlasing, mAtlasRect, mTextures, mOrientationCorrection );
}
if( attemptAtlasing ) // Flag needs to be set before creating renderer
mPlacementActor.Reset();
// Image loaded and ready to display
- ResourceReady();
+ ResourceReady( Toolkit::Visual::ResourceStatus::READY );
}
}
map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
map.Insert( Toolkit::ImageVisual::Property::ATLASING, mAttemptAtlasing );
+
if( mMaskingData != NULL )
{
map.Insert( Toolkit::ImageVisual::Property::ALPHA_MASK_URL, mMaskingData->mAlphaMaskUrl.GetUrl() );
map.Insert( Toolkit::DevelImageVisual::Property::LOAD_POLICY, mLoadPolicy );
map.Insert( Toolkit::DevelImageVisual::Property::RELEASE_POLICY, mReleasePolicy );
-
+ map.Insert( Toolkit::DevelImageVisual::Property::ORIENTATION_CORRECTION, mOrientationCorrection );
}
void ImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
}
}
+bool ImageVisual::IsResourceReady() const
+{
+ return ( mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::READY ||
+ mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::FAILED );
+}
+
Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache, bool atlasing, bool defaultTextureWrapping )
{
Shader shader;
// reset the weak handle so that the renderer only get added to actor once
mPlacementActor.Reset();
}
+ // Image loaded
+ ResourceReady( Toolkit::Visual::ResourceStatus::READY );
mLoading = false;
}
// From Texture Manager
void ImageVisual::UploadComplete( bool loadingSuccess, int32_t textureId, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle )
{
+ Toolkit::Visual::ResourceStatus resourceStatus;
Actor actor = mPlacementActor.GetHandle();
if( actor )
{
ApplyImageToSampler( brokenImage );
}
- // Image loaded and ready to display
- ResourceReady();
}
}
+ // Storing TextureSet needed when renderer staged.
+ if( ! mImpl->mRenderer )
+ {
+ mTextures = textureSet;
+ }
+
+ // Image loaded, set status regardless of staged status.
+ if( loadingSuccess )
+ {
+ resourceStatus = Toolkit::Visual::ResourceStatus::READY;
+ }
+ else
+ {
+ resourceStatus = Toolkit::Visual::ResourceStatus::FAILED;
+ }
+ // Signal to observers ( control ) that resources are ready. Must be all resources.
+ ResourceReady( resourceStatus );
mLoading = false;
}