X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-image%2Frolling-animated-image-cache.cpp;h=490c3bebda0548d0648d60b7519be13d7b88e9c9;hb=88ff99f30ef65a6a9b5f5d3ab03a6da247a976dc;hp=3992b08835c523a202951da826bdaf6873fae240;hpb=43ca048f4200d2f1d6e59c2163af59cd99a45b2e;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 3992b08..490c3be 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) 2020 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. @@ -29,27 +29,25 @@ 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:"<(mCacheSize) && !mQueue.IsFull(); ++i) { - ImageFrame imageFrame; - imageFrame.mFrameNumber = mFrameIndex; - imageFrame.mReady = false; - - mQueue.PushBack( imageFrame ); - - if( !mOnLoading ) + if(!mOnLoading) { mOnLoading = true; - RequestFrameLoading( mFrameIndex ); + RequestFrameLoading(mFrameIndex); } else { - mLoadWaitingQueue.push_back( mFrameIndex ); + mLoadWaitingQueue.push_back(mFrameIndex); } mFrameIndex++; mFrameIndex %= mFrameCount; } - CheckFrontFrame( frontFrameReady ); + CheckFrontFrame(frontFrameReady); LOG_CACHE; } -void RollingAnimatedImageCache::SetImageFrameReady( TextureManager::TextureId textureId ) +void RollingAnimatedImageCache::SetImageFrameReady(TextureManager::TextureId textureId) { - for( std::size_t i = 0; i < mQueue.Count() ; ++i ) + for(std::size_t i = 0; i < mQueue.Count(); ++i) { - if( GetCachedTextureId( i ) == textureId ) + if(GetCachedTextureId(i) == textureId) { mQueue[i].mReady = true; break; @@ -219,48 +254,42 @@ void RollingAnimatedImageCache::SetImageFrameReady( TextureManager::TextureId te TextureSet RollingAnimatedImageCache::GetFrontTextureSet() const { - DALI_LOG_INFO( gAnimImgLogFilter, Debug::Concise, "RollingAnimatedImageCache::GetFrontTextureSet() FrameNumber:%d\n", mQueue[ 0 ].mFrameNumber ); + DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "RollingAnimatedImageCache::GetFrontTextureSet() FrameNumber:%d\n", mQueue[0].mFrameNumber); - TextureManager::TextureId textureId = GetCachedTextureId( 0 ); - return mTextureManager.GetTextureSet( textureId ); + TextureManager::TextureId textureId = GetCachedTextureId(0); + return mTextureManager.GetTextureSet(textureId); } -TextureManager::TextureId RollingAnimatedImageCache::GetCachedTextureId( int index ) const +TextureManager::TextureId RollingAnimatedImageCache::GetCachedTextureId(int index) const { - return mImageUrls[ mQueue[ index ].mFrameNumber ].mTextureId; + return mImageUrls[mQueue[index].mFrameNumber].mTextureId; } -void RollingAnimatedImageCache::CheckFrontFrame( bool wasReady ) +void RollingAnimatedImageCache::CheckFrontFrame(bool wasReady) { - if( mWaitingForReadyFrame && wasReady == false && IsFrontReady() ) + if(mWaitingForReadyFrame && wasReady == false && IsFrontReady()) { mWaitingForReadyFrame = false; - mObserver.FrameReady( GetFrontTextureSet() ); + mObserver.FrameReady(GetFrontTextureSet()); } } -void RollingAnimatedImageCache::UploadComplete( - bool loadSuccess, - int32_t textureId, - TextureSet textureSet, - bool useAtlasing, - const Vector4& atlasRect, - bool preMultiplied ) +void RollingAnimatedImageCache::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(!mRequestingLoad) { - SetImageFrameReady( textureId ); + SetImageFrameReady(textureInformation.textureId); - CheckFrontFrame( frontFrameReady ); + CheckFrontFrame(frontFrameReady); } else { - // UploadComplete has been called from within RequestLoad. TextureManager must + // 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; @@ -270,28 +299,17 @@ void RollingAnimatedImageCache::UploadComplete( // The frames of a single animated image can not be loaded parallelly. // Therefore, a frame is now loading, other orders are waiting. // And, after the frame is loaded, requests load of next order. - if( !mLoadWaitingQueue.empty() ) + if(!mLoadWaitingQueue.empty()) { uint32_t loadingIndex = mLoadWaitingQueue.front(); - mLoadWaitingQueue.erase( mLoadWaitingQueue.begin() ); + mLoadWaitingQueue.erase(mLoadWaitingQueue.begin()); mOnLoading = true; - RequestFrameLoading( loadingIndex ); + RequestFrameLoading(loadingIndex); } LOG_CACHE; } -void RollingAnimatedImageCache::LoadComplete( - bool loadSuccess, - Devel::PixelBuffer pixelBuffer, - const VisualUrl& url, - bool preMultiplied ) -{ - // LoadComplete is called if this TextureUploadObserver requested to load - // an image that will be returned as a type of PixelBuffer by using a method - // TextureManager::LoadPixelBuffer. -} - } //namespace Internal } //namespace Toolkit } //namespace Dali