X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-image%2Ffixed-image-cache.cpp;h=8cc69ff840996bc05e99897ea2e7c871bb8e157b;hp=192a3c4005a87e4eafaf1e94afd79fa771373a66;hb=4464c30c30e68c6eee56cda1a201b22eb164fd20;hpb=cac222c1e627d98550657a4636c9d95735732de3 diff --git a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp index 192a3c4..8cc69ff 100644 --- a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp @@ -35,9 +35,13 @@ constexpr bool ENABLE_ORIENTATION_CORRECTION(true); constexpr uint32_t FIRST_FRAME_INDEX = 0u; } // namespace -FixedImageCache::FixedImageCache( - TextureManager& textureManager, UrlList& urlList, ImageCache::FrameReadyObserver& observer, uint32_t batchSize, uint32_t interval) -: ImageCache(textureManager, observer, batchSize, interval), +FixedImageCache::FixedImageCache(TextureManager& textureManager, + UrlList& urlList, + TextureManager::MaskingDataPointer& maskingData, + ImageCache::FrameReadyObserver& observer, + uint32_t batchSize, + uint32_t interval) +: ImageCache(textureManager, maskingData, observer, batchSize, interval), mImageUrls(urlList), mFront(FIRST_FRAME_INDEX) { @@ -122,7 +126,6 @@ void FixedImageCache::LoadBatch() bool synchronousLoading = false; bool atlasingStatus = false; bool loadingStatus = false; - TextureManager::MaskingDataPointer maskInfo = nullptr; AtlasUploadObserver* atlasObserver = nullptr; ImageAtlasManagerPtr imageAtlasManager = nullptr; Vector4 textureRect; @@ -130,7 +133,7 @@ void FixedImageCache::LoadBatch() auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; mTextureManager.LoadTexture( - url, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, maskInfo, synchronousLoading, mImageUrls[frameIndex].mTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply); + url, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, mMaskingData, synchronousLoading, mImageUrls[frameIndex].mTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply); mRequestingLoad = false; } @@ -157,10 +160,21 @@ void FixedImageCache::ClearCache() { mTextureManager.Remove(mImageUrls[i].mTextureId, this); mImageUrls[i].mTextureId = TextureManager::INVALID_TEXTURE_ID; + + if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID) + { + // In the CPU alpha masking, each frame increases reference count of masking texture. + // We should call TextureManager::Remove to decrease reference count when each frame is removed. + mTextureManager.Remove(mMaskingData->mAlphaMaskId, this); + } } } mReadyFlags.clear(); mLoadState = TextureManager::LoadState::NOT_STARTED; + if(mMaskingData) + { + mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID; + } } void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureInformation)