TextureHash textureHash = INITIAL_CACHE_NUMBER;
int cacheIndex = INVALID_CACHE_INDEX;
- if(storageType != StorageType::RETURN_PIXEL_BUFFER && !isAnimatedImage)
+ if(storageType != StorageType::RETURN_PIXEL_BUFFER)
{
- textureHash = GenerateHash(url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId);
+ textureHash = GenerateHash(url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId, isAnimatedImage, frameIndex);
// Look up the texture by hash. Note: The extra parameters are used in case of a hash collision.
- cacheIndex = FindCachedTexture(textureHash, url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId, preMultiplyOnLoad);
+ cacheIndex = FindCachedTexture(textureHash, url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId, preMultiplyOnLoad, isAnimatedImage, frameIndex);
}
TextureManager::TextureId textureId = INVALID_TEXTURE_ID;
+
// Check if the requested Texture exists in the cache.
if( cacheIndex != INVALID_CACHE_INDEX )
{
const FittingMode::Type fittingMode,
const Dali::SamplingMode::Type samplingMode,
const UseAtlas useAtlas,
- TextureId maskTextureId)
+ TextureId maskTextureId,
+ bool isAnimationImage,
+ uint32_t frameIndex )
{
std::string hashTarget( url );
const size_t urlLength = hashTarget.length();
}
}
+ if( isAnimationImage )
+ {
+ auto textureIdIndex = hashTarget.length();
+ hashTarget.resize( hashTarget.length() + sizeof( uint32_t ) );
+ char* hashTargetPtr = &( hashTarget[ textureIdIndex ] );
+
+ for( size_t byteIter = 0; byteIter < sizeof( uint32_t ); ++byteIter )
+ {
+ *hashTargetPtr++ = frameIndex & 0xff;
+ frameIndex >>= 8u;
+ }
+ }
+
if( maskTextureId != INVALID_TEXTURE_ID )
{
auto textureIdIndex = hashTarget.length();
const Dali::SamplingMode::Type samplingMode,
const bool useAtlas,
TextureId maskTextureId,
- TextureManager::MultiplyOnLoad preMultiplyOnLoad)
+ TextureManager::MultiplyOnLoad preMultiplyOnLoad,
+ bool isAnimatedImage,
+ uint32_t frameIndex )
{
// Default to an invalid ID, in case we do not find a match.
int cacheIndex = INVALID_CACHE_INDEX;
( size == textureInfo.desiredSize ) &&
( ( size.GetWidth() == 0 && size.GetHeight() == 0 ) ||
( fittingMode == textureInfo.fittingMode &&
- samplingMode == textureInfo.samplingMode ) ) )
+ samplingMode == textureInfo.samplingMode ) ) &&
+ ( isAnimatedImage == ( ( textureInfo.animatedImageLoading ) ? true : false ) ) &&
+ ( frameIndex == textureInfo.frameIndex ) )
{
// 1. If preMultiplyOnLoad is MULTIPLY_ON_LOAD, then textureInfo.preMultiplyOnLoad should be true. The premultiplication result can be different.
// 2. If preMultiplyOnLoad is LOAD_WITHOUT_MULTIPLY, then textureInfo.preMultiplied should be false.