diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-11-05 10:52:23 -0500 |
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2014-11-05 10:52:23 -0500 |
| commit | 13b4909a3ca066105695afc174642409daa46df2 (patch) | |
| tree | f12b1c2d32fda122bcd1f6f79ebfe2226325d9a8 /indra/newview/lllocalbitmaps.cpp | |
| parent | 52ed6ac28697ffcfd7300602aec34db8eafc171a (diff) | |
| parent | 02e2235277a90f2e291557a429ae4e5de3e0d3b6 (diff) | |
merge
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()) |
