diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-20 20:53:46 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-20 20:53:46 +0300 |
commit | a2d91f3160ec50a4208214b612d41868b23e3c35 (patch) | |
tree | 2797dac3a4da9156d6d2ecf9dbcbbc12f3b32c2d /indra/newview/lllocalbitmaps.cpp | |
parent | 2672093429ffd38e5f6c659e8e0220fde1501914 (diff) |
DRTVWR-493 LLLocalBitmapMgr to Singleton
Diffstat (limited to 'indra/newview/lllocalbitmaps.cpp')
-rw-r--r-- | indra/newview/lllocalbitmaps.cpp | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 760325b652..5e378f0980 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -69,9 +69,6 @@ /*=======================================*/ /* Formal declarations, constants, etc. */ /*=======================================*/ -std::list<LLLocalBitmap*> LLLocalBitmapMgr::sBitmapList; -LLLocalBitmapTimer LLLocalBitmapMgr::sTimer; -bool LLLocalBitmapMgr::sNeedsRebake; static const F32 LL_LOCAL_TIMER_HEARTBEAT = 3.0; static const BOOL LL_LOCAL_USE_MIPMAPS = true; @@ -131,7 +128,7 @@ LLLocalBitmap::~LLLocalBitmap() if(LL_LOCAL_REPLACE_ON_DEL && mValid && gAgentAvatarp) // fix for STORM-1837 { replaceIDs(mWorldID, IMG_DEFAULT); - LLLocalBitmapMgr::doRebake(); + LLLocalBitmapMgr::getInstance()->doRebake(); } // delete self from gimagelist @@ -570,7 +567,7 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index); gAgentAvatarp->wearableUpdated(type); /* telling the manager to rebake once update cycle is fully done */ - LLLocalBitmapMgr::setNeedsRebake(); + LLLocalBitmapMgr::getInstance()->setNeedsRebake(); } } @@ -835,7 +832,7 @@ bool LLLocalBitmapTimer::isRunning() BOOL LLLocalBitmapTimer::tick() { - LLLocalBitmapMgr::doUpdates(); + LLLocalBitmapMgr::getInstance()->doUpdates(); return FALSE; } @@ -844,17 +841,12 @@ BOOL LLLocalBitmapTimer::tick() /*=======================================*/ LLLocalBitmapMgr::LLLocalBitmapMgr() { - // The class is all made of static members, should i even bother instantiating? } LLLocalBitmapMgr::~LLLocalBitmapMgr() { -} - -void LLLocalBitmapMgr::cleanupClass() -{ - std::for_each(sBitmapList.begin(), sBitmapList.end(), DeletePointer()); - sBitmapList.clear(); + std::for_each(mBitmapList.begin(), mBitmapList.end(), DeletePointer()); + mBitmapList.clear(); } bool LLLocalBitmapMgr::addUnit() @@ -864,7 +856,7 @@ bool LLLocalBitmapMgr::addUnit() LLFilePicker& picker = LLFilePicker::instance(); if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE)) { - sTimer.stopTimer(); + mTimer.stopTimer(); std::string filename = picker.getFirstFile(); while(!filename.empty()) @@ -879,7 +871,7 @@ bool LLLocalBitmapMgr::addUnit() if (unit->getValid()) { - sBitmapList.push_back(unit); + mBitmapList.push_back(unit); add_successful = true; } else @@ -898,7 +890,7 @@ bool LLLocalBitmapMgr::addUnit() filename = picker.getNextFile(); } - sTimer.startTimer(); + mTimer.startTimer(); } return add_successful; @@ -937,10 +929,10 @@ bool LLLocalBitmapMgr::checkTextureDimensions(std::string filename) void LLLocalBitmapMgr::delUnit(LLUUID tracking_id) { - if (!sBitmapList.empty()) + if (!mBitmapList.empty()) { std::vector<LLLocalBitmap*> to_delete; - for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++) + for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++) { /* finding which ones we want deleted and making a separate list */ LLLocalBitmap* unit = *iter; if (unit->getTrackingID() == tracking_id) @@ -953,7 +945,7 @@ void LLLocalBitmapMgr::delUnit(LLUUID tracking_id) del_iter != to_delete.end(); del_iter++) { /* iterating over a temporary list, hence preserving the iterator validity while deleting. */ LLLocalBitmap* unit = *del_iter; - sBitmapList.remove(unit); + mBitmapList.remove(unit); delete unit; unit = NULL; } @@ -964,7 +956,7 @@ LLUUID LLLocalBitmapMgr::getWorldID(LLUUID tracking_id) { LLUUID world_id = LLUUID::null; - for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++) + for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++) { LLLocalBitmap* unit = *iter; if (unit->getTrackingID() == tracking_id) @@ -980,7 +972,7 @@ std::string LLLocalBitmapMgr::getFilename(LLUUID tracking_id) { std::string filename = ""; - for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++) + for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++) { LLLocalBitmap* unit = *iter; if (unit->getTrackingID() == tracking_id) @@ -998,10 +990,10 @@ void LLLocalBitmapMgr::feedScrollList(LLScrollListCtrl* ctrl) { ctrl->clearRows(); - if (!sBitmapList.empty()) + if (!mBitmapList.empty()) { - for (local_list_iter iter = sBitmapList.begin(); - iter != sBitmapList.end(); iter++) + for (local_list_iter iter = mBitmapList.begin(); + iter != mBitmapList.end(); iter++) { LLSD element; element["columns"][0]["column"] = "unit_name"; @@ -1022,29 +1014,29 @@ void LLLocalBitmapMgr::feedScrollList(LLScrollListCtrl* ctrl) void LLLocalBitmapMgr::doUpdates() { // preventing theoretical overlap in cases with huge number of loaded images. - sTimer.stopTimer(); - sNeedsRebake = false; + mTimer.stopTimer(); + mNeedsRebake = false; - for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++) + for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++) { (*iter)->updateSelf(); } doRebake(); - sTimer.startTimer(); + mTimer.startTimer(); } void LLLocalBitmapMgr::setNeedsRebake() { - sNeedsRebake = true; + mNeedsRebake = true; } void LLLocalBitmapMgr::doRebake() { /* separated that from doUpdates to insure a rebake can be called separately during deletion */ - if (sNeedsRebake) + if (mNeedsRebake) { gAgentAvatarp->forceBakeAllTextures(LL_LOCAL_SLAM_FOR_DEBUG); - sNeedsRebake = false; + mNeedsRebake = false; } } |