diff options
| author | Monty Brandenberg <monty@lindenlab.com> | 2014-09-22 17:11:17 -0400 |
|---|---|---|
| committer | Monty Brandenberg <monty@lindenlab.com> | 2014-09-22 17:11:17 -0400 |
| commit | 8897e7ca24533e0093825346391f5fa9a37f2427 (patch) | |
| tree | 781b08a7a90e53124d4f11b507be4d726544f0f0 /indra/newview/lllocalbitmaps.cpp | |
| parent | 79ab7c20703c092a4416a4f9a885e0246fc17ee0 (diff) | |
| parent | 499f5aa9a4b46d61ee94b26d5c86bc032766af70 (diff) | |
Merge. Refresh from viewer-release after 3.7.16 release.
Diffstat (limited to 'indra/newview/lllocalbitmaps.cpp')
| -rwxr-xr-x | indra/newview/lllocalbitmaps.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index b91e37d596..897ee8429a 100755 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -61,7 +61,9 @@ #include "llnotificationsutil.h" #include "pipeline.h" #include "llmaterialmgr.h" - +#include "llimagedimensionsinfo.h" +#include "llviewercontrol.h" +#include "lltrans.h" /*=======================================*/ /* Formal declarations, constants, etc. */ /*=======================================*/ @@ -845,6 +847,12 @@ bool LLLocalBitmapMgr::addUnit() std::string filename = picker.getFirstFile(); while(!filename.empty()) { + if(!checkTextureDimensions(filename)) + { + filename = picker.getNextFile(); + continue; + } + LLLocalBitmap* unit = new LLLocalBitmap(filename); if (unit->getValid()) @@ -874,6 +882,37 @@ bool LLLocalBitmapMgr::addUnit() return add_successful; } +bool LLLocalBitmapMgr::checkTextureDimensions(std::string filename) +{ + std::string exten = gDirUtilp->getExtension(filename); + U32 codec = LLImageBase::getCodecFromExtension(exten); + std::string mImageLoadError; + LLImageDimensionsInfo image_info; + if (!image_info.load(filename,codec)) + { + return false; + } + + S32 max_width = gSavedSettings.getS32("max_texture_dimension_X"); + S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y"); + + if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height)) + { + LLStringUtil::format_map_t args; + args["WIDTH"] = llformat("%d", max_width); + args["HEIGHT"] = llformat("%d", max_height); + mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args); + + LLSD notif_args; + notif_args["REASON"] = mImageLoadError; + LLNotificationsUtil::add("CannotUploadTexture", notif_args); + + return false; + } + + return true; +} + void LLLocalBitmapMgr::delUnit(LLUUID tracking_id) { if (!sBitmapList.empty()) |
