X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-image%2Frolling-animated-image-cache.cpp;h=370a6787360b67cc652f978692df14ce080d7059;hb=HEAD;hp=f23456c908a3230199d50c2fb8c57b7d3904a2f8;hpb=5d22db39196a33784aed613d66bd23fb9a9b444b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 f23456c..3ece4cb 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,12 @@ */ // CLASS HEADER -#include "rolling-animated-image-cache.h" +#include // INTERNAL HEADERS #include #include // For ImageAtlasManagerPtr +#include #include namespace @@ -43,9 +44,6 @@ Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, " #else #define LOG_CACHE #endif - -static constexpr bool ENABLE_ORIENTATION_CORRECTION(true); - } // namespace namespace Dali @@ -121,7 +119,7 @@ TextureSet RollingAnimatedImageCache::Frame(uint32_t frameIndex) synchronouslyLoaded = true; interval = mAnimatedImageLoading.GetFrameInterval(mQueue.Back().mFrameNumber); } - MakeFrameReady(synchronouslyLoaded, textureSet, interval, preMultiplyOnLoading == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD); + MakeFrameReady(synchronouslyLoaded, textureSet, mAnimatedImageLoading.GetImageCount(), interval, preMultiplyOnLoading == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD); } if(popExist || mQueue.IsEmpty() || synchronouslyLoaded) @@ -223,7 +221,7 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b synchronousLoading, this, preMultiplyOnLoading); - if(textureSet) + if(textureSet && (mWrapModeU != Dali::WrapMode::DEFAULT || mWrapModeV != Dali::WrapMode::DEFAULT)) { Sampler sampler = Sampler::New(); sampler.SetWrapMode(mWrapModeU, mWrapModeV); @@ -277,7 +275,7 @@ TextureSet RollingAnimatedImageCache::GetFrontTextureSet() const TextureManager::TextureId textureId = GetCachedTextureId(0); TextureSet textureSet = mTextureManager.GetTextureSet(textureId); - if(textureSet) + if(textureSet && (mWrapModeU != Dali::WrapMode::DEFAULT || mWrapModeV != Dali::WrapMode::DEFAULT)) { Sampler sampler = Sampler::New(); sampler.SetWrapMode(mWrapModeU, mWrapModeV); @@ -294,7 +292,8 @@ TextureManager::TextureId RollingAnimatedImageCache::GetCachedTextureId(int inde void RollingAnimatedImageCache::PopFrontCache() { ImageFrame imageFrame = mQueue.PopFront(); - mTextureManager.Remove(mTextureIds[imageFrame.mFrameNumber], this); + + mTextureManager.RequestRemove(mTextureIds[imageFrame.mFrameNumber], this); mTextureIds[imageFrame.mFrameNumber] = TextureManager::INVALID_TEXTURE_ID; if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID) @@ -308,7 +307,7 @@ void RollingAnimatedImageCache::PopFrontCache() void RollingAnimatedImageCache::ClearCache() { - while(mTextureManagerAlive && !mQueue.IsEmpty()) + while(Dali::Adaptor::IsAvailable() && !mQueue.IsEmpty()) { PopFrontCache(); } @@ -316,7 +315,7 @@ void RollingAnimatedImageCache::ClearCache() mLoadState = TextureManager::LoadState::NOT_STARTED; } -void RollingAnimatedImageCache::MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t interval, bool preMultiplied) +void RollingAnimatedImageCache::MakeFrameReady(bool loadSuccess, TextureSet textureSet, uint32_t frameCount, uint32_t interval, bool preMultiplied) { if(!loadSuccess) { @@ -329,9 +328,9 @@ void RollingAnimatedImageCache::MakeFrameReady(bool loadSuccess, TextureSet text mLoadState = TextureManager::LoadState::LOAD_FINISHED; // Reset size of Queue according to the real frame count. - if(mFrameCount != mAnimatedImageLoading.GetImageCount()) + if(mFrameCount != frameCount) { - mFrameCount = mAnimatedImageLoading.GetImageCount(); + mFrameCount = frameCount; mTextureIds.resize(mFrameCount); mIntervals.assign(mFrameCount, 0u); } @@ -355,14 +354,16 @@ void RollingAnimatedImageCache::LoadComplete(bool loadSuccess, TextureInformatio DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::LoadComplete(textureId:%d) start\n", textureInformation.textureId); LOG_CACHE; - if(textureInformation.textureSet) + if(textureInformation.textureSet && (mWrapModeU != Dali::WrapMode::DEFAULT || mWrapModeV != Dali::WrapMode::DEFAULT)) { Sampler sampler = Sampler::New(); sampler.SetWrapMode(mWrapModeU, mWrapModeV); textureInformation.textureSet.SetSampler(0u, sampler); } - MakeFrameReady(loadSuccess, textureInformation.textureSet, textureInformation.interval, textureInformation.preMultiplied); + MakeFrameReady(loadSuccess, textureInformation.textureSet, textureInformation.frameCount, textureInformation.interval, textureInformation.preMultiplied); + + // TODO : We need to remove some below logics, since user can remove Visual during ResourceReady callback. if(loadSuccess) {