diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-04-30 16:28:40 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-04-30 16:32:16 +0300 |
commit | 59433e3132b057003afcc1ba230ff16ffe62f92c (patch) | |
tree | 16f94bc4265881544a34388875ff7631004e1e53 /indra/llui | |
parent | d70b749101f5a954fc824e73519102a0d88f24ae (diff) |
SL-13119 Made control settings cached and fixed potential filtering issue
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfolderview.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 13 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.h | 2 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.cpp | 3 |
4 files changed, 12 insertions, 10 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index e718fcec46..0c1dcc301b 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -342,7 +342,9 @@ static LLTrace::BlockTimerStatHandle FTM_FILTER("Filter Folder View"); void LLFolderView::filter( LLFolderViewFilter& filter ) { LL_RECORD_BLOCK_TIME(FTM_FILTER); - filter.resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); + static LLCachedControl<S32> filter_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10); + static LLCachedControl<S32> filter_hidden(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameUnvisible", 1); + filter.resetTime(llclamp(mParentPanel.get()->getVisible() ? filter_visible() : filter_hidden(), 1, 100)); // Note: we filter the model, not the view getViewModelItem()->filter(filter); diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 9754192b06..863a72b6c0 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -183,10 +183,13 @@ LLFolderViewItem::~LLFolderViewItem() BOOL LLFolderViewItem::postBuild() { LLFolderViewModelItem& vmi = *getViewModelItem(); - mLabel = vmi.getDisplayName(); // slightly expensive, but only first time + // getDisplayName() is slightly expensive and requires a filter reset + mLabel = vmi.getDisplayName(); setToolTip(vmi.getName()); // Dirty the filter flag of the model from the view (CHUI-849) + vmi.dirtyFilter(); + mLabelNeedsRefresh = true; mLabelWidthDirty = true; return TRUE; @@ -288,10 +291,6 @@ void LLFolderViewItem::refresh() { LLFolderViewModelItem& vmi = *getViewModelItem(); - // getDisplayName() is slightly expensive on first run - mLabel = vmi.getDisplayName(); - setToolTip(vmi.getName()); - // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() mIcon = vmi.getIcon(); @@ -306,8 +305,6 @@ void LLFolderViewItem::refresh() mLabelSuffix = vmi.getLabelSuffix(); } - // Dirty the filter flag of the model from the view (CHUI-849) - vmi.dirtyFilter(); mLabelWidthDirty = true; mLabelNeedsRefresh = false; } @@ -362,6 +359,8 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height ) { if (mLabelNeedsRefresh) { + // Expensive. But despite refreshing label, + // it is purely visual, so it is fine to do at our laisure refresh(); } mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight; diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index f37125adb3..8693e1e0f9 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -268,7 +268,7 @@ public: virtual BOOL isPotentiallyVisible(S32 filter_generation = -1); // refresh information from the object being viewed. - // refreshes, label, sufixes and sets icons. Expensive! + // refreshes sufixes and sets icons. Expensive! virtual void refresh(); // LLView functionality diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3b45fb53a2..ea106b5fae 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -48,7 +48,8 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - getFilter().resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100)); + static LLCachedControl<S32> filter_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10); + getFilter().resetTime(llclamp(filter_visible(), 1, 100)); mFolderView->getViewModelItem()->filter(getFilter()); } |