summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersnapshot.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2011-12-16 09:39:55 -0500
committerOz Linden <oz@lindenlab.com>2011-12-16 09:39:55 -0500
commitb015ab4bd2296f86145e9567867227446cd1e10e (patch)
tree55ad92fa52cae5186126546dacd03846ae95380d /indra/newview/llfloatersnapshot.cpp
parent6b11c292c042059eb52784247c25d1c725ac11c1 (diff)
parent6cefa466361e37df8082f86a21a954199fbf14a4 (diff)
merge changes for vmrg-206
Diffstat (limited to 'indra/newview/llfloatersnapshot.cpp')
-rw-r--r--indra/newview/llfloatersnapshot.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 1b3290d5a8..cc7a1b2368 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -333,8 +333,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail
{
S32 old_image_index = mCurImageIndex;
mCurImageIndex = (mCurImageIndex + 1) % 2;
- setWidth(mWidth[old_image_index]);
- setHeight(mHeight[old_image_index]);
+ setSize(mWidth[old_image_index], mHeight[old_image_index]);
mFallAnimTimer.start();
}
mSnapshotUpToDate = FALSE;
@@ -833,7 +832,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->mPreviewImage->getHeight(),
previewp->mPreviewImage->getComponents());
- scaled->biasedScaleToPowerOfTwo(512);
+ scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
previewp->setImageScaled(TRUE);
if (formatted->encode(scaled, 0.f))
{
@@ -960,7 +959,7 @@ void LLSnapshotLivePreview::saveTexture()
mPreviewImage->getHeight(),
mPreviewImage->getComponents());
- scaled->biasedScaleToPowerOfTwo(512);
+ scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE);
lldebugs << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << llendl;
if (formatted->encode(scaled, 0.0f))
@@ -1447,7 +1446,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
if (previewp)
{
- lldebugs << "Setting snapshot type (" << shot_type << "), format (" << shot_format << ")" << llendl;
previewp->setSnapshotType(shot_type);
previewp->setSnapshotFormat(shot_format);
previewp->setSnapshotBufferType(layer_type);
@@ -1460,6 +1458,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
info["have-snapshot"] = got_snap;
current_panel->updateControls(info);
}
+ lldebugs << "finished updating controls" << llendl;
}
// static
@@ -1696,6 +1695,7 @@ void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finis
}
}
+// Apply a new resolution selected from the given combobox.
// static
void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update)
{
@@ -1738,6 +1738,13 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
lldebugs << "Loading typed res from panel " << spanel->getName() << llendl;
new_width = spanel->getTypedPreviewWidth();
new_height = spanel->getTypedPreviewHeight();
+
+ // Limit custom size for inventory snapshots to 512x512 px.
+ if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+ {
+ new_width = llmin(new_width, MAX_TEXTURE_SIZE);
+ new_height = llmin(new_height, MAX_TEXTURE_SIZE);
+ }
}
else
{
@@ -1864,11 +1871,11 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3
//change another value proportionally
if(isWidthChanged)
{
- height = (S32)(width / aspect_ratio) ;
+ height = llround(width / aspect_ratio) ;
}
else
{
- width = (S32)(height * aspect_ratio) ;
+ width = llround(height * aspect_ratio) ;
}
//bound w/h by the max_value