summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-06-12 19:12:09 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-06-12 19:12:09 +0300
commit04e67fa12d1dac368e2f88a04af4cd266b8b2063 (patch)
tree138e49a72de3ee4810f5f4676fc0dc3ccffe095b /indra/newview
parent19221d9ccf38a5b10e7e2ecefb1ad121f1fb51d7 (diff)
SL-11402 Last session image should be saved as png
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llstartup.cpp16
-rw-r--r--indra/newview/llviewerdisplay.cpp10
-rw-r--r--indra/newview/llviewermessage.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp60
-rw-r--r--indra/newview/llviewerwindow.h2
6 files changed, 54 insertions, 40 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 24886b01fb..f3915b9210 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4507,7 +4507,7 @@ void LLAppViewer::saveFinalSnapshot()
snap_filename += gDirUtilp->getDirDelimiter();
snap_filename += LLStartUp::getScreenLastFilename();
// use full pixel dimensions of viewer window (not post-scale dimensions)
- gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, TRUE);
+ gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, TRUE, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
mSavedFinalSnapshot = TRUE;
}
}
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index e34a9beb49..256ece594c 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -113,7 +113,7 @@
#include "llgroupmgr.h"
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
-#include "llimagebmp.h"
+#include "llimagepng.h"
#include "llinventorybridge.h"
#include "llinventorymodel.h"
#include "llinventorymodelbackgroundfetch.h"
@@ -210,8 +210,8 @@
bool gAgentMovementCompleted = false;
S32 gMaxAgentGroups;
-const std::string SCREEN_HOME_FILENAME = "screen_home%s.bmp";
-const std::string SCREEN_LAST_FILENAME = "screen_last%s.bmp";
+const std::string SCREEN_HOME_FILENAME = "screen_home%s.png";
+const std::string SCREEN_LAST_FILENAME = "screen_last%s.png";
LLPointer<LLViewerTexture> gStartTexture;
@@ -2709,7 +2709,7 @@ void init_start_screen(S32 location_id)
temp_str += LLStartUp::getScreenHomeFilename();
}
- LLPointer<LLImageBMP> start_image_bmp = new LLImageBMP;
+ LLPointer<LLImagePNG> start_image_png = new LLImagePNG;
// Turn off start screen to get around the occasional readback
// driver bug
@@ -2718,18 +2718,18 @@ void init_start_screen(S32 location_id)
LL_INFOS("AppInit") << "Bitmap load disabled" << LL_ENDL;
return;
}
- else if(!start_image_bmp->load(temp_str) )
+ else if(!start_image_png->load(temp_str) )
{
LL_WARNS("AppInit") << "Bitmap load failed" << LL_ENDL;
gStartTexture = NULL;
}
else
{
- gStartImageWidth = start_image_bmp->getWidth();
- gStartImageHeight = start_image_bmp->getHeight();
+ gStartImageWidth = start_image_png->getWidth();
+ gStartImageHeight = start_image_png->getHeight();
LLPointer<LLImageRaw> raw = new LLImageRaw;
- if (!start_image_bmp->decode(raw, 0.0f))
+ if (!start_image_png->decode(raw, 0.0f))
{
LL_WARNS("AppInit") << "Bitmap decode failed" << LL_ENDL;
gStartTexture = NULL;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index fd49d3b3d3..5924dbc260 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -42,7 +42,7 @@
#include "llfeaturemanager.h"
//#include "llfirstuse.h"
#include "llhudmanager.h"
-#include "llimagebmp.h"
+#include "llimagepng.h"
#include "llmemory.h"
#include "llselectmgr.h"
#include "llsky.h"
@@ -1590,15 +1590,15 @@ void render_disconnected_background()
std::string temp_str;
temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + LLStartUp::getScreenLastFilename();
- LLPointer<LLImageBMP> image_bmp = new LLImageBMP;
- if( !image_bmp->load(temp_str) )
+ LLPointer<LLImagePNG> image_png = new LLImagePNG;
+ if( !image_png->load(temp_str) )
{
//LL_INFOS() << "Bitmap load failed" << LL_ENDL;
return;
}
LLPointer<LLImageRaw> raw = new LLImageRaw;
- if (!image_bmp->decode(raw, 0.0f))
+ if (!image_png->decode(raw, 0.0f))
{
LL_INFOS() << "Bitmap decode failed" << LL_ENDL;
gDisconnectedImagep = NULL;
@@ -1606,7 +1606,7 @@ void render_disconnected_background()
}
U8 *rawp = raw->getData();
- S32 npixels = (S32)image_bmp->getWidth()*(S32)image_bmp->getHeight();
+ S32 npixels = (S32)image_png->getWidth()*(S32)image_png->getHeight();
for (S32 i = 0; i < npixels; i++)
{
S32 sum = 0;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index b70b077618..6e5c77e4a9 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5108,7 +5108,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
std::string snap_filename = gDirUtilp->getLindenUserDir();
snap_filename += gDirUtilp->getDirDelimiter();
snap_filename += LLStartUp::getScreenHomeFilename();
- gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
+ gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
}
if (notificationID == "RegionRestartMinutes" ||
@@ -5191,7 +5191,7 @@ static void process_special_alert_messages(const std::string & message)
std::string snap_filename = gDirUtilp->getLindenUserDir();
snap_filename += gDirUtilp->getDirDelimiter();
snap_filename += LLStartUp::getScreenHomeFilename();
- gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
+ gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
}
}
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 8e6df22171..74770dc483 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -122,7 +122,7 @@
#include "llhudmanager.h"
#include "llhudobject.h"
#include "llhudview.h"
-#include "llimagebmp.h"
+#include "llimage.h"
#include "llimagej2c.h"
#include "llimageworker.h"
#include "llkeyboard.h"
@@ -4487,32 +4487,46 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
}
}
-BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type)
+BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type, LLSnapshotModel::ESnapshotFormat format)
{
- LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL;
+ LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL;
- LLPointer<LLImageRaw> raw = new LLImageRaw;
- BOOL success = rawSnapshot(raw, image_width, image_height, TRUE, FALSE, show_ui, do_rebuild);
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
+ BOOL success = rawSnapshot(raw, image_width, image_height, TRUE, FALSE, show_ui, do_rebuild);
- if (success)
- {
- LLPointer<LLImageBMP> bmp_image = new LLImageBMP;
- success = bmp_image->encode(raw, 0.0f);
- if( success )
- {
- success = bmp_image->save(filepath);
- }
- else
- {
- LL_WARNS() << "Unable to encode bmp snapshot" << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS() << "Unable to capture raw snapshot" << LL_ENDL;
- }
+ if (success)
+ {
+ U8 image_codec = IMG_CODEC_BMP;
+ switch (format)
+ {
+ case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:
+ image_codec = IMG_CODEC_PNG;
+ break;
+ case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:
+ image_codec = IMG_CODEC_JPEG;
+ break;
+ default:
+ image_codec = IMG_CODEC_BMP;
+ break;
+ }
- return success;
+ LLPointer<LLImageFormatted> formated_image = LLImageFormatted::createFromType(image_codec);
+ success = formated_image->encode(raw, 0.0f);
+ if (success)
+ {
+ success = formated_image->save(filepath);
+ }
+ else
+ {
+ LL_WARNS() << "Unable to encode snapshot of format " << format << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Unable to capture raw snapshot" << LL_ENDL;
+ }
+
+ return success;
}
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index d41a606f11..071a3632dd 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -347,7 +347,7 @@ public:
// snapshot functionality.
// perhaps some of this should move to llfloatershapshot? -MG
- BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR);
+ BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::ESnapshotFormat format = LLSnapshotModel::SNAPSHOT_FORMAT_BMP);
BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,
BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE);
BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type);