summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersnapshot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersnapshot.cpp')
-rw-r--r--indra/newview/llfloatersnapshot.cpp68
1 files changed, 39 insertions, 29 deletions
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 2bac7d6360..f7c82621fb 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -46,12 +46,12 @@
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
-LLSnapshotFloaterView* gSnapshotFloaterView = NULL;
+LLSnapshotFloaterView* gSnapshotFloaterView = nullptr;
-const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f;
+constexpr F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f;
-const S32 MAX_POSTCARD_DATASIZE = 1572864; // 1.5 megabyte, similar to simulator limit
-const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
+constexpr S32 MAX_POSTCARD_DATASIZE = 1572864; // 1.5 megabyte, similar to simulator limit
+constexpr S32 MAX_TEXTURE_SIZE = 2048 ; //max upload texture size 2048 * 2048
static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view");
@@ -168,10 +168,10 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
panel_width = 700.f;
}
- S32 floater_width = 224.f;
+ S32 floater_width{ 224 };
if(mAdvanced)
{
- floater_width = floater_width + panel_width;
+ floater_width = floater_width + (S32)panel_width;
}
LLUICtrl* thumbnail_placeholder = floaterp->getChild<LLUICtrl>("thumbnail_placeholder");
@@ -185,14 +185,14 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
}
if (!mSkipReshaping)
{
- thumbnail_placeholder->reshape(panel_width, thumbnail_placeholder->getRect().getHeight());
+ thumbnail_placeholder->reshape((S32)panel_width, thumbnail_placeholder->getRect().getHeight());
if (!floaterp->isMinimized())
{
floaterp->reshape(floater_width, floaterp->getRect().getHeight());
}
}
- bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean();
+ bool use_freeze_frame = floaterp->mFreezeFrameCheck && floaterp->mFreezeFrameCheck->getValue().asBoolean();
if (use_freeze_frame)
{
@@ -210,13 +210,10 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
previewp->setEnabled(true);
}
- //RN: freeze all avatars
- LLCharacter* avatarp;
- for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
- iter != LLCharacter::sInstances.end(); ++iter)
+ // RN: freeze all avatars
+ for (LLCharacter* character : LLCharacter::sInstances)
{
- avatarp = *iter;
- floaterp->impl->mAvatarPauseHandles.push_back(avatarp->requestPause());
+ floaterp->impl->mAvatarPauseHandles.push_back(character->requestPause());
}
// freeze everything else
@@ -283,7 +280,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
width_ctrl->setValue(w);
if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)
{
- width_ctrl->setIncrement(w >> 1);
+ width_ctrl->setIncrement((F32)(w >> 1));
}
}
if (height_ctrl->getValue().asInteger() == 0)
@@ -293,7 +290,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
height_ctrl->setValue(h);
if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)
{
- height_ctrl->setIncrement(h >> 1);
+ height_ctrl->setIncrement((F32)(h >> 1));
}
}
@@ -303,9 +300,9 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
S32 width = gViewerWindow->getWindowWidthRaw();
S32 height = gViewerWindow->getWindowHeightRaw();
- width_ctrl->setMaxValue(width);
+ width_ctrl->setMaxValue((F32)width);
- height_ctrl->setMaxValue(height);
+ height_ctrl->setMaxValue((F32)height);
if (width_ctrl->getValue().asInteger() > width)
{
@@ -347,10 +344,22 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
}
floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
- floater->getChild<LLUICtrl>("file_size_label")->setColor(
- shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD
- && got_bytes
- && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
+
+ LLUIColor color = LLUIColorTable::instance().getColor( "LabelTextColor" );
+ if (shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD
+ && got_bytes
+ && previewp->getDataSize() > MAX_POSTCARD_DATASIZE)
+ {
+ color = LLUIColor(LLColor4::red);
+ }
+ if (shot_type == LLSnapshotModel::SNAPSHOT_WEB
+ && got_bytes
+ && previewp->getDataSize() > LLWebProfile::MAX_WEB_DATASIZE)
+ {
+ color = LLUIColor(LLColor4::red);
+ }
+
+ floater->getChild<LLUICtrl>("file_size_label")->setColor(color);
// Update the width and height spinners based on the corresponding resolution combos. (?)
switch(shot_type)
@@ -720,7 +729,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool
new_width = spanel->getTypedPreviewWidth();
new_height = spanel->getTypedPreviewHeight();
- // Limit custom size for inventory snapshots to 512x512 px.
+ // Limit custom size for inventory snapshots to 2048x2048 px.
if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
{
new_width = llmin(new_width, MAX_TEXTURE_SIZE);
@@ -761,8 +770,8 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool
getHeightSpinner(view)->setValue(height);
if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
{
- getWidthSpinner(view)->setIncrement(width >> 1);
- getHeightSpinner(view)->setIncrement(height >> 1);
+ getWidthSpinner(view)->setIncrement((F32)(width >> 1));
+ getHeightSpinner(view)->setIncrement((F32)(height >> 1));
}
}
@@ -882,8 +891,8 @@ void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshotBase*
getHeightSpinner(view)->forceSetValue(height);
if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)
{
- getWidthSpinner(view)->setIncrement(width >> 1);
- getHeightSpinner(view)->setIncrement(height >> 1);
+ getWidthSpinner(view)->setIncrement((F32)(width >> 1));
+ getHeightSpinner(view)->setIncrement((F32)(height >> 1));
}
}
@@ -1002,8 +1011,9 @@ bool LLFloaterSnapshot::postBuild()
getChild<LLUICtrl>("layer_types")->setValue("colors");
getChildView("layer_types")->setEnabled(false);
- getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
- childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this);
+ mFreezeFrameCheck = getChild<LLUICtrl>("freeze_frame_check");
+ mFreezeFrameCheck->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
+ mFreezeFrameCheck->setCommitCallback(&ImplBase::onCommitFreezeFrame, this);
getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this);