+ textureInfo.loadState = LOAD_FAILED;
+ CheckForWaitingTexture( textureInfo );
+ NotifyObservers( textureInfo, false );
+ }
+}
+
+void TextureManager::CheckForWaitingTexture( TextureInfo& maskTextureInfo )
+{
+ // Search the cache, checking if any texture has this texture id as a
+ // maskTextureId:
+ const unsigned int size = mTextureInfoContainer.size();
+
+ for( unsigned int cacheIndex = 0; cacheIndex < size; ++cacheIndex )
+ {
+ if( mTextureInfoContainer[cacheIndex].maskTextureId == maskTextureInfo.textureId &&
+ mTextureInfoContainer[cacheIndex].loadState == WAITING_FOR_MASK )
+ {
+ TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] );
+ PixelData pixelData = textureInfo.pixelData;
+ textureInfo.pixelData.Reset();
+
+ if( maskTextureInfo.loadState == LOAD_FINISHED )
+ {
+ ApplyMask( pixelData, maskTextureInfo.textureId );
+ UploadTexture( pixelData, textureInfo );
+ NotifyObservers( textureInfo, true );
+ }
+ else
+ {
+ DALI_LOG_ERROR( "TextureManager::ApplyMask to %s failed\n", textureInfo.url.GetUrl().c_str() );
+ textureInfo.loadState = LOAD_FAILED;
+ NotifyObservers( textureInfo, false );
+ }
+ }
+ }
+}
+
+void TextureManager::ApplyMask( PixelData pixelData, TextureId maskTextureId )
+{
+ int maskCacheIndex = GetCacheIndexFromId( maskTextureId );
+ PixelData maskPixelData = mTextureInfoContainer[maskCacheIndex].pixelData;
+ Dali::ApplyMask( pixelData, maskPixelData );
+}
+
+void TextureManager::UploadTexture( PixelData pixelData, TextureInfo& textureInfo )
+{
+ if( textureInfo.useAtlas != USE_ATLAS );
+ {
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, " TextureManager::UploadTexture() New Texture for textureId:%d\n", textureInfo.textureId );
+
+ Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
+ texture.Upload( pixelData );
+ textureInfo.textureSet = TextureSet::New();
+ textureInfo.textureSet.SetTexture( 0u, texture );