Merge branch 'DRTVWR-591-maint-X' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/newview/lloutfitslist.cpp
#	indra/newview/llviewertexturelist.cpp
master
Ansariel 2023-10-10 12:24:28 +02:00
commit 57bbdcacd2
12 changed files with 291 additions and 99 deletions

View File

@ -113,7 +113,8 @@ void LLGLTexture::setBoostLevel(S32 level)
{
mBoostLevel = level ;
if(mBoostLevel != LLGLTexture::BOOST_NONE
&& mBoostLevel != LLGLTexture::BOOST_ICON)
&& mBoostLevel != LLGLTexture::BOOST_ICON
&& mBoostLevel != LLGLTexture::BOOST_THUMBNAIL)
{
setNoDelete() ;
}

View File

@ -64,6 +64,7 @@ public:
BOOST_SUPER_HIGH , //textures higher than this need to be downloaded at the required resolution without delay.
BOOST_HUD ,
BOOST_ICON ,
BOOST_THUMBNAIL ,
BOOST_UI ,
BOOST_PREVIEW ,
BOOST_MAP ,

View File

@ -19977,17 +19977,6 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>FSDisplaySavedOutfitsCap</key>
<map>
<key>Comment</key>
<string>Display only so many saved outfits in edit appearance. 0 to disable.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>FSAdvancedWorldmapRegionInfo</key>
<map>
<key>Comment</key>

View File

@ -58,6 +58,7 @@
static LLPanelInjector<LLInventoryGallery> t_inventory_gallery("inventory_gallery");
const S32 GALLERY_ITEMS_PER_ROW_MIN = 2;
const S32 FAST_LOAD_THUMBNAIL_TRSHOLD = 50; // load folders below this value immediately
// Helper dnd functions
BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, BOOL drop, std::string& tooltip_msg, BOOL is_link);
@ -106,6 +107,7 @@ LLInventoryGallery::LLInventoryGallery(const LLInventoryGallery::Params& p)
mGalleryWidthFactor(p.gallery_width_factor),
mIsInitialized(false),
mRootDirty(false),
mLoadThumbnailsImmediately(true),
mNeedsArrange(false),
mSearchType(LLInventoryFilter::SEARCHTYPE_NAME),
mSortOrder(LLInventoryFilter::SO_DATE)
@ -540,6 +542,12 @@ void LLInventoryGallery::addToGallery(LLInventoryGalleryItem* item)
int n_prev = n - 1;
int row_count_prev = (n_prev % mItemsInRow) == 0 ? n_prev / mItemsInRow : n_prev / mItemsInRow + 1;
// Avoid loading too many items.
// Intent is for small folders to display all content fast
// and for large folders to load content mostly as needed
// Todo: ideally needs to unload images outside visible area
mLoadThumbnailsImmediately = mItemsAddedCount < FAST_LOAD_THUMBNAIL_TRSHOLD;
bool add_row = row_count != row_count_prev;
int pos = 0;
if (add_row)
@ -573,6 +581,8 @@ void LLInventoryGallery::removeFromGalleryLast(LLInventoryGalleryItem* item, boo
mItemsAddedCount--;
mIndexToItemMap.erase(mItemsAddedCount);
mLoadThumbnailsImmediately = mItemsAddedCount < FAST_LOAD_THUMBNAIL_TRSHOLD;
bool remove_row = row_count != row_count_prev;
removeFromLastRow(mItems[mItemsAddedCount]);
mItems.pop_back();
@ -636,6 +646,7 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L
gitem->setUUID(item_id);
gitem->setGallery(this);
gitem->setType(type, inventory_type, flags, is_link);
gitem->setLoadImmediately(mLoadThumbnailsImmediately);
gitem->setThumbnail(thumbnail_id);
gitem->setWorn(is_worn);
gitem->setCreatorName(get_searchable_creator_name(&gInventory, item_id));
@ -997,6 +1008,7 @@ void LLInventoryGallery::updateItemThumbnail(LLUUID item_id)
if (mItemMap[item_id])
{
mItemMap[item_id]->setLoadImmediately(mLoadThumbnailsImmediately);
mItemMap[item_id]->setThumbnail(thumbnail_id);
bool passes_filter = checkAgainstFilters(mItemMap[item_id], mFilterSubString);
@ -2574,6 +2586,7 @@ BOOL LLInventoryGalleryItem::postBuild()
{
mNameText = getChild<LLTextBox>("item_name");
mTextBgPanel = getChild<LLPanel>("text_bg_panel");
mThumbnailCtrl = getChild<LLThumbnailCtrl>("preview_thumbnail");
return TRUE;
}
@ -2649,14 +2662,19 @@ void LLInventoryGalleryItem::setThumbnail(LLUUID id)
mDefaultImage = id.isNull();
if(mDefaultImage)
{
getChild<LLThumbnailCtrl>("preview_thumbnail")->clearTexture();
mThumbnailCtrl->clearTexture();
}
else
{
getChild<LLThumbnailCtrl>("preview_thumbnail")->setValue(id);
mThumbnailCtrl->setValue(id);
}
}
void LLInventoryGalleryItem::setLoadImmediately(bool val)
{
mThumbnailCtrl->setInitImmediately(val);
}
void LLInventoryGalleryItem::draw()
{
if (isFadeItem())
@ -2671,7 +2689,7 @@ void LLInventoryGalleryItem::draw()
// Draw border
LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "MenuItemHighlightBgColor" : "TextFgTentativeColor", LLColor4::white);
LLRect border = getChildView("preview_thumbnail")->getRect();
LLRect border = mThumbnailCtrl->getRect();
border.mRight = border.mRight + 1;
border.mTop = border.mTop + 1;
gl_rect_2d(border, border_color.get(), FALSE);
@ -2893,7 +2911,7 @@ void LLInventoryGalleryItem::updateNameText()
mNameText->setFont(getTextFont());
mNameText->setText(mItemName + mPermSuffix + mWornSuffix);
mNameText->setToolTip(mItemName + mPermSuffix + mWornSuffix);
getChild<LLThumbnailCtrl>("preview_thumbnail")->setToolTip(mItemName + mPermSuffix + mWornSuffix);
mThumbnailCtrl->setToolTip(mItemName + mPermSuffix + mWornSuffix);
}
bool LLInventoryGalleryItem::isFadeItem()

View File

@ -39,6 +39,7 @@ class LLInventoryGalleryItem;
class LLScrollContainer;
class LLTextBox;
class LLThumbnailsObserver;
class LLThumbnailCtrl;
class LLGalleryGestureObserver;
class LLInventoryGalleryContextMenu;
@ -246,6 +247,7 @@ private:
int mRowCount;
int mItemsAddedCount;
bool mGalleryCreated;
bool mLoadThumbnailsImmediately;
bool mNeedsArrange;
/* Params */
@ -342,6 +344,7 @@ public:
LLAssetType::EType getAssetType() { return mType; }
void setThumbnail(LLUUID id);
void setGallery(LLInventoryGallery* gallery) { mGallery = gallery; }
void setLoadImmediately(bool val);
bool isFolder() { return mIsFolder; }
bool isLink() { return mIsLink; }
EInventorySortGroup getSortGroup() { return mSortGroup; }
@ -354,6 +357,7 @@ private:
LLUUID mUUID;
LLTextBox* mNameText;
LLPanel* mTextBgPanel;
LLThumbnailCtrl* mThumbnailCtrl;
bool mSelected;
bool mWorn;
bool mDefaultImage;

View File

@ -906,7 +906,6 @@ void LLOutfitListBase::onOpen(const LLSD& info)
// arrive.
category->fetch();
refreshList(outfits);
highlightBaseOutfit();
mIsInitialized = true;
}
@ -914,12 +913,14 @@ void LLOutfitListBase::onOpen(const LLSD& info)
void LLOutfitListBase::refreshList(const LLUUID& category_id)
{
bool wasNull = mRefreshListState.CategoryUUID.isNull();
mRefreshListState.CategoryUUID.setNull();
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
// Collect all sub-categories of a given category.
// <FS:ND> FIRE-6958/VWR-2862; Make sure to only collect folders of type FT_OUTFIT
class ndOutfitsCollector: public LLIsType
{
public:
@ -941,8 +942,8 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
// LLIsType is_category(LLAssetType::AT_CATEGORY);
ndOutfitsCollector is_category;
// </FS:ND>
gInventory.collectDescendentsIf(
category_id,
cat_array,
@ -950,22 +951,41 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
LLInventoryModel::EXCLUDE_TRASH,
is_category);
uuid_vec_t vadded;
uuid_vec_t vremoved;
// Memorize item names for each UUID
std::map<LLUUID, std::string> names;
for (const LLPointer<LLViewerInventoryCategory>& cat : cat_array)
{
names.emplace(std::make_pair(cat->getUUID(), cat->getName()));
}
// Fill added and removed items vectors.
mRefreshListState.Added.clear();
mRefreshListState.Removed.clear();
computeDifference(cat_array, mRefreshListState.Added, mRefreshListState.Removed);
// Sort added items vector by item name.
std::sort(mRefreshListState.Added.begin(), mRefreshListState.Added.end(),
[names](const LLUUID& a, const LLUUID& b)
{
return LLStringUtil::compareDict(names.at(a), names.at(b)) < 0;
});
// Initialize iterators for added and removed items vectors.
mRefreshListState.AddedIterator = mRefreshListState.Added.begin();
mRefreshListState.RemovedIterator = mRefreshListState.Removed.begin();
LL_INFOS() << "added: " << mRefreshListState.Added.size() <<
", removed: " << mRefreshListState.Removed.size() <<
", changed: " << gInventory.getChangedIDs().size() <<
LL_ENDL;
mRefreshListState.CategoryUUID = category_id;
if (wasNull)
{
gIdleCallbacks.addFunction(onIdle, this);
}
// Create added and removed items vectors.
computeDifference(cat_array, vadded, vremoved);
// <FS:ND> FIRE-6958/VWR-2862; Handle large amounts of outfits, write a least a warning into the logs.
if( vadded.size() > 128 )
LL_WARNS() << "Large amount of outfits found: " << vadded.size() << " this may cause hangs and disconnects" << LL_ENDL;
U32 nCap = gSavedSettings.getU32( "FSDisplaySavedOutfitsCap" );
if( nCap && nCap < vadded.size() )
{
vadded.resize( nCap );
LL_WARNS() << "Capped outfits to " << nCap << " due to debug setting FSDisplaySavedOutfitsCap" << LL_ENDL;
}
if (mRefreshListState.Added.size() > 128)
LL_WARNS() << "Large amount of outfits found: " << mRefreshListState.Added.size() << " this may cause hangs and disconnects" << LL_ENDL;
// </FS:ND>
// <FS:Ansariel> FIRE-12939: Add outfit count to outfits list
@ -976,25 +996,53 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
getChild<LLTextBox>("OutfitcountText")->setTextArg("COUNT", count_string);
}
// </FS:Ansariel>
}
// static
void LLOutfitListBase::onIdle(void* userdata)
{
LLOutfitListBase* self = (LLOutfitListBase*)userdata;
self->onIdleRefreshList();
}
void LLOutfitListBase::onIdleRefreshList()
{
if (mRefreshListState.CategoryUUID.isNull())
return;
const F64 MAX_TIME = 0.05f;
F64 curent_time = LLTimer::getTotalSeconds();
const F64 end_time = curent_time + MAX_TIME;
// Handle added tabs.
for (uuid_vec_t::const_iterator iter = vadded.begin();
iter != vadded.end();
++iter)
while (mRefreshListState.AddedIterator < mRefreshListState.Added.end())
{
const LLUUID cat_id = (*iter);
const LLUUID cat_id = (*mRefreshListState.AddedIterator++);
updateAddedCategory(cat_id);
curent_time = LLTimer::getTotalSeconds();
if (curent_time >= end_time)
return;
}
mRefreshListState.Added.clear();
mRefreshListState.AddedIterator = mRefreshListState.Added.end();
// <FS:ND> We called mAccordion->addCollapsibleCtrl with false as second paramter and did not let it arrange itself each time. Do this here after all is said and done.
arrange();
// Handle removed tabs.
for (uuid_vec_t::const_iterator iter = vremoved.begin(); iter != vremoved.end(); ++iter)
while (mRefreshListState.RemovedIterator < mRefreshListState.Removed.end())
{
const LLUUID cat_id = (*iter);
const LLUUID cat_id = (*mRefreshListState.RemovedIterator++);
updateRemovedCategory(cat_id);
curent_time = LLTimer::getTotalSeconds();
if (curent_time >= end_time)
return;
}
mRefreshListState.Removed.clear();
mRefreshListState.RemovedIterator = mRefreshListState.Removed.end();
// Get changed items from inventory model and update outfit tabs
// which might have been renamed.
@ -1007,9 +1055,9 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
if (!cat)
{
LLInventoryObject* obj = gInventory.getObject(*items_iter);
if(!obj || (obj->getType() != LLAssetType::AT_CATEGORY))
if (!obj || (obj->getType() != LLAssetType::AT_CATEGORY))
{
return;
break;
}
cat = (LLViewerInventoryCategory*)obj;
}
@ -1019,6 +1067,12 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
}
sortOutfits();
highlightBaseOutfit();
gIdleCallbacks.deleteFunction(onIdle, this);
mRefreshListState.CategoryUUID.setNull();
LL_INFOS() << "done" << LL_ENDL;
}
void LLOutfitListBase::computeDifference(
@ -1055,7 +1109,6 @@ void LLOutfitListBase::highlightBaseOutfit()
mHighlightedOutfitUUID = base_id;
onHighlightBaseOutfit(base_id, prev_id);
}
}
void LLOutfitListBase::removeSelected()

View File

@ -121,8 +121,20 @@ protected:
void onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response);
virtual void onChangeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id) = 0;
static void onIdle(void* userdata);
void onIdleRefreshList();
struct
{
LLUUID CategoryUUID;
uuid_vec_t Added;
uuid_vec_t Removed;
uuid_vec_t::const_iterator AddedIterator;
uuid_vec_t::const_iterator RemovedIterator;
} mRefreshListState;
bool mIsInitialized;
LLInventoryCategoriesObserver* mCategoriesObserver;
LLInventoryCategoriesObserver* mCategoriesObserver;
LLUUID mSelectedOutfitUUID;
// id of currently highlited outfit
LLUUID mHighlightedOutfitUUID;

View File

@ -255,6 +255,7 @@ BOOL LLPanelGroupNotices::postBuild()
mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
mNoticesList->setCommitOnSelectionChange(TRUE);
mNoticesList->setCommitCallback(onSelectNotice, this);
// mNoticesList->sortByColumn("date", false); // <FS:Ansariel> Done in XUI
mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
mBtnNewMessage->setClickedCallback(onClickNewMessage, this);

View File

@ -57,7 +57,8 @@ LLThumbnailCtrl::LLThumbnailCtrl(const LLThumbnailCtrl::Params& p)
, mFallbackImagep(p.fallback_image)
, mInteractable(p.interactable())
, mShowLoadingPlaceholder(p.show_loading())
, mPriority(LLGLTexture::BOOST_PREVIEW)
, mInited(false)
, mInitImmediately(true)
{
mLoadingPlaceholderString = LLTrans::getString("texture_loading");
@ -84,6 +85,10 @@ LLThumbnailCtrl::~LLThumbnailCtrl()
void LLThumbnailCtrl::draw()
{
if (!mInited)
{
initImage();
}
LLRect draw_rect = getLocalRect();
if (mBorderVisible)
@ -171,11 +176,19 @@ void LLThumbnailCtrl::draw()
LLUICtrl::draw();
}
void LLThumbnailCtrl::setVisible(BOOL visible)
{
if (!visible && mInited)
{
unloadImage();
}
LLUICtrl::setVisible(visible);
}
void LLThumbnailCtrl::clearTexture()
{
mImageAssetID = LLUUID::null;
mTexturep = nullptr;
mImagep = nullptr;
setValue(LLSD());
mInited = true; // nothing to do
}
// virtual
@ -191,38 +204,11 @@ void LLThumbnailCtrl::setValue(const LLSD& value)
LLUICtrl::setValue(tvalue);
mImageAssetID = LLUUID::null;
mTexturep = nullptr;
mImagep = nullptr;
if (tvalue.isUUID())
{
mImageAssetID = tvalue.asUUID();
if (mImageAssetID.notNull())
{
// Should it support baked textures?
mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
mTexturep->setBoostLevel(mPriority);
mTexturep->forceToSaveRawImage(0);
S32 desired_draw_width = mTexturep->getWidth();
S32 desired_draw_height = mTexturep->getHeight();
mTexturep->setKnownDrawSize(desired_draw_width, desired_draw_height);
}
}
else if (tvalue.isString())
unloadImage();
if (mInitImmediately)
{
mImagep = LLUI::getUIImage(tvalue.asString(), LLGLTexture::BOOST_UI);
if (mImagep)
{
LLViewerFetchedTexture* texture = dynamic_cast<LLViewerFetchedTexture*>(mImagep->getImage().get());
if(texture)
{
mImageAssetID = texture->getID();
}
}
initImage();
}
}
@ -236,4 +222,51 @@ BOOL LLThumbnailCtrl::handleHover(S32 x, S32 y, MASK mask)
return LLUICtrl::handleHover(x, y, mask);
}
void LLThumbnailCtrl::initImage()
{
if (mInited)
{
return;
}
mInited = true;
LLSD tvalue = getValue();
if (tvalue.isUUID())
{
mImageAssetID = tvalue.asUUID();
if (mImageAssetID.notNull())
{
// Should it support baked textures?
mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_THUMBNAIL);
mTexturep->forceToSaveRawImage(0);
S32 desired_draw_width = mTexturep->getWidth();
S32 desired_draw_height = mTexturep->getHeight();
mTexturep->setKnownDrawSize(desired_draw_width, desired_draw_height);
}
}
else if (tvalue.isString())
{
mImagep = LLUI::getUIImage(tvalue.asString(), LLGLTexture::BOOST_UI);
if (mImagep)
{
LLViewerFetchedTexture* texture = dynamic_cast<LLViewerFetchedTexture*>(mImagep->getImage().get());
if (texture)
{
mImageAssetID = texture->getID();
}
}
}
}
void LLThumbnailCtrl::unloadImage()
{
mImageAssetID = LLUUID::null;
mTexturep = nullptr;
mImagep = nullptr;
mInited = false;
}

View File

@ -64,17 +64,24 @@ public:
virtual ~LLThumbnailCtrl();
virtual void draw() override;
void setVisible(BOOL visible) override;
virtual void setValue(const LLSD& value ) override;
void setInitImmediately(bool val) { mInitImmediately = val; }
void clearTexture();
virtual BOOL handleHover(S32 x, S32 y, MASK mask) override;
protected:
void initImage();
void unloadImage();
private:
S32 mPriority;
bool mBorderVisible;
bool mInteractable;
bool mShowLoadingPlaceholder;
bool mInited;
bool mInitImmediately;
std::string mLoadingPlaceholderString;
LLUUID mImageAssetID;
LLViewBorder* mBorder;

View File

@ -110,7 +110,8 @@ S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size
const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64;
const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez;
const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128;
const S32 DEFAULT_ICON_DIMENTIONS = 32;
const S32 DEFAULT_ICON_DIMENSIONS = 32;
const S32 DEFAULT_THUMBNAIL_DIMENSIONS = 256;
U32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256.
U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA;
bool LLViewerTexture::sFreezeImageUpdates = false;
@ -788,7 +789,8 @@ void LLViewerTexture::setBoostLevel(S32 level)
if(mBoostLevel != LLViewerTexture::BOOST_NONE &&
mBoostLevel != LLViewerTexture::BOOST_ALM &&
mBoostLevel != LLViewerTexture::BOOST_SELECTED &&
mBoostLevel != LLViewerTexture::BOOST_ICON)
mBoostLevel != LLViewerTexture::BOOST_ICON &&
mBoostLevel != LLViewerTexture::BOOST_THUMBNAIL)
{
setNoDelete();
}
@ -1312,8 +1314,19 @@ void LLViewerFetchedTexture::loadFromFastCache()
{
// Shouldn't do anything usefull since texures in fast cache are 16x16,
// it is here in case fast cache changes.
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS;
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENSIONS;
if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height))
{
// scale oversized icon, no need to give more work to gl
mRawImage->scale(expected_width, expected_height);
}
}
if (mBoostLevel == LLGLTexture::BOOST_THUMBNAIL)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_THUMBNAIL_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_THUMBNAIL_DIMENSIONS;
if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height))
{
// scale oversized icon, no need to give more work to gl
@ -1837,7 +1850,7 @@ void LLViewerFetchedTexture::processTextureStats()
{
mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
}
else if (mDontDiscard && mBoostLevel == LLGLTexture::BOOST_ICON)
else if (mDontDiscard && (mBoostLevel == LLGLTexture::BOOST_ICON || mBoostLevel == LLGLTexture::BOOST_THUMBNAIL))
{
if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
{
@ -1954,7 +1967,10 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
// Don't decode anything we don't need
priority = -4.0f;
}
else if ((mBoostLevel == LLGLTexture::BOOST_UI || mBoostLevel == LLGLTexture::BOOST_ICON) && !have_all_data)
else if ((mBoostLevel == LLGLTexture::BOOST_UI
|| mBoostLevel == LLGLTexture::BOOST_ICON
|| mBoostLevel == LLGLTexture::BOOST_THUMBNAIL)
&& !have_all_data)
{
priority = 1.f;
}
@ -2321,8 +2337,20 @@ bool LLViewerFetchedTexture::updateFetch()
if (mBoostLevel == LLGLTexture::BOOST_ICON)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS;
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENSIONS;
if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height))
{
// scale oversized icon, no need to give more work to gl
// since we got mRawImage from thread worker and image may be in use (ex: writing cache), make a copy
mRawImage = mRawImage->scaled(expected_width, expected_height);
}
}
if (mBoostLevel == LLGLTexture::BOOST_THUMBNAIL)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_THUMBNAIL_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_THUMBNAIL_DIMENSIONS;
if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height))
{
// scale oversized icon, no need to give more work to gl
@ -3075,7 +3103,9 @@ LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level)
if(mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= discard_level)
{
if (mSavedRawDiscardLevel != discard_level && mBoostLevel != BOOST_ICON)
if (mSavedRawDiscardLevel != discard_level
&& mBoostLevel != BOOST_ICON
&& mBoostLevel != BOOST_THUMBNAIL)
{
mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents());
mRawImage->copy(getSavedRawImage());
@ -3181,8 +3211,22 @@ void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* im
{
if (mBoostLevel == LLGLTexture::BOOST_ICON)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS;
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENSIONS;
if (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)
{
mCachedRawImage = new LLImageRaw(expected_width, expected_height, imageraw->getComponents());
mCachedRawImage->copyScaled(imageraw);
}
else
{
mCachedRawImage = imageraw;
}
}
else if (mBoostLevel == LLGLTexture::BOOST_THUMBNAIL)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_THUMBNAIL_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_THUMBNAIL_DIMENSIONS;
if (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)
{
mCachedRawImage = new LLImageRaw(expected_width, expected_height, imageraw->getComponents());
@ -3287,8 +3331,22 @@ void LLViewerFetchedTexture::saveRawImage()
mSavedRawDiscardLevel = mRawDiscardLevel;
if (mBoostLevel == LLGLTexture::BOOST_ICON)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS;
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENSIONS;
if (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)
{
mSavedRawImage = new LLImageRaw(expected_width, expected_height, mRawImage->getComponents());
mSavedRawImage->copyScaled(mRawImage);
}
else
{
mSavedRawImage = new LLImageRaw(mRawImage->getData(), mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents());
}
}
else if (mBoostLevel == LLGLTexture::BOOST_THUMBNAIL)
{
S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_THUMBNAIL_DIMENSIONS;
S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_THUMBNAIL_DIMENSIONS;
if (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)
{
mSavedRawImage = new LLImageRaw(expected_width, expected_height, mRawImage->getComponents());

View File

@ -74,7 +74,7 @@ LLViewerTextureList gTextureList;
ETexListType get_element_type(S32 priority)
{
return (priority == LLViewerFetchedTexture::BOOST_ICON) ? TEX_LIST_SCALE : TEX_LIST_STANDARD;
return (priority == LLViewerFetchedTexture::BOOST_ICON || priority == LLViewerFetchedTexture::BOOST_THUMBNAIL) ? TEX_LIST_SCALE : TEX_LIST_STANDARD;
}
///////////////////////////////////////////////////////////////////////////////
@ -506,11 +506,18 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string&
if (boost_priority != 0)
{
if (boost_priority == LLViewerFetchedTexture::BOOST_UI
|| boost_priority == LLViewerFetchedTexture::BOOST_ICON)
if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
{
imagep->dontDiscard();
}
if (boost_priority == LLViewerFetchedTexture::BOOST_ICON
|| boost_priority == LLViewerFetchedTexture::BOOST_THUMBNAIL)
{
// Agent and group Icons are downloadable content, nothing manages
// icon deletion yet, so they should not persist
imagep->dontDiscard();
imagep->forceActive();
}
imagep->setBoostLevel(boost_priority);
}
}
@ -618,11 +625,18 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
if (boost_priority != 0)
{
if (boost_priority == LLViewerFetchedTexture::BOOST_UI
|| boost_priority == LLViewerFetchedTexture::BOOST_ICON)
if (boost_priority == LLViewerFetchedTexture::BOOST_UI)
{
imagep->dontDiscard();
}
if (boost_priority == LLViewerFetchedTexture::BOOST_ICON
|| boost_priority == LLViewerFetchedTexture::BOOST_THUMBNAIL)
{
// Agent and group Icons are downloadable content, nothing manages
// icon deletion yet, so they should not persist.
imagep->dontDiscard();
imagep->forceActive();
}
imagep->setBoostLevel(boost_priority);
}
else
@ -2110,8 +2124,9 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st
LLUIImagePtr new_imagep = new LLUIImage(name, imagep);
new_imagep->setScaleStyle(scale_style);
if (imagep->getBoostLevel() != LLGLTexture::BOOST_ICON &&
imagep->getBoostLevel() != LLGLTexture::BOOST_PREVIEW)
if (imagep->getBoostLevel() != LLGLTexture::BOOST_ICON
&& imagep->getBoostLevel() != LLGLTexture::BOOST_THUMBNAIL
&& imagep->getBoostLevel() != LLGLTexture::BOOST_PREVIEW)
{
// Don't add downloadable content into this list
// all UI images are non-deletable and list does not support deletion