aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/native/TexturePacker/src
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2023-04-13 14:58:01 -0700
committerLukas Rusak <lorusak@gmail.com>2023-05-12 20:50:24 -0700
commite64be71d12b7ab29ce036fcdfdab52ff2eff15fd (patch)
tree2c46d20c282a1c027c24d6d286592d748d5f0765 /tools/depends/native/TexturePacker/src
parentc383092929312c7b99f8ede5f508efe4ab14901f (diff)
TexturePacker: move dupecheck to class member
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.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/tools/depends/native/TexturePacker/src/TexturePacker.cpp b/tools/depends/native/TexturePacker/src/TexturePacker.cpp
index a7b81ee05c..6fb13cd545 100644
--- a/tools/depends/native/TexturePacker/src/TexturePacker.cpp
+++ b/tools/depends/native/TexturePacker/src/TexturePacker.cpp
@@ -105,10 +105,9 @@ public:
TexturePacker() = default;
~TexturePacker() = default;
- int createBundle(const std::string& InputDir,
- const std::string& OutputFile,
- unsigned int flags,
- bool dupecheck);
+ void EnableDupeCheck() { m_dupecheck = true; }
+
+ int createBundle(const std::string& InputDir, const std::string& OutputFile, unsigned int flags);
DecoderManager decoderManager;
@@ -123,6 +122,8 @@ private:
std::map<std::string, unsigned int>& hashes,
std::vector<unsigned int>& dupes,
unsigned int pos);
+
+ bool m_dupecheck{false};
};
void TexturePacker::CreateSkeletonHeader(CXBTFWriter& xbtfWriter,
@@ -277,8 +278,7 @@ bool TexturePacker::CheckDupe(MD5Context* ctx,
int TexturePacker::createBundle(const std::string& InputDir,
const std::string& OutputFile,
- unsigned int flags,
- bool dupecheck)
+ unsigned int flags)
{
CXBTFWriter writer(OutputFile);
if (!writer.Create())
@@ -293,7 +293,7 @@ int TexturePacker::createBundle(const std::string& InputDir,
std::vector<CXBTFFile> files = writer.GetFiles();
dupes.resize(files.size());
- if (!dupecheck)
+ if (!m_dupecheck)
{
for (unsigned int i=0;i<dupes.size();++i)
dupes[i] = i;
@@ -321,7 +321,7 @@ int TexturePacker::createBundle(const std::string& InputDir,
printf("%s\n", output.c_str());
bool skip=false;
- if (dupecheck)
+ if (m_dupecheck)
{
for (unsigned int j = 0; j < frames.frameList.size(); j++)
MD5Update(&ctx, (const uint8_t*)frames.frameList[j].rgbaImage.pixels.data(),
@@ -376,7 +376,6 @@ int main(int argc, char* argv[])
return 1;
bool valid = false;
unsigned int flags = 0;
- bool dupecheck = false;
CmdLineArgs args(argc, (const char**)argv);
// setup some defaults, lzo packing,
@@ -407,7 +406,7 @@ int main(int argc, char* argv[])
}
else if (!strcmp(args[i], "-dupecheck"))
{
- dupecheck = true;
+ texturePacker.EnableDupeCheck();
}
else if (!strcmp(args[i], "-verbose"))
{
@@ -438,5 +437,5 @@ int main(int argc, char* argv[])
if (pos != InputDir.length() - 1)
InputDir += DIR_SEPARATOR;
- texturePacker.createBundle(InputDir, OutputFilename, flags, dupecheck);
+ texturePacker.createBundle(InputDir, OutputFilename, flags);
}