diff options
Diffstat (limited to 'linden/indra/newview/llviewerimagelist.cpp')
-rw-r--r-- | linden/indra/newview/llviewerimagelist.cpp | 80 |
1 files changed, 58 insertions, 22 deletions
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp index 142e862..6f0605c 100644 --- a/linden/indra/newview/llviewerimagelist.cpp +++ b/linden/indra/newview/llviewerimagelist.cpp | |||
@@ -125,7 +125,7 @@ void LLViewerImageList::doPreloadImages() | |||
125 | 125 | ||
126 | LLUIImageList* image_list = LLUIImageList::getInstance(); | 126 | LLUIImageList* image_list = LLUIImageList::getInstance(); |
127 | 127 | ||
128 | image_list->initFromFile(gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "textures", "textures.xml")); | 128 | image_list->initFromFile(); |
129 | 129 | ||
130 | // prefetch specific UUIDs | 130 | // prefetch specific UUIDs |
131 | getImage(IMG_SHOT, TRUE); | 131 | getImage(IMG_SHOT, TRUE); |
@@ -426,6 +426,12 @@ void LLViewerImageList::removeImageFromList(LLViewerImage *image) | |||
426 | llassert(image); | 426 | llassert(image); |
427 | if (!image->mInImageList) | 427 | if (!image->mInImageList) |
428 | { | 428 | { |
429 | llinfos << "RefCount: " << image->getNumRefs() << llendl ; | ||
430 | uuid_map_t::iterator iter = mUUIDMap.find(image->getID()); | ||
431 | if(iter == mUUIDMap.end() || iter->second != image) | ||
432 | { | ||
433 | llinfos << "Image is not in mUUIDMap!" << llendl ; | ||
434 | } | ||
429 | llerrs << "LLViewerImageList::removeImageFromList - Image not in list" << llendl; | 435 | llerrs << "LLViewerImageList::removeImageFromList - Image not in list" << llendl; |
430 | } | 436 | } |
431 | llverify(mImageList.erase(image) == 1); | 437 | llverify(mImageList.erase(image) == 1); |
@@ -1276,23 +1282,55 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerImage *src_vi, LLImag | |||
1276 | } | 1282 | } |
1277 | } | 1283 | } |
1278 | 1284 | ||
1279 | bool LLUIImageList::initFromFile(const LLString& filename) | 1285 | bool LLUIImageList::initFromFile() |
1280 | { | 1286 | { |
1281 | LLXmlTree xml_tree; | 1287 | // construct path to canonical textures.xml in default skin dir |
1288 | std::string base_file_path = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "default", "textures", "textures.xml"); | ||
1289 | |||
1290 | LLXMLNodePtr root; | ||
1282 | 1291 | ||
1283 | if (!xml_tree.parseFile(filename)) | 1292 | if (!LLXMLNode::parseFile(base_file_path, root, NULL)) |
1284 | { | 1293 | { |
1285 | llwarns << "Unable to parse UI image list file " << filename << llendl; | 1294 | llwarns << "Unable to parse UI image list file " << base_file_path << llendl; |
1286 | return false; | 1295 | return false; |
1287 | } | 1296 | } |
1288 | 1297 | ||
1289 | LLXmlTreeNode* rootp = xml_tree.getRoot(); | 1298 | if (!root->hasAttribute("version")) |
1290 | if (!rootp || !rootp->hasAttribute("version")) | ||
1291 | { | 1299 | { |
1292 | llwarns << "No valid version number in UI image list file " << filename << llendl; | 1300 | llwarns << "No valid version number in UI image list file " << base_file_path << llendl; |
1293 | return false; | 1301 | return false; |
1294 | } | 1302 | } |
1295 | 1303 | ||
1304 | std::vector<std::string> paths; | ||
1305 | // path to current selected skin | ||
1306 | paths.push_back(gDirUtilp->getSkinDir() | ||
1307 | + gDirUtilp->getDirDelimiter() | ||
1308 | + "textures" | ||
1309 | + gDirUtilp->getDirDelimiter() | ||
1310 | + "textures.xml"); | ||
1311 | // path to user overrides on current skin | ||
1312 | paths.push_back(gDirUtilp->getUserSkinDir() | ||
1313 | + gDirUtilp->getDirDelimiter() | ||
1314 | + "textures" | ||
1315 | + gDirUtilp->getDirDelimiter() | ||
1316 | + "textures.xml"); | ||
1317 | |||
1318 | // apply skinned xml files incrementally | ||
1319 | for(std::vector<std::string>::iterator path_it = paths.begin(); | ||
1320 | path_it != paths.end(); | ||
1321 | ++path_it) | ||
1322 | { | ||
1323 | // don't reapply base file to itself | ||
1324 | if (!path_it->empty() && (*path_it) != base_file_path) | ||
1325 | { | ||
1326 | LLXMLNodePtr update_root; | ||
1327 | if (LLXMLNode::parseFile(*path_it, update_root, NULL)) | ||
1328 | { | ||
1329 | LLXMLNode::updateNode(root, update_root); | ||
1330 | } | ||
1331 | } | ||
1332 | } | ||
1333 | |||
1296 | enum | 1334 | enum |
1297 | { | 1335 | { |
1298 | PASS_DECODE_NOW, | 1336 | PASS_DECODE_NOW, |
@@ -1302,10 +1340,12 @@ bool LLUIImageList::initFromFile(const LLString& filename) | |||
1302 | 1340 | ||
1303 | for (S32 pass = PASS_DECODE_NOW; pass < NUM_PASSES; pass++) | 1341 | for (S32 pass = PASS_DECODE_NOW; pass < NUM_PASSES; pass++) |
1304 | { | 1342 | { |
1305 | LLXmlTreeNode* child_nodep = rootp->getFirstChild(); | 1343 | LLXMLNodePtr child_nodep = root->getFirstChild(); |
1306 | while(child_nodep) | 1344 | while(child_nodep.notNull()) |
1307 | { | 1345 | { |
1308 | LLString image_name = child_nodep->getName(); | 1346 | LLString image_name; |
1347 | child_nodep->getAttributeString("name", image_name); | ||
1348 | |||
1309 | LLString file_name = image_name; | 1349 | LLString file_name = image_name; |
1310 | LLRect scale_rect; | 1350 | LLRect scale_rect; |
1311 | BOOL use_mip_maps = FALSE; | 1351 | BOOL use_mip_maps = FALSE; |
@@ -1318,7 +1358,7 @@ bool LLUIImageList::initFromFile(const LLString& filename) | |||
1318 | { | 1358 | { |
1319 | if (pass == PASS_DECODE_LATER) | 1359 | if (pass == PASS_DECODE_LATER) |
1320 | { | 1360 | { |
1321 | child_nodep = rootp->getNextChild(); | 1361 | child_nodep = child_nodep->getNextSibling(); |
1322 | continue; | 1362 | continue; |
1323 | } | 1363 | } |
1324 | } | 1364 | } |
@@ -1326,7 +1366,7 @@ bool LLUIImageList::initFromFile(const LLString& filename) | |||
1326 | { | 1366 | { |
1327 | if (pass == PASS_DECODE_NOW) | 1367 | if (pass == PASS_DECODE_NOW) |
1328 | { | 1368 | { |
1329 | child_nodep = rootp->getNextChild(); | 1369 | child_nodep = child_nodep->getNextSibling(); |
1330 | continue; | 1370 | continue; |
1331 | } | 1371 | } |
1332 | } | 1372 | } |
@@ -1334,18 +1374,14 @@ bool LLUIImageList::initFromFile(const LLString& filename) | |||
1334 | child_nodep->getAttributeString("file_name", file_name); | 1374 | child_nodep->getAttributeString("file_name", file_name); |
1335 | child_nodep->getAttributeBOOL("use_mips", use_mip_maps); | 1375 | child_nodep->getAttributeBOOL("use_mips", use_mip_maps); |
1336 | 1376 | ||
1337 | LLXmlTreeNode* rect_node = child_nodep->getChildByName("scale_rect"); | 1377 | child_nodep->getAttributeS32("scale_left", scale_rect.mLeft); |
1338 | if (rect_node) | 1378 | child_nodep->getAttributeS32("scale_right", scale_rect.mRight); |
1339 | { | 1379 | child_nodep->getAttributeS32("scale_bottom", scale_rect.mBottom); |
1340 | rect_node->getAttributeS32("left", scale_rect.mLeft); | 1380 | child_nodep->getAttributeS32("scale_top", scale_rect.mTop); |
1341 | rect_node->getAttributeS32("right", scale_rect.mRight); | ||
1342 | rect_node->getAttributeS32("bottom", scale_rect.mBottom); | ||
1343 | rect_node->getAttributeS32("top", scale_rect.mTop); | ||
1344 | } | ||
1345 | 1381 | ||
1346 | preloadUIImage(image_name, file_name, use_mip_maps, scale_rect); | 1382 | preloadUIImage(image_name, file_name, use_mip_maps, scale_rect); |
1347 | 1383 | ||
1348 | child_nodep = rootp->getNextChild(); | 1384 | child_nodep = child_nodep->getNextSibling(); |
1349 | } | 1385 | } |
1350 | 1386 | ||
1351 | if (pass == PASS_DECODE_NOW && !gSavedSettings.getBOOL("NoPreload")) | 1387 | if (pass == PASS_DECODE_NOW && !gSavedSettings.getBOOL("NoPreload")) |