Hotspot elimination.
This commit is contained in:
@@ -1056,15 +1056,15 @@ void LLHUDNameTag::reshape()
|
||||
|
||||
F32 LLHUDNameTag::LLHUDTextSegment::getWidth(const LLFontGL* font)
|
||||
{
|
||||
std::map<const LLFontGL*, F32>::iterator iter = mFontWidthMap.find(font);
|
||||
if (iter != mFontWidthMap.end())
|
||||
if (mFontWidthMap[0].first == font)
|
||||
{
|
||||
return iter->second;
|
||||
return mFontWidthMap[0].second;
|
||||
}
|
||||
else
|
||||
else if (mFontWidthMap[1].first == font)
|
||||
{
|
||||
F32 width = font->getWidthF32(mText.c_str());
|
||||
mFontWidthMap[font] = width;
|
||||
return width;
|
||||
return mFontWidthMap[1].second;
|
||||
}
|
||||
F32 width = font->getWidthF32(mText.c_str());
|
||||
mFontWidthMap[mFontWidthMap[0].first != nullptr] = std::make_pair(font, width);
|
||||
return width;
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ protected:
|
||||
{}
|
||||
F32 getWidth(const LLFontGL* font);
|
||||
const LLWString& getText() const { return mText; }
|
||||
void clearFontWidthMap() { mFontWidthMap.clear(); }
|
||||
void clearFontWidthMap() { mFontWidthMap[0].first = nullptr; mFontWidthMap[1].first = nullptr; }
|
||||
|
||||
LLColor4 mColor;
|
||||
LLFontGL::StyleFlags mStyle;
|
||||
const LLFontGL* mFont;
|
||||
private:
|
||||
LLWString mText;
|
||||
std::map<const LLFontGL*, F32> mFontWidthMap;
|
||||
std::pair<const LLFontGL*, F32> mFontWidthMap[2];
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
@@ -674,17 +674,17 @@ void LLHUDText::reshape()
|
||||
|
||||
F32 LLHUDText::LLHUDTextSegment::getWidth(const LLFontGL* font)
|
||||
{
|
||||
std::map<const LLFontGL*, F32>::iterator iter = mFontWidthMap.find(font);
|
||||
if (iter != mFontWidthMap.end())
|
||||
if (mFontWidthMap[0].first == font)
|
||||
{
|
||||
return iter->second;
|
||||
return mFontWidthMap[0].second;
|
||||
}
|
||||
else
|
||||
else if (mFontWidthMap[1].first == font)
|
||||
{
|
||||
F32 width = font->getWidthF32(mText.c_str());
|
||||
mFontWidthMap[font] = width;
|
||||
return width;
|
||||
return mFontWidthMap[1].second;
|
||||
}
|
||||
F32 width = font->getWidthF32(mText.c_str());
|
||||
mFontWidthMap[mFontWidthMap[0].first != nullptr] = std::make_pair(font, width);
|
||||
return width;
|
||||
}
|
||||
|
||||
// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.0f
|
||||
|
||||
@@ -61,14 +61,14 @@ protected:
|
||||
{}
|
||||
F32 getWidth(const LLFontGL* font);
|
||||
const LLWString& getText() const { return mText; }
|
||||
void clearFontWidthMap() { mFontWidthMap.clear(); }
|
||||
void clearFontWidthMap() { mFontWidthMap[0].first = nullptr; mFontWidthMap[1].first = nullptr; }
|
||||
|
||||
LLColor4 mColor;
|
||||
LLFontGL::StyleFlags mStyle;
|
||||
const LLFontGL* mFont;
|
||||
private:
|
||||
LLWString mText;
|
||||
std::map<const LLFontGL*, F32> mFontWidthMap;
|
||||
std::pair<const LLFontGL*, F32> mFontWidthMap[2];
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
@@ -1269,6 +1269,7 @@ public:
|
||||
group->destroyGL();
|
||||
|
||||
{OctreeGuard guard(group->getOctreeNode());
|
||||
if (!mNoRebuild) // Singu note: No need to iterate if not rebuilding...
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
|
||||
|
||||
@@ -326,6 +326,7 @@ void LLViewerTextureList::shutdown()
|
||||
mCreateTextureList.clear();
|
||||
|
||||
mUUIDMap.clear();
|
||||
mUUIDDict.clear();
|
||||
|
||||
mImageList.clear();
|
||||
|
||||
@@ -600,8 +601,8 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
|
||||
|
||||
LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id)
|
||||
{
|
||||
uuid_map_t::iterator iter = mUUIDMap.find(image_id);
|
||||
if(iter == mUUIDMap.end())
|
||||
auto& iter = mUUIDDict.find(image_id);
|
||||
if(iter == mUUIDDict.end())
|
||||
return NULL;
|
||||
return iter->second;
|
||||
}
|
||||
@@ -648,8 +649,8 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
|
||||
<< " but doesn't have mInImageList set"
|
||||
<< " ref count is " << image->getNumRefs()
|
||||
<< LL_ENDL;
|
||||
uuid_map_t::iterator iter = mUUIDMap.find(image->getID());
|
||||
if(iter == mUUIDMap.end())
|
||||
auto& iter = mUUIDDict.find(image->getID());
|
||||
if(iter == mUUIDDict.end())
|
||||
{
|
||||
LL_INFOS() << "Image " << image->getID() << " is also not in mUUIDMap!" << LL_ENDL ;
|
||||
}
|
||||
@@ -690,7 +691,8 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image)
|
||||
sNumImages++;
|
||||
|
||||
addImageToList(new_image);
|
||||
mUUIDMap[image_id] = new_image;
|
||||
mUUIDMap.emplace(image_id, new_image);
|
||||
mUUIDDict.emplace(image_id, new_image);
|
||||
}
|
||||
|
||||
|
||||
@@ -703,7 +705,9 @@ void LLViewerTextureList::deleteImage(LLViewerFetchedTexture *image)
|
||||
mCallbackList.erase(image);
|
||||
}
|
||||
|
||||
llverify(mUUIDMap.erase(image->getID()) == 1);
|
||||
const LLUUID& id = image->getID();
|
||||
llverify(mUUIDMap.erase(id) == 1);
|
||||
llverify(mUUIDDict.erase(id) == 1);
|
||||
sNumImages--;
|
||||
removeImageFromList(image);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "llui.h"
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
const U32 LL_IMAGE_REZ_LOSSLESS_CUTOFF = 128;
|
||||
|
||||
@@ -187,6 +188,8 @@ public:
|
||||
private:
|
||||
typedef std::map< LLUUID, LLPointer<LLViewerFetchedTexture> > uuid_map_t;
|
||||
uuid_map_t mUUIDMap;
|
||||
typedef std::unordered_map< LLUUID, LLPointer<LLViewerFetchedTexture>* > uuid_dict_t;
|
||||
uuid_map_t mUUIDDict;
|
||||
LLUUID mLastUpdateUUID;
|
||||
LLUUID mLastFetchUUID;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user