X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftexture-manager%2Ftexture-cache-manager.cpp;h=cc90fd8b37b11c17630f0fb6edea2a2d96eec328;hb=c7efc4f6dd8ca6ff94bc99acf92944b7f697e0bb;hp=3fe5105090ec81732f9e684e86092cf2007586af;hpb=77cec61f0ccb6270ae149ee3e7f31418002e07f6;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp b/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp index 3fe5105..cc90fd8 100644 --- a/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp +++ b/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp @@ -326,19 +326,20 @@ TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( const Dali::FittingMode::Type& fittingMode, const Dali::SamplingMode::Type& samplingMode, const TextureCacheManager::UseAtlas& useAtlas, - const TextureCacheManager::TextureId& maskTextureId) + const TextureCacheManager::TextureId& maskTextureId, + const bool& cropToMask) { - std::string hashTarget(url); - const size_t urlLength = hashTarget.length(); - const uint16_t width = size.GetWidth(); - const uint16_t height = size.GetWidth(); + std::vector hashTarget(url.begin(), url.end()); + const size_t urlLength = url.length(); + const uint16_t width = size.GetWidth(); + const uint16_t height = size.GetWidth(); // If either the width or height has been specified, include the resizing options in the hash if(width != 0 || height != 0) { // We are appending 5 bytes to the URL to form the hash input. hashTarget.resize(urlLength + 5u); - char* hashTargetPtr = &(hashTarget[urlLength]); + std::uint8_t* hashTargetPtr = &(hashTarget[urlLength]); // Pack the width and height (4 bytes total). *hashTargetPtr++ = size.GetWidth() & 0xff; @@ -373,9 +374,9 @@ TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( if(maskTextureId != INVALID_TEXTURE_ID) { - auto textureIdIndex = hashTarget.length(); - hashTarget.resize(hashTarget.length() + sizeof(TextureId)); - unsigned char* hashTargetPtr = reinterpret_cast(&(hashTarget[textureIdIndex])); + auto textureIdIndex = hashTarget.size(); + hashTarget.resize(hashTarget.size() + sizeof(TextureId) + 1u); + std::uint8_t* hashTargetPtr = reinterpret_cast(&(hashTarget[textureIdIndex])); // Append the texture id to the end of the URL byte by byte: // (to avoid SIGBUS / alignment issues) @@ -385,6 +386,7 @@ TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( *hashTargetPtr++ = saltedMaskTextureId & 0xff; saltedMaskTextureId >>= 8u; } + *hashTargetPtr++ = (cropToMask ? 'C' : 'M'); } return Dali::CalculateHash(hashTarget); @@ -398,7 +400,9 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::FindCachedTexture( const Dali::SamplingMode::Type& samplingMode, const TextureCacheManager::UseAtlas& useAtlas, const TextureCacheManager::TextureId& maskTextureId, - const TextureCacheManager::MultiplyOnLoad& preMultiplyOnLoad) + const TextureCacheManager::MultiplyOnLoad& preMultiplyOnLoad, + bool isAnimatedImage, + const bool& cropToMask) { // Default to an invalid ID, in case we do not find a match. TextureCacheIndex cacheIndex = INVALID_CACHE_INDEX; @@ -415,7 +419,9 @@ TextureCacheManager::TextureCacheIndex TextureCacheManager::FindCachedTexture( if((url == textureInfo.url.GetUrl()) && (useAtlas == textureInfo.useAtlas) && (maskTextureId == textureInfo.maskTextureId) && + (cropToMask == textureInfo.cropToMask) && (size == textureInfo.desiredSize) && + (isAnimatedImage == textureInfo.isAnimatedImageFormat) && ((size.GetWidth() == 0 && size.GetHeight() == 0) || (fittingMode == textureInfo.fittingMode && samplingMode == textureInfo.samplingMode))) @@ -449,7 +455,6 @@ void TextureCacheManager::RemoveCache(const TextureCacheManager::TextureId& text if(textureInfoIndex != INVALID_CACHE_INDEX) { TextureInfo& textureInfo(mTextureInfoContainer[textureInfoIndex]); - DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureCacheManager::Remove(textureId:%d) url:%s\n cacheIdx:%d loadState:%s reference count = %d\n", textureId, textureInfo.url.GetUrl().c_str(), textureInfoIndex, GET_LOAD_STATE_STRING(textureInfo.loadState), textureInfo.referenceCount); // Decrement the reference count and check if this is the last user of this Texture.