summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitgallery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lloutfitgallery.cpp')
-rw-r--r--indra/newview/lloutfitgallery.cpp76
1 files changed, 37 insertions, 39 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 72fb9464d8..98b7d74cd2 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -55,14 +55,20 @@
static LLPanelInjector<LLOutfitGallery> t_outfit_gallery("outfit_gallery");
-#define MAX_OUTFIT_PHOTO_WIDTH 256
-#define MAX_OUTFIT_PHOTO_HEIGHT 256
+// The maximum resolution at which to load the outfit photo. If the given
+// texture has a higher resolution, tell the texture streaming system to
+// only load the resolution needed. An in-world object may request to load
+// the texture at a higher resolution, but that won't affect textures
+// loaded with LLViewerTexture::FETCHED_TEXTURE. (see
+// LLOutfitGalleryItem::setImageAssetId and also
+// LLViewerTexture::LOD_TEXTURE)
+#define MAX_OUTFIT_PHOTO_LOAD_WIDTH 256
+#define MAX_OUTFIT_PHOTO_LOAD_HEIGHT 256
const S32 GALLERY_ITEMS_PER_ROW_MIN = 2;
LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
: LLOutfitListBase(),
- mOutfitsObserver(NULL),
mScrollPanel(NULL),
mGalleryPanel(NULL),
mLastRowPanel(NULL),
@@ -723,12 +729,6 @@ LLOutfitGallery::~LLOutfitGallery()
{
delete mOutfitGalleryMenu;
- if (gInventory.containsObserver(mOutfitsObserver))
- {
- gInventory.removeObserver(mOutfitsObserver);
- }
- delete mOutfitsObserver;
-
while (!mUnusedRowPanels.empty())
{
LLPanel* panelp = mUnusedRowPanels.back();
@@ -786,6 +786,17 @@ void LLOutfitGallery::updateAddedCategory(LLUUID cat_id)
LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
if (!cat) return;
+ if (!isOutfitFolder(cat))
+ {
+ // Assume a subfolder that contains or will contain outfits, track it
+ const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+ mCategoriesObserver->addCategory(cat_id, [this, outfits]()
+ {
+ observerCallback(outfits);
+ });
+ return;
+ }
+
std::string name = cat->getName();
LLOutfitGalleryItem* item = buildGalleryItem(name, cat_id);
mOutfitMap.insert(LLOutfitGallery::outfit_map_value_t(cat_id, item));
@@ -802,14 +813,8 @@ void LLOutfitGallery::updateAddedCategory(LLUUID cat_id)
if (!outfit_category)
return;
- if (mOutfitsObserver == NULL)
- {
- mOutfitsObserver = new LLInventoryCategoriesObserver();
- gInventory.addObserver(mOutfitsObserver);
- }
-
// Start observing changes in "My Outfits" category.
- mOutfitsObserver->addCategory(cat_id,
+ mCategoriesObserver->addCategory(cat_id,
boost::bind(&LLOutfitGallery::refreshOutfit, this, cat_id), true);
outfit_category->fetch();
@@ -822,7 +827,7 @@ void LLOutfitGallery::updateRemovedCategory(LLUUID cat_id)
if (outfits_iter != mOutfitMap.end())
{
// 0. Remove category from observer.
- mOutfitsObserver->removeCategory(cat_id);
+ mCategoriesObserver->removeCategory(cat_id);
//const LLUUID& outfit_id = outfits_iter->first;
LLOutfitGalleryItem* item = outfits_iter->second;
@@ -979,28 +984,18 @@ void LLOutfitGalleryItem::draw()
border.mRight = border.mRight + 1;
gl_rect_2d(border, border_color, false);
- // If the floater is focused, don't apply its alpha to the texture (STORM-677).
- const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
if (mTexturep)
{
- if (mImageUpdatePending && mTexturep->getDiscardLevel() >= 0)
- {
- mImageUpdatePending = false;
- if (mTexturep->getOriginalWidth() > MAX_OUTFIT_PHOTO_WIDTH || mTexturep->getOriginalHeight() > MAX_OUTFIT_PHOTO_HEIGHT)
- {
- setDefaultImage();
- }
- }
- else
- {
- LLRect interior = border;
- interior.stretch(-1);
+ LLRect interior = border;
+ interior.stretch(-1);
- gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
+ // Pump the priority
+ const F32 stats = (F32)llmin(interior.getWidth() * interior.getHeight(), MAX_OUTFIT_PHOTO_LOAD_WIDTH * MAX_OUTFIT_PHOTO_LOAD_HEIGHT);
+ mTexturep->addTextureStats(stats);
- // Pump the priority
- mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight()));
- }
+ // If the floater is focused, don't apply its alpha to the texture (STORM-677).
+ const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
}
}
@@ -1128,14 +1123,18 @@ bool LLOutfitGalleryItem::openOutfitsContent()
bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id)
{
- LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
- if (texture && texture->getOriginalWidth() <= MAX_OUTFIT_PHOTO_WIDTH && texture->getOriginalHeight() <= MAX_OUTFIT_PHOTO_HEIGHT)
+ LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE);
+ if (texture)
{
mImageAssetId = image_asset_id;
mTexturep = texture;
+ // *TODO: There was previously logic which attempted to toggle
+ // visibility of the preview icon based on certain conditions,
+ // however these conditions either did not make sense or were not
+ // applicable due to texture streaming. Maybe we should only hide
+ // the preview icon if the texture has at least one mip loaded.
mPreviewIcon->setVisible(false);
mDefaultImage = false;
- mImageUpdatePending = (texture->getDiscardLevel() == -1);
return true;
}
return false;
@@ -1152,7 +1151,6 @@ void LLOutfitGalleryItem::setDefaultImage()
mImageAssetId.setNull();
mPreviewIcon->setVisible(true);
mDefaultImage = true;
- mImageUpdatePending = false;
}
LLContextMenu* LLOutfitGalleryContextMenu::createMenu()