X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftexture-manager%2Ftexture-manager-impl.cpp;h=445ad658ea0b3d2e71bcfea2b818e5cc10d459cd;hp=cac3b4711bf4af87dd4ab3eb1fe8fa759512ba5b;hb=refs%2Fchanges%2F26%2F275226%2F16;hpb=7e344e690ac8c73c5f019a0c504990c4ca1100f0 diff --git a/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp b/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp index cac3b47..445ad65 100644 --- a/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp +++ b/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp @@ -402,39 +402,36 @@ TextureSet TextureManager::LoadTexture( if(!textureSet) // big image, no atlasing or atlasing failed { atlasingStatus = false; - if(!maskInfo || !maskInfo->mAlphaMaskUrl.IsValid()) - { - textureId = RequestLoad( - url, - desiredSize, - fittingMode, - samplingMode, - UseAtlas::NO_ATLAS, - textureObserver, - orientationCorrection, - reloadPolicy, - preMultiplyOnLoad, - synchronousLoading); - } - else + + TextureId alphaMaskId = INVALID_TEXTURE_ID; + float contentScaleFactor = 1.0f; + bool cropToMask = false; + if(maskInfo && maskInfo->mAlphaMaskUrl.IsValid()) { maskInfo->mAlphaMaskId = RequestMaskLoad(maskInfo->mAlphaMaskUrl, maskInfo->mPreappliedMasking ? StorageType::KEEP_PIXEL_BUFFER : StorageType::KEEP_TEXTURE, synchronousLoading); - textureId = RequestLoad( - url, - maskInfo->mAlphaMaskId, - maskInfo->mContentScaleFactor, - desiredSize, - fittingMode, - samplingMode, - UseAtlas::NO_ATLAS, - maskInfo->mCropToMask, - textureObserver, - orientationCorrection, - reloadPolicy, - preMultiplyOnLoad, - synchronousLoading); + alphaMaskId = maskInfo->mAlphaMaskId; + if(maskInfo && maskInfo->mPreappliedMasking) + { + contentScaleFactor = maskInfo->mContentScaleFactor; + cropToMask = maskInfo->mCropToMask; + } } + textureId = RequestLoad( + url, + alphaMaskId, + contentScaleFactor, + desiredSize, + fittingMode, + samplingMode, + UseAtlas::NO_ATLAS, + cropToMask, + textureObserver, + orientationCorrection, + reloadPolicy, + preMultiplyOnLoad, + synchronousLoading); + TextureManager::LoadState loadState = mTextureCacheManager.GetTextureStateInternal(textureId); if(loadState == TextureManager::LoadState::UPLOADED) { @@ -667,19 +664,31 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( } else // For the image loading. { + Texture maskTexture; if(maskTextureId != INVALID_TEXTURE_ID) { TextureCacheIndex maskCacheIndex = mTextureCacheManager.GetCacheIndexFromId(maskTextureId); if(maskCacheIndex != INVALID_CACHE_INDEX) { - Devel::PixelBuffer maskPixelBuffer = mTextureCacheManager[maskCacheIndex].pixelBuffer; - if(maskPixelBuffer) + if(mTextureCacheManager[maskCacheIndex].storageType == StorageType::KEEP_TEXTURE) { - pixelBuffer.ApplyMask(maskPixelBuffer, contentScale, cropToMask); + TextureSet maskTextures = mTextureCacheManager[maskCacheIndex].textureSet; + if(maskTextures && maskTextures.GetTextureCount()) + { + maskTexture = maskTextures.GetTexture(0u); + } } - else + else if(mTextureCacheManager[maskCacheIndex].storageType == StorageType::KEEP_PIXEL_BUFFER) { - DALI_LOG_ERROR("Mask image cached invalid pixel buffer!\n"); + Devel::PixelBuffer maskPixelBuffer = mTextureCacheManager[maskCacheIndex].pixelBuffer; + if(maskPixelBuffer) + { + pixelBuffer.ApplyMask(maskPixelBuffer, contentScale, cropToMask); + } + else + { + DALI_LOG_ERROR("Mask image cached invalid pixel buffer!\n"); + } } } else @@ -691,6 +700,10 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( // Upload texture UploadTexture(pixelBuffer, textureInfo); + if(maskTexture && textureInfo.textureSet) + { + textureInfo.textureSet.SetTexture(1u, maskTexture); + } } } }