Skip to content
Snippets Groups Projects
Commit 181e48c4 authored by andreykproductengine's avatar andreykproductengine
Browse files

MAINT-4341 FIXED Pixel width and height of the preview is not matched to value...

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
parent c1fe3a3e
No related branches found
No related tags found
No related merge requests found
...@@ -383,12 +383,20 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) ...@@ -383,12 +383,20 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
S32 w = gViewerWindow->getWindowWidthRaw(); S32 w = gViewerWindow->getWindowWidthRaw();
LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL; LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL;
width_ctrl->setValue(w); width_ctrl->setValue(w);
if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
{
width_ctrl->setIncrement(w >> 1);
}
} }
if (height_ctrl->getValue().asInteger() == 0) if (height_ctrl->getValue().asInteger() == 0)
{ {
S32 h = gViewerWindow->getWindowHeightRaw(); S32 h = gViewerWindow->getWindowHeightRaw();
LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL; LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL;
height_ctrl->setValue(h); height_ctrl->setValue(h);
if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
{
height_ctrl->setIncrement(h >> 1);
}
} }
// Clamp snapshot resolution to window size when showing UI or HUD in snapshot. // Clamp snapshot resolution to window size when showing UI or HUD in snapshot.
...@@ -823,6 +831,11 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL ...@@ -823,6 +831,11 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
{ {
getWidthSpinner(view)->setValue(width); getWidthSpinner(view)->setValue(width);
getHeightSpinner(view)->setValue(height); getHeightSpinner(view)->setValue(height);
if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
{
getWidthSpinner(view)->setIncrement(width >> 1);
getHeightSpinner(view)->setIncrement(height >> 1);
}
} }
if(original_width != width || original_height != height) if(original_width != width || original_height != height)
...@@ -942,6 +955,11 @@ void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view ...@@ -942,6 +955,11 @@ void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view
{ {
getWidthSpinner(view)->forceSetValue(width); getWidthSpinner(view)->forceSetValue(width);
getHeightSpinner(view)->forceSetValue(height); getHeightSpinner(view)->forceSetValue(height);
if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
{
getWidthSpinner(view)->setIncrement(width >> 1);
getHeightSpinner(view)->setIncrement(height >> 1);
}
} }
// static // static
......
...@@ -37,6 +37,19 @@ ...@@ -37,6 +37,19 @@
#include "llsidetraypanelcontainer.h" #include "llsidetraypanelcontainer.h"
#include "llviewercontrol.h" // gSavedSettings #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 // virtual
BOOL LLPanelSnapshot::postBuild() BOOL LLPanelSnapshot::postBuild()
{ {
...@@ -164,8 +177,26 @@ void LLPanelSnapshot::cancel() ...@@ -164,8 +177,26 @@ void LLPanelSnapshot::cancel()
void LLPanelSnapshot::onCustomResolutionCommit() void LLPanelSnapshot::onCustomResolutionCommit()
{ {
LLSD info; LLSD info;
info["w"] = getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger(); LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(getWidthSpinnerName());
info["h"] = getChild<LLUICtrl>(getHeightSpinnerName())->getValue().asInteger(); 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)); LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment