X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Ftexture-manager-impl.cpp;h=57384b346feb87349b2b843521ce69900fdc72f8;hb=2d575e2d7a23ef6734066873da054d4d0db3d055;hp=c879226cd6c39552e0abc7e13736c04ed76fca96;hpb=6c564564a332b674668f2793d157e83997bcc80b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.cpp b/dali-toolkit/internal/visuals/texture-manager-impl.cpp index c879226..57384b3 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.cpp +++ b/dali-toolkit/internal/visuals/texture-manager-impl.cpp @@ -182,6 +182,15 @@ TextureSet TextureManager::LoadTexture( { Devel::PixelBuffer pixelBuffer = LoadImageFromFile( url.GetUrl(), desiredSize, fittingMode, samplingMode, orientationCorrection ); + if( maskInfo ) + { + Devel::PixelBuffer maskPixelBuffer = LoadImageFromFile( maskInfo->mAlphaMaskUrl.GetUrl(), ImageDimensions(), + FittingMode::SCALE_TO_FILL, SamplingMode::NO_FILTER, true ); + if( maskPixelBuffer ) + { + pixelBuffer.ApplyMask( maskPixelBuffer, maskInfo->mContentScaleFactor, maskInfo->mCropToMask ); + } + } if( pixelBuffer ) { PreMultiply( pixelBuffer, preMultiplyOnLoad ); @@ -243,8 +252,9 @@ TextureSet TextureManager::LoadTexture( } else { + TextureId alphaMaskId = RequestMaskLoad( maskInfo->mAlphaMaskUrl ); textureId = RequestLoad( url, - maskInfo->mAlphaMaskId, + alphaMaskId, maskInfo->mContentScaleFactor, desiredSize, fittingMode, samplingMode, @@ -367,6 +377,10 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( ++( mTextureInfoContainer[ cacheIndex ].referenceCount ); } textureId = mTextureInfoContainer[ cacheIndex ].textureId; + + // Update preMultiplyOnLoad value. It should be changed according to preMultiplied value of the cached info. + preMultiplyOnLoad = mTextureInfoContainer[ cacheIndex ].preMultiplied ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; + DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture id@%d, textureId=%d\n", url.GetUrl().c_str(), observer, cacheIndex, textureId ); } @@ -772,10 +786,6 @@ void TextureManager::AsyncLoadComplete( AsyncLoadingInfoContainerType& loadingCo if( textureInfo.loadState != CANCELLED ) { - if( textureInfo.maskApplied ) - { - textureInfo.loadState = MASK_APPLIED; - } // textureInfo can be invalidated after this call (as the mTextureInfoContainer may be modified) PostLoad( textureInfo, pixelBuffer ); } @@ -805,8 +815,9 @@ void TextureManager::PostLoad( TextureInfo& textureInfo, Devel::PixelBuffer& pix // wait for the mask to finish loading. if( textureInfo.maskTextureId != INVALID_TEXTURE_ID ) { - if( textureInfo.loadState == MASK_APPLIED ) + if( textureInfo.loadState == MASK_APPLYING ) { + textureInfo.loadState = MASK_APPLIED; UploadTexture( pixelBuffer, textureInfo ); NotifyObservers( textureInfo, true ); } @@ -891,7 +902,6 @@ void TextureManager::ApplyMask( TextureInfo& textureInfo, TextureId maskTextureI textureInfo.url.GetUrl().c_str(), textureInfo.loadSynchronously?"T":"F" ); textureInfo.loadState = MASK_APPLYING; - textureInfo.maskApplied = true; auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders; auto loadingHelperIt = loadersContainer.GetNext(); auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad ? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF;