diff options
author | Steve Bennetts <steve@lindenlab.com> | 2009-10-25 23:05:15 -0700 |
---|---|---|
committer | Steve Bennetts <steve@lindenlab.com> | 2009-10-25 23:05:15 -0700 |
commit | 53c972a521cbb92c6c9390c41b250a41dc22cd5a (patch) | |
tree | f6fc9f14f3815a943b0f6655a3ec113f7ae8e9a9 /indra | |
parent | 4bc3b5f3db98f70faac9059616135886debb16a7 (diff) |
* Changes to enable differentiating between icon texture priority and other UI texture priority.
* Still need to only request smaller mip maps of icon textures
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/lliconctrl.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lliconctrl.h | 5 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llui.h | 8 | ||||
-rw-r--r-- | indra/newview/llavatariconctrl.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterland.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llviewertexture.h | 8 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 72 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.h | 10 | ||||
-rw-r--r-- | indra/newview/llworldmapview.cpp | 2 |
11 files changed, 80 insertions, 56 deletions
diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 0330a2b374..66c2ba682f 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -56,7 +56,8 @@ LLIconCtrl::Params::Params() LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) : LLUICtrl(p), mColor(p.color()), - mImagep(p.image) + mImagep(p.image), + mPriority(0) { if (mImagep.notNull()) { @@ -93,11 +94,11 @@ void LLIconCtrl::setValue(const LLSD& value ) LLUICtrl::setValue(tvalue); if (tvalue.isUUID()) { - mImagep = LLUI::getUIImageByID(tvalue.asUUID()); + mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority); } else { - mImagep = LLUI::getUIImage(tvalue.asString()); + mImagep = LLUI::getUIImage(tvalue.asString(), mPriority); } } diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index ff25b0d53e..90f1693060 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -72,10 +72,13 @@ public: std::string getImageName() const; void setColor(const LLColor4& color) { mColor = color; } + +protected: + S32 mPriority; private: LLUIColor mColor; - LLPointer<LLUIImage> mImagep; + LLPointer<LLUIImage> mImagep; }; #endif diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index da9384f876..48504a1e54 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1807,11 +1807,11 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) } //static -LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id) +LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id, S32 priority) { if (sImageProvider) { - return sImageProvider->getUIImageByID(image_id); + return sImageProvider->getUIImageByID(image_id, priority); } else { @@ -1820,10 +1820,10 @@ LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id) } //static -LLPointer<LLUIImage> LLUI::getUIImage(const std::string& name) +LLPointer<LLUIImage> LLUI::getUIImage(const std::string& name, S32 priority) { if (!name.empty() && sImageProvider) - return sImageProvider->getUIImage(name); + return sImageProvider->getUIImage(name, priority); else return NULL; } diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 6ab78ab3cd..efb1b0a36f 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -195,8 +195,8 @@ public: static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y); static void setScaleFactor(const LLVector2& scale_factor); static void setLineWidth(F32 width); - static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id); - static LLPointer<LLUIImage> getUIImage(const std::string& name); + static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0); + static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0); static LLVector2 getWindowSize(); static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); @@ -241,8 +241,8 @@ protected: LLImageProviderInterface() {}; virtual ~LLImageProviderInterface() {}; public: - virtual LLPointer<LLUIImage> getUIImage(const std::string& name) = 0; - virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id) = 0; + virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0; + virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0; virtual void cleanUp() = 0; }; diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 7ae1b5cd4a..ebcda13dd4 100644 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -152,6 +152,8 @@ LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p) : LLIconCtrl(p), mDrawTooltip(p.draw_tooltip) { + mPriority = LLViewerFetchedTexture::BOOST_ICON; + LLRect rect = p.rect; static LLUICachedControl<S32> llavatariconctrl_symbol_hpad("UIAvatariconctrlSymbolHPad", 2); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 488d71aa70..bdf9842b01 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1054,9 +1054,9 @@ BOOL LLPanelLandObjects::postBuild() mBtnReturnOwnerList = getChild<LLButton>("Return objects..."); mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this); - mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga"); - mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga"); - mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga"); + mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga", 0); + mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga", 0); + mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga", 0); mOwnerList = getChild<LLNameListCtrl>("owner list"); mOwnerList->sortByColumnIndex(3, FALSE); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 95459a7116..e5c53c91c9 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -191,25 +191,25 @@ LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 wid LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( const LLUUID &image_id, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, LLHost request_from_host) { - return gTextureList.getImage(image_id, usemipmaps, level_immediate, texture_type, internal_format, primary_format, request_from_host) ; + return gTextureList.getImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( const std::string& filename, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, const LLUUID& force_id) { - return gTextureList.getImageFromFile(filename, usemipmaps, level_immediate, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromFile(filename, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, LLHost host) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 596bfea670..480e1c1cbc 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -118,10 +118,10 @@ public: BOOST_SELECTED = 12, BOOST_HUD = 13, BOOST_AVATAR_BAKED_SELF = 14, - BOOST_UI = 15, - BOOST_PREVIEW = 16, - BOOST_MAP = 17, - BOOST_MAP_LAYER = 18, + BOOST_ICON = 15, + BOOST_UI = 16, + BOOST_PREVIEW = 17, + BOOST_MAP = 18, BOOST_AVATAR_SELF = 19, // needed for baking avatar BOOST_MAX_LEVEL }; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 4ad4c8e1ea..b5986c70f5 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -111,10 +111,10 @@ void LLViewerTextureList::doPreloadImages() LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL; // Set the "missing asset" image - LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, IMMEDIATE_YES); + LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); // Set the "white" image - LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", MIPMAP_NO, IMMEDIATE_YES); + LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); LLUIImageList* image_list = LLUIImageList::getInstance(); @@ -131,31 +131,31 @@ void LLViewerTextureList::doPreloadImages() // prefetch specific UUIDs LLViewerTextureManager::getFetchedTexture(IMG_SHOT, TRUE); LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF, TRUE); - LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", MIPMAP_YES, IMMEDIATE_YES); + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", MIPMAP_YES, IMMEDIATE_YES); + image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", MIPMAP_YES, IMMEDIATE_YES); + image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, IMMEDIATE_YES); + image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, IMMEDIATE_YES, LLViewerTexture::FETCHED_TEXTURE, + image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, 0,0,LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); if (image) { @@ -315,7 +315,7 @@ void LLViewerTextureList::restoreGL() LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, @@ -369,10 +369,14 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& addImage(imagep); - if (level_immediate) + if (boost_priority != 0) { - imagep->dontDiscard(); - imagep->setBoostLevel(LLViewerFetchedTexture::BOOST_UI); + if (boost_priority == LLViewerFetchedTexture::BOOST_UI || + boost_priority == LLViewerFetchedTexture::BOOST_ICON) + { + imagep->dontDiscard(); + } + imagep->setBoostLevel(boost_priority); } } @@ -384,7 +388,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, @@ -403,7 +407,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, if (imagep.isNull()) { - imagep = createImage(image_id, usemipmaps, level_immediate, texture_type, internal_format, primary_format, request_from_host) ; + imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } imagep->setGLTextureCreated(true); @@ -414,7 +418,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, //when this function is called, there is no such texture in the gTextureList with image_id. LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, @@ -443,16 +447,20 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, addImage(imagep); - if (level_immediate) + if (boost_priority != 0) { - imagep->dontDiscard(); - imagep->setBoostLevel(LLViewerFetchedTexture::BOOST_UI); + if (boost_priority == LLViewerFetchedTexture::BOOST_UI || + boost_priority == LLViewerFetchedTexture::BOOST_ICON) + { + imagep->dontDiscard(); + } + imagep->setBoostLevel(boost_priority); } else { //by default, the texure can not be removed from memory even if it is not used. //here turn this off - //if this texture should be set to NO_DELETE, either pass level_immediate == TRUE here, or call setNoDelete() afterwards. + //if this texture should be set to NO_DELETE, call setNoDelete() afterwards. imagep->forceActive() ; } @@ -1286,7 +1294,7 @@ void LLUIImageList::cleanUp() mUITextureList.clear() ; } -LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id) +LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id, S32 priority) { // use id as image name std::string image_name = image_id.asString(); @@ -1298,10 +1306,12 @@ LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id) return found_it->second; } - return loadUIImageByID(image_id); + const BOOL use_mips = FALSE; + const LLRect scale_rect = LLRect::null; + return loadUIImageByID(image_id, use_mips, scale_rect, priority); } -LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name) +LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priority) { // look for existing image uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name); @@ -1310,18 +1320,24 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name) return found_it->second; } - return loadUIImageByName(image_name, image_name); + const BOOL use_mips = FALSE; + const LLRect scale_rect = LLRect::null; + return loadUIImageByName(image_name, image_name, use_mips, scale_rect, priority); } -LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect) +LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, + BOOL use_mips, const LLRect& scale_rect, S32 boost_priority ) { - LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, IMMEDIATE_YES); + if (boost_priority == 0) boost_priority = LLViewerFetchedTexture::BOOST_UI; + LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, boost_priority); return loadUIImage(imagep, name, use_mips, scale_rect); } -LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, BOOL use_mips, const LLRect& scale_rect) +LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, + BOOL use_mips, const LLRect& scale_rect, S32 boost_priority) { - LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, IMMEDIATE_YES); + if (boost_priority == 0) boost_priority = LLViewerFetchedTexture::BOOST_UI; + LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, boost_priority); return loadUIImage(imagep, id.asString(), use_mips, scale_rect); } @@ -1332,11 +1348,11 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st imagep->setAddressMode(LLTexUnit::TAM_CLAMP); //all UI images are non-deletable - imagep->setNoDelete() ; + imagep->setNoDelete(); LLUIImagePtr new_imagep = new LLUIImage(name, imagep); mUIImages.insert(std::make_pair(name, new_imagep)); - mUITextureList.push_back(imagep) ; + mUITextureList.push_back(imagep); LLUIImageLoadData* datap = new LLUIImageLoadData; datap->mImageName = name; diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 11d1dd855f..fda57ce981 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -202,8 +202,8 @@ class LLUIImageList : public LLImageProviderInterface, public LLSingleton<LLUIIm { public: // LLImageProviderInterface - LLUIImagePtr getUIImageByID(const LLUUID& id); - LLUIImagePtr getUIImage(const std::string& name); + /*virtual*/ LLUIImagePtr getUIImageByID(const LLUUID& id, S32 priority); + /*virtual*/ LLUIImagePtr getUIImage(const std::string& name, S32 priority); void cleanUp(); bool initFromFile(); @@ -212,8 +212,10 @@ public: static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); private: - LLUIImagePtr loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null); - LLUIImagePtr loadUIImageByID(const LLUUID& id, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null); + LLUIImagePtr loadUIImageByName(const std::string& name, const std::string& filename, + BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, S32 boost_priority = 0); + LLUIImagePtr loadUIImageByID(const LLUUID& id, + BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, S32 boost_priority = 0); LLUIImagePtr loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null); diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 3aad5c7378..823db027ee 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -368,7 +368,7 @@ void LLWorldMapView::draw() continue; } - current_image->setBoostLevel(LLViewerTexture::BOOST_MAP_LAYER); + current_image->setBoostLevel(LLViewerTexture::BOOST_MAP); current_image->setKnownDrawSize(llround(pix_width * LLUI::sGLScaleFactor.mV[VX]), llround(pix_height * LLUI::sGLScaleFactor.mV[VY])); if (!current_image->hasGLTexture()) |