55
55
56
56
static LLPanelInjector<LLOutfitGallery> t_outfit_gallery (" outfit_gallery" );
57
57
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
60
67
61
68
const S32 GALLERY_ITEMS_PER_ROW_MIN = 2 ;
62
69
@@ -979,28 +986,18 @@ void LLOutfitGalleryItem::draw()
979
986
border.mRight = border.mRight + 1 ;
980
987
gl_rect_2d (border, border_color, false );
981
988
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 ();
984
989
if (mTexturep )
985
990
{
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 );
998
993
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);
1000
997
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);
1004
1001
}
1005
1002
1006
1003
}
@@ -1128,14 +1125,18 @@ bool LLOutfitGalleryItem::openOutfitsContent()
1128
1125
1129
1126
bool LLOutfitGalleryItem::setImageAssetId (LLUUID image_asset_id)
1130
1127
{
1131
- LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture (image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
1132
- if (texture && texture-> getOriginalWidth () <= MAX_OUTFIT_PHOTO_WIDTH && texture-> getOriginalHeight () <= MAX_OUTFIT_PHOTO_HEIGHT )
1128
+ LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture (image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE );
1129
+ if (texture)
1133
1130
{
1134
1131
mImageAssetId = image_asset_id;
1135
1132
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.
1136
1138
mPreviewIcon ->setVisible (false );
1137
1139
mDefaultImage = false ;
1138
- mImageUpdatePending = (texture->getDiscardLevel () == -1 );
1139
1140
return true ;
1140
1141
}
1141
1142
return false ;
@@ -1152,7 +1153,6 @@ void LLOutfitGalleryItem::setDefaultImage()
1152
1153
mImageAssetId .setNull ();
1153
1154
mPreviewIcon ->setVisible (true );
1154
1155
mDefaultImage = true ;
1155
- mImageUpdatePending = false ;
1156
1156
}
1157
1157
1158
1158
LLContextMenu* LLOutfitGalleryContextMenu::createMenu ()
0 commit comments