From: Eunki Hong Date: Wed, 23 Feb 2022 17:54:04 +0000 (+0000) Subject: Merge "Make TextureHash as buffer" into devel/master X-Git-Tag: dali_2.1.11~4 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=18550c831b92074461a7990541e75e9225894062;hp=68c18cf776be4010ffa0a70209deb465a21a269c Merge "Make TextureHash as buffer" into devel/master --- diff --git a/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp b/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp index 3fe5105..bdc0b6a 100644 --- a/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp +++ b/dali-toolkit/internal/texture-manager/texture-cache-manager.cpp @@ -328,17 +328,17 @@ TextureCacheManager::TextureHash TextureCacheManager::GenerateHash( const TextureCacheManager::UseAtlas& useAtlas, const TextureCacheManager::TextureId& maskTextureId) { - 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 +373,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)); + 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)