diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-09-01 18:35:23 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-09-04 21:58:53 +0800 |
| commit | 00bb3bb6f07660bd914d29a1389342bb3060d254 (patch) | |
| tree | 431f574922494d2201718f13085f17bc6bd7fb42 /indra/llimage/llimage.cpp | |
| parent | a8636720129952c10cf49ab80da21bf8b340b96c (diff) | |
| parent | 4ef9f8f14b35ed388c294d53767a0dca0e890924 (diff) | |
Merge remote-tracking branch 'secondlife/release/26.4' into 26.4
Diffstat (limited to 'indra/llimage/llimage.cpp')
| -rw-r--r-- | indra/llimage/llimage.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 35bc7065b1..b4d34f536c 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -2048,6 +2048,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) @@ -2068,7 +2087,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()) { @@ -2080,6 +2100,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) { |
