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)
{
bool synchronousLoading = false;
bool atlasingStatus = false;
bool loadingStatus = false;
- TextureManager::MaskingDataPointer maskInfo = nullptr;
AtlasUploadObserver* atlasObserver = nullptr;
ImageAtlasManagerPtr imageAtlasManager = nullptr;
Vector4 textureRect;
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);
+ url, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, mMaskingData, 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);
mRequestingLoad = false;
}
{
mTextureManager.Remove(mImageUrls[i].mTextureId, this);
mImageUrls[i].mTextureId = TextureManager::INVALID_TEXTURE_ID;
+
+ if(mMaskingData && mMaskingData->mAlphaMaskId != TextureManager::INVALID_TEXTURE_ID)
+ {
+ // In the CPU alpha masking, each frame increases reference count of masking texture.
+ // We should call TextureManager::Remove to decrease reference count when each frame is removed.
+ mTextureManager.Remove(mMaskingData->mAlphaMaskId, this);
+ }
}
}
mReadyFlags.clear();
mLoadState = TextureManager::LoadState::NOT_STARTED;
+ if(mMaskingData)
+ {
+ mMaskingData->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ }
}
void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureInformation)