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=bd6c5a70a807991b550dd1d409bcd71a308cf3d7;hp=2929d890979332c20b8c74774b592bd78e364405;hb=2bba756a645043d8c1c4023a75966401d531827c;hpb=ff6ce970724ccc8bee65f7c93411b274907c09d7 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 2929d89..bd6c5a7 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 @@ -28,6 +28,7 @@ namespace Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ANIMATED_IMAGE"); #define LOG_CACHE \ + if(gAnimImgLogFilter->IsEnabledFor(Debug::Concise)) \ { \ std::ostringstream oss; \ oss << "Size:" << mQueue.Count() << " [ "; \ @@ -65,7 +66,10 @@ RollingAnimatedImageCache::RollingAnimatedImageCache(TextureManager& ImageCache::FrameReadyObserver& observer, uint16_t cacheSize, uint16_t batchSize, - bool isSynchronousLoading) + const Dali::WrapMode::Type& wrapModeU, + const Dali::WrapMode::Type& wrapModeV, + bool isSynchronousLoading, + bool preMultiplyOnLoad) : ImageCache(textureManager, maskingData, observer, batchSize, 0u), mImageUrl(animatedImageLoading.GetUrl()), mAnimatedImageLoading(animatedImageLoading), @@ -73,7 +77,10 @@ RollingAnimatedImageCache::RollingAnimatedImageCache(TextureManager& mFrameIndex(FIRST_FRAME_INDEX), mCacheSize(cacheSize), mQueue(cacheSize), - mIsSynchronousLoading(isSynchronousLoading) + mWrapModeU(wrapModeU), + mWrapModeV(wrapModeV), + mIsSynchronousLoading(isSynchronousLoading), + mPreMultiplyOnLoad(preMultiplyOnLoad) { mTextureIds.resize(mFrameCount); mIntervals.assign(mFrameCount, 0); @@ -191,6 +198,9 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b mLoadState = TextureManager::LoadState::LOADING; + auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD + : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; + TextureManager::TextureId loadTextureId = TextureManager::INVALID_TEXTURE_ID; TextureSet textureSet = mTextureManager.LoadAnimatedImageTexture(mImageUrl, mAnimatedImageLoading, @@ -198,10 +208,15 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b loadTextureId, mMaskingData, SamplingMode::BOX_THEN_LINEAR, - Dali::WrapMode::Type::DEFAULT, - Dali::WrapMode::Type::DEFAULT, synchronousLoading, - this); + this, + preMultiplyOnLoading); + if(textureSet) + { + Sampler sampler = Sampler::New(); + sampler.SetWrapMode(mWrapModeU, mWrapModeV); + textureSet.SetSampler(0u, sampler); + } mTextureIds[frameIndex] = loadTextureId; @@ -249,7 +264,14 @@ TextureSet RollingAnimatedImageCache::GetFrontTextureSet() const DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "RollingAnimatedImageCache::GetFrontTextureSet() FrameNumber:%d\n", mQueue[0].mFrameNumber); TextureManager::TextureId textureId = GetCachedTextureId(0); - return mTextureManager.GetTextureSet(textureId); + TextureSet textureSet = mTextureManager.GetTextureSet(textureId); + if(textureSet) + { + Sampler sampler = Sampler::New(); + sampler.SetWrapMode(mWrapModeU, mWrapModeV); + textureSet.SetSampler(0u, sampler); + } + return textureSet; } TextureManager::TextureId RollingAnimatedImageCache::GetCachedTextureId(int index) const @@ -265,7 +287,6 @@ void RollingAnimatedImageCache::PopFrontCache() if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID) { - mTextureManager.Remove(mMaskingData->mAlphaMaskId, this); if(mQueue.IsEmpty()) { mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID; @@ -321,7 +342,14 @@ void RollingAnimatedImageCache::LoadComplete(bool loadSuccess, TextureInformatio DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::LoadComplete(textureId:%d) start\n", textureInformation.textureId); LOG_CACHE; - MakeFrameReady(loadSuccess, mTextureManager.GetTextureSet(textureInformation.textureId), textureInformation.interval); + if(textureInformation.textureSet) + { + Sampler sampler = Sampler::New(); + sampler.SetWrapMode(mWrapModeU, mWrapModeV); + textureInformation.textureSet.SetSampler(0u, sampler); + } + + MakeFrameReady(loadSuccess, textureInformation.textureSet, textureInformation.interval); if(loadSuccess) {