From b9d02ab85a00b0a5a95ed531d590a034f0b6b72d Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 26 Oct 2023 13:56:47 +0900 Subject: [PATCH] Remove Atlas parameter for TextureManager cache system If some visual attempt to atlas, they will use AtlasManager. So there is no reason to keep atlas relative informations for TextureInfo struct, what we are caching now. + This patch touch a lots of codes in texture-manager. So, I also change something useless lvalue usages Something like, const bool& Change-Id: I6a83b75c8311377e2ab6d62d29c19864a21d7e79 Signed-off-by: Eunki, Hong --- .../utc-Dali-TextureManager.cpp | 15 - .../src/dali-toolkit/utc-Dali-AsyncImageLoader.cpp | 2 +- .../internal/common/image-resource-loader.cpp | 2 +- .../texture-async-loading-helper.cpp | 46 +-- .../texture-manager/texture-async-loading-helper.h | 45 ++- .../texture-manager/texture-cache-manager.cpp | 118 +++----- .../texture-manager/texture-cache-manager.h | 78 +++-- .../texture-manager/texture-manager-impl.cpp | 316 ++++++++++----------- .../texture-manager/texture-manager-impl.h | 188 ++++++------ .../texture-manager/texture-manager-type.h | 92 +++--- .../texture-manager/texture-upload-observer.cpp | 20 +- .../texture-manager/texture-upload-observer.h | 12 +- .../internal/visuals/image/image-visual.cpp | 59 ++-- 13 files changed, 439 insertions(+), 554 deletions(-) diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp index f9df7d8..7292c03 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp @@ -207,7 +207,6 @@ int UtcTextureManagerRequestLoad(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer, true, TextureManager::ReloadPolicy::CACHED, @@ -234,7 +233,6 @@ int UtcTextureManagerGenerateHash(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer, true, TextureManager::ReloadPolicy::CACHED, @@ -282,7 +280,6 @@ int UtcTextureManagerEncodedImageBuffer(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer1, true, ///< orientationCorrection TextureManager::ReloadPolicy::CACHED, @@ -356,7 +353,6 @@ int UtcTextureManagerEncodedImageBuffer(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer3, true, ///< orientationCorrection TextureManager::ReloadPolicy::CACHED, @@ -373,7 +369,6 @@ int UtcTextureManagerEncodedImageBuffer(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer4, true, ///< orientationCorrection TextureManager::ReloadPolicy::FORCED, @@ -807,7 +802,6 @@ int UtcTextureManagerEncodedImageBufferReferenceCount(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer1, true, ///< orientationCorrection TextureManager::ReloadPolicy::CACHED, @@ -886,7 +880,6 @@ int UtcTextureManagerCachingForDifferentLoadingType(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer1, true, TextureManager::ReloadPolicy::CACHED, @@ -1452,7 +1445,6 @@ int UtcTextureManagerQueueRemoveDuringObserve(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer, true, TextureManager::ReloadPolicy::CACHED, @@ -1559,7 +1551,6 @@ int UtcTextureManagerRemoveDuringApplyMasking(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer2, true, ///< orientationCorrection TextureManager::ReloadPolicy::CACHED, @@ -1931,7 +1922,6 @@ int UtcTextureManagerRemoveDuringGPUMasking(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, data2.addTextureObserver, true, TextureManager::ReloadPolicy::CACHED, @@ -2069,7 +2059,6 @@ int UtcTextureManagerDestroyObserverDuringObserve(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer1, true, TextureManager::ReloadPolicy::CACHED, @@ -2080,7 +2069,6 @@ int UtcTextureManagerDestroyObserverDuringObserve(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, observer2, true, TextureManager::ReloadPolicy::CACHED, @@ -2091,7 +2079,6 @@ int UtcTextureManagerDestroyObserverDuringObserve(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, &observer3, true, TextureManager::ReloadPolicy::CACHED, @@ -2205,7 +2192,6 @@ int UtcTextureManagerDestroyObserverDuringObserve(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, data1.resendTextureObserver, true, TextureManager::ReloadPolicy::CACHED, @@ -2220,7 +2206,6 @@ int UtcTextureManagerDestroyObserverDuringObserve(void) ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, - TextureManager::UseAtlas::NO_ATLAS, *data1.removeTextureObserver, true, TextureManager::ReloadPolicy::CACHED, diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AsyncImageLoader.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AsyncImageLoader.cpp index 70263e6..894a23d 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AsyncImageLoader.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AsyncImageLoader.cpp @@ -98,7 +98,7 @@ void dali_async_image_loader_cleanup(void) test_return_value = TET_PASS; } -int UtcDaliImageAtlasNew01(void) +int UtcDaliAsyncImageLoaderNew01(void) { ToolkitTestApplication application; diff --git a/dali-scene3d/internal/common/image-resource-loader.cpp b/dali-scene3d/internal/common/image-resource-loader.cpp index e580cd3..7677e30 100644 --- a/dali-scene3d/internal/common/image-resource-loader.cpp +++ b/dali-scene3d/internal/common/image-resource-loader.cpp @@ -94,7 +94,7 @@ std::size_t GenerateHash(const ImageInformation& info) *hashTargetPtr++ = info.mDimensions.GetHeight() & 0xff; *hashTargetPtr++ = (info.mDimensions.GetHeight() >> 8u) & 0xff; - // Bit-pack the FittingMode, SamplingMode and atlasing. + // Bit-pack the FittingMode, SamplingMode and orientation correction. // FittingMode=2bits, SamplingMode=3bits, orientationCorrection=1bit *hashTargetPtr = (info.mFittingMode << 4u) | (info.mSamplingMode << 1) | (info.mOrientationCorrection ? 1 : 0); } diff --git a/dali-toolkit/internal/texture-manager/texture-async-loading-helper.cpp b/dali-toolkit/internal/texture-manager/texture-async-loading-helper.cpp index 9927ea2..972b919 100644 --- a/dali-toolkit/internal/texture-manager/texture-async-loading-helper.cpp +++ b/dali-toolkit/internal/texture-manager/texture-async-loading-helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "texture-async-loading-helper.h" +#include // EXTERNAL HEADERS #include @@ -41,27 +41,27 @@ TextureAsyncLoadingHelper::TextureAsyncLoadingHelper(TextureManager& textureMana { } -void TextureAsyncLoadingHelper::LoadAnimatedImage(const TextureManager::TextureId& textureId, - Dali::AnimatedImageLoading animatedImageLoading, - const std::uint32_t& frameIndex, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const DevelAsyncImageLoader::PreMultiplyOnLoad& preMultiplyOnLoad) +void TextureAsyncLoadingHelper::LoadAnimatedImage(const TextureManager::TextureId textureId, + Dali::AnimatedImageLoading animatedImageLoading, + const uint32_t frameIndex, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad) { LoadingTaskPtr loadingTask = new LoadingTask(++mLoadTaskId, animatedImageLoading, frameIndex, desiredSize, fittingMode, samplingMode, preMultiplyOnLoad, MakeCallback(this, &TextureAsyncLoadingHelper::AsyncLoadComplete)); loadingTask->SetTextureId(textureId); Dali::AsyncTaskManager::Get().AddTask(loadingTask); } -void TextureAsyncLoadingHelper::Load(const TextureManager::TextureId& textureId, - const VisualUrl& url, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& orientationCorrection, - const DevelAsyncImageLoader::PreMultiplyOnLoad& preMultiplyOnLoad, - const bool& loadYuvPlanes) +void TextureAsyncLoadingHelper::Load(const TextureManager::TextureId textureId, + const VisualUrl& url, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool orientationCorrection, + const DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, + const bool loadYuvPlanes) { LoadingTaskPtr loadingTask; if(DALI_UNLIKELY(url.IsBufferResource())) @@ -77,12 +77,12 @@ void TextureAsyncLoadingHelper::Load(const TextureManager::TextureId& Dali::AsyncTaskManager::Get().AddTask(loadingTask); } -void TextureAsyncLoadingHelper::ApplyMask(const TextureManager::TextureId& textureId, - Devel::PixelBuffer pixelBuffer, - Devel::PixelBuffer maskPixelBuffer, - const float& contentScale, - const bool& cropToMask, - const DevelAsyncImageLoader::PreMultiplyOnLoad& preMultiplyOnLoad) +void TextureAsyncLoadingHelper::ApplyMask(const TextureManager::TextureId textureId, + Devel::PixelBuffer pixelBuffer, + Devel::PixelBuffer maskPixelBuffer, + const float contentScale, + const bool cropToMask, + const DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad) { LoadingTaskPtr loadingTask = new LoadingTask(++mLoadTaskId, pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad, MakeCallback(this, &TextureAsyncLoadingHelper::AsyncLoadComplete)); loadingTask->SetTextureId(textureId); diff --git a/dali-toolkit/internal/texture-manager/texture-async-loading-helper.h b/dali-toolkit/internal/texture-manager/texture-async-loading-helper.h index 15e1d4e..a8fddbf 100644 --- a/dali-toolkit/internal/texture-manager/texture-async-loading-helper.h +++ b/dali-toolkit/internal/texture-manager/texture-async-loading-helper.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXTURE_ASYNC_LOADING_HELPER_H /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ // EXTERNAL INCLUDES #include -#include // INTERNAL INCLUDES #include @@ -54,13 +53,13 @@ public: * @param[in] samplingMode The SamplingMode to use * @param[in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask. */ - void LoadAnimatedImage(const TextureManager::TextureId& textureId, - Dali::AnimatedImageLoading animatedImageLoading, - const std::uint32_t& frameIndex, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const DevelAsyncImageLoader::PreMultiplyOnLoad& preMultiplyOnLoad); + void LoadAnimatedImage(const TextureManager::TextureId textureId, + Dali::AnimatedImageLoading animatedImageLoading, + const uint32_t frameIndex, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad); /** * @brief Load a new texture. @@ -75,14 +74,14 @@ public: * @param[in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask. * @param[in] loadYuvPlanes True if the image should be loaded as yuv planes */ - void Load(const TextureManager::TextureId& textureId, - const VisualUrl& url, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& orientationCorrection, - const DevelAsyncImageLoader::PreMultiplyOnLoad& preMultiplyOnLoad, - const bool& loadYuvPlanes); + void Load(const TextureManager::TextureId textureId, + const VisualUrl& url, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool orientationCorrection, + const DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, + const bool loadYuvPlanes); /** * @brief Apply mask @@ -93,12 +92,12 @@ public: * @param [in] cropToMask Whether to crop the content to the mask size * @param [in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha. */ - void ApplyMask(const TextureManager::TextureId& textureId, - Devel::PixelBuffer pixelBuffer, - Devel::PixelBuffer maskPixelBuffer, - const float& contentScale, - const bool& cropToMask, - const DevelAsyncImageLoader::PreMultiplyOnLoad& preMultiplyOnLoad); + void ApplyMask(const TextureManager::TextureId textureId, + Devel::PixelBuffer pixelBuffer, + Devel::PixelBuffer maskPixelBuffer, + const float contentScale, + const bool cropToMask, + const DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad); public: TextureAsyncLoadingHelper(const TextureAsyncLoadingHelper&) = delete; diff --git a/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp b/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp index 4343a84..095f21f 100644 --- a/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp +++ b/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp @@ -77,7 +77,7 @@ void TextureCacheManager::RemoveTextureInfoByIndex(removeContainerIndex.GetIndex() + 1) < cacheContainer.size()) { // First, change the cache index infomations inside of converter - mTextureIdConverter[cacheContainer.back().bufferId] = static_cast(removeContainerIndex); + mTextureIdConverter[cacheContainer.back().bufferId] = static_cast(removeContainerIndex); // After change converter, swap the value between current data and last data. std::swap(cacheContainer[removeContainerIndex.GetIndex()], cacheContainer.back()); @@ -94,7 +94,7 @@ void TextureCacheManager::RemoveTextureInfoByIndex(ContainerType& cacheContainer if(static_cast(removeContainerIndex.GetIndex() + 1) < cacheContainer.size()) { // First, change the cache index infomations inside of converter - mTextureIdConverter[cacheContainer.back().textureId] = static_cast(removeContainerIndex); + mTextureIdConverter[cacheContainer.back().textureId] = static_cast(removeContainerIndex); // After change converter, swap the value between current data and last data. std::swap(cacheContainer[removeContainerIndex.GetIndex()], cacheContainer.back()); @@ -112,10 +112,10 @@ TextureCacheManager::~TextureCacheManager() { } -VisualUrl TextureCacheManager::GetVisualUrl(const TextureCacheManager::TextureId& textureId) +VisualUrl TextureCacheManager::GetVisualUrl(const TextureCacheManager::TextureId textureId) { VisualUrl visualUrl(""); - TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); + TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); switch(static_cast(cacheIndex.detailValue.type)) { @@ -151,10 +151,10 @@ VisualUrl TextureCacheManager::GetVisualUrl(const TextureCacheManager::TextureId return visualUrl; } -TextureCacheManager::LoadState TextureCacheManager::GetTextureState(const TextureCacheManager::TextureId& textureId) +TextureCacheManager::LoadState TextureCacheManager::GetTextureState(const TextureCacheManager::TextureId textureId) { LoadState loadState = TextureCacheManager::LoadState::NOT_STARTED; - TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); + TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); switch(static_cast(cacheIndex.detailValue.type)) { @@ -178,7 +178,7 @@ TextureCacheManager::LoadState TextureCacheManager::GetTextureState(const Textur return loadState; } -TextureCacheManager::LoadState TextureCacheManager::GetTextureStateInternal(const TextureCacheManager::TextureId& textureId) +TextureCacheManager::LoadState TextureCacheManager::GetTextureStateInternal(const TextureCacheManager::TextureId textureId) { LoadState loadState = TextureCacheManager::LoadState::NOT_STARTED; TextureCacheIndex cacheIndex = GetCacheIndexFromId(textureId); @@ -191,7 +191,7 @@ TextureCacheManager::LoadState TextureCacheManager::GetTextureStateInternal(cons return loadState; } -Texture TextureCacheManager::GetTexture(const TextureCacheManager::TextureId& textureId, uint32_t textureIndex) +Texture TextureCacheManager::GetTexture(const TextureCacheManager::TextureId textureId, const uint32_t textureIndex) { Texture texture; // empty handle TextureCacheIndex cacheIndex = GetCacheIndexFromId(textureId); @@ -216,7 +216,7 @@ Texture TextureCacheManager::GetTexture(const TextureCacheManager::TextureId& te return texture; } -TextureCacheManager::ExternalTextureInfo& TextureCacheManager::GetExternalTextureInfo(const TextureCacheManager::TextureId& textureId) +TextureCacheManager::ExternalTextureInfo& TextureCacheManager::GetExternalTextureInfo(const TextureCacheManager::TextureId textureId) { TextureCacheIndex cacheIndex = GetCacheIndexFromExternalTextureId(textureId); DALI_ASSERT_ALWAYS(cacheIndex != INVALID_CACHE_INDEX); @@ -224,7 +224,7 @@ TextureCacheManager::ExternalTextureInfo& TextureCacheManager::GetExternalTextur return mExternalTextures[cacheIndex.GetIndex()]; } -EncodedImageBuffer TextureCacheManager::GetEncodedImageBuffer(const TextureCacheManager::TextureId& bufferId) +EncodedImageBuffer TextureCacheManager::GetEncodedImageBuffer(const TextureCacheManager::TextureId bufferId) { EncodedImageBuffer encodedImageBuffer; // empty handle TextureCacheIndex cacheIndex = GetCacheIndexFromEncodedImageBufferId(bufferId); @@ -250,7 +250,7 @@ EncodedImageBuffer TextureCacheManager::GetEncodedImageBuffer(const VisualUrl& u return encodedImageBuffer; } -std::string TextureCacheManager::AddExternalTexture(const TextureSet& textureSet, bool preMultiplied) +std::string TextureCacheManager::AddExternalTexture(const TextureSet& textureSet, const bool preMultiplied) { TextureId textureId = GenerateTextureId(TextureCacheIndex(TextureCacheIndexType::TEXTURE_CACHE_INDEX_TYPE_TEXTURE, mExternalTextures.size())); @@ -418,14 +418,14 @@ void TextureCacheManager::UseExternalResource(const VisualUrl& url) TextureCacheManager::TextureId TextureCacheManager::GenerateTextureId(const TextureCacheIndex& textureCacheIndex) { - return mTextureIdConverter.Add(static_cast(textureCacheIndex.indexValue)); + return mTextureIdConverter.Add(static_cast(textureCacheIndex.indexValue)); } -TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromId(const TextureCacheManager::TextureId& textureId) +TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromId(const TextureCacheManager::TextureId textureId) { if(textureId == INVALID_TEXTURE_ID) return INVALID_CACHE_INDEX; - TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); + TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); if(DALI_UNLIKELY(cacheIndex.detailValue.type != TextureCacheIndexType::TEXTURE_CACHE_INDEX_TYPE_LOCAL)) { return INVALID_CACHE_INDEX; @@ -436,11 +436,11 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromId( return cacheIndex; } -TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromExternalTextureId(const TextureCacheManager::TextureId& textureId) +TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromExternalTextureId(const TextureCacheManager::TextureId textureId) { if(textureId == INVALID_TEXTURE_ID) return INVALID_CACHE_INDEX; - TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); + TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(textureId)]); if(DALI_UNLIKELY(cacheIndex.detailValue.type != TextureCacheIndexType::TEXTURE_CACHE_INDEX_TYPE_TEXTURE)) { return INVALID_CACHE_INDEX; @@ -451,11 +451,11 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromExt return cacheIndex; } -TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromEncodedImageBufferId(const TextureCacheManager::TextureId& bufferId) +TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromEncodedImageBufferId(const TextureCacheManager::TextureId bufferId) { if(bufferId == INVALID_TEXTURE_ID) return INVALID_CACHE_INDEX; - TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(bufferId)]); + TextureCacheIndex cacheIndex = static_cast(mTextureIdConverter[static_cast(bufferId)]); if(DALI_UNLIKELY(cacheIndex.detailValue.type != TextureCacheIndexType::TEXTURE_CACHE_INDEX_TYPE_BUFFER)) { return INVALID_CACHE_INDEX; @@ -466,7 +466,7 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::GetCacheIndexFromEnc return cacheIndex; } -TextureCacheManager::TextureCacheIndex TextureCacheManager::FindCachedEncodedImageBuffer(const TextureCacheManager::TextureHash& hash, const EncodedImageBuffer& encodedImageBuffer) +TextureCacheManager::TextureCacheIndex TextureCacheManager::FindCachedEncodedImageBuffer(const TextureCacheManager::TextureHash hash, const EncodedImageBuffer& encodedImageBuffer) { // Iterate through our hashes to find a match. const auto& hashIterator = mTextureHashContainer.find(hash); @@ -494,14 +494,13 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::FindCachedEncodedIma } TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( - const VisualUrl& url, - const Dali::ImageDimensions& size, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureCacheManager::UseAtlas& useAtlas, - const TextureCacheManager::TextureId& maskTextureId, - const bool& cropToMask, - const std::uint32_t& frameIndex) + const VisualUrl& url, + const Dali::ImageDimensions& size, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const TextureCacheManager::TextureId maskTextureId, + const bool cropToMask, + const uint32_t frameIndex) { std::vector hashTarget; const uint16_t width = size.GetWidth(); @@ -520,29 +519,9 @@ TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( *hashTargetPtr++ = size.GetHeight() & 0xff; *hashTargetPtr++ = (size.GetHeight() >> 8u) & 0xff; - // Bit-pack the FittingMode, SamplingMode and atlasing. - // FittingMode=2bits, SamplingMode=3bits, useAtlas=1bit - *hashTargetPtr = (fittingMode << 4u) | (samplingMode << 1) | (useAtlas == UseAtlas::USE_ATLAS ? 1 : 0); - } - else - { - // We are not including sizing information, but we still need an extra byte for atlasing. - hashTarget.resize(1u); - - // Add the atlasing to the hash input. - switch(useAtlas) - { - case UseAtlas::NO_ATLAS: - { - hashTarget[0u] = 'f'; - break; - } - case UseAtlas::USE_ATLAS: - { - hashTarget[0u] = 't'; - break; - } - } + // Bit-pack the FittingMode, SamplingMode. + // FittingMode=2bits, SamplingMode=3bits + *hashTargetPtr = (fittingMode << 3u) | (samplingMode); } if(maskTextureId != INVALID_TEXTURE_ID) @@ -566,12 +545,13 @@ TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( if(frameIndex > 0u) { auto textureIdIndex = hashTarget.size(); - hashTarget.resize(hashTarget.size() + sizeof(std::uint32_t)); + hashTarget.resize(hashTarget.size() + sizeof(uint32_t)); std::uint8_t* hashTargetPtr = reinterpret_cast(&(hashTarget[textureIdIndex])); // Append the frame index to the end of the URL byte by byte: - std::uint32_t saltedFrameIndex = frameIndex; - for(size_t byteIter = 0; byteIter < sizeof(std::uint8_t); ++byteIter) + // (to avoid SIGBUS / alignment issues) + uint32_t saltedFrameIndex = frameIndex; + for(size_t byteIter = 0; byteIter < sizeof(uint32_t); ++byteIter) { *hashTargetPtr++ = saltedFrameIndex & 0xff; saltedFrameIndex >>= 8u; @@ -582,18 +562,17 @@ TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( } TextureCacheManager::TextureCacheIndex TextureCacheManager::FindCachedTexture( - const TextureCacheManager::TextureHash& hash, - const VisualUrl& url, - const Dali::ImageDimensions& size, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureCacheManager::UseAtlas& useAtlas, - const StorageType& storageType, - const TextureCacheManager::TextureId& maskTextureId, - const bool& cropToMask, - const TextureCacheManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& isAnimatedImage, - const std::uint32_t& frameIndex) + const TextureCacheManager::TextureHash hash, + const VisualUrl& url, + const Dali::ImageDimensions& size, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const TextureCacheManager::StorageType storageType, + const TextureCacheManager::TextureId maskTextureId, + const bool cropToMask, + const TextureCacheManager::MultiplyOnLoad preMultiplyOnLoad, + const bool isAnimatedImage, + const uint32_t frameIndex) { // Iterate through our hashes to find a match. const auto& hashIterator = mTextureHashContainer.find(hash); @@ -608,7 +587,6 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::FindCachedTexture( TextureInfo& textureInfo(mTextureInfoContainer[cacheIndex.GetIndex()]); if((url.GetUrl() == textureInfo.url.GetUrl()) && - (useAtlas == textureInfo.useAtlas) && (maskTextureId == textureInfo.maskTextureId) && (cropToMask == textureInfo.cropToMask) && (size == textureInfo.desiredSize) && @@ -677,13 +655,9 @@ void TextureCacheManager::RemoveCache(TextureCacheManager::TextureInfo& textureI // This is the last remove for this Texture. textureInfo.referenceCount = 0; - // If loaded, we can remove the TextureInfo and the Atlas (if atlased). + // If loaded, we can remove the TextureInfo if(textureInfo.loadState == LoadState::UPLOADED) { - if(textureInfo.atlas) - { - textureInfo.atlas.Remove(textureInfo.atlasRect); - } removeTextureInfo = true; } else if(textureInfo.loadState == LoadState::LOADING) @@ -730,7 +704,7 @@ void TextureCacheManager::RemoveCache(TextureCacheManager::TextureInfo& textureI } } -void TextureCacheManager::RemoveHashId(const TextureCacheManager::TextureHash& textureHash, const TextureCacheManager::TextureId& textureId) +void TextureCacheManager::RemoveHashId(const TextureCacheManager::TextureHash textureHash, const TextureCacheManager::TextureId textureId) { auto hashIterator = mTextureHashContainer.find(textureHash); if(hashIterator != mTextureHashContainer.end()) diff --git a/dali-toolkit/internal/texture-manager/texture-cache-manager.h b/dali-toolkit/internal/texture-manager/texture-cache-manager.h index 75686a1..d4d6ea6 100644 --- a/dali-toolkit/internal/texture-manager/texture-cache-manager.h +++ b/dali-toolkit/internal/texture-manager/texture-cache-manager.h @@ -70,9 +70,7 @@ public: static constexpr TextureId INVALID_TEXTURE_ID = TextureManagerType::INVALID_TEXTURE_ID; static constexpr TextureCacheIndex INVALID_CACHE_INDEX = TextureManagerType::INVALID_CACHE_INDEX; - using UseAtlas = TextureManagerType::UseAtlas; using StorageType = TextureManagerType::StorageType; - using LoadType = TextureManagerType::LoadType; using LoadState = TextureManagerType::LoadState; using ReloadPolicy = TextureManagerType::ReloadPolicy; using MultiplyOnLoad = TextureManagerType::MultiplyOnLoad; @@ -98,7 +96,7 @@ public: * @param[in] textureId The texture Id to get * @return The visual Url associated with the texture id. */ - VisualUrl GetVisualUrl(const TextureCacheManager::TextureId& textureId); + VisualUrl GetVisualUrl(const TextureCacheManager::TextureId textureId); /** * @brief Get the current state of a texture @@ -107,7 +105,7 @@ public: * @return The loading state if the texture is valid, or NOT_STARTED if the textureId * is not valid. */ - TextureCacheManager::LoadState GetTextureState(const TextureCacheManager::TextureId& textureId); + TextureCacheManager::LoadState GetTextureState(const TextureCacheManager::TextureId textureId); /** * @brief Get the current state of a texture @@ -116,7 +114,7 @@ public: * @return The loading state if the texture is valid, or NOT_STARTED if the textureId * is not valid. */ - TextureCacheManager::LoadState GetTextureStateInternal(const TextureCacheManager::TextureId& textureId); + TextureCacheManager::LoadState GetTextureStateInternal(const TextureCacheManager::TextureId textureId); /** * @brief Get the associated texture set if the texture id is valid @@ -124,21 +122,21 @@ public: * @param[in] textureIndex The texture index to query * @return the associated texture, or an empty handle if textureId is not valid */ - Texture GetTexture(const TextureCacheManager::TextureId& textureId, uint32_t textureIndex = 0); + Texture GetTexture(const TextureCacheManager::TextureId textureId, const uint32_t textureIndex = 0); /** * @brief Get the external texture set information if the texture id is valid * @param[in] textureId The texture Id to look up * @return the external texture information. Assert if textureId is not valid */ - TextureCacheManager::ExternalTextureInfo& GetExternalTextureInfo(const TextureCacheManager::TextureId& textureId); + TextureCacheManager::ExternalTextureInfo& GetExternalTextureInfo(const TextureCacheManager::TextureId textureId); /** * @brief Get the encoded image buffer * @param[in] bufferId The bufferId to look up * @return the encoded image buffer, or an empty handle if bufferId is not valid */ - EncodedImageBuffer GetEncodedImageBuffer(const TextureCacheManager::TextureId& bufferId); + EncodedImageBuffer GetEncodedImageBuffer(const TextureCacheManager::TextureId bufferId); /** * @brief Get the encoded image buffer by VisualUrl @@ -153,7 +151,7 @@ public: * @param[in] preMultiplied Whether this external texture preMultiplied or not. Default as false. * @return string containing the URL for the texture */ - std::string AddExternalTexture(const TextureSet& texture, bool preMultiplied); + std::string AddExternalTexture(const TextureSet& texture, const bool preMultiplied); /** * Adds an encoded image buffer to the texture manager @@ -197,32 +195,30 @@ public: * @param[in] textureId The TextureId to look up * @return The cache index */ - TextureCacheManager::TextureCacheIndex GetCacheIndexFromId(const TextureCacheManager::TextureId& textureId); + TextureCacheManager::TextureCacheIndex GetCacheIndexFromId(const TextureCacheManager::TextureId textureId); /** * @brief Generates a hash for caching based on the input parameters. * Only applies size, fitting mode andsampling mode if the size is specified. * Only applies maskTextureId if it isn't INVALID_TEXTURE_ID - * Always applies useAtlas. + * Only applied frameIndex if it is not 0. * @param[in] url The URL of the image to load * @param[in] size The image size * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlas True if atlased * @param[in] maskTextureId The masking texture id (or INVALID_TEXTURE_ID) * @param[in] cropToMask True if crop to mask * @param[in] frameIndex The frame index to use * @return A hash of the provided data for caching. */ TextureCacheManager::TextureHash GenerateHash( - const VisualUrl& url, - const Dali::ImageDimensions& size, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureCacheManager::UseAtlas& useAtlas, - const TextureCacheManager::TextureId& maskTextureId, - const bool& cropToMask, - const std::uint32_t& frameIndex); + const VisualUrl& url, + const Dali::ImageDimensions& size, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const TextureCacheManager::TextureId maskTextureId, + const bool cropToMask, + const uint32_t frameIndex); /** * @brief Looks up a cached texture by its hash. @@ -232,7 +228,6 @@ public: * @param[in] size The image size * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlas True if atlased * @param[in] storageType Whether the pixel data is stored in the cache or uploaded to the GPU * @param[in] maskTextureId Optional texture ID to use to mask this image * @param[in] cropToMask True if crop to mask @@ -242,18 +237,17 @@ public: * @return A TextureCacheIndex of a cached Texture if found. Or INVALID_CACHE_INDEX if not found. */ TextureCacheManager::TextureCacheIndex FindCachedTexture( - const TextureCacheManager::TextureHash& hash, - const VisualUrl& url, - const Dali::ImageDimensions& size, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureCacheManager::UseAtlas& useAtlas, - const StorageType& storageType, - const TextureCacheManager::TextureId& maskTextureId, - const bool& cropToMask, - const TextureCacheManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& isAnimatedImage, - const std::uint32_t& frameIndex); + const TextureCacheManager::TextureHash hash, + const VisualUrl& url, + const Dali::ImageDimensions& size, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const TextureCacheManager::StorageType storageType, + const TextureCacheManager::TextureId maskTextureId, + const bool cropToMask, + const TextureCacheManager::MultiplyOnLoad preMultiplyOnLoad, + const bool isAnimatedImage, + const uint32_t frameIndex); /** * @brief Append a Texture to the TextureCacheManager. @@ -293,7 +287,7 @@ public: * @note This API doesn't consider external & encodedimagebuffer. * @return The number of associated cached image */ - inline std::size_t size() noexcept + inline size_t size() noexcept { return mTextureInfoContainer.size(); } @@ -306,9 +300,9 @@ private: */ struct EncodedImageBufferInfo { - EncodedImageBufferInfo(const TextureCacheManager::TextureId& bufferId, - const TextureCacheManager::TextureHash& bufferHash, - const EncodedImageBuffer& encodedImageBuffer) + EncodedImageBufferInfo(const TextureCacheManager::TextureId bufferId, + const TextureCacheManager::TextureHash bufferHash, + const EncodedImageBuffer& encodedImageBuffer) : bufferId(bufferId), bufferHash(bufferHash), encodedImageBuffer(encodedImageBuffer), @@ -318,7 +312,7 @@ private: TextureCacheManager::TextureId bufferId; TextureCacheManager::TextureHash bufferHash; EncodedImageBuffer encodedImageBuffer; - std::int16_t referenceCount; + uint32_t referenceCount; }; typedef Dali::FreeList TextureIdConverterType; ///< The converter type from TextureId to index of TextureInfoContainer. @@ -336,14 +330,14 @@ private: * @param[in] textureId The TextureId to look up * @return The cache index */ - TextureCacheManager::TextureCacheIndex GetCacheIndexFromExternalTextureId(const TextureCacheManager::TextureId& textureId); + TextureCacheManager::TextureCacheIndex GetCacheIndexFromExternalTextureId(const TextureCacheManager::TextureId textureId); /** * @brief Used to lookup an index into the EncodedImageBufferInfoContainer from a bufferId * @param[in] bufferId The bufferId to look up * @return The cache index */ - TextureCacheManager::TextureCacheIndex GetCacheIndexFromEncodedImageBufferId(const TextureCacheManager::TextureId& bufferId); + TextureCacheManager::TextureCacheIndex GetCacheIndexFromEncodedImageBufferId(const TextureCacheManager::TextureId bufferId); /** * @brief Looks up a cached encoded image buffer cached by its hash. @@ -352,14 +346,14 @@ private: * @param[in] encodedImageBuffer The image buffer to load * @return A TextureCacheIndex of a cached Texture if found. Or INVALID_CACHE_INDEX if not found. */ - TextureCacheManager::TextureCacheIndex FindCachedEncodedImageBuffer(const TextureCacheManager::TextureHash& hash, const EncodedImageBuffer& encodedImageBuffer); + TextureCacheManager::TextureCacheIndex FindCachedEncodedImageBuffer(const TextureCacheManager::TextureHash hash, const EncodedImageBuffer& encodedImageBuffer); /** * @brief Remove id in HashContainer. * @param[in] hash The hash of the texture/buffer to be delete * @param[in] id The texture/buffer id to be deleted. */ - void RemoveHashId(const TextureCacheManager::TextureHash& hash, const TextureCacheManager::TextureId& id); + void RemoveHashId(const TextureCacheManager::TextureHash hash, const TextureCacheManager::TextureId id); /** * @brief Remove data from container by the TextureCacheIndex. diff --git a/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp b/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp index 0c3e3dd..5b8a154 100644 --- a/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp +++ b/dali-toolkit/internal/texture-manager/texture-manager-impl.cpp @@ -67,8 +67,7 @@ Debug::Filter* gTextureManagerLogFilter = Debug::Filter::New(Debug::NoLogging, f namespace { -const uint32_t DEFAULT_ATLAS_SIZE(1024u); ///< This size can fit 8 by 8 images of average size 128 * 128 -const Vector4 FULL_ATLAS_RECT(0.0f, 0.0f, 1.0f, 1.0f); ///< UV Rectangle that covers the full Texture +const Vector4 FULL_ATLAS_RECT(0.0f, 0.0f, 1.0f, 1.0f); ///< UV Rectangle that covers the full Texture void PreMultiply(Devel::PixelBuffer pixelBuffer, TextureManager::MultiplyOnLoad& preMultiplyOnLoad) { @@ -128,13 +127,13 @@ TextureManager::~TextureManager() TextureSet TextureManager::LoadAnimatedImageTexture( const VisualUrl& url, Dali::AnimatedImageLoading animatedImageLoading, - const uint32_t& frameIndex, + const uint32_t frameIndex, TextureManager::TextureId& textureId, MaskingDataPointer& maskInfo, const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& synchronousLoading, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool synchronousLoading, TextureUploadObserver* textureObserver, TextureManager::MultiplyOnLoad& preMultiplyOnLoad) { @@ -202,7 +201,7 @@ TextureSet TextureManager::LoadAnimatedImageTexture( bool cropToMask = false; if(maskInfo && maskInfo->mAlphaMaskUrl.IsValid()) { - maskInfo->mAlphaMaskId = RequestMaskLoad(maskInfo->mAlphaMaskUrl, maskInfo->mPreappliedMasking ? StorageType::KEEP_PIXEL_BUFFER : StorageType::KEEP_TEXTURE); + maskInfo->mAlphaMaskId = RequestMaskLoad(maskInfo->mAlphaMaskUrl, maskInfo->mPreappliedMasking ? TextureManager::StorageType::KEEP_PIXEL_BUFFER : TextureManager::StorageType::KEEP_TEXTURE); alphaMaskId = maskInfo->mAlphaMaskId; if(maskInfo->mPreappliedMasking) { @@ -211,7 +210,7 @@ TextureSet TextureManager::LoadAnimatedImageTexture( } } - textureId = RequestLoadInternal(url, alphaMaskId, textureId, contentScaleFactor, desiredSize, fittingMode, samplingMode, UseAtlas::NO_ATLAS, cropToMask, StorageType::UPLOAD_TO_TEXTURE, textureObserver, true, TextureManager::ReloadPolicy::CACHED, preMultiplyOnLoad, animatedImageLoading, frameIndex, false); + textureId = RequestLoadInternal(url, alphaMaskId, textureId, contentScaleFactor, desiredSize, fittingMode, samplingMode, cropToMask, TextureManager::StorageType::UPLOAD_TO_TEXTURE, textureObserver, true, TextureManager::ReloadPolicy::CACHED, preMultiplyOnLoad, animatedImageLoading, frameIndex, false); TextureManager::LoadState loadState = mTextureCacheManager.GetTextureStateInternal(textureId); if(loadState == TextureManager::LoadState::UPLOADED) @@ -227,11 +226,11 @@ TextureSet TextureManager::LoadAnimatedImageTexture( Devel::PixelBuffer TextureManager::LoadPixelBuffer( const VisualUrl& url, const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& synchronousLoading, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool synchronousLoading, TextureUploadObserver* textureObserver, - const bool& orientationCorrection, + const bool orientationCorrection, TextureManager::MultiplyOnLoad& preMultiplyOnLoad) { Devel::PixelBuffer pixelBuffer; @@ -259,30 +258,30 @@ Devel::PixelBuffer TextureManager::LoadPixelBuffer( } else { - RequestLoadInternal(url, INVALID_TEXTURE_ID, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, UseAtlas::NO_ATLAS, false, StorageType::RETURN_PIXEL_BUFFER, textureObserver, orientationCorrection, TextureManager::ReloadPolicy::FORCED, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u, false); + RequestLoadInternal(url, INVALID_TEXTURE_ID, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, false, TextureManager::StorageType::RETURN_PIXEL_BUFFER, textureObserver, orientationCorrection, TextureManager::ReloadPolicy::FORCED, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u, false); } return pixelBuffer; } TextureSet TextureManager::LoadTexture( - const VisualUrl& url, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - MaskingDataPointer& maskInfo, - const bool& synchronousLoading, - TextureManager::TextureId& textureId, - Vector4& textureRect, - Dali::ImageDimensions& textureRectSize, - bool& atlasingStatus, - bool& loadingStatus, - TextureUploadObserver* textureObserver, - AtlasUploadObserver* atlasObserver, - ImageAtlasManagerPtr imageAtlasManager, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad) + const VisualUrl& url, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + MaskingDataPointer& maskInfo, + const bool synchronousLoading, + TextureManager::TextureId& textureId, + Vector4& textureRect, + Dali::ImageDimensions& textureRectSize, + bool& atlasingStatus, + bool& loadingStatus, + TextureUploadObserver* textureObserver, + AtlasUploadObserver* atlasObserver, + ImageAtlasManagerPtr imageAtlasManager, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad) { TextureSet textureSet; @@ -308,11 +307,11 @@ TextureSet TextureManager::LoadTexture( TextureId alphaMaskId = INVALID_TEXTURE_ID; if(maskInfo && maskInfo->mAlphaMaskUrl.IsValid()) { - maskInfo->mAlphaMaskId = RequestMaskLoad(maskInfo->mAlphaMaskUrl, StorageType::KEEP_TEXTURE, synchronousLoading); + maskInfo->mAlphaMaskId = RequestMaskLoad(maskInfo->mAlphaMaskUrl, TextureManager::StorageType::KEEP_TEXTURE, synchronousLoading); alphaMaskId = maskInfo->mAlphaMaskId; // Create new textureId. this textureId is not same as location - textureId = RequestLoad(url, alphaMaskId, textureId, 1.0f, desiredSize, fittingMode, samplingMode, UseAtlas::NO_ATLAS, false, textureObserver, orientationCorrection, reloadPolicy, preMultiplyOnLoad, synchronousLoading); + textureId = RequestLoad(url, alphaMaskId, textureId, 1.0f, desiredSize, fittingMode, samplingMode, false, textureObserver, orientationCorrection, reloadPolicy, preMultiplyOnLoad, synchronousLoading); TextureManager::LoadState loadState = mTextureCacheManager.GetTextureStateInternal(textureId); if(loadState == TextureManager::LoadState::UPLOADED) @@ -411,7 +410,7 @@ TextureSet TextureManager::LoadTexture( bool cropToMask = false; if(maskInfo && maskInfo->mAlphaMaskUrl.IsValid()) { - maskInfo->mAlphaMaskId = RequestMaskLoad(maskInfo->mAlphaMaskUrl, maskInfo->mPreappliedMasking ? StorageType::KEEP_PIXEL_BUFFER : StorageType::KEEP_TEXTURE, synchronousLoading); + maskInfo->mAlphaMaskId = RequestMaskLoad(maskInfo->mAlphaMaskUrl, maskInfo->mPreappliedMasking ? TextureManager::StorageType::KEEP_PIXEL_BUFFER : TextureManager::StorageType::KEEP_TEXTURE, synchronousLoading); alphaMaskId = maskInfo->mAlphaMaskId; if(maskInfo && maskInfo->mPreappliedMasking) { @@ -428,7 +427,6 @@ TextureSet TextureManager::LoadTexture( desiredSize, fittingMode, samplingMode, - UseAtlas::NO_ATLAS, cropToMask, textureObserver, orientationCorrection, @@ -468,78 +466,75 @@ TextureSet TextureManager::LoadTexture( } TextureManager::TextureId TextureManager::RequestLoad( - const VisualUrl& url, - const ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const UseAtlas& useAtlas, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& synchronousLoading) + const VisualUrl& url, + const ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + const bool synchronousLoading) { - return RequestLoadInternal(url, INVALID_TEXTURE_ID, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, useAtlas, false, StorageType::UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u, synchronousLoading); + return RequestLoadInternal(url, INVALID_TEXTURE_ID, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, false, TextureManager::StorageType::UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u, synchronousLoading); } TextureManager::TextureId TextureManager::RequestLoad( - const VisualUrl& url, - const TextureManager::TextureId& maskTextureId, - const TextureManager::TextureId& previousTextureId, - const float& contentScale, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlas, - const bool& cropToMask, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& synchronousLoading) + const VisualUrl& url, + const TextureManager::TextureId maskTextureId, + const TextureManager::TextureId previousTextureId, + const float contentScale, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool cropToMask, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + const bool synchronousLoading) { - return RequestLoadInternal(url, maskTextureId, previousTextureId, contentScale, desiredSize, fittingMode, samplingMode, useAtlas, cropToMask, StorageType::UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u, synchronousLoading); + return RequestLoadInternal(url, maskTextureId, previousTextureId, contentScale, desiredSize, fittingMode, samplingMode, cropToMask, TextureManager::StorageType::UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy, preMultiplyOnLoad, Dali::AnimatedImageLoading(), 0u, synchronousLoading); } TextureManager::TextureId TextureManager::RequestMaskLoad( - const VisualUrl& maskUrl, - StorageType storageType, - const bool& synchronousLoading) + const VisualUrl& maskUrl, + const TextureManager::StorageType storageType, + const bool synchronousLoading) { // Use the normal load procedure to get the alpha mask. auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; - return RequestLoadInternal(maskUrl, INVALID_TEXTURE_ID, INVALID_TEXTURE_ID, 1.0f, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::NO_FILTER, UseAtlas::NO_ATLAS, false, storageType, NULL, true, TextureManager::ReloadPolicy::CACHED, preMultiply, Dali::AnimatedImageLoading(), 0u, synchronousLoading); + return RequestLoadInternal(maskUrl, INVALID_TEXTURE_ID, INVALID_TEXTURE_ID, 1.0f, ImageDimensions(), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::NO_FILTER, false, storageType, NULL, true, TextureManager::ReloadPolicy::CACHED, preMultiply, Dali::AnimatedImageLoading(), 0u, synchronousLoading); } TextureManager::TextureId TextureManager::RequestLoadInternal( - const VisualUrl& url, - const TextureManager::TextureId& maskTextureId, - const TextureManager::TextureId& previousTextureId, - const float& contentScale, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlas, - const bool& cropToMask, - const TextureManager::StorageType& storageType, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - Dali::AnimatedImageLoading animatedImageLoading, - const std::uint32_t& frameIndex, - const bool& synchronousLoading) + const VisualUrl& url, + const TextureManager::TextureId maskTextureId, + const TextureManager::TextureId previousTextureId, + const float contentScale, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool cropToMask, + const TextureManager::StorageType storageType, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + Dali::AnimatedImageLoading animatedImageLoading, + const uint32_t frameIndex, + const bool synchronousLoading) { TextureHash textureHash = INITIAL_HASH_NUMBER; TextureCacheIndex cacheIndex = INVALID_CACHE_INDEX; - bool loadYuvPlanes = (mLoadYuvPlanes && maskTextureId == INVALID_TEXTURE_ID && storageType == StorageType::UPLOAD_TO_TEXTURE); + bool loadYuvPlanes = (mLoadYuvPlanes && maskTextureId == INVALID_TEXTURE_ID && storageType == TextureManager::StorageType::UPLOAD_TO_TEXTURE); - if(storageType != StorageType::RETURN_PIXEL_BUFFER) + if(storageType != TextureManager::StorageType::RETURN_PIXEL_BUFFER) { - textureHash = mTextureCacheManager.GenerateHash(url, desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId, cropToMask, frameIndex); + textureHash = mTextureCacheManager.GenerateHash(url, desiredSize, fittingMode, samplingMode, maskTextureId, cropToMask, frameIndex); // Look up the texture by hash. Note: The extra parameters are used in case of a hash collision. - cacheIndex = mTextureCacheManager.FindCachedTexture(textureHash, url, desiredSize, fittingMode, samplingMode, useAtlas, storageType, maskTextureId, cropToMask, preMultiplyOnLoad, (animatedImageLoading) ? true : false, frameIndex); + cacheIndex = mTextureCacheManager.FindCachedTexture(textureHash, url, desiredSize, fittingMode, samplingMode, storageType, maskTextureId, cropToMask, preMultiplyOnLoad, (animatedImageLoading) ? true : false, frameIndex); } TextureManager::TextureId textureId = INVALID_TEXTURE_ID; @@ -567,7 +562,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( bool preMultiply = (preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD); // Cache new texutre, and get cacheIndex. - cacheIndex = mTextureCacheManager.AppendCache(TextureInfo(textureId, maskTextureId, url, desiredSize, contentScale, fittingMode, samplingMode, false, cropToMask, useAtlas, textureHash, orientationCorrection, preMultiply, animatedImageLoading, frameIndex, loadYuvPlanes)); + cacheIndex = mTextureCacheManager.AppendCache(TextureInfo(textureId, maskTextureId, url, desiredSize, contentScale, fittingMode, samplingMode, false, cropToMask, textureHash, orientationCorrection, preMultiply, animatedImageLoading, frameIndex, loadYuvPlanes)); DALI_LOG_INFO(gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d, maskTextureId=%d, frameindex=%d premultiply=%d\n", url.GetUrl().c_str(), observer, cacheIndex.GetIndex(), textureId, maskTextureId, frameIndex, preMultiply); } @@ -582,7 +577,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( // the case using external texture has already been loaded texture, so change its status to WAITING_FOR_MASK. if(url.GetProtocolType() == VisualUrl::TEXTURE) { - if(textureInfo.loadState != LoadState::UPLOADED) + if(textureInfo.loadState != TextureManager::LoadState::UPLOADED) { textureInfo.preMultiplied = (preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD); textureInfo.loadState = TextureManager::LoadState::WAITING_FOR_MASK; @@ -655,7 +650,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( case TextureManager::LoadState::LOAD_FINISHED: { // Loading has already completed. - if(observer && textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER) + if(observer && textureInfo.storageType == TextureManager::StorageType::RETURN_PIXEL_BUFFER) { LoadOrQueueTexture(textureInfo, observer); } @@ -679,7 +674,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( TextureId id = std::stoi(location); auto externalTextureInfo = mTextureCacheManager.GetExternalTextureInfo(id); textureInfo.textures.push_back(externalTextureInfo.textureSet.GetTexture(0)); - textureInfo.loadState = LoadState::UPLOADED; + textureInfo.loadState = TextureManager::LoadState::UPLOADED; } } else @@ -694,10 +689,10 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( return INVALID_TEXTURE_ID; } - if(storageType == StorageType::KEEP_PIXEL_BUFFER) // For the mask image loading. + if(storageType == TextureManager::StorageType::KEEP_PIXEL_BUFFER) // For the mask image loading. { textureInfo.pixelBuffer = pixelBuffers[0]; // Store the pixel data - textureInfo.loadState = LoadState::LOAD_FINISHED; + textureInfo.loadState = TextureManager::LoadState::LOAD_FINISHED; } else // For the image loading. { @@ -707,7 +702,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( TextureCacheIndex maskCacheIndex = mTextureCacheManager.GetCacheIndexFromId(maskTextureId); if(maskCacheIndex != INVALID_CACHE_INDEX) { - if(mTextureCacheManager[maskCacheIndex].storageType == StorageType::KEEP_PIXEL_BUFFER) + if(mTextureCacheManager[maskCacheIndex].storageType == TextureManager::StorageType::KEEP_PIXEL_BUFFER) { Devel::PixelBuffer maskPixelBuffer = mTextureCacheManager[maskCacheIndex].pixelBuffer; if(maskPixelBuffer) @@ -737,7 +732,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal( return textureId; } -void TextureManager::RequestRemove(const TextureManager::TextureId& textureId, TextureUploadObserver* observer) +void TextureManager::RequestRemove(const TextureManager::TextureId textureId, TextureUploadObserver* observer) { DALI_LOG_INFO(gTextureManagerLogFilter, Debug::General, "TextureManager::RequestRemove( textureId=%d observer=%p )\n", textureId, observer); @@ -765,7 +760,7 @@ void TextureManager::RequestRemove(const TextureManager::TextureId& textureId, T } } -void TextureManager::Remove(const TextureManager::TextureId& textureId) +void TextureManager::Remove(const TextureManager::TextureId textureId) { if(textureId != INVALID_TEXTURE_ID) { @@ -775,7 +770,7 @@ void TextureManager::Remove(const TextureManager::TextureId& textureId) TextureManager::TextureId maskTextureId = INVALID_TEXTURE_ID; TextureInfo& textureInfo(mTextureCacheManager[textureCacheIndex]); // We only need to consider maskTextureId when texture's loadState is not cancelled. Because it is already deleted. - if(textureInfo.loadState != LoadState::CANCELLED && textureInfo.loadState != LoadState::MASK_CANCELLED) + if(textureInfo.loadState != TextureManager::LoadState::CANCELLED && textureInfo.loadState != TextureManager::LoadState::MASK_CANCELLED) { if(textureInfo.maskTextureId != INVALID_TEXTURE_ID) { @@ -834,10 +829,10 @@ void TextureManager::Process(bool postProcessor) void TextureManager::LoadImageSynchronously( const VisualUrl& url, const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& orientationCorrection, - const bool& loadYuvPlanes, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool orientationCorrection, + const bool loadYuvPlanes, std::vector& pixelBuffers) { Devel::PixelBuffer pixelBuffer; @@ -894,8 +889,8 @@ void TextureManager::LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo { switch(textureInfo.loadState) { - case LoadState::NOT_STARTED: - case LoadState::LOAD_FAILED: + case TextureManager::LoadState::NOT_STARTED: + case TextureManager::LoadState::LOAD_FAILED: { if(mLoadingQueueTextureId != INVALID_TEXTURE_ID) { @@ -907,7 +902,7 @@ void TextureManager::LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo } break; } - case LoadState::UPLOADED: + case TextureManager::LoadState::UPLOADED: { if(mLoadingQueueTextureId != INVALID_TEXTURE_ID) { @@ -924,13 +919,13 @@ void TextureManager::LoadOrQueueTexture(TextureManager::TextureInfo& textureInfo } break; } - case LoadState::LOADING: - case LoadState::CANCELLED: - case LoadState::MASK_CANCELLED: - case LoadState::LOAD_FINISHED: - case LoadState::WAITING_FOR_MASK: - case LoadState::MASK_APPLYING: - case LoadState::MASK_APPLIED: + case TextureManager::LoadState::LOADING: + case TextureManager::LoadState::CANCELLED: + case TextureManager::LoadState::MASK_CANCELLED: + case TextureManager::LoadState::LOAD_FINISHED: + case TextureManager::LoadState::WAITING_FOR_MASK: + case TextureManager::LoadState::MASK_APPLYING: + case TextureManager::LoadState::MASK_APPLIED: { break; } @@ -954,7 +949,7 @@ void TextureManager::QueueLoadTexture(const TextureManager::TextureInfo& texture void TextureManager::LoadTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer) { DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureManager::LoadTexture(): url:%s sync:%s\n", textureInfo.url.GetUrl().c_str(), textureInfo.loadSynchronously ? "T" : "F"); - textureInfo.loadState = LoadState::LOADING; + textureInfo.loadState = TextureManager::LoadState::LOADING; if(!textureInfo.loadSynchronously) { auto premultiplyOnLoad = (textureInfo.preMultiplyOnLoad && textureInfo.maskTextureId == INVALID_TEXTURE_ID) ? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF; @@ -986,14 +981,16 @@ void TextureManager::ProcessLoadQueue() DALI_LOG_INFO(gTextureManagerLogFilter, Debug::General, "TextureManager::ProcessLoadQueue() textureId=%d, observer=%p, cacheIndex=@%d, loadState:%s\n", element.mTextureId, element.mObserver, cacheIndex.GetIndex(), GET_LOAD_STATE_STRING(textureInfo.loadState)); - if((textureInfo.loadState == LoadState::UPLOADED) || (textureInfo.loadState == LoadState::LOAD_FINISHED && textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER)) + if((textureInfo.loadState == TextureManager::LoadState::UPLOADED) || + (textureInfo.loadState == TextureManager::LoadState::LOAD_FINISHED && + textureInfo.storageType == TextureManager::StorageType::RETURN_PIXEL_BUFFER)) { if(element.mObserver) { EmitLoadComplete(element.mObserver, textureInfo, true); } } - else if(textureInfo.loadState == LoadState::LOADING) + else if(textureInfo.loadState == TextureManager::LoadState::LOADING) { // Note : LOADING state texture cannot be queue. // This case be occured when same texture id are queue in mLoadQueue. @@ -1022,7 +1019,7 @@ void TextureManager::ObserveTexture(TextureManager::TextureInfo& textureInfo, } } -void TextureManager::AsyncLoadComplete(const TextureManager::TextureId& textureId, std::vector& pixelBuffers) +void TextureManager::AsyncLoadComplete(const TextureManager::TextureId textureId, std::vector& pixelBuffers) { TextureCacheIndex cacheIndex = mTextureCacheManager.GetCacheIndexFromId(textureId); DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureManager::AsyncLoadComplete( textureId:%d CacheIndex:%d )\n", textureId, cacheIndex.GetIndex()); @@ -1031,7 +1028,7 @@ void TextureManager::AsyncLoadComplete(const TextureManager::TextureId& textureI TextureInfo& textureInfo(mTextureCacheManager[cacheIndex]); DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, " textureId:%d Url:%s CacheIndex:%d LoadState: %s\n", textureInfo.textureId, textureInfo.url.GetUrl().c_str(), cacheIndex.GetIndex(), GET_LOAD_STATE_STRING(textureInfo.loadState)); - if(textureInfo.loadState != LoadState::CANCELLED && textureInfo.loadState != LoadState::MASK_CANCELLED) + if(textureInfo.loadState != TextureManager::LoadState::CANCELLED && textureInfo.loadState != TextureManager::LoadState::MASK_CANCELLED) { // textureInfo can be invalidated after this call (as the mTextureInfoContainer may be modified) PostLoad(textureInfo, pixelBuffers); @@ -1045,31 +1042,28 @@ void TextureManager::AsyncLoadComplete(const TextureManager::TextureId& textureI void TextureManager::PostLoad(TextureManager::TextureInfo& textureInfo, std::vector& pixelBuffers) { - // Was the load successful? - if(!pixelBuffers.empty()) + if(!pixelBuffers.empty()) ///< Load success { if(pixelBuffers.size() == 1) { Devel::PixelBuffer pixelBuffer = pixelBuffers[0]; if(pixelBuffer && (pixelBuffer.GetWidth() != 0) && (pixelBuffer.GetHeight() != 0)) { - // No atlas support for now - textureInfo.useAtlas = UseAtlas::NO_ATLAS; textureInfo.preMultiplied = pixelBuffer.IsAlphaPreMultiplied(); - if(textureInfo.storageType == StorageType::UPLOAD_TO_TEXTURE) + if(textureInfo.storageType == TextureManager::StorageType::UPLOAD_TO_TEXTURE) { // If there is a mask texture ID associated with this texture, then apply the mask // if it's already loaded. If it hasn't, and the mask is still loading, // wait for the mask to finish loading. // note, If the texture is already uploaded synchronously during loading, // we don't need to apply mask. - if(textureInfo.loadState != LoadState::UPLOADED && + if(textureInfo.loadState != TextureManager::LoadState::UPLOADED && textureInfo.maskTextureId != INVALID_TEXTURE_ID) { - if(textureInfo.loadState == LoadState::MASK_APPLYING) + if(textureInfo.loadState == TextureManager::LoadState::MASK_APPLYING) { - textureInfo.loadState = LoadState::MASK_APPLIED; + textureInfo.loadState = TextureManager::LoadState::MASK_APPLIED; UploadTextures(pixelBuffers, textureInfo); NotifyObservers(textureInfo, true); } @@ -1077,23 +1071,21 @@ void TextureManager::PostLoad(TextureManager::TextureInfo& textureInfo, std::vec { LoadState maskLoadState = mTextureCacheManager.GetTextureStateInternal(textureInfo.maskTextureId); textureInfo.pixelBuffer = pixelBuffer; // Store the pixel buffer temporarily - if(maskLoadState == LoadState::LOADING) + if(maskLoadState == TextureManager::LoadState::LOADING) { - textureInfo.loadState = LoadState::WAITING_FOR_MASK; + textureInfo.loadState = TextureManager::LoadState::WAITING_FOR_MASK; } - else if(maskLoadState == LoadState::LOAD_FINISHED || maskLoadState == LoadState::UPLOADED) + else if(maskLoadState == TextureManager::LoadState::LOAD_FINISHED || maskLoadState == TextureManager::LoadState::UPLOADED) { - // Send New Task to Thread TextureCacheIndex maskCacheIndex = mTextureCacheManager.GetCacheIndexFromId(textureInfo.maskTextureId); if(maskCacheIndex != INVALID_CACHE_INDEX) { TextureInfo& maskTextureInfo(mTextureCacheManager[maskCacheIndex]); - if(maskTextureInfo.storageType == StorageType::KEEP_PIXEL_BUFFER) + if(maskTextureInfo.storageType == TextureManager::StorageType::KEEP_PIXEL_BUFFER) { - // Send New Task to Thread ApplyMask(textureInfo, textureInfo.maskTextureId); } - else if(maskTextureInfo.storageType == StorageType::KEEP_TEXTURE) + else if(maskTextureInfo.storageType == TextureManager::StorageType::KEEP_TEXTURE) { // Upload image texture. textureInfo.loadState will be UPLOADED. UploadTextures(pixelBuffers, textureInfo); @@ -1103,7 +1095,7 @@ void TextureManager::PostLoad(TextureManager::TextureInfo& textureInfo, std::vec } } } - else // maskLoadState == LoadState::LOAD_FAILED + else // maskLoadState == TextureManager::LoadState::LOAD_FAILED { // Url texture load success, But alpha mask texture load failed. Run as normal image upload. DALI_LOG_ERROR("Alpha mask image loading failed! Image will not be masked\n"); @@ -1121,13 +1113,13 @@ void TextureManager::PostLoad(TextureManager::TextureInfo& textureInfo, std::vec else { textureInfo.pixelBuffer = pixelBuffer; // Store the pixel data - textureInfo.loadState = LoadState::LOAD_FINISHED; + textureInfo.loadState = TextureManager::LoadState::LOAD_FINISHED; - if(textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER) + if(textureInfo.storageType == TextureManager::StorageType::RETURN_PIXEL_BUFFER) { NotifyObservers(textureInfo, true); } - else // for the StorageType::KEEP_PIXEL_BUFFER and StorageType::KEEP_TEXTURE + else // for the TextureManager::StorageType::KEEP_PIXEL_BUFFER and TextureManager::StorageType::KEEP_TEXTURE { // Check if there was another texture waiting for this load to complete // (e.g. if this was an image mask, and its load is on a different thread) @@ -1139,18 +1131,16 @@ void TextureManager::PostLoad(TextureManager::TextureInfo& textureInfo, std::vec else { // YUV case - // No atlas support for now - textureInfo.useAtlas = UseAtlas::NO_ATLAS; textureInfo.preMultiplied = false; UploadTextures(pixelBuffers, textureInfo); NotifyObservers(textureInfo, true); } } - else + else ///< Load fail { - textureInfo.loadState = LoadState::LOAD_FAILED; - if(textureInfo.storageType == StorageType::KEEP_PIXEL_BUFFER || textureInfo.storageType == StorageType::KEEP_TEXTURE) + textureInfo.loadState = TextureManager::LoadState::LOAD_FAILED; + if(textureInfo.storageType == TextureManager::StorageType::KEEP_PIXEL_BUFFER || textureInfo.storageType == TextureManager::StorageType::KEEP_TEXTURE) { // Check if there was another texture waiting for this load to complete // (e.g. if this was an image mask, and its load is on a different thread) @@ -1165,8 +1155,8 @@ void TextureManager::PostLoad(TextureManager::TextureInfo& textureInfo, std::vec void TextureManager::CheckForWaitingTexture(TextureManager::TextureInfo& maskTextureInfo) { - if(maskTextureInfo.loadState == LoadState::LOAD_FINISHED && - maskTextureInfo.storageType == StorageType::KEEP_TEXTURE) + if(maskTextureInfo.loadState == TextureManager::LoadState::LOAD_FINISHED && + maskTextureInfo.storageType == TextureManager::StorageType::KEEP_TEXTURE) { // Upload mask texture. textureInfo.loadState will be UPLOADED. std::vector pixelBuffers; @@ -1177,7 +1167,7 @@ void TextureManager::CheckForWaitingTexture(TextureManager::TextureInfo& maskTex DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureManager::CheckForWaitingTexture(): maskTextureId=%d, maskTextureUrl=%s\n", maskTextureInfo.textureId, maskTextureInfo.url.GetUrl().c_str()); // Search the cache, checking if any texture has this texture id as a maskTextureId - const std::size_t size = mTextureCacheManager.size(); + const size_t size = mTextureCacheManager.size(); // Keep notify observer required textureIds. // Note : NotifyObservers can change mTextureCacheManager cache struct. We should check id's validation before notify. @@ -1187,21 +1177,20 @@ void TextureManager::CheckForWaitingTexture(TextureManager::TextureInfo& maskTex for(TextureCacheIndex cacheIndex = TextureCacheIndex(TextureManagerType::TEXTURE_CACHE_INDEX_TYPE_LOCAL, 0u); cacheIndex.GetIndex() < size; ++cacheIndex.detailValue.index) { if(mTextureCacheManager[cacheIndex].maskTextureId == maskTextureInfo.textureId && - mTextureCacheManager[cacheIndex].loadState == LoadState::WAITING_FOR_MASK) + mTextureCacheManager[cacheIndex].loadState == TextureManager::LoadState::WAITING_FOR_MASK) { TextureInfo& textureInfo(mTextureCacheManager[cacheIndex]); - if(maskTextureInfo.loadState == LoadState::LOAD_FINISHED) + if(maskTextureInfo.loadState == TextureManager::LoadState::LOAD_FINISHED) { - if(maskTextureInfo.storageType == StorageType::KEEP_PIXEL_BUFFER) + if(maskTextureInfo.storageType == TextureManager::StorageType::KEEP_PIXEL_BUFFER) { - // Send New Task to Thread ApplyMask(textureInfo, maskTextureInfo.textureId); } } - else if(maskTextureInfo.loadState == LoadState::UPLOADED) + else if(maskTextureInfo.loadState == TextureManager::LoadState::UPLOADED) { - if(maskTextureInfo.storageType == StorageType::KEEP_TEXTURE) + if(maskTextureInfo.storageType == TextureManager::StorageType::KEEP_TEXTURE) { if(textureInfo.url.GetProtocolType() == VisualUrl::TEXTURE) { @@ -1212,7 +1201,7 @@ void TextureManager::CheckForWaitingTexture(TextureManager::TextureInfo& maskTex TextureId id = std::stoi(location); auto externalTextureInfo = mTextureCacheManager.GetExternalTextureInfo(id); textureInfo.textures.push_back(externalTextureInfo.textureSet.GetTexture(0)); - textureInfo.loadState = LoadState::UPLOADED; + textureInfo.loadState = TextureManager::LoadState::UPLOADED; } } else @@ -1234,7 +1223,7 @@ void TextureManager::CheckForWaitingTexture(TextureManager::TextureInfo& maskTex notifyRequiredTextureIds.push_back(textureInfo.textureId); } } - else // maskTextureInfo.loadState == LoadState::LOAD_FAILED + else // maskTextureInfo.loadState == TextureManager::LoadState::LOAD_FAILED { // Url texture load success, But alpha mask texture load failed. Run as normal image upload. DALI_LOG_ERROR("Alpha mask image loading failed! Image will not be masked\n"); @@ -1273,7 +1262,7 @@ void TextureManager::CheckForWaitingTexture(TextureManager::TextureInfo& maskTex } } -void TextureManager::ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId& maskTextureId) +void TextureManager::ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId maskTextureId) { TextureCacheIndex maskCacheIndex = mTextureCacheManager.GetCacheIndexFromId(maskTextureId); if(maskCacheIndex != INVALID_CACHE_INDEX) @@ -1284,7 +1273,7 @@ void TextureManager::ApplyMask(TextureManager::TextureInfo& textureInfo, const T DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureManager::ApplyMask(): url:%s sync:%s\n", textureInfo.url.GetUrl().c_str(), textureInfo.loadSynchronously ? "T" : "F"); - textureInfo.loadState = LoadState::MASK_APPLYING; + textureInfo.loadState = TextureManager::LoadState::MASK_APPLYING; auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad ? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF; mAsyncLoader->ApplyMask(textureInfo.textureId, pixelBuffer, maskPixelBuffer, textureInfo.scaleFactor, textureInfo.cropToMask, premultiplyOnLoad); } @@ -1292,7 +1281,7 @@ void TextureManager::ApplyMask(TextureManager::TextureInfo& textureInfo, const T void TextureManager::UploadTextures(std::vector& pixelBuffers, TextureManager::TextureInfo& textureInfo) { - if(!pixelBuffers.empty() && textureInfo.loadState != LoadState::UPLOADED && textureInfo.useAtlas != UseAtlas::USE_ATLAS) + if(!pixelBuffers.empty() && textureInfo.loadState != TextureManager::LoadState::UPLOADED) { DALI_LOG_INFO(gTextureManagerLogFilter, Debug::General, " TextureManager::UploadTextures() New Texture for textureId:%d\n", textureInfo.textureId); @@ -1321,10 +1310,10 @@ void TextureManager::UploadTextures(std::vector& pixelBuffer // Note: This is regardless of success as we care about whether a // load attempt is in progress or not. If unsuccessful, a broken // image is still loaded. - textureInfo.loadState = LoadState::UPLOADED; + textureInfo.loadState = TextureManager::LoadState::UPLOADED; } -void TextureManager::NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool& success) +void TextureManager::NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool success) { TextureId textureId = textureInfo.textureId; @@ -1382,7 +1371,7 @@ void TextureManager::NotifyObservers(TextureManager::TextureInfo& textureInfo, c mLoadingQueueTextureId = INVALID_TEXTURE_ID; ProcessLoadQueue(); - if(info->storageType == StorageType::RETURN_PIXEL_BUFFER && info->observerList.Count() == 0) + if(info->storageType == TextureManager::StorageType::RETURN_PIXEL_BUFFER && info->observerList.Count() == 0) { RequestRemove(info->textureId, nullptr); } @@ -1422,14 +1411,14 @@ void TextureManager::ObserverDestroyed(TextureUploadObserver* observer) } } -Dali::Geometry TextureManager::GetRenderGeometry(const TextureManager::TextureId& textureId, std::uint32_t& frontElements, std::uint32_t& backElements) +Dali::Geometry TextureManager::GetRenderGeometry(const TextureManager::TextureId textureId, uint32_t& frontElements, uint32_t& backElements) { return RenderingAddOn::Get().IsValid() ? RenderingAddOn::Get().GetGeometry(textureId, frontElements, backElements) : Geometry(); } -void TextureManager::EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool& success) +void TextureManager::EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool success) { - if(textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER) + if(textureInfo.storageType == TextureManager::StorageType::RETURN_PIXEL_BUFFER) { observer->LoadComplete(success, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::PIXEL_BUFFER, textureInfo.pixelBuffer, textureInfo.url.GetUrl(), textureInfo.preMultiplied)); } @@ -1442,18 +1431,17 @@ void TextureManager::EmitLoadComplete(TextureUploadObserver* observer, TextureMa } else { - observer->LoadComplete(success, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::TEXTURE, textureInfo.textureId, textureSet, (textureInfo.useAtlas == UseAtlas::USE_ATLAS) ? true : false, textureInfo.atlasRect, textureInfo.preMultiplied)); + observer->LoadComplete(success, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::TEXTURE, textureInfo.textureId, textureSet, textureInfo.preMultiplied)); } } } -TextureSet TextureManager::GetTextureSet(const TextureManager::TextureId& textureId) +TextureSet TextureManager::GetTextureSet(const TextureManager::TextureId textureId) { TextureSet textureSet; TextureManager::LoadState loadState = mTextureCacheManager.GetTextureStateInternal(textureId); if(loadState == TextureManager::LoadState::UPLOADED) { - // LoadComplete has already been called - keep the same texture set TextureCacheIndex textureCacheIndex = mTextureCacheManager.GetCacheIndexFromId(textureId); if(textureCacheIndex != INVALID_CACHE_INDEX) { @@ -1472,8 +1460,9 @@ TextureSet TextureManager::GetTextureSet(const TextureManager::TextureInfo& text { TextureSet textureSet; - // LoadComplete has already been called - keep the same texture set + // Always create new TextureSet here, so we don't share same TextureSets for multiple visuals. textureSet = TextureSet::New(); + if(!textureInfo.textures.empty()) { if(textureInfo.textures.size() > 1) // For YUV case @@ -1491,7 +1480,7 @@ TextureSet TextureManager::GetTextureSet(const TextureManager::TextureInfo& text if(maskCacheIndex != INVALID_CACHE_INDEX) { TextureInfo& maskTextureInfo(mTextureCacheManager[maskCacheIndex]); - if(maskTextureInfo.storageType == StorageType::UPLOAD_TO_TEXTURE || maskTextureInfo.storageType == StorageType::KEEP_TEXTURE) + if(maskTextureInfo.storageType == TextureManager::StorageType::UPLOAD_TO_TEXTURE || maskTextureInfo.storageType == TextureManager::StorageType::KEEP_TEXTURE) { if(!maskTextureInfo.textures.empty()) { @@ -1506,7 +1495,6 @@ TextureSet TextureManager::GetTextureSet(const TextureManager::TextureInfo& text void TextureManager::RemoveTextureObserver(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer) { - // Remove its observer if(observer) { const auto iterEnd = textureInfo.observerList.End(); diff --git a/dali-toolkit/internal/texture-manager/texture-manager-impl.h b/dali-toolkit/internal/texture-manager/texture-manager-impl.h index 59aa9b7..9ac6f25 100644 --- a/dali-toolkit/internal/texture-manager/texture-manager-impl.h +++ b/dali-toolkit/internal/texture-manager/texture-manager-impl.h @@ -46,7 +46,7 @@ class TextureAsyncLoadingHelper; /** * The TextureManager provides a common Image loading API for Visuals. * - * The TextureManager is responsible for providing sync, async, atlased and non-atlased + * The TextureManager is responsible for providing sync, async, * CPU time alpha masking, animated image loads. * * Texture caching is provided and performed by TextureCacheManager. @@ -63,9 +63,7 @@ public: static constexpr TextureId INVALID_TEXTURE_ID = TextureManagerType::INVALID_TEXTURE_ID; static constexpr TextureCacheIndex INVALID_CACHE_INDEX = TextureManagerType::INVALID_CACHE_INDEX; - using UseAtlas = TextureManagerType::UseAtlas; using StorageType = TextureManagerType::StorageType; - using LoadType = TextureManagerType::LoadType; using LoadState = TextureManagerType::LoadState; using ReloadPolicy = TextureManagerType::ReloadPolicy; using MultiplyOnLoad = TextureManagerType::MultiplyOnLoad; @@ -135,13 +133,13 @@ public: */ TextureSet LoadAnimatedImageTexture(const VisualUrl& url, Dali::AnimatedImageLoading animatedImageLoading, - const uint32_t& frameIndex, + const uint32_t frameIndex, TextureManager::TextureId& textureId, MaskingDataPointer& maskInfo, const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& synchronousLoading, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool synchronousLoading, TextureUploadObserver* textureObserver, TextureManager::MultiplyOnLoad& preMultiplyOnLoad); @@ -167,11 +165,11 @@ public: Devel::PixelBuffer LoadPixelBuffer( const VisualUrl& url, const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& synchronousLoading, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool synchronousLoading, TextureUploadObserver* textureObserver, - const bool& orientationCorrection, + const bool orientationCorrection, TextureManager::MultiplyOnLoad& preMultiplyOnLoad); /** @@ -194,7 +192,7 @@ public: * this is the rectangle in normalized coordinates. * @param[out] textureRectSize The rectangle within the texture atlas that this URL occupies, * this is the same rectangle in pixels. - * @param[in,out] atlasingStatus Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still + * @param[in,out] atlasingStatus Set to true to attempt atlasing. If atlasing fails, the image will still * be loaded, and marked successful, but this will be set to false. * If atlasing succeeds, this will be set to true. * @param[out] loadingStatus The loading status of the texture @@ -211,23 +209,23 @@ public: * @return The texture set containing the image, or empty if still loading. */ TextureSet LoadTexture( - const VisualUrl& url, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - MaskingDataPointer& maskInfo, - const bool& synchronousLoading, - TextureManager::TextureId& textureId, - Dali::Vector4& textureRect, - Dali::ImageDimensions& textureRectSize, - bool& atlasingStatus, - bool& loadingStatus, - TextureUploadObserver* textureObserver, - AtlasUploadObserver* atlasObserver, - ImageAtlasManagerPtr imageAtlasManager, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad); + const VisualUrl& url, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + MaskingDataPointer& maskInfo, + const bool synchronousLoading, + TextureManager::TextureId& textureId, + Dali::Vector4& textureRect, + Dali::ImageDimensions& textureRectSize, + bool& atlasingStatus, + bool& loadingStatus, + TextureUploadObserver* textureObserver, + AtlasUploadObserver* atlasObserver, + ImageAtlasManagerPtr imageAtlasManager, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad); /** * Add an observer to the object. @@ -249,14 +247,14 @@ public: * @param[out] backElements number of back elements * @return Returns valid geometry object */ - Geometry GetRenderGeometry(const TextureManager::TextureId& textureId, std::uint32_t& frontElements, std::uint32_t& backElements); + Geometry GetRenderGeometry(const TextureManager::TextureId textureId, uint32_t& frontElements, uint32_t& backElements); /** * @brief Returns the textureSet in texture manager. * @param[in] textureId Id of the texture * @return The textureSet in texture manager. These textures include YUV textures or images and masks. */ - TextureSet GetTextureSet(const TextureManager::TextureId& textureId); + TextureSet GetTextureSet(const TextureManager::TextureId textureId); /** * @brief Returns the textureSet in texture manager. @@ -271,7 +269,7 @@ public: /** * @copydoc TextureCacheManager::GetVisualUrl */ - inline VisualUrl GetVisualUrl(const TextureManager::TextureId& textureId) + inline VisualUrl GetVisualUrl(const TextureManager::TextureId textureId) { return mTextureCacheManager.GetVisualUrl(textureId); } @@ -279,7 +277,7 @@ public: /** * @copydoc TextureCacheManager::GetTexture */ - inline Texture GetTexture(const TextureManager::TextureId& textureId) + inline Texture GetTexture(const TextureManager::TextureId textureId) { return mTextureCacheManager.GetTexture(textureId); } @@ -319,7 +317,7 @@ public: /** * @copydoc TextureCacheManager::AddExternalTexture */ - inline std::string AddExternalTexture(const TextureSet& texture, bool preMultiplied = false) + inline std::string AddExternalTexture(const TextureSet& texture, const bool preMultiplied = false) { return mTextureCacheManager.AddExternalTexture(texture, preMultiplied); } @@ -345,8 +343,6 @@ public: // Load Request API * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be loaded, and marked successful, - * but "useAtlasing" will be set to false in the "LoadCompleted" callback from the TextureManagerUploadObserver. * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" virtual. * This is called when an image load completes (or fails). * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data @@ -357,16 +353,15 @@ public: // Load Request API * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoad( - const VisualUrl& url, - const ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlasing, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& synchronousLoading = false); + const VisualUrl& url, + const ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + const bool synchronousLoading = false); private: // Internal Load Request API /** @@ -387,10 +382,6 @@ private: // Internal Load Request API * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still - * be loaded, and marked successful, - * but "useAtlasing" will be set to false in the "LoadCompleted" callback from - * the TextureManagerUploadObserver. * @param[in] cropToMask Only used with masking, this will crop the scaled image to the mask size. * If false, then the mask will be scaled to fit the image before being applied. * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" @@ -405,34 +396,33 @@ private: // Internal Load Request API * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoad( - const VisualUrl& url, - const TextureManager::TextureId& maskTextureId, - const TextureManager::TextureId& previousTextureId, - const float& contentScale, - const ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlasing, - const bool& cropToMask, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - const bool& synchronousLoading = false); + const VisualUrl& url, + const TextureManager::TextureId maskTextureId, + const TextureManager::TextureId previousTextureId, + const float contentScale, + const ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool cropToMask, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + const bool synchronousLoading = false); /** * @brief Requests a masking image to be loaded. This mask is not uploaded to GL, * instead, it is stored in CPU memory, and can be used for CPU blending. * @param[in] maskUrl The URL of the mask image to load - * @param[in] storageType, Whether the pixel data is stored in the cache or uploaded to the GPU + * @param[in] storageType Whether the pixel data is stored in the cache or uploaded to the GPU * @param[in] synchronousLoading True if the frame should be loaded synchronously. If you skip this parameter, * default is false. * @return A TextureId to use as a handle to reference this mask Texture */ TextureId RequestMaskLoad( - const VisualUrl& maskUrl, - StorageType storageType, - const bool& synchronousLoading = false); + const VisualUrl& maskUrl, + const TextureManager::StorageType storageType, + const bool synchronousLoading = false); /** * @brief Requests an image load of the given URL, when the texture has @@ -453,12 +443,9 @@ private: // Internal Load Request API * @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic * @param[in] fittingMode The FittingMode to use * @param[in] samplingMode The SamplingMode to use - * @param[in] useAtlasing Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be - * loaded, and marked successful, but "useAtlasing" will be set to false in the - * "LoadCompleted" callback from the TextureManagerUploadObserver. * @param[in] cropToMask Whether to crop the target after masking, or scale the mask to the image before * masking. - * @param[in] storageType, Whether the pixel data is stored in the cache or uploaded to the GPU + * @param[in] storageType Whether the pixel data is stored in the cache or uploaded to the GPU * @param[in] observer The client object should inherit from this and provide the "LoadCompleted" * virtual. * This is called when an image load completes (or fails). @@ -473,23 +460,22 @@ private: // Internal Load Request API * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoadInternal( - const VisualUrl& url, - const TextureManager::TextureId& maskTextureId, - const TextureManager::TextureId& previousTextureId, - const float& contentScale, - const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const TextureManager::UseAtlas& useAtlas, - const bool& cropToMask, - const TextureManager::StorageType& storageType, - TextureUploadObserver* observer, - const bool& orientationCorrection, - const TextureManager::ReloadPolicy& reloadPolicy, - TextureManager::MultiplyOnLoad& preMultiplyOnLoad, - Dali::AnimatedImageLoading animatedImageLoading, - const std::uint32_t& frameIndex, - const bool& synchronousLoading); + const VisualUrl& url, + const TextureManager::TextureId maskTextureId, + const TextureManager::TextureId previousTextureId, + const float contentScale, + const Dali::ImageDimensions& desiredSize, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool cropToMask, + const TextureManager::StorageType storageType, + TextureUploadObserver* observer, + const bool orientationCorrection, + const TextureManager::ReloadPolicy reloadPolicy, + TextureManager::MultiplyOnLoad& preMultiplyOnLoad, + Dali::AnimatedImageLoading animatedImageLoading, + const uint32_t frameIndex, + const bool synchronousLoading); /** * @brief Load a new image synchronously. @@ -507,10 +493,10 @@ private: // Internal Load Request API void LoadImageSynchronously( const VisualUrl& url, const Dali::ImageDimensions& desiredSize, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - const bool& orientationCorrection, - const bool& loadYuvPlanes, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool orientationCorrection, + const bool loadYuvPlanes, std::vector& pixelBuffers); public: // Remove Request API @@ -523,7 +509,7 @@ public: // Remove Request API * @param[in] textureId The ID of the Texture to remove. * @param[in] textureObserver The texture observer. */ - void RequestRemove(const TextureManager::TextureId& textureId, TextureUploadObserver* textureObserver); + void RequestRemove(const TextureManager::TextureId textureId, TextureUploadObserver* textureObserver); private: /** @@ -534,7 +520,7 @@ private: * * @param[in] textureId The ID of the Texture to remove. */ - void Remove(const TextureManager::TextureId& textureId); + void Remove(const TextureManager::TextureId textureId); /** * @brief Initiate remove of texture queued. @@ -549,7 +535,7 @@ private: */ struct QueueElement { - QueueElement(TextureManager::TextureId textureId, TextureUploadObserver* observer) + QueueElement(const TextureManager::TextureId textureId, TextureUploadObserver* observer) : mTextureId(textureId), mObserver(observer) { @@ -593,7 +579,7 @@ private: void ObserveTexture(TextureManager::TextureInfo& textureInfo, TextureUploadObserver* observer); /** - * @brief Performs Post-Load steps including atlasing. + * @brief Performs Post-Load steps. * @param[in] textureInfo The struct associated with this Texture * @param[in] pixelBuffers The image pixelBuffer * @return True if successful @@ -612,7 +598,7 @@ private: * @param[in] textureInfo The information of texture to apply the mask to * @param[in] maskTextureId The texture id of the mask. */ - void ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId& maskTextureId); + void ApplyMask(TextureManager::TextureInfo& textureInfo, const TextureManager::TextureId maskTextureId); /** * Upload the texture specified in pixelBuffer to the appropriate location @@ -627,7 +613,7 @@ private: * @param[in] textureInfo The struct associated with this Texture * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU */ - void NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool& success); + void NotifyObservers(TextureManager::TextureInfo& textureInfo, const bool success); /** * Call LoadComplete to the observer. @@ -635,7 +621,7 @@ private: * @param[in] textureInfo The struct associated with this Texture * @param[in] success If the pixel data was retrieved successfully and uploaded to GPU */ - void EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool& success); + void EmitLoadComplete(TextureUploadObserver* observer, TextureManager::TextureInfo& textureInfo, const bool success); /** * @brief Remove observer in textureInfo @@ -652,7 +638,7 @@ public: * @param[in] textureId The ID of the texture load complete. * @param[in] pixelBuffers The loaded image data */ - void AsyncLoadComplete(const TextureManager::TextureId& textureId, std::vector& pixelBuffers); + void AsyncLoadComplete(const TextureManager::TextureId textureId, std::vector& pixelBuffers); protected: // Implementation of Processor /** diff --git a/dali-toolkit/internal/texture-manager/texture-manager-type.h b/dali-toolkit/internal/texture-manager/texture-manager-type.h index 2d95210..a81d761 100644 --- a/dali-toolkit/internal/texture-manager/texture-manager-type.h +++ b/dali-toolkit/internal/texture-manager/texture-manager-type.h @@ -65,15 +65,15 @@ enum TextureCacheIndexType union TextureCacheIndexData { TextureCacheIndexData() = default; - constexpr TextureCacheIndexData(const std::uint32_t& index) + constexpr TextureCacheIndexData(const uint32_t index) : indexValue(index) { } - constexpr explicit TextureCacheIndexData(const std::int32_t& index) - : indexValue(static_cast(index)) + constexpr explicit TextureCacheIndexData(const int32_t index) + : indexValue(static_cast(index)) { } - constexpr TextureCacheIndexData(const TextureCacheIndexType& type, const std::uint32_t& index) + constexpr TextureCacheIndexData(const TextureCacheIndexType& type, const uint32_t index) : detailValue{index, type} { } @@ -86,7 +86,7 @@ union TextureCacheIndexData { } - TextureCacheIndexData& operator=(const std::uint32_t& index) + TextureCacheIndexData& operator=(const uint32_t index) { indexValue = index; return *this; @@ -102,25 +102,25 @@ union TextureCacheIndexData return *this; } - constexpr operator std::uint32_t() const + constexpr operator uint32_t() const { return indexValue; } - constexpr operator std::uint32_t() + constexpr operator uint32_t() { return indexValue; } - constexpr explicit operator std::int32_t() const + constexpr explicit operator int32_t() const { - return static_cast(indexValue); + return static_cast(indexValue); } - constexpr explicit operator std::int32_t() + constexpr explicit operator int32_t() { - return static_cast(indexValue); + return static_cast(indexValue); } // Return detailValue.index. - the real index of datailValue.type container - constexpr inline std::uint32_t GetIndex() const + constexpr inline uint32_t GetIndex() const { return detailValue.index; } @@ -135,7 +135,7 @@ union TextureCacheIndexData } // Data area - std::uint32_t indexValue; + uint32_t indexValue; struct { unsigned int index : 28; @@ -145,11 +145,11 @@ union TextureCacheIndexData // Typedef: -typedef std::int32_t TextureId; ///< The TextureId type. This is used as a handle to refer to a particular Texture. +typedef int32_t TextureId; ///< The TextureId type. This is used as a handle to refer to a particular Texture. typedef TextureCacheIndexData TextureCacheIndex; ///< The TextureCacheIndex type. This is used as a handles to refer to a particular Texture in TextureCacheManager. /// Note : For the same Texture, TextureId will not be changed. But TextureCacheIndex can be chaged when TextureCacheManager /// Internal container informations changed by Append or Remove. -typedef std::size_t TextureHash; ///< The type used to store the hash used for Texture caching. +typedef size_t TextureHash; ///< The type used to store the hash used for Texture caching. // Constant values: @@ -159,15 +159,6 @@ static constexpr TextureCacheIndex INVALID_CACHE_INDEX = 0; ///< Used to repres // Enum classes: /** - * Whether the texture should be atlased or uploaded into it's own GPU texture - */ -enum class UseAtlas -{ - NO_ATLAS, - USE_ATLAS -}; - -/** * Whether the pixel data should be kept in TextureManager, returned with pixelBuffer or uploaded for rendering */ enum class StorageType @@ -180,15 +171,6 @@ enum class StorageType }; /** - * Whether the texture should be loaded synchronously or asynchronously. - */ -enum class LoadType -{ - LOAD_ASYNCHRONOUSLY, - LOAD_SYNCHRONOUSLY -}; - -/** * @brief The LoadState Enumeration represents the current state of a particular Texture's life-cycle. */ enum class LoadState @@ -230,26 +212,24 @@ enum class MultiplyOnLoad */ struct TextureInfo { - TextureInfo(const TextureId& textureId, - const TextureId& maskTextureId, + TextureInfo(const TextureId textureId, + const TextureId maskTextureId, const VisualUrl& url, const Dali::ImageDimensions& desiredSize, - float scaleFactor, - const Dali::FittingMode::Type& fittingMode, - const Dali::SamplingMode::Type& samplingMode, - bool loadSynchronously, - bool cropToMask, - const UseAtlas& useAtlas, - const TextureHash& hash, - bool orientationCorrection, - bool preMultiplyOnLoad, + const float scaleFactor, + const Dali::FittingMode::Type fittingMode, + const Dali::SamplingMode::Type samplingMode, + const bool loadSynchronously, + const bool cropToMask, + const TextureHash hash, + const bool orientationCorrection, + const bool preMultiplyOnLoad, const Dali::AnimatedImageLoading& animatedImageLoading, - std::uint32_t frameIndex, - bool loadYuvPlanes) + const uint32_t frameIndex, + const bool loadYuvPlanes) : url(url), desiredSize(desiredSize), useSize(desiredSize), - atlasRect(0.0f, 0.0f, 1.0f, 1.0f), // Full atlas rectangle textureId(textureId), maskTextureId(maskTextureId), hash(hash), @@ -263,7 +243,6 @@ struct TextureInfo frameIndex(frameIndex), frameCount(0u), frameInterval(0u), - useAtlas(useAtlas), loadSynchronously(loadSynchronously), cropToMask(cropToMask), orientationCorrection(true), @@ -280,18 +259,16 @@ struct TextureInfo typedef Dali::Vector ObserverListType; ObserverListType observerList; ///< Container used to store all observer clients of this Texture - Dali::Toolkit::ImageAtlas atlas; ///< The atlas this Texture lays within (if any) Dali::Devel::PixelBuffer pixelBuffer; ///< The PixelBuffer holding the image data (May be empty after upload) std::vector textures; ///< The Textures VisualUrl url; ///< The URL of the image Dali::ImageDimensions desiredSize; ///< The size requested Dali::ImageDimensions useSize; ///< The size used - Dali::Vector4 atlasRect; ///< The atlas rect used if atlased TextureId textureId; ///< The TextureId associated with this Texture TextureId maskTextureId; ///< The mask TextureId to be applied on load TextureHash hash; ///< The hash used to cache this Texture float scaleFactor; ///< The scale factor to apply to the Texture when masking - std::int16_t referenceCount; ///< The reference count of clients using this Texture + uint32_t referenceCount; ///< The reference count of clients using this Texture LoadState loadState; ///< The load state showing the load progress of the Texture Dali::FittingMode::Type fittingMode : 3; ///< The requested FittingMode Dali::SamplingMode::Type samplingMode : 3; ///< The requested SamplingMode @@ -300,7 +277,6 @@ struct TextureInfo uint32_t frameIndex; ///< Frame index that be loaded, in case of animated image uint32_t frameCount; ///< Total frame count of input animated image. If this variable is not 0, this textureInfo is for animated image file format. uint32_t frameInterval; ///< Time interval between this frame and next frame of animated image. - UseAtlas useAtlas; ///< USE_ATLAS if an atlas was requested. bool loadSynchronously : 1; ///< True if synchronous loading was requested bool cropToMask : 1; ///< True if the image should be cropped to the mask size. @@ -316,9 +292,9 @@ struct TextureInfo */ struct ExternalTextureInfo { - ExternalTextureInfo(const TextureId& textureId, + ExternalTextureInfo(const TextureId textureId, const TextureSet& textureSet, - bool preMultiplied) + const bool preMultiplied) : textureId(textureId), textureSet(textureSet), referenceCount(1u), @@ -326,10 +302,10 @@ struct ExternalTextureInfo { } - TextureId textureId; ///< The TextureId associated with this ExternalTexture - TextureSet textureSet; ///< The external texture - std::int16_t referenceCount; ///< The reference count of clients using this ExternalTexture - bool preMultiplied : 1; ///< True if the image's color was multiplied by it's alpha + TextureId textureId; ///< The TextureId associated with this ExternalTexture + TextureSet textureSet; ///< The external texture + uint32_t referenceCount; ///< The reference count of clients using this ExternalTexture + bool preMultiplied : 1; ///< True if the image's color was multiplied by it's alpha }; } // namespace TextureManagerType diff --git a/dali-toolkit/internal/texture-manager/texture-upload-observer.cpp b/dali-toolkit/internal/texture-manager/texture-upload-observer.cpp index ee8ff1c..5761837 100644 --- a/dali-toolkit/internal/texture-manager/texture-upload-observer.cpp +++ b/dali-toolkit/internal/texture-manager/texture-upload-observer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "texture-upload-observer.h" +#include // INTERNAL INCLUDES #include // for INVALUD_TEXTURE_ID @@ -25,48 +25,40 @@ namespace Dali { namespace Toolkit { -TextureUploadObserver::TextureInformation::TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) +TextureUploadObserver::TextureInformation::TextureInformation(const ReturnType returnType, const int32_t textureId, TextureSet textureSet, const bool preMultiplied) : returnType(returnType), textureId(textureId), textureSet(textureSet), - useAtlasing(useAtlasing), - atlasRect(atlasRect), preMultiplied(preMultiplied), pixelBuffer(), url() { } -TextureUploadObserver::TextureInformation::TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, const std::string& url, bool preMultiplied) +TextureUploadObserver::TextureInformation::TextureInformation(const ReturnType returnType, const int32_t textureId, TextureSet textureSet, const std::string& url, const bool preMultiplied) : returnType(returnType), textureId(textureId), textureSet(textureSet), - useAtlasing(false), - atlasRect(Vector4::ZERO), preMultiplied(preMultiplied), pixelBuffer(), url(url) { } -TextureUploadObserver::TextureInformation::TextureInformation(ReturnType returnType, Devel::PixelBuffer pixelBuffer, const std::string& url, bool preMultiplied) +TextureUploadObserver::TextureInformation::TextureInformation(const ReturnType returnType, Devel::PixelBuffer pixelBuffer, const std::string& url, const bool preMultiplied) : returnType(returnType), textureId(Internal::TextureManagerType::INVALID_TEXTURE_ID), textureSet(), - useAtlasing(false), - atlasRect(Vector4::ZERO), preMultiplied(preMultiplied), pixelBuffer(pixelBuffer), url(url) { } -TextureUploadObserver::TextureInformation::TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, uint32_t frameCount, uint32_t interval) +TextureUploadObserver::TextureInformation::TextureInformation(const ReturnType returnType, const int32_t textureId, TextureSet textureSet, const uint32_t frameCount, const uint32_t interval) : returnType(returnType), textureId(textureId), textureSet(textureSet), - useAtlasing(false), - atlasRect(Vector4::ZERO), preMultiplied(false), pixelBuffer(), url(), diff --git a/dali-toolkit/internal/texture-manager/texture-upload-observer.h b/dali-toolkit/internal/texture-manager/texture-upload-observer.h index 82b6691..7af80ea 100644 --- a/dali-toolkit/internal/texture-manager/texture-upload-observer.h +++ b/dali-toolkit/internal/texture-manager/texture-upload-observer.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,18 +51,16 @@ public: struct TextureInformation { - TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied); - TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, const std::string& url, bool preMultiplied); - TextureInformation(ReturnType returnType, Devel::PixelBuffer pixelBuffer, const std::string& url, bool preMultiplied); - TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, uint32_t frameCount, uint32_t interval); + TextureInformation(const ReturnType returnType, const int32_t textureId, TextureSet textureSet, const bool preMultiplied); + TextureInformation(const ReturnType returnType, const int32_t textureId, TextureSet textureSet, const std::string& url, const bool preMultiplied); + TextureInformation(const ReturnType returnType, Devel::PixelBuffer pixelBuffer, const std::string& url, const bool preMultiplied); + TextureInformation(const ReturnType returnType, const int32_t textureId, TextureSet textureSet, const uint32_t frameCount, const uint32_t interval); TextureInformation(); ReturnType returnType; ///< Returned Texture type. int32_t textureId; ///< The textureId of the loaded texture in the TextureManager TextureSet textureSet; ///< The TextureSet containing the Texture - bool useAtlasing; ///< True if atlasing was used (note: this may be different to what was requested) - const Vector4& atlasRect; ///< If using atlasing, this is the rectangle within the atlas to use. bool preMultiplied; ///< True if the image had pre-multiplied alpha applied Devel::PixelBuffer pixelBuffer; ///< The PixelBuffer of the loaded image. std::string_view url; ///< The url address of the loaded image. diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index fd0f2b7..02df28f 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -104,31 +104,31 @@ constexpr uint32_t TEXTURE_COUNT_FOR_GPU_ALPHA_MASK = 2u; struct NameIndexMatch { const char* const name; - Property::Index index; + Property::Index index; }; const NameIndexMatch NAME_INDEX_MATCH_TABLE[] = -{ - {IMAGE_FITTING_MODE, Toolkit::ImageVisual::Property::FITTING_MODE}, - {IMAGE_SAMPLING_MODE, Toolkit::ImageVisual::Property::SAMPLING_MODE}, - {IMAGE_DESIRED_WIDTH, Toolkit::ImageVisual::Property::DESIRED_WIDTH}, - {IMAGE_DESIRED_HEIGHT, Toolkit::ImageVisual::Property::DESIRED_HEIGHT}, - {PIXEL_AREA_UNIFORM_NAME, Toolkit::ImageVisual::Property::PIXEL_AREA}, - {IMAGE_WRAP_MODE_U, Toolkit::ImageVisual::Property::WRAP_MODE_U}, - {IMAGE_WRAP_MODE_V, Toolkit::ImageVisual::Property::WRAP_MODE_V}, - {SYNCHRONOUS_LOADING, Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING}, - {IMAGE_ATLASING, Toolkit::ImageVisual::Property::ATLASING}, - {ALPHA_MASK_URL, Toolkit::ImageVisual::Property::ALPHA_MASK_URL}, - {MASK_CONTENT_SCALE_NAME, Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE}, - {CROP_TO_MASK_NAME, Toolkit::ImageVisual::Property::CROP_TO_MASK}, - {MASKING_TYPE_NAME, Toolkit::DevelImageVisual::Property::MASKING_TYPE}, - {ENABLE_BROKEN_IMAGE, Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE}, - {LOAD_POLICY_NAME, Toolkit::ImageVisual::Property::LOAD_POLICY}, - {RELEASE_POLICY_NAME, Toolkit::ImageVisual::Property::RELEASE_POLICY}, - {ORIENTATION_CORRECTION_NAME, Toolkit::ImageVisual::Property::ORIENTATION_CORRECTION}, - {FAST_TRACK_UPLOADING_NAME, Toolkit::DevelImageVisual::Property::FAST_TRACK_UPLOADING}, + { + {IMAGE_FITTING_MODE, Toolkit::ImageVisual::Property::FITTING_MODE}, + {IMAGE_SAMPLING_MODE, Toolkit::ImageVisual::Property::SAMPLING_MODE}, + {IMAGE_DESIRED_WIDTH, Toolkit::ImageVisual::Property::DESIRED_WIDTH}, + {IMAGE_DESIRED_HEIGHT, Toolkit::ImageVisual::Property::DESIRED_HEIGHT}, + {PIXEL_AREA_UNIFORM_NAME, Toolkit::ImageVisual::Property::PIXEL_AREA}, + {IMAGE_WRAP_MODE_U, Toolkit::ImageVisual::Property::WRAP_MODE_U}, + {IMAGE_WRAP_MODE_V, Toolkit::ImageVisual::Property::WRAP_MODE_V}, + {SYNCHRONOUS_LOADING, Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING}, + {IMAGE_ATLASING, Toolkit::ImageVisual::Property::ATLASING}, + {ALPHA_MASK_URL, Toolkit::ImageVisual::Property::ALPHA_MASK_URL}, + {MASK_CONTENT_SCALE_NAME, Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE}, + {CROP_TO_MASK_NAME, Toolkit::ImageVisual::Property::CROP_TO_MASK}, + {MASKING_TYPE_NAME, Toolkit::DevelImageVisual::Property::MASKING_TYPE}, + {ENABLE_BROKEN_IMAGE, Toolkit::DevelImageVisual::Property::ENABLE_BROKEN_IMAGE}, + {LOAD_POLICY_NAME, Toolkit::ImageVisual::Property::LOAD_POLICY}, + {RELEASE_POLICY_NAME, Toolkit::ImageVisual::Property::RELEASE_POLICY}, + {ORIENTATION_CORRECTION_NAME, Toolkit::ImageVisual::Property::ORIENTATION_CORRECTION}, + {FAST_TRACK_UPLOADING_NAME, Toolkit::DevelImageVisual::Property::FAST_TRACK_UPLOADING}, }; -const int NAME_INDEX_MATCH_TABLE_SIZE = sizeof(NAME_INDEX_MATCH_TABLE)/sizeof(NAME_INDEX_MATCH_TABLE[0]); +const int NAME_INDEX_MATCH_TABLE_SIZE = sizeof(NAME_INDEX_MATCH_TABLE) / sizeof(NAME_INDEX_MATCH_TABLE[0]); Geometry CreateGeometry(VisualFactoryCache& factoryCache, ImageDimensions gridSize) { @@ -137,7 +137,8 @@ Geometry CreateGeometry(VisualFactoryCache& factoryCache, ImageDimensions gridSi if(gridSize == ImageDimensions(1, 1)) { geometry = factoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY); - } else + } + else { geometry = VisualFactoryCache::CreateGridGeometry(gridSize); } @@ -1043,11 +1044,6 @@ void ImageVisual::LoadComplete(bool loadingSuccess, TextureInformation textureIn Toolkit::Visual::ResourceStatus resourceStatus; if(mImpl->mRenderer) { - if(textureInformation.useAtlasing) - { - mImpl->mRenderer.RegisterProperty(ATLAS_RECT_UNIFORM_NAME, mAtlasRect); - } - EnablePreMultipliedAlpha(textureInformation.preMultiplied); Actor actor = mPlacementActor.GetHandle(); @@ -1058,12 +1054,9 @@ void ImageVisual::LoadComplete(bool loadingSuccess, TextureInformation textureIn } else { - if(!textureInformation.useAtlasing) - { - Sampler sampler = Sampler::New(); - sampler.SetWrapMode(mWrapModeU, mWrapModeV); - textureInformation.textureSet.SetSampler(0u, sampler); - } + Sampler sampler = Sampler::New(); + sampler.SetWrapMode(mWrapModeU, mWrapModeV); + textureInformation.textureSet.SetSampler(0u, sampler); mImpl->mRenderer.SetTextures(textureInformation.textureSet); ComputeTextureSize(); -- 2.7.4