aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2023-04-13 15:08:30 -0700
committerLukas Rusak <lorusak@gmail.com>2023-05-12 20:50:45 -0700
commit60da5c9790105f60b3674d26c753e1b3e4275562 (patch)
tree577c31b400ee4d554219d920028267067c460238 /tools
parent4e0b732371fae989307fc8eb23bdf6a56f4bb8bb (diff)
TexturePacker: add hashes as a class member
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/depends/native/TexturePacker/src/TexturePacker.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/tools/depends/native/TexturePacker/src/TexturePacker.cpp b/tools/depends/native/TexturePacker/src/TexturePacker.cpp
index f2e008dbc8..ead4b8832e 100644
--- a/tools/depends/native/TexturePacker/src/TexturePacker.cpp
+++ b/tools/depends/native/TexturePacker/src/TexturePacker.cpp
@@ -120,13 +120,12 @@ private:
CXBTFFrame CreateXBTFFrame(DecodedFrame& decodedFrame, CXBTFWriter& writer) const;
- bool CheckDupe(MD5Context* ctx,
- std::map<std::string, unsigned int>& hashes,
- std::vector<unsigned int>& dupes,
- unsigned int pos);
+ bool CheckDupe(MD5Context* ctx, std::vector<unsigned int>& dupes, unsigned int pos);
DecoderManager decoderManager;
+ std::map<std::string, unsigned int> m_hashes;
+
bool m_dupecheck{false};
unsigned int m_flags{0};
};
@@ -252,7 +251,6 @@ CXBTFFrame TexturePacker::CreateXBTFFrame(DecodedFrame& decodedFrame, CXBTFWrite
}
bool TexturePacker::CheckDupe(MD5Context* ctx,
- std::map<std::string, unsigned int>& hashes,
std::vector<unsigned int>& dupes,
unsigned int pos)
{
@@ -266,14 +264,14 @@ bool TexturePacker::CheckDupe(MD5Context* ctx,
digest[9], digest[10], digest[11], digest[12], digest[13], digest[14],
digest[15]);
hex[32] = 0;
- std::map<std::string, unsigned int>::iterator it = hashes.find(hex);
- if (it != hashes.end())
+ std::map<std::string, unsigned int>::iterator it = m_hashes.find(hex);
+ if (it != m_hashes.end())
{
dupes[pos] = it->second;
return true;
}
- hashes.insert(std::make_pair(hex,pos));
+ m_hashes.insert(std::make_pair(hex, pos));
dupes[pos] = pos;
return false;
@@ -288,7 +286,6 @@ int TexturePacker::createBundle(const std::string& InputDir, const std::string&
return 1;
}
- std::map<std::string, unsigned int> hashes;
std::vector<unsigned int> dupes;
CreateSkeletonHeader(writer, InputDir);
@@ -328,7 +325,7 @@ int TexturePacker::createBundle(const std::string& InputDir, const std::string&
MD5Update(&ctx, (const uint8_t*)frames.frameList[j].rgbaImage.pixels.data(),
frames.frameList[j].rgbaImage.height * frames.frameList[j].rgbaImage.pitch);
- if (CheckDupe(&ctx, hashes, dupes, i))
+ if (CheckDupe(&ctx, dupes, i))
{
printf("**** duplicate of %s\n", files[dupes[i]].GetPath().c_str());
file.GetFrames().insert(file.GetFrames().end(),