summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelprofile.cpp
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-03-25 18:09:23 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-03-25 18:09:23 +0200
commit5143456f51d32b90a94b6c01aebb74c3503a3e27 (patch)
treeaa77941e2bfae98fd9a980c3594dc24ad93da49e /indra/newview/llpanelprofile.cpp
parent458d318aebd7a7da8ea2c594b8df2f285f7efded (diff)
SL-10799 [Legacy Profiles] added 3x4 image dimentions support
Diffstat (limited to 'indra/newview/llpanelprofile.cpp')
-rw-r--r--indra/newview/llpanelprofile.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 4933b0d25e..b03fcabd92 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -257,6 +257,7 @@ BOOL LLPanelProfileSecondLife::postBuild()
mGroupList = getChild<LLGroupList>("group_list");
mShowInSearchCheckbox = getChild<LLCheckBoxCtrl>("show_in_search_checkbox");
mSecondLifePic = getChild<LLTextureCtrl>("2nd_life_pic");
+ mSecondLifePicLayout = getChild<LLPanel>("image_stack");
mDescriptionEdit = getChild<LLTextBase>("sl_description_edit");
mTeleportButton = getChild<LLButton>("teleport");
mShowOnMapButton = getChild<LLButton>("show_on_map_btn");
@@ -397,7 +398,12 @@ void LLPanelProfileSecondLife::resetData()
getChild<LLUICtrl>("register_date")->setValue(LLStringUtil::null);
getChild<LLUICtrl>("acc_status_text")->setValue(LLStringUtil::null);
getChild<LLUICtrl>("partner_text")->setValue(LLStringUtil::null);
+
+ // Set default image and 1:1 dimensions for it
mSecondLifePic->setValue(mSecondLifePic->getDefaultImageAssetID());
+ LLRect imageRect = mSecondLifePicLayout->getRect();
+ mSecondLifePicLayout->reshape(imageRect.getHeight(), imageRect.getHeight());
+
mDescriptionEdit->setValue(LLStringUtil::null);
mStatusText->setVisible(FALSE);
mGroups.clear();
@@ -480,6 +486,23 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
mDescriptionEdit->setValue(avatar_data->about_text);
mSecondLifePic->setValue(avatar_data->image_id);
+ //Don't bother about boost level, picker will set it
+ LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(avatar_data->image_id);
+ if (imagep->getHeight())
+ {
+ onImageLoaded(true, imagep);
+ }
+ else
+ {
+ imagep->setLoadedCallback(onImageLoaded,
+ MAX_DISCARD_LEVEL,
+ FALSE,
+ FALSE,
+ new LLHandle<LLPanel>(getHandle()),
+ NULL,
+ FALSE);
+ }
+
if (getSelfProfile())
{
mShowInSearchCheckbox->setValue((BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH));
@@ -555,6 +578,48 @@ void LLPanelProfileSecondLife::onGroupInvite()
LLAvatarActions::inviteToGroup(getAvatarId());
}
+void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep)
+{
+ LLRect imageRect = mSecondLifePicLayout->getRect();
+ if (!success || imagep->getWidth() == imagep->getHeight())
+ {
+ mSecondLifePicLayout->reshape(imageRect.getHeight(), imageRect.getHeight());
+ }
+ else
+ {
+ // assume 3:4, for sake of firestorm
+ mSecondLifePicLayout->reshape(imageRect.getHeight() * 4 / 3, imageRect.getHeight());
+ }
+}
+
+//static
+void LLPanelProfileSecondLife::onImageLoaded(BOOL success,
+ LLViewerFetchedTexture *src_vi,
+ LLImageRaw* src,
+ LLImageRaw* aux_src,
+ S32 discard_level,
+ BOOL final,
+ void* userdata)
+{
+ if (!userdata) return;
+
+ LLHandle<LLPanel>* handle = (LLHandle<LLPanel>*)userdata;
+
+ if (!handle->isDead())
+ {
+ LLPanelProfileSecondLife* panel = static_cast<LLPanelProfileSecondLife*>(handle->get());
+ if (panel)
+ {
+ panel->onImageLoaded(success, src_vi);
+ }
+ }
+
+ if (final || !success)
+ {
+ delete handle;
+ }
+}
+
// virtual, called by LLAvatarTracker
void LLPanelProfileSecondLife::changed(U32 mask)
{