Skip to content

Commit 8eb14cd

Browse files
committed
#3104: Remove resolution restriction but prevent texture from fully loading. Miscellaneous cleanup and comments.
1 parent 2948df1 commit 8eb14cd

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

indra/newview/lloutfitgallery.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,15 @@
5555

5656
static LLPanelInjector<LLOutfitGallery> t_outfit_gallery("outfit_gallery");
5757

58-
#define MAX_OUTFIT_PHOTO_WIDTH 256
59-
#define MAX_OUTFIT_PHOTO_HEIGHT 256
58+
// The maximum resolution at which to load the outfit photo. If the given
59+
// texture has a higher resolution, tell the texture streaming system to
60+
// only load the resolution needed. An in-world object may request to load
61+
// the texture at a higher resolution, but that won't affect textures
62+
// loaded with LLViewerTexture::FETCHED_TEXTURE. (see
63+
// LLOutfitGalleryItem::setImageAssetId and also
64+
// LLViewerTexture::LOD_TEXTURE)
65+
#define MAX_OUTFIT_PHOTO_LOAD_WIDTH 256
66+
#define MAX_OUTFIT_PHOTO_LOAD_HEIGHT 256
6067

6168
const S32 GALLERY_ITEMS_PER_ROW_MIN = 2;
6269

@@ -979,28 +986,18 @@ void LLOutfitGalleryItem::draw()
979986
border.mRight = border.mRight + 1;
980987
gl_rect_2d(border, border_color, false);
981988

982-
// If the floater is focused, don't apply its alpha to the texture (STORM-677).
983-
const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
984989
if (mTexturep)
985990
{
986-
if (mImageUpdatePending && mTexturep->getDiscardLevel() >= 0)
987-
{
988-
mImageUpdatePending = false;
989-
if (mTexturep->getOriginalWidth() > MAX_OUTFIT_PHOTO_WIDTH || mTexturep->getOriginalHeight() > MAX_OUTFIT_PHOTO_HEIGHT)
990-
{
991-
setDefaultImage();
992-
}
993-
}
994-
else
995-
{
996-
LLRect interior = border;
997-
interior.stretch(-1);
991+
LLRect interior = border;
992+
interior.stretch(-1);
998993

999-
gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
994+
// Pump the priority
995+
const F32 stats = (F32)llmin(interior.getWidth() * interior.getHeight(), MAX_OUTFIT_PHOTO_LOAD_WIDTH * MAX_OUTFIT_PHOTO_LOAD_HEIGHT);
996+
mTexturep->addTextureStats(stats);
1000997

1001-
// Pump the priority
1002-
mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight()));
1003-
}
998+
// If the floater is focused, don't apply its alpha to the texture (STORM-677).
999+
const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
1000+
gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
10041001
}
10051002

10061003
}
@@ -1129,13 +1126,17 @@ bool LLOutfitGalleryItem::openOutfitsContent()
11291126
bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id)
11301127
{
11311128
LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE);
1132-
if (texture && texture->getOriginalWidth() <= MAX_OUTFIT_PHOTO_WIDTH && texture->getOriginalHeight() <= MAX_OUTFIT_PHOTO_HEIGHT)
1129+
if (texture)
11331130
{
11341131
mImageAssetId = image_asset_id;
11351132
mTexturep = texture;
1133+
// *TODO: There was previously logic which attempted to toggle
1134+
// visibility of the preview icon based on certain conditions,
1135+
// however these conditions either did not make sense or were not
1136+
// applicable due to texture streaming. Maybe we should only hide
1137+
// the preview icon if the texture has at least one mip loaded.
11361138
mPreviewIcon->setVisible(false);
11371139
mDefaultImage = false;
1138-
mImageUpdatePending = (texture->getDiscardLevel() == -1);
11391140
return true;
11401141
}
11411142
return false;
@@ -1152,7 +1153,6 @@ void LLOutfitGalleryItem::setDefaultImage()
11521153
mImageAssetId.setNull();
11531154
mPreviewIcon->setVisible(true);
11541155
mDefaultImage = true;
1155-
mImageUpdatePending = false;
11561156
}
11571157

11581158
LLContextMenu* LLOutfitGalleryContextMenu::createMenu()

indra/newview/lloutfitgallery.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ class LLOutfitGalleryItem : public LLPanel
266266
bool mSelected;
267267
bool mWorn;
268268
bool mDefaultImage;
269-
bool mImageUpdatePending;
270269
bool mHidden;
271270
std::string mOutfitName;
272271
};

0 commit comments

Comments
 (0)