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%2Frolling-animated-image-cache.cpp;h=e5ea68e809329cbe61ad1167c5b96319fbde7503;hp=473f276ceb944eeec004f8bf75eb8e0bb2d97bd3;hb=4464c30c30e68c6eee56cda1a201b22eb164fd20;hpb=cac222c1e627d98550657a4636c9d95735732de3 diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp index 473f276..e5ea68e 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp @@ -59,9 +59,14 @@ static constexpr uint32_t SINGLE_IMAGE_COUNT = 1u; static constexpr uint32_t FIRST_FRAME_INDEX = 0u; } // namespace -RollingAnimatedImageCache::RollingAnimatedImageCache( - TextureManager& textureManager, AnimatedImageLoading& animatedImageLoading, ImageCache::FrameReadyObserver& observer, uint16_t cacheSize, uint16_t batchSize, bool isSynchronousLoading) -: ImageCache(textureManager, observer, batchSize, 0u), +RollingAnimatedImageCache::RollingAnimatedImageCache(TextureManager& textureManager, + AnimatedImageLoading& animatedImageLoading, + TextureManager::MaskingDataPointer& maskingData, + ImageCache::FrameReadyObserver& observer, + uint16_t cacheSize, + uint16_t batchSize, + bool isSynchronousLoading) +: ImageCache(textureManager, maskingData, observer, batchSize, 0u), mAnimatedImageLoading(animatedImageLoading), mFrameCount(SINGLE_IMAGE_COUNT), mFrameIndex(FIRST_FRAME_INDEX), @@ -84,10 +89,8 @@ TextureSet RollingAnimatedImageCache::Frame(uint32_t frameIndex) bool popExist = false; while(!mQueue.IsEmpty() && mQueue.Front().mFrameNumber != frameIndex) { - ImageFrame imageFrame = mQueue.PopFront(); - mTextureManager.Remove(mImageUrls[imageFrame.mFrameNumber].mTextureId, this); - mImageUrls[imageFrame.mFrameNumber].mTextureId = TextureManager::INVALID_TEXTURE_ID; - popExist = true; + PopFrontCache(); + popExist = true; } TextureSet textureSet; @@ -191,6 +194,7 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b TextureSet textureSet = mTextureManager.LoadAnimatedImageTexture(mAnimatedImageLoading, frameIndex, loadTextureId, + mMaskingData, SamplingMode::BOX_THEN_LINEAR, Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT, @@ -252,13 +256,27 @@ TextureManager::TextureId RollingAnimatedImageCache::GetCachedTextureId(int inde return mImageUrls[mQueue[index].mFrameNumber].mTextureId; } +void RollingAnimatedImageCache::PopFrontCache() +{ + ImageFrame imageFrame = mQueue.PopFront(); + mTextureManager.Remove(mImageUrls[imageFrame.mFrameNumber].mTextureId, this); + mImageUrls[imageFrame.mFrameNumber].mTextureId = TextureManager::INVALID_TEXTURE_ID; + + if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID) + { + mTextureManager.Remove(mMaskingData->mAlphaMaskId, this); + if(mQueue.IsEmpty()) + { + mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID; + } + } +} + void RollingAnimatedImageCache::ClearCache() { while(mTextureManagerAlive && !mQueue.IsEmpty()) { - ImageFrame imageFrame = mQueue.PopFront(); - mTextureManager.Remove(mImageUrls[imageFrame.mFrameNumber].mTextureId, this); - mImageUrls[imageFrame.mFrameNumber].mTextureId = TextureManager::INVALID_TEXTURE_ID; + PopFrontCache(); } mLoadWaitingQueue.clear(); mLoadState = TextureManager::LoadState::NOT_STARTED;