Convert LLUI and LLRender2D to LLSimpleton to reduce overhead during ui draw (#2202)
parent
db376f2ace
commit
75455d101c
|
|
@ -726,7 +726,7 @@ void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& c
|
|||
}
|
||||
gGL.end();
|
||||
|
||||
LLRender2D::getInstance()->setLineWidth(1.f);
|
||||
LLRender2D::setLineWidth(1.f);
|
||||
}
|
||||
|
||||
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, bool filled, F32 start_angle, F32 end_angle)
|
||||
|
|
|
|||
|
|
@ -122,12 +122,13 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, bool
|
|||
|
||||
class LLImageProviderInterface;
|
||||
|
||||
class LLRender2D : public LLParamSingleton<LLRender2D>
|
||||
class LLRender2D : public LLSimpleton<LLRender2D>
|
||||
{
|
||||
LLSINGLETON(LLRender2D, LLImageProviderInterface* image_provider);
|
||||
LOG_CLASS(LLRender2D);
|
||||
~LLRender2D();
|
||||
public:
|
||||
LLRender2D(LLImageProviderInterface* image_provider);
|
||||
~LLRender2D();
|
||||
|
||||
static void pushMatrix();
|
||||
static void popMatrix();
|
||||
static void loadIdentity();
|
||||
|
|
|
|||
|
|
@ -81,10 +81,10 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
|
|||
}
|
||||
}
|
||||
|
||||
LLRender2D::getInstance()->pushMatrix();
|
||||
LLRender2D::pushMatrix();
|
||||
{
|
||||
LLVector3 rect_origin = origin_agent + ((F32)rect.mLeft * x_axis) + ((F32)rect.mBottom * y_axis);
|
||||
LLRender2D::getInstance()->translate(rect_origin.mV[VX],
|
||||
LLRender2D::translate(rect_origin.mV[VX],
|
||||
rect_origin.mV[VY],
|
||||
rect_origin.mV[VZ]);
|
||||
gGL.getTexUnit(0)->bind(getImage());
|
||||
|
|
@ -103,7 +103,7 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
|
|||
(F32)rect.getWidth() * x_axis,
|
||||
(F32)rect.getHeight() * y_axis);
|
||||
|
||||
} LLRender2D::getInstance()->popMatrix();
|
||||
} LLRender2D::popMatrix();
|
||||
}
|
||||
|
||||
//#include "lluiimage.inl"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -112,18 +112,18 @@ class LLImageProviderInterface;
|
|||
|
||||
typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
|
||||
|
||||
class LLUI : public LLParamSingleton<LLUI>
|
||||
class LLUI : public LLSimpleton<LLUI>
|
||||
{
|
||||
LOG_CLASS(LLUI);
|
||||
public:
|
||||
typedef std::map<std::string, LLControlGroup*, std::less<> > 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
|
||||
//
|
||||
|
|
|
|||
|
|
@ -802,7 +802,7 @@ bool LLAppViewer::init()
|
|||
settings_map["floater"] = &gSavedSettings; // *TODO: New settings file
|
||||
settings_map["account"] = &gSavedPerAccountSettings;
|
||||
|
||||
LLUI::initParamSingleton(settings_map,
|
||||
LLUI::createInstance(settings_map,
|
||||
LLUIImageList::getInstance(),
|
||||
ui_audio_callback,
|
||||
deferred_ui_audio_callback);
|
||||
|
|
@ -2155,6 +2155,7 @@ bool LLAppViewer::cleanup()
|
|||
LLViewerEventRecorder::deleteSingleton();
|
||||
LLWorld::deleteSingleton();
|
||||
LLVoiceClient::deleteSingleton();
|
||||
LLUI::deleteSingleton();
|
||||
|
||||
// It's not at first obvious where, in this long sequence, a generic cleanup
|
||||
// call OUGHT to go. So let's say this: as we migrate cleanup from
|
||||
|
|
|
|||
Loading…
Reference in New Issue