Remove mask internally in texture manager 10/276710/11
authortscholb <scholb.kim@samsung.com>
Thu, 23 Jun 2022 07:19:14 +0000 (16:19 +0900)
committertscholb <scholb.kim@samsung.com>
Tue, 6 Sep 2022 07:16:12 +0000 (16:16 +0900)
texture manager know the information of mask, so it can remove its mask
internally

Change-Id: Ife69614793c6a8fad7b605af14a41a5290a090ee

automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
dali-toolkit/internal/texture-manager/texture-cache-manager.cpp
dali-toolkit/internal/texture-manager/texture-cache-manager.h
dali-toolkit/internal/texture-manager/texture-manager-impl.cpp
dali-toolkit/internal/texture-manager/texture-manager-impl.h
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp

index 1c8fea2..87e9a78 100644 (file)
@@ -1216,22 +1216,6 @@ int UtcTextureManagerRemoveDuringApplyMasking(void)
 
   tet_printf("textureId1:%d removed and textureId2:%d requested\n", static_cast<int>(textureId1), static_cast<int>(textureId2));
 
-  // ApplyMask event come back, and do nothing.
-  // CAPTION : HARD-CODING.
-  {
-    std::vector<Devel::PixelBuffer> pixelBuffers;
-    textureManager.AsyncLoadComplete(textureId1, pixelBuffers);
-    textureManager.Remove(maskInfo->mAlphaMaskId, nullptr);
-  }
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS(observer1.mLoaded, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(observer1.mObserverCalled, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(observer2.mLoaded, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(observer2.mObserverCalled, false, TEST_LOCATION);
-
   // CAPTION : HARD-CODING.
   {
     std::vector<Devel::PixelBuffer> pixelBuffers;
index 7a7bf26..1559ae7 100644 (file)
@@ -81,6 +81,7 @@ const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif";
 
 const char* TEST_SVG_FILE_NAME                   = TEST_RESOURCE_DIR "/svg1.svg";
 const char* TEST_ANIMATED_VECTOR_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insta_camera.json";
+const char* TEST_WEBP_FILE_NAME                  = TEST_RESOURCE_DIR "/dali-logo.webp";
 
 void TestUrl(ImageView imageView, const std::string url)
 {
@@ -3460,6 +3461,74 @@ void OnResourceReadySignal05(Control control)
   }
 }
 
+int gResourceReadySignal06ComesOrder = 0;
+
+void OnResourceReadySignal06(Control control)
+{
+  gResourceReadySignalCounter++;
+  if(gResourceReadySignalCounter == 1)
+  {
+    auto scene = gImageView1.GetParent();
+
+    // Request load something
+    // We hope this request result is return later than gImageView2.
+
+    Property::Map map1;
+    map1[Toolkit::ImageVisual::Property::URL] = TEST_IMAGE_1;
+    map1[Toolkit::ImageVisual::Property::ALPHA_MASK_URL] = TEST_BROKEN_IMAGE_DEFAULT;
+
+    gImageView3 = ImageView::New();
+    gImageView3.SetProperty(Toolkit::ImageView::Property::IMAGE, map1);
+    gImageView3.ResourceReadySignal().Connect(&OnResourceReadySignal06);
+
+    Property::Map map2;
+    map2[Toolkit::ImageVisual::Property::URL] = TEST_IMAGE_2;
+    map2[Toolkit::ImageVisual::Property::ALPHA_MASK_URL] = TEST_BROKEN_IMAGE_S;
+    gImageView4 = ImageView::New();
+    gImageView4.SetProperty(Toolkit::ImageView::Property::IMAGE, map2);
+    gImageView4.ResourceReadySignal().Connect(&OnResourceReadySignal06);
+
+    if(control == gImageView1)
+    {
+      gResourceReadySignal06ComesOrder = 1;
+    }
+    else
+    {
+      gResourceReadySignal06ComesOrder = 2;
+    }
+  }
+  if(gResourceReadySignalCounter == 2)
+  {
+    if(gResourceReadySignal06ComesOrder == 1 && control == gImageView2)
+    {
+      // Scene off first one.
+      gImageView1.Unparent();
+
+      // Scene off second one.
+      gImageView2.Unparent();
+    }
+    else if(gResourceReadySignal06ComesOrder == 2 && control == gImageView1)
+    {
+      // Scene off first one.
+      gImageView2.Unparent();
+
+      // Scene off second one.
+      gImageView1.Unparent();
+    }
+    else
+    {
+      // We can't check that this utc fail case. just pass always when we come here.
+      gResourceReadySignal06ComesOrder = -1;
+    }
+
+    // If we don't seperate index of FreeList area
+    // and if we don't queue remove during obversing,
+    // cache index become something invalid data.
+    // In this case, some strange observer can be called.
+    // For example, gImageView4.LoadComplete will be called.
+  }
+}
+
 } // namespace
 
 int UtcDaliImageViewSetImageOnResourceReadySignal01(void)
@@ -3887,3 +3956,82 @@ int UtcDaliImageViewSetImageOnResourceReadySignal05(void)
 
   END_TEST;
 }
+int UtcDaliImageViewSetImageOnResourceReadySignal06(void)
+{
+  tet_infoline("Test texturemanager's remove image & mask queue works well within signal handler.");
+
+  ToolkitTestApplication application;
+
+  gResourceReadySignalCounter      = 0;
+  gResourceReadySignal06ComesOrder = 0;
+
+  Property::Map map;
+  map[Toolkit::ImageVisual::Property::URL] = "invalid.jpg";
+  map[Toolkit::ImageVisual::Property::ALPHA_MASK_URL] = "invalid.png";
+
+  gImageView1 = ImageView::New(); // request invalid image, to make loading failed fast.
+  gImageView1.SetProperty(Toolkit::ImageView::Property::IMAGE, map);
+  gImageView1.ResourceReadySignal().Connect(&OnResourceReadySignal06);
+  application.GetScene().Add(gImageView1);
+
+  gImageView2 = ImageView::New(); // request invalid image, to make loading failed fast.
+  gImageView2.SetProperty(Toolkit::ImageView::Property::IMAGE, map);
+  gImageView2.ResourceReadySignal().Connect(&OnResourceReadySignal06);
+  application.GetScene().Add(gImageView2);
+
+  application.SendNotification();
+  application.Render();
+
+  tet_infoline("Try to load 2 invalid image");
+
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(gResourceReadySignalCounter, 2, TEST_LOCATION);
+
+  tet_infoline("load done");
+
+  // We can test this UTC only if gImageView1 and gImageView2 loaded done.
+  if(gResourceReadySignal06ComesOrder == -1)
+  {
+    tet_infoline("Bad news.. gImageView3 or gImageView4 loaded faster than others. just skip this UTC");
+  }
+  else
+  {
+    // gImageView3 and gImageView4 load must not be successed yet.
+    DALI_TEST_EQUALS(gImageView3.GetRendererCount(), 0u, TEST_LOCATION);
+    DALI_TEST_EQUALS(gImageView4.GetRendererCount(), 0u, TEST_LOCATION);
+
+    application.GetScene().Add(gImageView3);
+    application.GetScene().Add(gImageView4);
+    application.SendNotification();
+    application.Render();
+
+    tet_infoline("Try to load 2 valid image");
+
+    DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+    DALI_TEST_EQUALS(gResourceReadySignalCounter, 2, TEST_LOCATION);
+
+    tet_infoline("load done");
+  }
+  END_TEST;
+}
+
+int UtcDaliImageViewUseSameUrlWithAnimatedImageVisual(void)
+{
+  tet_infoline("Test multiple views with same image in animated image visual");
+  ToolkitTestApplication application;
+
+  gImageView1 = ImageView::New(TEST_WEBP_FILE_NAME);
+  application.GetScene().Add(gImageView1);
+
+  tet_infoline("Remove imageView and Create new imageView with same url");
+  application.GetScene().Remove(gImageView1);
+  gImageView2 = ImageView::New(TEST_WEBP_FILE_NAME);
+  application.GetScene().Add(gImageView2);
+
+  application.SendNotification();
+  application.Render();
+
+  tet_infoline("Check the ImageView load image successfully");
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  END_TEST;
+}
index 24a8ea2..74b1ea4 100644 (file)
@@ -645,61 +645,55 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::AppendCache(const Te
   return cacheIndex;
 }
 
-void TextureCacheManager::RemoveCache(const TextureCacheManager::TextureId& textureId)
+void TextureCacheManager::RemoveCache(TextureCacheManager::TextureInfo& textureInfo)
 {
-  TextureCacheIndex textureInfoIndex = GetCacheIndexFromId(textureId);
-
+  TextureCacheIndex textureInfoIndex = GetCacheIndexFromId(textureInfo.textureId);
   bool removeTextureInfo = false;
 
-  if(textureInfoIndex != INVALID_CACHE_INDEX)
-  {
-    TextureInfo& textureInfo(mTextureInfoContainer[textureInfoIndex.GetIndex()]);
+  DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureCacheManager::Remove(textureId:%d) url:%s\n  cacheIdx:%d loadState:%s reference count = %d\n", textureInfo.textureId, textureInfo.url.GetUrl().c_str(), textureInfoIndex.GetIndex(), GET_LOAD_STATE_STRING(textureInfo.loadState), textureInfo.referenceCount);
 
-    DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureCacheManager::Remove(textureId:%d) url:%s\n  cacheIdx:%d loadState:%s reference count = %d\n", textureId, textureInfo.url.GetUrl().c_str(), textureInfoIndex.GetIndex(), GET_LOAD_STATE_STRING(textureInfo.loadState), textureInfo.referenceCount);
+  // Decrement the reference count and check if this is the last user of this Texture.
+  if(--textureInfo.referenceCount <= 0)
+  {
+    // This is the last remove for this Texture.
+    textureInfo.referenceCount = 0;
 
-    // Decrement the reference count and check if this is the last user of this Texture.
-    if(--textureInfo.referenceCount <= 0)
+    // If loaded, we can remove the TextureInfo and the Atlas (if atlased).
+    if(textureInfo.loadState == LoadState::UPLOADED)
     {
-      // This is the last remove for this Texture.
-      textureInfo.referenceCount = 0;
-
-      // If loaded, we can remove the TextureInfo and the Atlas (if atlased).
-      if(textureInfo.loadState == LoadState::UPLOADED)
-      {
-        if(textureInfo.atlas)
-        {
-          textureInfo.atlas.Remove(textureInfo.atlasRect);
-        }
-        removeTextureInfo = true;
-      }
-      else if(textureInfo.loadState == LoadState::LOADING || textureInfo.loadState == LoadState::MASK_APPLYING)
-      {
-        // We mark the textureInfo for removal.
-        // Once the load has completed, this method will be called again.
-        textureInfo.loadState = LoadState::CANCELLED;
-      }
-      else
+      if(textureInfo.atlas)
       {
-        // In other states, we are not waiting for a load so we are safe to remove the TextureInfo data.
-        removeTextureInfo = true;
+        textureInfo.atlas.Remove(textureInfo.atlasRect);
       }
+      removeTextureInfo = true;
+    }
+    else if(textureInfo.loadState == LoadState::LOADING || textureInfo.loadState == LoadState::MASK_APPLYING)
+    {
+      // We mark the textureInfo for removal.
+      // Once the load has completed, this method will be called again.
+      textureInfo.loadState = LoadState::CANCELLED;
+    }
+    else
+    {
+      // In other states, we are not waiting for a load so we are safe to remove the TextureInfo data.
+      removeTextureInfo = true;
+    }
 
-      // If the state allows us to remove the TextureInfo data, we do so.
-      if(removeTextureInfo)
+    // If the state allows us to remove the TextureInfo data, we do so.
+    if(removeTextureInfo)
+    {
+      // If url location is BUFFER, decrease reference count of EncodedImageBuffer.
+      if(textureInfo.url.IsBufferResource())
       {
-        // If url location is BUFFER, decrease reference count of EncodedImageBuffer.
-        if(textureInfo.url.IsBufferResource())
-        {
-          RemoveEncodedImageBuffer(textureInfo.url.GetUrl());
-        }
+        RemoveEncodedImageBuffer(textureInfo.url.GetUrl());
+      }
 
-        // Permanently remove the textureInfo struct.
+      // Permanently remove the textureInfo struct.
 
-        // Step 1. remove current textureId information in mTextureHashContainer.
-        RemoveHashId(textureInfo.hash, textureId);
-        // Step 2. make textureId is not using anymore. After this job, we can reuse textureId.
-        mTextureIdConverter.Remove(textureId);
-      }
+      // Step 1. remove current textureId information in mTextureHashContainer.
+      RemoveHashId(textureInfo.hash, textureInfo.textureId);
+      // Step 2. make textureId is not using anymore. After this job, we can reuse textureId.
+      mTextureIdConverter.Remove(textureInfo.textureId);
     }
   }
 
index fb7dfd7..c0b296b 100644 (file)
@@ -269,9 +269,9 @@ public:
    * Textures are cached and therefore only the removal of the last
    * occurrence of a Texture will cause its removal internally.
    *
-   * @param[in] textureId The Id of the Texture to remove at Cache.
+   * @param[in] textureInfo TextureInfo that want to cache in container.
    */
-  void RemoveCache(const TextureCacheManager::TextureId& textureId);
+  void RemoveCache(TextureCacheManager::TextureInfo& textureInfo);
 
 public:
   /**
index e23ee49..3156f9e 100644 (file)
@@ -133,7 +133,7 @@ TextureManager::TextureManager()
   mLifecycleObservers(),
   mLoadQueue(),
   mRemoveQueue(),
-  mQueueLoadFlag(false),
+  mLoadingQueueTextureId(INVALID_TEXTURE_ID),
   mLoadYuvPlanes(NeedToLoadYuvPlanes())
 {
   // Initialize the AddOn
@@ -454,7 +454,7 @@ TextureSet TextureManager::LoadTexture(
                          loadState == TextureManager::LoadState::MASK_APPLYING ||
                          loadState == TextureManager::LoadState::MASK_APPLIED ||
                          loadState == TextureManager::LoadState::NOT_STARTED ||
-                         mQueueLoadFlag);
+                         mLoadingQueueTextureId != INVALID_TEXTURE_ID);
       }
       else
       {
@@ -725,15 +725,60 @@ void TextureManager::Remove(const TextureManager::TextureId& textureId, TextureU
 {
   if(textureId != INVALID_TEXTURE_ID)
   {
-    if(mQueueLoadFlag)
+    TextureCacheIndex textureCacheIndex = mTextureCacheManager.GetCacheIndexFromId(textureId);
+    if(textureCacheIndex != INVALID_CACHE_INDEX)
     {
-      // Remove textureId after NotifyObserver finished
-      mRemoveQueue.PushBack(textureId);
-    }
-    else
-    {
-      // Remove textureId in CacheManager.
-      mTextureCacheManager.RemoveCache(textureId);
+      TextureManager::TextureId maskTextureId = INVALID_TEXTURE_ID;
+      TextureInfo& textureInfo(mTextureCacheManager[textureCacheIndex]);
+      if(textureInfo.maskTextureId != INVALID_TEXTURE_ID)
+      {
+        maskTextureId = textureInfo.maskTextureId;
+      }
+
+      // the case that LoadingQueue is working.
+      if(mLoadingQueueTextureId != INVALID_TEXTURE_ID)
+      {
+        // If textureId is not same, this observer need to delete when ProcessRemoveQueue() is called.
+        TextureUploadObserver* queueObserver = nullptr;
+        if(mLoadingQueueTextureId != textureId)
+        {
+          queueObserver = observer;
+        }
+
+        // Remove textureId after NotifyObserver finished
+        if(maskTextureId != INVALID_TEXTURE_ID)
+        {
+          if(textureInfo.loadState != LoadState::CANCELLED)
+          {
+            mRemoveQueue.PushBack(QueueElement(maskTextureId, nullptr));
+          }
+        }
+        mRemoveQueue.PushBack(QueueElement(textureId, queueObserver));
+      }
+      else
+      {
+        // Remove its observer
+        RemoveTextureObserver(textureInfo, observer);
+
+        // Remove maskTextureId in CacheManager
+        if(maskTextureId != INVALID_TEXTURE_ID)
+        {
+          TextureCacheIndex maskCacheIndex = mTextureCacheManager.GetCacheIndexFromId(maskTextureId);
+          if(maskCacheIndex != INVALID_CACHE_INDEX)
+          {
+            TextureInfo& maskTextureInfo(mTextureCacheManager[maskCacheIndex]);
+
+            // Only Remove maskTexture when texture's loadState is not CANCELLED. because it is already deleted.
+            if(textureInfo.loadState != LoadState::CANCELLED)
+            {
+              mTextureCacheManager.RemoveCache(maskTextureInfo);
+            }
+          }
+        }
+
+        // Remove textureId in CacheManager
+        mTextureCacheManager.RemoveCache(textureInfo);
+      }
     }
 
     if(observer)
@@ -818,7 +863,7 @@ void TextureManager::LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo
     case LoadState::NOT_STARTED:
     case LoadState::LOAD_FAILED:
     {
-      if(mQueueLoadFlag)
+      if(mLoadingQueueTextureId != INVALID_TEXTURE_ID)
       {
         QueueLoadTexture(textureInfo, observer);
       }
@@ -830,7 +875,7 @@ void TextureManager::LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo
     }
     case LoadState::UPLOADED:
     {
-      if(mQueueLoadFlag)
+      if(mLoadingQueueTextureId != INVALID_TEXTURE_ID)
       {
         QueueLoadTexture(textureInfo, observer);
       }
@@ -857,7 +902,7 @@ void TextureManager::LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo
 void TextureManager::QueueLoadTexture(const TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer)
 {
   const auto& textureId = textureInfo.textureId;
-  mLoadQueue.PushBack(LoadQueueElement(textureId, observer));
+  mLoadQueue.PushBack(QueueElement(textureId, observer));
 
   observer->DestructionSignal().Connect(this, &TextureManager::ObserverDestroyed);
 }
@@ -919,9 +964,16 @@ void TextureManager::ProcessLoadQueue()
 
 void TextureManager::ProcessRemoveQueue()
 {
-  for(const auto& textureId : mRemoveQueue)
+  TextureCacheIndex textureCacheIndex = INVALID_CACHE_INDEX;
+  for(auto&& element : mRemoveQueue)
   {
-    mTextureCacheManager.RemoveCache(textureId);
+    textureCacheIndex = mTextureCacheManager.GetCacheIndexFromId(element.mTextureId);
+    if(textureCacheIndex != INVALID_CACHE_INDEX)
+    {
+      TextureInfo& textureInfo(mTextureCacheManager[textureCacheIndex]);
+      RemoveTextureObserver(textureInfo, element.mObserver);
+      mTextureCacheManager.RemoveCache(textureInfo);
+    }
   }
   mRemoveQueue.Clear();
 }
@@ -1222,7 +1274,7 @@ void TextureManager::NotifyObservers(TextureManager::TextureInfo& textureInfo, c
     info->animatedImageLoading.Reset();
   }
 
-  mQueueLoadFlag = true;
+  mLoadingQueueTextureId = textureId;
 
   // Reverse observer list that we can pop_back the observer.
   std::reverse(info->observerList.Begin(), info->observerList.End());
@@ -1258,7 +1310,7 @@ void TextureManager::NotifyObservers(TextureManager::TextureInfo& textureInfo, c
     info = &mTextureCacheManager[textureInfoIndex];
   }
 
-  mQueueLoadFlag = false;
+  mLoadingQueueTextureId = INVALID_TEXTURE_ID;
   ProcessLoadQueue();
   ProcessRemoveQueue();
 
@@ -1319,6 +1371,22 @@ void TextureManager::EmitLoadComplete(TextureUploadObserver* observer, TextureMa
   }
 }
 
+void TextureManager::RemoveTextureObserver(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer)
+{
+  // Remove its observer
+  if(observer)
+  {
+    const auto   iterEnd = textureInfo.observerList.End();
+    const auto   iter    = std::find(textureInfo.observerList.Begin(), iterEnd, observer);
+    if(iter != iterEnd)
+    {
+      // Disconnect and remove the observer.
+      observer->DestructionSignal().Disconnect(this, &TextureManager::ObserverDestroyed);
+      textureInfo.observerList.Erase(iter);
+    }
+  }
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index 5601052..601cbea 100644 (file)
@@ -511,9 +511,9 @@ private:
   /**
    * Structure to hold info about a texture load queued during NotifyObservers
    */
-  struct LoadQueueElement
+  struct QueueElement
   {
-    LoadQueueElement(TextureManager::TextureId textureId, TextureUploadObserver* observer)
+    QueueElement(TextureManager::TextureId textureId, TextureUploadObserver* observer)
     : mTextureId(textureId),
       mObserver(observer)
     {
@@ -606,6 +606,15 @@ private:
    */
   void EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool& success);
 
+
+  /**
+   * @brief Remove observer in textureInfo
+   *
+   * @param textureInfo The struct associated with this Texture.
+   * @param observer The observer wishing to remove.
+   */
+  void RemoveTextureObserver(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer);
+
 public:
   /**
    * @brief Common method to handle loading completion.
@@ -639,11 +648,11 @@ private:                                    // Member Variables:
   RoundRobinContainerView<TextureAsyncLoadingHelper> mAsyncLocalLoaders;  ///< The Asynchronous image loaders used to provide all local async loads
   RoundRobinContainerView<TextureAsyncLoadingHelper> mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads
 
-  Dali::Vector<LifecycleObserver*>        mLifecycleObservers; ///< Lifecycle observers of texture manager
-  Dali::Vector<LoadQueueElement>          mLoadQueue;          ///< Queue of textures to load after NotifyObservers
-  Dali::Vector<TextureManager::TextureId> mRemoveQueue;        ///< Queue of textures to remove after NotifyObservers
-  bool                                    mQueueLoadFlag;      ///< Flag that causes Load Textures to be queued.
-  bool                                    mLoadYuvPlanes;      ///< A global flag to specify if the image should be loaded as yuv planes
+  Dali::Vector<LifecycleObserver*>        mLifecycleObservers;      ///< Lifecycle observers of texture manager
+  Dali::Vector<QueueElement>              mLoadQueue;               ///< Queue of textures to load after NotifyObservers
+  Dali::Vector<QueueElement>              mRemoveQueue;             ///< Queue of textures to remove after NotifyObservers
+  TextureManager::TextureId               mLoadingQueueTextureId;   ///< TextureId when it is loading. it causes Load Textures to be queued.
+  bool                                    mLoadYuvPlanes;           ///< A global flag to specify if the image should be loaded as yuv planes
 };
 
 } // namespace Internal
index 97b8d35..0a81956 100644 (file)
@@ -160,13 +160,6 @@ void FixedImageCache::ClearCache()
     {
       mTextureManager.Remove(mImageUrls[i].mTextureId, this);
       mImageUrls[i].mTextureId = TextureManager::INVALID_TEXTURE_ID;
-
-      if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID)
-      {
-        // In the CPU alpha masking, each frame increases reference count of masking texture.
-        // We should call TextureManager::Remove to decrease reference count when each frame is removed.
-        mTextureManager.Remove(mMaskingData->mAlphaMaskId, this);
-      }
     }
   }
   mReadyFlags.clear();
index b8a6961..6518df7 100644 (file)
@@ -276,7 +276,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;
index 7a84f5b..4f1bc1b 100644 (file)
@@ -197,7 +197,6 @@ void RollingImageCache::PopFrontCache()
 
   if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID)
   {
-    mTextureManager.Remove(mMaskingData->mAlphaMaskId, this);
     if(mQueue.IsEmpty())
     {
       mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
index 87d6ea6..b82e944 100644 (file)
@@ -180,18 +180,6 @@ ImageVisual::~ImageVisual()
 {
   if(Stage::IsInstalled())
   {
-    if(mMaskingData)
-    {
-      // TextureManager could have been deleted before the actor that contains this
-      // ImageVisual is destroyed (e.g. due to stage shutdown). Ensure the stage
-      // is still valid before accessing texture manager.
-      if(mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID)
-      {
-        TextureManager& textureManager = mFactoryCache.GetTextureManager();
-        textureManager.Remove(mMaskingData->mAlphaMaskId, this);
-      }
-    }
-
     if(mImageUrl.IsValid())
     {
       // Decrease reference count of External Resources :