diff options
| author | callum_linden <none@none> | 2017-08-22 14:32:04 -0700 |
|---|---|---|
| committer | callum_linden <none@none> | 2017-08-22 14:32:04 -0700 |
| commit | b5dbb9c52aa8f9379662f1ff1169adadcf8ac5f8 (patch) | |
| tree | 438d099240df63608825568d162874e186835994 /indra/newview/llsnapshotlivepreview.cpp | |
| parent | 8e6751efced8d9f5ede5ec5d954ff809d56d1162 (diff) | |
| parent | 58176de9574164e31790a148d9b5489a129fc961 (diff) | |
Automated merge with head of ll/viewer64 after DRTVWR-439 merge
Diffstat (limited to 'indra/newview/llsnapshotlivepreview.cpp')
| -rw-r--r-- | indra/newview/llsnapshotlivepreview.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 58e48480c1..ee8b2d79c0 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -45,6 +45,7 @@ #include "llimagepng.h" #include "lllandmarkactions.h" #include "lllocalcliprect.h" +#include "llresmgr.h" #include "llnotificationsutil.h" #include "llslurl.h" #include "llsnapshotlivepreview.h" @@ -56,6 +57,7 @@ #include "llvfs.h" #include "llwindow.h" #include "llworld.h" +#include <boost/filesystem.hpp> const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; @@ -1069,7 +1071,7 @@ BOOL LLSnapshotLivePreview::saveLocal() getFormattedImage(); // Save the formatted image - BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage); + BOOL success = saveLocal(mFormattedImage); if(success) { @@ -1078,3 +1080,38 @@ BOOL LLSnapshotLivePreview::saveLocal() return success; } +//Check if failed due to insufficient memory +BOOL LLSnapshotLivePreview::saveLocal(LLPointer<LLImageFormatted> mFormattedImage) +{ + BOOL insufficient_memory; + BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage, FALSE, insufficient_memory); + + if (insufficient_memory) + { + std::string lastSnapshotDir = LLViewerWindow::getLastSnapshotDir(); + +#ifdef LL_WINDOWS + boost::filesystem::path b_path(utf8str_to_utf16str(lastSnapshotDir)); +#else + boost::filesystem::path b_path(lastSnapshotDir); +#endif + boost::filesystem::space_info b_space = boost::filesystem::space(b_path); + if (b_space.free < mFormattedImage->getDataSize()) + { + LLSD args; + args["PATH"] = lastSnapshotDir; + + std::string needM_bytes_string; + LLResMgr::getInstance()->getIntegerString(needM_bytes_string, (mFormattedImage->getDataSize()) >> 10); + args["NEED_MEMORY"] = needM_bytes_string; + + std::string freeM_bytes_string; + LLResMgr::getInstance()->getIntegerString(freeM_bytes_string, (b_space.free) >> 10); + args["FREE_MEMORY"] = freeM_bytes_string; + + LLNotificationsUtil::add("SnapshotToComputerFailed", args); + return false; + } + } + return success; +} |
