aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimagelist.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llviewerimagelist.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/llviewerimagelist.cpp')
-rw-r--r--linden/indra/newview/llviewerimagelist.cpp44
1 files changed, 26 insertions, 18 deletions
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp
index 3ff0013..28f51e1 100644
--- a/linden/indra/newview/llviewerimagelist.cpp
+++ b/linden/indra/newview/llviewerimagelist.cpp
@@ -126,6 +126,14 @@ void LLViewerImageList::doPreloadImages()
126 LLUIImageList* image_list = LLUIImageList::getInstance(); 126 LLUIImageList* image_list = LLUIImageList::getInstance();
127 127
128 image_list->initFromFile(); 128 image_list->initFromFile();
129
130 // turn off clamping and bilinear filtering for uv picking images
131 //LLViewerImage* uv_test = preloadUIImage("uv_test1.tga", LLUUID::null, FALSE);
132 //uv_test->setClamp(FALSE, FALSE);
133 //uv_test->setMipFilterNearest(TRUE, TRUE);
134 //uv_test = preloadUIImage("uv_test2.tga", LLUUID::null, FALSE);
135 //uv_test->setClamp(FALSE, FALSE);
136 //uv_test->setMipFilterNearest(TRUE, TRUE);
129 137
130 // prefetch specific UUIDs 138 // prefetch specific UUIDs
131 getImage(IMG_SHOT, TRUE); 139 getImage(IMG_SHOT, TRUE);
@@ -181,7 +189,7 @@ void LLViewerImageList::doPrefetchImages()
181 LLSD imagelist; 189 LLSD imagelist;
182 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); 190 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
183 llifstream file; 191 llifstream file;
184 file.open(filename.c_str()); 192 file.open(filename);
185 if (file.is_open()) 193 if (file.is_open())
186 { 194 {
187 LLSDSerialize::fromXML(imagelist, file); 195 LLSDSerialize::fromXML(imagelist, file);
@@ -206,7 +214,6 @@ void LLViewerImageList::doPrefetchImages()
206 214
207LLViewerImageList::~LLViewerImageList() 215LLViewerImageList::~LLViewerImageList()
208{ 216{
209 llassert(mIRCallbackData.empty());
210} 217}
211 218
212void LLViewerImageList::shutdown() 219void LLViewerImageList::shutdown()
@@ -252,7 +259,7 @@ void LLViewerImageList::shutdown()
252 { 259 {
253 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); 260 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
254 llofstream file; 261 llofstream file;
255 file.open(filename.c_str()); 262 file.open(filename);
256 LLSDSerialize::toPrettyXML(imagelist, file); 263 LLSDSerialize::toPrettyXML(imagelist, file);
257 } 264 }
258 265
@@ -260,7 +267,6 @@ void LLViewerImageList::shutdown()
260 // Clean up "loaded" callbacks. 267 // Clean up "loaded" callbacks.
261 // 268 //
262 mCallbackList.clear(); 269 mCallbackList.clear();
263 mIRCallbackData.clear();
264 270
265 // Flush all of the references 271 // Flush all of the references
266 mLoadingStreamList.clear(); 272 mLoadingStreamList.clear();
@@ -307,7 +313,7 @@ void LLViewerImageList::restoreGL()
307 313
308/////////////////////////////////////////////////////////////////////////////// 314///////////////////////////////////////////////////////////////////////////////
309 315
310LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename, 316LLViewerImage* LLViewerImageList::getImageFromFile(const std::string& filename,
311 BOOL usemipmaps, 317 BOOL usemipmaps,
312 BOOL level_immediate, 318 BOOL level_immediate,
313 LLGLint internal_format, 319 LLGLint internal_format,
@@ -336,7 +342,7 @@ LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename,
336 } 342 }
337 else 343 else
338 { 344 {
339 new_id.generate(std::string(full_path)); 345 new_id.generate(full_path);
340 } 346 }
341 347
342 LLPointer<LLViewerImage> imagep = hasImage(new_id); 348 LLPointer<LLViewerImage> imagep = hasImage(new_id);
@@ -452,7 +458,7 @@ void LLViewerImageList::addImage(LLViewerImage *new_image)
452 LLViewerImage *image = hasImage(image_id); 458 LLViewerImage *image = hasImage(image_id);
453 if (image) 459 if (image)
454 { 460 {
455 llerrs << "Image with ID " << image_id << " already in list" << llendl; 461 llwarns << "Image with ID " << image_id << " already in list" << llendl;
456 } 462 }
457 sNumImages++; 463 sNumImages++;
458 464
@@ -667,6 +673,7 @@ F32 LLViewerImageList::updateImagesFetchTextures(F32 max_time)
667 if(iter1 == mImageList.end()) 673 if(iter1 == mImageList.end())
668 { 674 {
669 llerrs << "DEV-12002: update_counter not calculated correctly!" << llendl; 675 llerrs << "DEV-12002: update_counter not calculated correctly!" << llendl;
676 return 0.f;
670 } 677 }
671 678
672 LLPointer<LLViewerImage> const & ptr = *iter1; 679 LLPointer<LLViewerImage> const & ptr = *iter1;
@@ -795,8 +802,8 @@ void LLViewerImageList::decodeAllImages(F32 max_time)
795} 802}
796 803
797 804
798BOOL LLViewerImageList::createUploadFile(const LLString& filename, 805BOOL LLViewerImageList::createUploadFile(const std::string& filename,
799 const LLString& out_filename, 806 const std::string& out_filename,
800 const U8 codec) 807 const U8 codec)
801{ 808{
802 // First, load the image. 809 // First, load the image.
@@ -1170,7 +1177,7 @@ void LLUIImageList::cleanUp()
1170LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id) 1177LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id)
1171{ 1178{
1172 // use id as image name 1179 // use id as image name
1173 LLString image_name = image_id.asString(); 1180 std::string image_name = image_id.asString();
1174 1181
1175 // look for existing image 1182 // look for existing image
1176 uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name); 1183 uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name);
@@ -1182,7 +1189,7 @@ LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id)
1182 return loadUIImageByID(image_id); 1189 return loadUIImageByID(image_id);
1183} 1190}
1184 1191
1185LLUIImagePtr LLUIImageList::getUIImage(const LLString& image_name) 1192LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name)
1186{ 1193{
1187 // look for existing image 1194 // look for existing image
1188 uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name); 1195 uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name);
@@ -1194,7 +1201,7 @@ LLUIImagePtr LLUIImageList::getUIImage(const LLString& image_name)
1194 return loadUIImageByName(image_name, image_name); 1201 return loadUIImageByName(image_name, image_name);
1195} 1202}
1196 1203
1197LLUIImagePtr LLUIImageList::loadUIImageByName(const LLString& name, const LLString& filename, BOOL use_mips, const LLRect& scale_rect) 1204LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect)
1198{ 1205{
1199 LLViewerImage* imagep = gImageList.getImageFromFile(filename, MIPMAP_NO, IMMEDIATE_YES); 1206 LLViewerImage* imagep = gImageList.getImageFromFile(filename, MIPMAP_NO, IMMEDIATE_YES);
1200 return loadUIImage(imagep, name, use_mips, scale_rect); 1207 return loadUIImage(imagep, name, use_mips, scale_rect);
@@ -1206,7 +1213,7 @@ LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, BOOL use_mips, con
1206 return loadUIImage(imagep, id.asString(), use_mips, scale_rect); 1213 return loadUIImage(imagep, id.asString(), use_mips, scale_rect);
1207} 1214}
1208 1215
1209LLUIImagePtr LLUIImageList::loadUIImage(LLViewerImage* imagep, const LLString& name, BOOL use_mips, const LLRect& scale_rect) 1216LLUIImagePtr LLUIImageList::loadUIImage(LLViewerImage* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect)
1210{ 1217{
1211 if (!imagep) return NULL; 1218 if (!imagep) return NULL;
1212 1219
@@ -1219,12 +1226,12 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerImage* imagep, const LLString& n
1219 datap->mImageName = name; 1226 datap->mImageName = name;
1220 datap->mImageScaleRegion = scale_rect; 1227 datap->mImageScaleRegion = scale_rect;
1221 1228
1222 imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, datap); 1229 imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap);
1223 1230
1224 return new_imagep; 1231 return new_imagep;
1225} 1232}
1226 1233
1227LLUIImagePtr LLUIImageList::preloadUIImage(const LLString& name, const LLString& filename, BOOL use_mips, const LLRect& scale_rect) 1234LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect)
1228{ 1235{
1229 // look for existing image 1236 // look for existing image
1230 uuid_ui_image_map_t::iterator found_it = mUIImages.find(name); 1237 uuid_ui_image_map_t::iterator found_it = mUIImages.find(name);
@@ -1245,7 +1252,7 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerImage *src_vi, LLImag
1245 return; 1252 return;
1246 } 1253 }
1247 1254
1248 LLString ui_image_name ; 1255 std::string ui_image_name ;
1249 LLRect scale_rect ; 1256 LLRect scale_rect ;
1250 { 1257 {
1251 LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data; 1258 LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data;
@@ -1345,10 +1352,10 @@ bool LLUIImageList::initFromFile()
1345 LLXMLNodePtr child_nodep = root->getFirstChild(); 1352 LLXMLNodePtr child_nodep = root->getFirstChild();
1346 while(child_nodep.notNull()) 1353 while(child_nodep.notNull())
1347 { 1354 {
1348 LLString image_name; 1355 std::string image_name;
1349 child_nodep->getAttributeString("name", image_name); 1356 child_nodep->getAttributeString("name", image_name);
1350 1357
1351 LLString file_name = image_name; 1358 std::string file_name = image_name;
1352 LLRect scale_rect; 1359 LLRect scale_rect;
1353 BOOL use_mip_maps = FALSE; 1360 BOOL use_mip_maps = FALSE;
1354 1361
@@ -1394,3 +1401,4 @@ bool LLUIImageList::initFromFile()
1394 return true; 1401 return true;
1395} 1402}
1396 1403
1404