[Tizen] Fix the cache to load the correct texture 05/273105/4
authorsunghyun kim <scholb.kim@samsung.com>
Wed, 30 Mar 2022 08:57:07 +0000 (17:57 +0900)
committertscholb <scholb.kim@samsung.com>
Wed, 6 Apr 2022 05:48:40 +0000 (14:48 +0900)
if new animated image visual use previous texture, textureId is not updated properly some case.
so invalid texture is loaded in AnimatedImageUploadComplete.
To solve this problem, i fix the cache to load the correct texture

Change-Id: Ie4c8154e7de5e2a0e91104458c898531df372df9

dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp

index 263cf8d..e352344 100644 (file)
@@ -191,10 +191,11 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b
   mQueue.PushBack(imageFrame);
 
   bool       loadingStatus = false;
+  TextureManager::TextureId loadTextureId = TextureManager::INVALID_TEXTURE_ID;
   TextureSet textureSet    = mTextureManager.LoadAnimatedImageTexture(mAnimatedImageLoading,
                                                                    frameIndex,
                                                                    loadingStatus,
-                                                                   mImageUrls[frameIndex].mTextureId,
+                                                                   loadTextureId,
                                                                    mMaskingData,
                                                                    mDesiredSize,
                                                                    mSamplingMode,
@@ -203,6 +204,7 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b
                                                                    synchronousLoading,
                                                                    useCache,
                                                                    this);
+  mImageUrls[frameIndex].mTextureId = loadTextureId;
 
   // If textureSet is returned but loadingState is false than load state is LOAD_FINISHED. (Notification is not comming yet.)
   // If textureSet is null and the request is synchronous, load state is LOAD_FAILED.
@@ -346,7 +348,7 @@ void RollingAnimatedImageCache::AnimatedImageUploadComplete(bool loadSuccess, in
   // If it is, notify frame ready to observer.
   if(frontFrameReady == false && IsFrontReady())
   {
-    mObserver.FrameReady(GetFrontTextureSet(), interval);
+    mObserver.FrameReady(mTextureManager.GetTextureSet(textureId), interval);
   }
 
   // The frames of a single animated image can not be loaded parallelly.