From 7c6b959dafce4de857ca247530ebe4d4c8509de6 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 19 Jan 2023 16:01:42 +0900 Subject: [PATCH] [Tizen] Resolve textureInfo validation for some cases 1. Alphamask image load failed 2. Multiply request same images during ResourceReady signal Change-Id: Ib9dc71bca3487d51d60717ccac2f8b20c96b89b3 Signed-off-by: Eunki, Hong --- .../internal/visuals/texture-manager-impl.cpp | 73 ++++++++++++++++++++-- 1 file changed, 67 insertions(+), 6 deletions(-) diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.cpp b/dali-toolkit/internal/visuals/texture-manager-impl.cpp index bf28017..0f36fad 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.cpp +++ b/dali-toolkit/internal/visuals/texture-manager-impl.cpp @@ -1085,6 +1085,12 @@ void TextureManager::ProcessQueuedTextures() { element.mObserver->LoadComplete(true, textureInfo.pixelBuffer, textureInfo.url, textureInfo.preMultiplied); } + else if(textureInfo.loadState == LoadState::LOADING) + { + // Note : LOADING state texture cannot be queue. + // This case be occured when same texture id are queue in mLoadQueue. + ObserveTexture( textureInfo, element.mObserver ); + } else { LoadTexture(textureInfo, element.mObserver); @@ -1249,8 +1255,16 @@ void TextureManager::PostLoad(TextureInfo& textureInfo, std::vector notifySuccessRequiredTextureIds; + std::vector notifyFailedRequiredTextureIds; + for(unsigned int cacheIndex = 0; cacheIndex < size; ++cacheIndex) { if(mTextureInfoContainer[cacheIndex].maskTextureId == maskTextureInfo.textureId && @@ -1292,19 +1312,60 @@ void TextureManager::CheckForWaitingTexture(TextureInfo& maskTextureInfo) Texture maskTexture = maskTextureInfo.textureSet.GetTexture(0u); textureInfo.textureSet.SetTexture(1u, maskTexture); } - // notify mask texture set. - NotifyObservers(textureInfo, true); + + // Increase reference counts for notify required textureId. + // Now we can assume that we don't remove & re-assign this textureId + // during NotifyObserver signal emit. + textureInfo.referenceCount++; + + notifySuccessRequiredTextureIds.push_back(textureInfo.textureId); } } - else + else // maskTextureInfo.loadState == LoadState::LOAD_FAILED { // for the load fail. textureInfo.pixelBuffer.Reset(); textureInfo.loadState = LoadState::LOAD_FAILED; - NotifyObservers(textureInfo, false); + + // Increase reference counts for notify required textureId. + // Now we can assume that we don't remove & re-assign this textureId + // during NotifyObserver signal emit. + textureInfo.referenceCount++; + + notifyFailedRequiredTextureIds.push_back(textureInfo.textureId); } } } + + // Notify textures are masked + for(const auto textureId : notifySuccessRequiredTextureIds) + { + int textureCacheIndex = GetCacheIndexFromId(textureId); + if(textureCacheIndex != INVALID_CACHE_INDEX) + { + TextureInfo& textureInfo(mTextureInfoContainer[textureCacheIndex]); + NotifyObservers(textureInfo, true); + } + } + for(const auto textureId : notifyFailedRequiredTextureIds) + { + int textureCacheIndex = GetCacheIndexFromId(textureId); + if(textureCacheIndex != INVALID_CACHE_INDEX) + { + TextureInfo& textureInfo(mTextureInfoContainer[textureCacheIndex]); + NotifyObservers(textureInfo, false); + } + } + + // Decrease reference count + for(const auto textureId : notifySuccessRequiredTextureIds) + { + Remove(textureId, nullptr); + } + for(const auto textureId : notifyFailedRequiredTextureIds) + { + Remove(textureId, nullptr); + } } void TextureManager::ApplyMask(TextureInfo& textureInfo, TextureId maskTextureId) -- 2.7.4