/*
- * 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.
Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ANIMATED_IMAGE");
#define LOG_CACHE \
+ if(gAnimImgLogFilter->IsEnabledFor(Debug::Concise)) \
{ \
std::ostringstream oss; \
oss << "Size:" << mQueue.Count() << " [ "; \
{
namespace Internal
{
-RollingImageCache::RollingImageCache(
- TextureManager& textureManager, UrlList& urlList, ImageCache::FrameReadyObserver& observer, uint16_t cacheSize, uint16_t batchSize, uint32_t interval)
-: ImageCache(textureManager, observer, batchSize, interval),
+RollingImageCache::RollingImageCache(TextureManager& textureManager,
+ UrlList& urlList,
+ TextureManager::MaskingDataPointer& maskingData,
+ ImageCache::FrameReadyObserver& observer,
+ uint16_t cacheSize,
+ uint16_t batchSize,
+ uint32_t interval)
+: ImageCache(textureManager, maskingData, observer, batchSize, interval),
mImageUrls(urlList),
mQueue(cacheSize)
{
bool popExist = false;
while(!mQueue.IsEmpty() && mQueue.Front().mUrlIndex != frameIndex)
{
- ImageFrame imageFrame = mQueue.PopFront();
- mTextureManager.Remove(mImageUrls[imageFrame.mUrlIndex].mTextureId, this);
- mImageUrls[imageFrame.mUrlIndex].mTextureId = TextureManager::INVALID_TEXTURE_ID;
- popExist = true;
+ PopFrontCache();
+ popExist = true;
}
// TODO: synchronous loading of first frame.
{
ImageFrame imageFrame;
- std::string& url = mImageUrls[frameIndex].mUrl;
+ VisualUrl& url = mImageUrls[frameIndex].mUrl;
imageFrame.mUrlIndex = frameIndex;
imageFrame.mReady = 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;
+ 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;
TextureManager::TextureId loadTextureId = TextureManager::INVALID_TEXTURE_ID;
TextureSet textureSet = mTextureManager.LoadTexture(
- url, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, maskInfo, synchronousLoading, loadTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply);
+ url, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, mMaskingData, synchronousLoading, loadTextureId, textureRect, textureRectSize, atlasingStatus, loadingStatus, Dali::WrapMode::Type::DEFAULT, Dali::WrapMode::Type::DEFAULT, this, atlasObserver, imageAtlasManager, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED, preMultiply);
mImageUrls[imageFrame.mUrlIndex].mTextureId = loadTextureId;
mRequestingLoad = false;
return mImageUrls[mQueue[index].mUrlIndex].mTextureId;
}
+void RollingImageCache::PopFrontCache()
+{
+ ImageFrame imageFrame = mQueue.PopFront();
+ mTextureManager.Remove(mImageUrls[imageFrame.mUrlIndex].mTextureId, this);
+ mImageUrls[imageFrame.mUrlIndex].mTextureId = TextureManager::INVALID_TEXTURE_ID;
+
+ if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID)
+ {
+ mTextureManager.Remove(mMaskingData->mAlphaMaskId, this);
+ if(mQueue.IsEmpty())
+ {
+ mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ }
+ }
+}
+
void RollingImageCache::ClearCache()
{
while(mTextureManagerAlive && !mQueue.IsEmpty())
{
- ImageFrame imageFrame = mQueue.PopFront();
- mTextureManager.Remove(mImageUrls[imageFrame.mUrlIndex].mTextureId, this);
- mImageUrls[imageFrame.mUrlIndex].mTextureId = TextureManager::INVALID_TEXTURE_ID;
+ PopFrontCache();
}
mLoadState = TextureManager::LoadState::NOT_STARTED;
}
if(loadSuccess)
{
- mLoadState = TextureManager::LoadState::LOAD_FINISHED;
+ mLoadState = TextureManager::LoadState::LOAD_FINISHED;
bool frontFrameReady = IsFrontReady();
if(!mRequestingLoad)
{