summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmarketplaceinbox.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-09-02 13:46:13 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-09-04 10:16:46 +0300
commit57ab1a410f9cb3534bb403e034743505758579d8 (patch)
treeaa7077841e6027d1efaf2c358c635e9cea83e8f2 /indra/newview/llpanelmarketplaceinbox.cpp
parent5c64e5e13d9a75cac510aac3128fc6ee780ab243 (diff)
viewer#2411 A bit more coverage for font buffer
Diffstat (limited to 'indra/newview/llpanelmarketplaceinbox.cpp')
-rw-r--r--indra/newview/llpanelmarketplaceinbox.cpp44
1 files changed, 29 insertions, 15 deletions
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index 35961da579..d10e12d3a8 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -52,6 +52,8 @@ LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
, mInboxButton(NULL)
, mInventoryPanel(NULL)
, mSavedFolderState(NULL)
+ , mLastItemCount(-1)
+ , mLastFreshItemCount(-1)
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(false);
@@ -253,28 +255,40 @@ void LLPanelMarketplaceInbox::draw()
llassert(mFreshCountCtrl != NULL);
- if (item_count > 0)
+ if (mLastItemCount != item_count)
{
- std::string item_count_str = llformat("%d", item_count);
-
- LLStringUtil::format_map_t args;
- args["[NUM]"] = item_count_str;
- mInboxButton->setLabel(getString("InboxLabelWithArg", args));
-
- // set green text to fresh item count
- U32 fresh_item_count = getFreshItemCount();
- mFreshCountCtrl->setVisible((fresh_item_count > 0));
+ mLastItemCount = item_count;
+ if (item_count > 0)
+ {
+ std::string item_count_str = llformat("%d", item_count);
- if (fresh_item_count > 0)
+ LLStringUtil::format_map_t args;
+ args["[NUM]"] = item_count_str;
+ // setLabel is expensive, causes buffer regeneration
+ mInboxButton->setLabel(getString("InboxLabelWithArg", args));
+ }
+ else
{
- mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
+ mInboxButton->setLabel(getString("InboxLabelNoArg"));
+
+ mFreshCountCtrl->setVisible(false);
}
}
- else
+
+ if (item_count > 0)
{
- mInboxButton->setLabel(getString("InboxLabelNoArg"));
+ // set green text to fresh item count
+ U32 fresh_item_count = getFreshItemCount();
+ if (mLastFreshItemCount != fresh_item_count)
+ {
+ mLastFreshItemCount = fresh_item_count;
+ mFreshCountCtrl->setVisible((fresh_item_count > 0));
- mFreshCountCtrl->setVisible(false);
+ if (fresh_item_count > 0)
+ {
+ mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
+ }
+ }
}
LLPanel::draw();