From: seungho baek Date: Thu, 26 Oct 2023 05:49:29 +0000 (+0900) Subject: Fix unclear naming of member variable and function of FixedImageCache X-Git-Tag: dali_2.2.51~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb8b7c15a886dfba4d525db9b3e7c847a1ceb71d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Fix unclear naming of member variable and function of FixedImageCache - Some naming of member variable and function have not changed after some logic is changed. - In current implementation, FixedImageCache not use a concept of front frame. - This patch fixed such a unclear naming and fixed parameters to match the naming too. Change-Id: I43baf87b2cb67941aa89e8fd6aadce33c4495565 Signed-off-by: seungho baek --- 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 dfa9f2e..adf8da8 100644 --- a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp +++ b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp @@ -47,7 +47,7 @@ FixedImageCache::FixedImageCache(TextureManager& textureMana bool preMultiplyOnLoad) : ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, interval, preMultiplyOnLoad), mImageUrls(urlList), - mFront(FIRST_FRAME_INDEX) + mCurrentFrameIndex(FIRST_FRAME_INDEX) { mReadyFlags.reserve(mImageUrls.size()); } @@ -67,17 +67,17 @@ TextureSet FixedImageCache::Frame(uint32_t frameIndex) } while(mReadyFlags.size() < mImageUrls.size() && - (frameIndex > mFront || mReadyFlags.empty())) + (frameIndex > mCurrentFrameIndex || mReadyFlags.empty())) { - ++mFront; + ++mCurrentFrameIndex; LoadBatch(); } - mFront = frameIndex; + mCurrentFrameIndex = frameIndex; - if(IsFrontReady() && mLoadState != TextureManager::LoadState::LOAD_FAILED) + if(IsFrameReady(mCurrentFrameIndex) && mLoadState != TextureManager::LoadState::LOAD_FAILED) { - textureSet = GetFrontTextureSet(); + textureSet = GetTextureSet(mCurrentFrameIndex); } return textureSet; @@ -97,7 +97,7 @@ uint32_t FixedImageCache::GetFrameInterval(uint32_t frameIndex) const int32_t FixedImageCache::GetCurrentFrameIndex() const { - return static_cast(mFront); + return static_cast(mCurrentFrameIndex); } int32_t FixedImageCache::GetTotalFrameCount() const @@ -105,9 +105,9 @@ int32_t FixedImageCache::GetTotalFrameCount() const return mImageUrls.size(); } -bool FixedImageCache::IsFrontReady() const +bool FixedImageCache::IsFrameReady(uint32_t frameIndex) const { - return (mReadyFlags.size() > 0 && mReadyFlags[mFront] == true); + return (mReadyFlags.size() > 0 && mReadyFlags[frameIndex] == true); } void FixedImageCache::LoadBatch() @@ -143,9 +143,9 @@ void FixedImageCache::LoadBatch() } } -TextureSet FixedImageCache::GetFrontTextureSet() const +TextureSet FixedImageCache::GetTextureSet(uint32_t frameIndex) const { - TextureSet textureSet = mTextureManager.GetTextureSet(mImageUrls[mFront].mTextureId); + TextureSet textureSet = mTextureManager.GetTextureSet(mImageUrls[frameIndex].mTextureId); if(textureSet) { Sampler sampler = Sampler::New(); @@ -155,11 +155,11 @@ TextureSet FixedImageCache::GetFrontTextureSet() const return textureSet; } -void FixedImageCache::CheckFrontFrame(bool wasReady, bool preMultiplied) +void FixedImageCache::MakeReady(bool wasReady, uint32_t frameIndex, bool preMultiplied) { - if(wasReady == false && IsFrontReady()) + if(wasReady == false && IsFrameReady(frameIndex)) { - mObserver.FrameReady(GetFrontTextureSet(), mInterval, preMultiplied); + mObserver.FrameReady(GetTextureSet(frameIndex), mInterval, preMultiplied); } } @@ -186,7 +186,7 @@ void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureI if(loadSuccess) { mLoadState = TextureManager::LoadState::LOAD_FINISHED; - bool frontFrameReady = IsFrontReady(); + bool isCurrentFrameReady = IsFrameReady(mCurrentFrameIndex); if(!mRequestingLoad) { for(std::size_t i = 0; i < mImageUrls.size(); ++i) @@ -202,7 +202,7 @@ void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureI { mReadyFlags.back() = true; } - CheckFrontFrame(frontFrameReady, textureInformation.preMultiplied); + MakeReady(isCurrentFrameReady, mCurrentFrameIndex, textureInformation.preMultiplied); } else { diff --git a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h index 62cd174..4fc4ecc 100644 --- a/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h +++ b/dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h @@ -91,11 +91,12 @@ public: private: /** - * @brief Check whether the front frame is ready or not. + * @brief Check whether the frame is ready or not. + * @param[in] frameIndex The frame index to check the frame is ready or not. * - * @return true if the front frame is ready + * @return true if the frame is ready */ - bool IsFrontReady() const; + bool IsFrameReady(uint32_t frameIndex) const; /** * @brief Load the next batch of images @@ -103,19 +104,21 @@ private: void LoadBatch(); /** - * @brief Get the texture set of the front frame. + * @brief Get the texture set at the input frame index + * @param[in] frameIndex The frame index to retrieve texture set. * * @return the texture set of the front of Cache. */ - TextureSet GetFrontTextureSet() const; + TextureSet GetTextureSet(uint32_t frameIndex) const; /** * @brief Check if the front frame has become ready - if so, inform observer * * @param[in] wasReady Readiness before call. + * @param[in] frameIndex The frame index for this frame * @param[in] preMultiplied whether the texture is premultied alpha or not. */ - void CheckFrontFrame(bool wasReady, bool preMultiplied); + void MakeReady(bool wasReady, uint32_t frameIndex, bool preMultiplied); protected: /** @@ -127,7 +130,7 @@ private: std::vector& mImageUrls; std::vector mReadyFlags; std::vector mLoadStates; - uint32_t mFront; + uint32_t mCurrentFrameIndex; }; } //namespace Internal