diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index b1214fd3c4..bd72bbb8d6 100755 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -862,14 +862,13 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL LL_DEBUGS() << "Loading typed res from panel " << spanel->getName() << LL_ENDL; new_width = spanel->getTypedPreviewWidth(); new_height = spanel->getTypedPreviewHeight(); - // FIRE-15794. Back out 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 - // Because having cropped snapshots of UI is worse than having mismatched values. + // 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); - //}*/ + if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) + { + new_width = llmin(new_width, MAX_TEXTURE_SIZE); + new_height = llmin(new_height, MAX_TEXTURE_SIZE); + } } else { @@ -907,13 +906,11 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL { getWidthSpinner(view)->setValue(width); getHeightSpinner(view)->setValue(height); - // FIRE-15794. Back out 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 - // Because having cropped snapshots of UI is worse than having mismatched values. - //if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) - //{ - // getWidthSpinner(view)->setIncrement(width >> 1); - // getHeightSpinner(view)->setIncrement(height >> 1); - //}*/ + if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) + { + getWidthSpinner(view)->setIncrement(width >> 1); + getHeightSpinner(view)->setIncrement(height >> 1); + } } // Store settings at logout; Only update spinners when using custom resolution } @@ -1039,13 +1036,11 @@ void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view { getWidthSpinner(view)->forceSetValue(width); getHeightSpinner(view)->forceSetValue(height); - // FIRE-15794. Back out 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 - // Because having cropped snapshots of UI is worse than having mismatched values. - //if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) - //{ - // getWidthSpinner(view)->setIncrement(width >> 1); - // getHeightSpinner(view)->setIncrement(height >> 1); - //}*/ + if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) + { + getWidthSpinner(view)->setIncrement(width >> 1); + getHeightSpinner(view)->setIncrement(height >> 1); + } } // static diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index 47a50d344a..149faf7b90 100755 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -39,20 +39,18 @@ const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 -// FIRE-15794. Back out 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 - // Because having cropped snapshots of UI is worse than having mismatched values. -//S32 power_of_two(S32 sz, S32 upper) -//{ -// S32 res = upper; -// while( upper >= sz) -// { -// res = upper; -// upper >>= 1; -// } -// return res; -//} +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() { getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1)); @@ -193,30 +191,26 @@ void LLPanelSnapshot::cancel() void LLPanelSnapshot::onCustomResolutionCommit() { LLSD info; - info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger(); - info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger(); - // FIRE-15794. Back out 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 - // Because having cropped snapshots of UI is worse than having mismatched values. - //LLSpinCtrl *widthSpinner = getChild(getWidthSpinnerName()); - //LLSpinCtrl *heightSpinner = getChild(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(); - //} + LLSpinCtrl *widthSpinner = getChild(getWidthSpinnerName()); + LLSpinCtrl *heightSpinner = getChild(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)); }