From 75455d101c9535d0d45aa0f505f888f4ba3de64d Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 6 Aug 2024 09:21:19 -0400 Subject: Convert LLUI and LLRender2D to LLSimpleton to reduce overhead during ui draw (#2202) --- indra/llui/llfocusmgr.cpp | 4 ++-- indra/llui/llui.cpp | 7 ++++++- indra/llui/llui.h | 10 +++++----- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 937dde4def..c635d24f51 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -183,7 +183,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) } } - LLUI::getInstance()->removePopup(view); + if(LLUI::instanceExists()) LLUI::getInstance()->removePopup(view); } void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool keystrokes_only) @@ -481,7 +481,7 @@ void LLFocusMgr::setAppHasFocus(bool focus) // release focus from "top ctrl"s, which generally hides them if (!focus) { - LLUI::getInstance()->clearPopups(); + if(LLUI::instanceExists()) LLUI::getInstance()->clearPopups(); } mAppHasFocus = focus; } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index e3ddd66b58..8d46422c09 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -156,7 +156,7 @@ mWindow(NULL), // set later in startup mRootView(NULL), mHelpImpl(NULL) { - LLRender2D::initParamSingleton(image_provider); + LLRender2D::createInstance(image_provider); if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) || (get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) || @@ -196,6 +196,11 @@ mHelpImpl(NULL) LLCommandManager::load(); } +LLUI::~LLUI() +{ + LLRender2D::deleteSingleton(); +} + void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) { mAddPopupFunc = add_popup; diff --git a/indra/llui/llui.h b/indra/llui/llui.h index f33b43f599..375cd539b7 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -112,18 +112,18 @@ class LLImageProviderInterface; typedef void (*LLUIAudioCallback)(const LLUUID& uuid); -class LLUI : public LLParamSingleton +class LLUI : public LLSimpleton { + LOG_CLASS(LLUI); public: typedef std::map > settings_map_t; -private: - LLSINGLETON(LLUI , const settings_map_t &settings, + LLUI(const settings_map_t &settings, LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback, LLUIAudioCallback deferred_audio_callback); - LOG_CLASS(LLUI); -public: + ~LLUI(); + // // Classes // -- cgit v1.2.3