summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexturelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
-rwxr-xr-xindra/newview/llviewertexturelist.cpp55
1 files changed, 30 insertions, 25 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 10fbc8bd25..a8c93646c6 100755
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -70,23 +70,27 @@ S32 LLViewerTextureList::sNumImages = 0;
LLViewerTextureList gTextureList;
static LLTrace::BlockTimerStatHandle FTM_PROCESS_IMAGES("Process Images");
-bool is_ui_element(S32 priority)
+ETexListType get_element_type(S32 priority)
{
- // alternatively don't discard flag can be used
- return priority == LLViewerFetchedTexture::BOOST_ICON
- || priority == LLViewerFetchedTexture::BOOST_UI;
+ // don't discard flag can be used in some cases, but it usually is not set yet
+ if (priority == LLViewerFetchedTexture::BOOST_ICON
+ || priority == LLViewerFetchedTexture::BOOST_UI)
+ {
+ return TEX_LIST_UI;
+ }
+ return TEX_LIST_DISCARD;
}
///////////////////////////////////////////////////////////////////////////////
LLTextureKey::LLTextureKey()
: textureId(LLUUID::null),
-isUI(false)
+textureType(TEX_LIST_DISCARD)
{
}
-LLTextureKey::LLTextureKey(LLUUID id, bool is_ui)
-: textureId(id), isUI(is_ui)
+LLTextureKey::LLTextureKey(LLUUID id, ETexListType tex_type)
+: textureId(id), textureType(tex_type)
{
}
@@ -404,7 +408,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
new_id.generate(url);
}
- LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id, is_ui_element(boost_priority));
+ LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id, get_element_type(boost_priority));
if (!imagep.isNull())
{
@@ -442,12 +446,12 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
imagep->setExplicitFormat(internal_format, primary_format);
}
- bool is_ui = is_ui_element(boost_priority);
- addImage(imagep, is_ui);
+ addImage(imagep, get_element_type(boost_priority));
if (boost_priority != 0)
{
- if (is_ui)
+ if (boost_priority == LLViewerFetchedTexture::BOOST_UI
+ || boost_priority == LLViewerFetchedTexture::BOOST_ICON)
{
imagep->dontDiscard();
}
@@ -484,7 +488,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id,
return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI));
}
- LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, is_ui_element(boost_priority));
+ LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, get_element_type(boost_priority));
if (!imagep.isNull())
{
LLViewerFetchedTexture *texture = imagep.get();
@@ -546,12 +550,12 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
imagep->setExplicitFormat(internal_format, primary_format);
}
- bool is_ui = is_ui_element(boost_priority);
- addImage(imagep, is_ui);
+ addImage(imagep, get_element_type(boost_priority));
if (boost_priority != 0)
{
- if (is_ui)
+ if (boost_priority == LLViewerFetchedTexture::BOOST_UI
+ || boost_priority == LLViewerFetchedTexture::BOOST_ICON)
{
imagep->dontDiscard();
}
@@ -575,7 +579,7 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
void LLViewerTextureList::findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output)
{
- LLTextureKey search_key(image_id, false);
+ LLTextureKey search_key(image_id, TEX_LIST_DISCARD);
uuid_map_t::iterator iter = mUUIDMap.lower_bound(search_key);
while (iter != mUUIDMap.end() && iter->first.textureId == image_id)
{
@@ -592,9 +596,9 @@ LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLTextureKey &searc
return iter->second;
}
-LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id, bool is_ui)
+LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id, ETexListType tex_type)
{
- return findImage(LLTextureKey(image_id, is_ui));
+ return findImage(LLTextureKey(image_id, tex_type));
}
void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image)
@@ -639,7 +643,7 @@ 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(LLTextureKey(image->getID(), image->isUITexture()));
+ uuid_map_t::iterator iter = mUUIDMap.find(LLTextureKey(image->getID(), (ETexListType)image->getTextureListType()));
if(iter == mUUIDMap.end())
{
LL_INFOS() << "Image " << image->getID() << " is also not in mUUIDMap!" << LL_ENDL ;
@@ -664,7 +668,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
image->setInImageList(FALSE) ;
}
-void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, bool add_ui)
+void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, ETexListType tex_type)
{
if (!new_image)
{
@@ -672,7 +676,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, bool add_u
}
//llassert(new_image);
LLUUID image_id = new_image->getID();
- LLTextureKey key(image_id, add_ui);
+ LLTextureKey key(image_id, tex_type);
LLViewerFetchedTexture *image = findImage(key);
if (image)
@@ -683,6 +687,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, bool add_u
addImageToList(new_image);
mUUIDMap[key] = new_image;
+ new_image->setTextureListType(tex_type);
}
@@ -694,7 +699,7 @@ void LLViewerTextureList::deleteImage(LLViewerFetchedTexture *image)
{
mCallbackList.erase(image);
}
- LLTextureKey key(image->getID(), image->isUITexture());
+ LLTextureKey key(image->getID(), (ETexListType)image->getTextureListType());
llverify(mUUIDMap.erase(key) == 1);
sNumImages--;
removeImageFromList(image);
@@ -1128,7 +1133,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
fetch_count += (imagep->updateFetch() ? 1 : 0);
if (min_count <= min_update_count)
{
- mLastFetchKey = LLTextureKey(imagep->getID(), imagep->isUITexture());
+ mLastFetchKey = LLTextureKey(imagep->getID(), (ETexListType)imagep->getTextureListType());
}
if ((min_count-- <= 0) && (image_op_timer.getElapsedTimeF32() > max_time))
{
@@ -1580,14 +1585,14 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
LLUUID image_id;
msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id);
- LLViewerFetchedTexture* image = gTextureList.findImage( image_id, false);
+ LLViewerFetchedTexture* image = gTextureList.findImage( image_id, TEX_LIST_DISCARD);
if( image )
{
LL_WARNS() << "Image not in db" << LL_ENDL;
image->setIsMissingAsset();
}
- image = gTextureList.findImage(image_id, true);
+ image = gTextureList.findImage(image_id, TEX_LIST_UI);
if (image)
{
LL_WARNS() << "Icon not in db" << LL_ENDL;