diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/lltexturecache.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-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/lltexturecache.cpp')
-rw-r--r-- | linden/indra/newview/lltexturecache.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/linden/indra/newview/lltexturecache.cpp b/linden/indra/newview/lltexturecache.cpp index 22cb6c1..da23710 100644 --- a/linden/indra/newview/lltexturecache.cpp +++ b/linden/indra/newview/lltexturecache.cpp | |||
@@ -155,7 +155,7 @@ protected: | |||
155 | class LLTextureCacheLocalFileWorker : public LLTextureCacheWorker | 155 | class LLTextureCacheLocalFileWorker : public LLTextureCacheWorker |
156 | { | 156 | { |
157 | public: | 157 | public: |
158 | LLTextureCacheLocalFileWorker(LLTextureCache* cache, U32 priority, const LLString& filename, const LLUUID& id, | 158 | LLTextureCacheLocalFileWorker(LLTextureCache* cache, U32 priority, const std::string& filename, const LLUUID& id, |
159 | U8* data, S32 datasize, S32 offset, | 159 | U8* data, S32 datasize, S32 offset, |
160 | S32 imagesize, // for writes | 160 | S32 imagesize, // for writes |
161 | LLTextureCache::Responder* responder) | 161 | LLTextureCache::Responder* responder) |
@@ -169,7 +169,7 @@ public: | |||
169 | virtual bool doWrite(); | 169 | virtual bool doWrite(); |
170 | 170 | ||
171 | private: | 171 | private: |
172 | LLString mFileName; | 172 | std::string mFileName; |
173 | }; | 173 | }; |
174 | 174 | ||
175 | bool LLTextureCacheLocalFileWorker::doRead() | 175 | bool LLTextureCacheLocalFileWorker::doRead() |
@@ -180,7 +180,7 @@ bool LLTextureCacheLocalFileWorker::doRead() | |||
180 | { | 180 | { |
181 | mDataSize = local_size; // Only a complete file is valid | 181 | mDataSize = local_size; // Only a complete file is valid |
182 | 182 | ||
183 | LLString extension = mFileName.substr(mFileName.size() - 3, 3); | 183 | std::string extension = mFileName.substr(mFileName.size() - 3, 3); |
184 | 184 | ||
185 | mImageFormat = LLImageBase::getCodecFromExtension(extension); | 185 | mImageFormat = LLImageBase::getCodecFromExtension(extension); |
186 | 186 | ||
@@ -1034,12 +1034,12 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL read_only) | |||
1034 | 1034 | ||
1035 | if (!mReadOnly) | 1035 | if (!mReadOnly) |
1036 | { | 1036 | { |
1037 | LLFile::mkdir(mTexturesDirName.c_str()); | 1037 | LLFile::mkdir(mTexturesDirName); |
1038 | const char* subdirs = "0123456789abcdef"; | 1038 | const char* subdirs = "0123456789abcdef"; |
1039 | for (S32 i=0; i<16; i++) | 1039 | for (S32 i=0; i<16; i++) |
1040 | { | 1040 | { |
1041 | std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i]; | 1041 | std::string dirname = mTexturesDirName + gDirUtilp->getDirDelimiter() + subdirs[i]; |
1042 | LLFile::mkdir(dirname.c_str()); | 1042 | LLFile::mkdir(dirname); |
1043 | } | 1043 | } |
1044 | } | 1044 | } |
1045 | readHeaderCache(); | 1045 | readHeaderCache(); |
@@ -1060,12 +1060,10 @@ struct lru_data | |||
1060 | typedef const lru_data* lru_data_ptr; | 1060 | typedef const lru_data* lru_data_ptr; |
1061 | bool operator()(const lru_data_ptr& a, const lru_data_ptr& b) const | 1061 | bool operator()(const lru_data_ptr& a, const lru_data_ptr& b) const |
1062 | { | 1062 | { |
1063 | if (a->time > b->time) | 1063 | if(a->time == b->time) |
1064 | return true; | 1064 | return (a->index < b->index); |
1065 | else if (b->time > a->time) | ||
1066 | return false; | ||
1067 | else | 1065 | else |
1068 | return a->index < b->index; | 1066 | return (a->time >= b->time); |
1069 | } | 1067 | } |
1070 | }; | 1068 | }; |
1071 | }; | 1069 | }; |
@@ -1137,16 +1135,16 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) | |||
1137 | for (S32 i=0; i<16; i++) | 1135 | for (S32 i=0; i<16; i++) |
1138 | { | 1136 | { |
1139 | std::string dirname = mTexturesDirName + delem + subdirs[i]; | 1137 | std::string dirname = mTexturesDirName + delem + subdirs[i]; |
1140 | gDirUtilp->deleteFilesInDir(dirname.c_str(),mask); | 1138 | gDirUtilp->deleteFilesInDir(dirname,mask); |
1141 | if (purge_directories) | 1139 | if (purge_directories) |
1142 | { | 1140 | { |
1143 | LLFile::rmdir(dirname.c_str()); | 1141 | LLFile::rmdir(dirname); |
1144 | } | 1142 | } |
1145 | } | 1143 | } |
1146 | ll_apr_file_remove(mTexturesDirEntriesFileName, NULL); | 1144 | ll_apr_file_remove(mTexturesDirEntriesFileName, NULL); |
1147 | if (purge_directories) | 1145 | if (purge_directories) |
1148 | { | 1146 | { |
1149 | LLFile::rmdir(mTexturesDirName.c_str()); | 1147 | LLFile::rmdir(mTexturesDirName); |
1150 | } | 1148 | } |
1151 | } | 1149 | } |
1152 | mTexturesSizeMap.clear(); | 1150 | mTexturesSizeMap.clear(); |
@@ -1395,7 +1393,7 @@ S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, bool touch, S32* image | |||
1395 | 1393 | ||
1396 | // Calls from texture pipeline thread (i.e. LLTextureFetch) | 1394 | // Calls from texture pipeline thread (i.e. LLTextureFetch) |
1397 | 1395 | ||
1398 | LLTextureCache::handle_t LLTextureCache::readFromCache(const LLString& filename, const LLUUID& id, U32 priority, | 1396 | LLTextureCache::handle_t LLTextureCache::readFromCache(const std::string& filename, const LLUUID& id, U32 priority, |
1399 | S32 offset, S32 size, ReadResponder* responder) | 1397 | S32 offset, S32 size, ReadResponder* responder) |
1400 | { | 1398 | { |
1401 | // Note: checking to see if an entry exists can cause a stall, | 1399 | // Note: checking to see if an entry exists can cause a stall, |