diff options
author | andreykproductengine <akleshchev@productengine.com> | 2014-09-17 21:13:18 +0300 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2014-09-17 21:13:18 +0300 |
commit | 181e48c4422a69c94956977d1f8da05ce6384f7a (patch) | |
tree | 88a5155e16d82416f23557dd04a4ed85c4be31ef /indra/newview/llpanelsnapshot.cpp | |
parent | c1fe3a3ed6aca0e0439a4f0d1116a31e9999a495 (diff) |
MAINT-4341 FIXED Pixel width and height of the preview is not matched to value of Width or Height text-box in the “Snapshot to inventory” window
Diffstat (limited to 'indra/newview/llpanelsnapshot.cpp')
-rwxr-xr-x | indra/newview/llpanelsnapshot.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index 56569e3207..106fb4997e 100755 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -37,6 +37,19 @@ #include "llsidetraypanelcontainer.h" #include "llviewercontrol.h" // gSavedSettings +const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 + +S32 power_of_two(S32 sz, S32 upper) +{ + S32 res = upper; + while( upper >= sz) + { + res = upper; + upper >>= 1; + } + return res; +} + // virtual BOOL LLPanelSnapshot::postBuild() { @@ -164,8 +177,26 @@ void LLPanelSnapshot::cancel() void LLPanelSnapshot::onCustomResolutionCommit() { LLSD info; - info["w"] = getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger(); - info["h"] = getChild<LLUICtrl>(getHeightSpinnerName())->getValue().asInteger(); + LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(getWidthSpinnerName()); + LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(getHeightSpinnerName()); + if (getName() == "panel_snapshot_inventory") + { + S32 width = widthSpinner->getValue().asInteger(); + width = power_of_two(width, MAX_TEXTURE_SIZE); + info["w"] = width; + widthSpinner->setIncrement(width >> 1); + widthSpinner->forceSetValue(width); + S32 height = heightSpinner->getValue().asInteger(); + height = power_of_two(height, MAX_TEXTURE_SIZE); + heightSpinner->setIncrement(height >> 1); + heightSpinner->forceSetValue(height); + info["h"] = height; + } + else + { + info["w"] = widthSpinner->getValue().asInteger(); + info["h"] = heightSpinner->getValue().asInteger(); + } LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); } |