/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
{
namespace
{
-constexpr bool ENABLE_ORIENTATION_CORRECTION(true);
+constexpr bool ENABLE_ORIENTATION_CORRECTION(true);
constexpr uint32_t FIRST_FRAME_INDEX = 0u;
} // namespace
-FixedImageCache::FixedImageCache(
- TextureManager& textureManager, UrlList& urlList, ImageCache::FrameReadyObserver& observer, uint32_t batchSize, uint32_t interval)
-: ImageCache(textureManager, observer, batchSize, interval),
+FixedImageCache::FixedImageCache(TextureManager& textureManager,
+ UrlList& urlList,
+ TextureManager::MaskingDataPointer& maskingData,
+ ImageCache::FrameReadyObserver& observer,
+ uint32_t batchSize,
+ uint32_t interval)
+: ImageCache(textureManager, maskingData, observer, batchSize, interval),
mImageUrls(urlList),
mFront(FIRST_FRAME_INDEX)
{
// Once the cache is filled, no more images are loaded.
for(unsigned int i = 0; i < mBatchSize && mReadyFlags.size() < mImageUrls.size(); ++i)
{
- uint32_t frameIndex = mReadyFlags.size();
- std::string& url = mImageUrls[frameIndex].mUrl;
+ uint32_t frameIndex = mReadyFlags.size();
+ VisualUrl& url = mImageUrls[frameIndex].mUrl;
mReadyFlags.push_back(false);
// from within this method. This means it won't yet have a texture id, so we
// need to account for this inside the LoadComplete method using mRequestingLoad.
mRequestingLoad = true;
- mLoadState = TextureManager::LoadState::LOADING;
-
- bool synchronousLoading = false;
- bool atlasingStatus = false;
- bool loadingStatus = false;
- TextureManager::MaskingDataPointer maskInfo = nullptr;
- AtlasUploadObserver* atlasObserver = nullptr;
- ImageAtlasManagerPtr imageAtlasManager = nullptr;
- Vector4 textureRect;
- Dali::ImageDimensions textureRectSize;
- auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
-
- mTextureManager.LoadTexture(
- url, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, maskInfo, synchronousLoading, mImageUrls[frameIndex].mTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply);
-
+ mLoadState = TextureManager::LoadState::LOADING;
+
+ bool synchronousLoading = false;
+ bool atlasingStatus = false;
+ bool loadingStatus = false;
+ AtlasUploadObserver* atlasObserver = nullptr;
+ ImageAtlasManagerPtr imageAtlasManager = nullptr;
+ Vector4 textureRect;
+ Dali::ImageDimensions textureRectSize;
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+
+ mTextureManager.LoadTexture(url, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, mMaskingData, synchronousLoading, mImageUrls[frameIndex].mTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply);
mRequestingLoad = false;
}
}
TextureSet FixedImageCache::GetFrontTextureSet() const
{
- return mTextureManager.GetTextureSet(mImageUrls[mFront].mTextureId);
+ TextureSet textureSet = mTextureManager.GetTextureSet(mImageUrls[mFront].mTextureId);
+ if(textureSet)
+ {
+ Sampler sampler = Sampler::New();
+ sampler.SetWrapMode(Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT);
+ textureSet.SetSampler(0u, sampler);
+ }
+ return textureSet;
}
void FixedImageCache::CheckFrontFrame(bool wasReady)
}
mReadyFlags.clear();
mLoadState = TextureManager::LoadState::NOT_STARTED;
+ if(mMaskingData)
+ {
+ mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ }
}
void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureInformation)
{
if(loadSuccess)
{
- mLoadState = TextureManager::LoadState::LOAD_FINISHED;
+ mLoadState = TextureManager::LoadState::LOAD_FINISHED;
bool frontFrameReady = IsFrontReady();
if(!mRequestingLoad)
{