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-image-cache.cpp;h=c0c598a7107cd84d00f63dc3c8bd3c94c28ea586;hp=847e6816e078914efcaf6f49d87b919de2aac70a;hb=4464c30c30e68c6eee56cda1a201b22eb164fd20;hpb=d00467f4821a9d7509d195473c5a482a1e9a5200 diff --git a/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp b/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp index 847e681..c0c598a 100644 --- a/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -18,6 +18,7 @@ #include // INTERNAL HEADERS +#include // For ImageAtlasManagerPtr #include // EXTERNAL HEADERS @@ -27,28 +28,27 @@ namespace #if defined(DEBUG_ENABLED) Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ANIMATED_IMAGE"); -#define LOG_CACHE \ - { \ - std::ostringstream oss; \ - oss<<"Size:"<mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID) + { + mTextureManager.Remove(mMaskingData->mAlphaMaskId, this); + if(mQueue.IsEmpty()) + { + mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID; + } + } } -void RollingImageCache::CheckFrontFrame( bool wasReady ) +void RollingImageCache::ClearCache() { - if( mWaitingForReadyFrame && wasReady == false && IsFrontReady() ) + while(mTextureManagerAlive && !mQueue.IsEmpty()) { - mWaitingForReadyFrame = false; - mObserver.FrameReady( GetFrontTextureSet() ); + PopFrontCache(); } + mLoadState = TextureManager::LoadState::NOT_STARTED; } -void RollingImageCache::UploadComplete( - bool loadSuccess, - int32_t textureId, - TextureSet textureSet, - bool useAtlasing, - const Vector4& atlasRect ) +void RollingImageCache::LoadComplete(bool loadSuccess, TextureInformation textureInformation) { - DALI_LOG_INFO(gAnimImgLogFilter,Debug::Concise,"AnimatedImageVisual::UploadComplete(textureId:%d) start\n", textureId); + DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::LoadComplete(textureId:%d) start\n", textureInformation.textureId); LOG_CACHE; - bool frontFrameReady = IsFrontReady(); - - if( ! mRequestingLoad ) + if(loadSuccess) { - SetImageFrameReady( textureId ); + mLoadState = TextureManager::LoadState::LOAD_FINISHED; + bool frontFrameReady = IsFrontReady(); + if(!mRequestingLoad) + { + for(std::size_t i = 0; i < mQueue.Count(); ++i) + { + if(GetCachedTextureId(i) == textureInformation.textureId) + { + mQueue[i].mReady = true; + break; + } + } + } + else + { + // LoadComplete has been called from within RequestLoad. TextureManager must + // therefore already have the texture cached, so make the texture ready. + // (Use the last texture, as the texture id hasn't been assigned yet) + mQueue.Back().mReady = true; + } - CheckFrontFrame( frontFrameReady ); + if(!frontFrameReady && IsFrontReady()) + { + mObserver.FrameReady(mTextureManager.GetTextureSet(textureInformation.textureId), mInterval); + } } else { - // UploadComplete has been called from within RequestLoad. TextureManager must - // therefore already have the texture cached, so make the texture ready. - // (Use the last texture, as the texture id hasn't been assigned yet) - mQueue.Back().mReady = true; + mLoadState = TextureManager::LoadState::LOAD_FAILED; + mObserver.FrameReady(TextureSet(), 0); } LOG_CACHE;