diff options
author | Lukas Rusak <lorusak@gmail.com> | 2023-04-13 14:50:15 -0700 |
---|---|---|
committer | Lukas Rusak <lorusak@gmail.com> | 2023-05-12 20:50:03 -0700 |
commit | 5477fd7b34ab36c29a8f16f247f1650395af2442 (patch) | |
tree | 0483818055c140ef26fd6693b75408af8656cf9e /tools/depends/native/TexturePacker/src | |
parent | 12e85848bfc3c0b3a1651cc0e6af916e66394f45 (diff) |
TexturePacker: add checkDupe to class
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Diffstat (limited to 'tools/depends/native/TexturePacker/src')
-rw-r--r-- | tools/depends/native/TexturePacker/src/TexturePacker.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/depends/native/TexturePacker/src/TexturePacker.cpp b/tools/depends/native/TexturePacker/src/TexturePacker.cpp index ebd5d3e4fa..bc4486acdf 100644 --- a/tools/depends/native/TexturePacker/src/TexturePacker.cpp +++ b/tools/depends/native/TexturePacker/src/TexturePacker.cpp @@ -109,6 +109,11 @@ private: const std::string& relativePath = ""); CXBTFFrame CreateXBTFFrame(DecodedFrame& decodedFrame, CXBTFWriter& writer, unsigned int flags) const; + + bool CheckDupe(MD5Context* ctx, + std::map<std::string, unsigned int>& hashes, + std::vector<unsigned int>& dupes, + unsigned int pos); }; void TexturePacker::CreateSkeletonHeader(CXBTFWriter& xbtfWriter, @@ -242,9 +247,10 @@ void Usage() puts(" -dupecheck Enable duplicate file detection. Reduces output file size. Default: off"); } -static bool checkDupe(struct MD5Context* ctx, - std::map<std::string, unsigned int>& hashes, - std::vector<unsigned int>& dupes, unsigned int pos) +bool TexturePacker::CheckDupe(MD5Context* ctx, + std::map<std::string, unsigned int>& hashes, + std::vector<unsigned int>& dupes, + unsigned int pos) { unsigned char digest[17]; MD5Final(digest,ctx); @@ -321,7 +327,7 @@ int TexturePacker::createBundle(const std::string& InputDir, 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, hashes, dupes, i)) { printf("**** duplicate of %s\n", files[dupes[i]].GetPath().c_str()); file.GetFrames().insert(file.GetFrames().end(), |