summaryrefslogtreecommitdiff
path: root/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <118752495+marchcat@users.noreply.github.com>2026-01-20 18:49:25 +0200
committerGitHub <noreply@github.com>2026-01-20 18:49:25 +0200
commitb4f75c4cd53192573e8245eb5fe63a65734d0a1b (patch)
treec91ced079bd5b84eb5cd3c7a9c3b3b7bb8367057 /indra/llimage/llimage.cpp
parent7d616292ad664472ffa79cc0cd447096a18e72ba (diff)
parent30e7621140a3cbf4c911f596c1325f4b7eae25a6 (diff)
Merge pull request #5303 from secondlife/marchcat/slua-ed-dev-lnx
Merge develop-linux into SLua editor PV branch
Diffstat (limited to 'indra/llimage/llimage.cpp')
-rw-r--r--indra/llimage/llimage.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index ca8a4199e8..bea33c04ed 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -2036,6 +2036,25 @@ file_extensions[] =
{ "dxt", IMG_CODEC_DXT },
{ "png", IMG_CODEC_PNG }
};
+
+static struct
+{
+ const wchar_t* exten;
+ EImageCodec codec;
+}
+wide_file_extensions[] =
+{
+ { L"bmp", IMG_CODEC_BMP },
+ { L"tga", IMG_CODEC_TGA },
+ { L"j2c", IMG_CODEC_J2C },
+ { L"jp2", IMG_CODEC_J2C },
+ { L"texture", IMG_CODEC_J2C },
+ { L"jpg", IMG_CODEC_JPEG },
+ { L"jpeg", IMG_CODEC_JPEG },
+ { L"mip", IMG_CODEC_DXT },
+ { L"dxt", IMG_CODEC_DXT },
+ { L"png", IMG_CODEC_PNG }
+};
#define NUM_FILE_EXTENSIONS LL_ARRAY_SIZE(file_extensions)
#if 0
static std::string find_file(std::string &name, S8 *codec)
@@ -2056,7 +2075,8 @@ static std::string find_file(std::string &name, S8 *codec)
return std::string("");
}
#endif
-EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten)
+
+EImageCodec LLImageBase::getCodecFromExtension(std::string_view exten)
{
if (!exten.empty())
{
@@ -2068,6 +2088,20 @@ EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten)
}
return IMG_CODEC_INVALID;
}
+
+EImageCodec LLImageBase::getCodecFromExtension(std::wstring_view exten)
+{
+ if (!exten.empty())
+ {
+ for (int i = 0; i < (int)(NUM_FILE_EXTENSIONS); i++)
+ {
+ if (exten == wide_file_extensions[i].exten)
+ return wide_file_extensions[i].codec;
+ }
+ }
+ return IMG_CODEC_INVALID;
+}
+
#if 0
bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only)
{