summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenufile.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-04-13 14:05:31 -0700
committerMerov Linden <merov@lindenlab.com>2011-04-13 14:05:31 -0700
commit759d72a46c5d487e6881426f90c54c6ae2da4847 (patch)
treebcbf6f2c2294eaa4052c9c53c59a89f7a59852e1 /indra/newview/llviewermenufile.cpp
parent505e5e403d6439f29d60861553656d01522cb241 (diff)
EXP-669 : Refactor code to use correct LLImageFormatted methods to load images of all formats, reviewed by richard
Diffstat (limited to 'indra/newview/llviewermenufile.cpp')
-rw-r--r--indra/newview/llviewermenufile.cpp55
1 files changed, 5 insertions, 50 deletions
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index fda291f3c1..2cf8dbec89 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -493,6 +493,7 @@ void upload_new_resource(const std::string& src_filename, std::string name,
LLSD args;
std::string exten = gDirUtilp->getExtension(src_filename);
+ U32 codec = LLImageBase::getCodecFromExtension(exten);
LLAssetType::EType asset_type = LLAssetType::AT_NONE;
std::string error_message;
@@ -510,66 +511,20 @@ void upload_new_resource(const std::string& src_filename, std::string name,
upload_error(error_message, "NoFileExtension", filename, args);
return;
}
- else if( exten == "bmp")
+ else if (codec != IMG_CODEC_INVALID)
{
+ // It's an image file, the upload procedure is the same for all
asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_BMP ))
+ if (!LLViewerTextureList::createUploadFile(src_filename, filename, codec ))
{
error_message = llformat( "Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
+ src_filename.c_str(), LLImage::getLastError().c_str());
args["FILE"] = src_filename;
args["ERROR"] = LLImage::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
- else if( exten == "tga")
- {
- asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_TGA ))
- {
- error_message = llformat("Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
- args["FILE"] = src_filename;
- args["ERROR"] = LLImage::getLastError();
- upload_error(error_message, "ProblemWithFile", filename, args);
- return;
- }
- }
- else if( exten == "jpg" || exten == "jpeg")
- {
- asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_JPEG ))
- {
- error_message = llformat("Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
- args["FILE"] = src_filename;
- args["ERROR"] = LLImage::getLastError();
- upload_error(error_message, "ProblemWithFile", filename, args);
- return;
- }
- }
- else if( exten == "png")
- {
- asset_type = LLAssetType::AT_TEXTURE;
- if (!LLViewerTextureList::createUploadFile(src_filename,
- filename,
- IMG_CODEC_PNG ))
- {
- error_message = llformat("Problem with file %s:\n\n%s\n",
- src_filename.c_str(), LLImage::getLastError().c_str());
- args["FILE"] = src_filename;
- args["ERROR"] = LLImage::getLastError();
- upload_error(error_message, "ProblemWithFile", filename, args);
- return;
- }
- }
else if(exten == "wav")
{
asset_type = LLAssetType::AT_SOUND; // tag it as audio