summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturecache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rw-r--r--indra/newview/lltexturecache.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index a14d4f7a30..750b63eb5e 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -96,7 +96,7 @@ private:
public:
LLTextureCacheWorker(LLTextureCache* cache, const LLUUID& id,
- U8* data, S32 datasize, S32 offset,
+ const U8* data, S32 datasize, S32 offset,
S32 imagesize, // for writes
LLTextureCache::Responder* responder)
: LLWorkerClass(cache, "LLTextureCacheWorker"),
@@ -108,7 +108,7 @@ public:
mOffset(offset),
mImageSize(imagesize),
mImageFormat(IMG_CODEC_J2C),
- mImageLocal(FALSE),
+ mImageLocal(false),
mResponder(responder),
mFileHandle(LLLFSThread::nullHandle()),
mBytesToRead(0),
@@ -145,12 +145,12 @@ protected:
LLUUID mID;
U8* mReadData;
- U8* mWriteData;
+ const U8* mWriteData;
S32 mDataSize;
S32 mOffset;
S32 mImageSize;
EImageCodec mImageFormat;
- BOOL mImageLocal;
+ bool mImageLocal;
LLPointer<LLTextureCache::Responder> mResponder;
LLLFSThread::handle_t mFileHandle;
S32 mBytesToRead;
@@ -224,7 +224,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
else
{
mImageSize = local_size;
- mImageLocal = TRUE;
+ mImageLocal = true;
}
return true;
}
@@ -239,7 +239,7 @@ class LLTextureCacheRemoteWorker : public LLTextureCacheWorker
{
public:
LLTextureCacheRemoteWorker(LLTextureCache* cache, const LLUUID& id,
- U8* data, S32 datasize, S32 offset,
+ const U8* data, S32 datasize, S32 offset,
S32 imagesize, // for writes
LLPointer<LLImageRaw> raw, S32 discardlevel,
LLTextureCache::Responder* responder)
@@ -364,7 +364,7 @@ bool LLTextureCacheRemoteWorker::doRead()
else
{
mImageSize = local_size;
- mImageLocal = TRUE;
+ mImageLocal = true;
}
}
else
@@ -796,9 +796,9 @@ LLTextureCache::LLTextureCache(bool threaded)
mListMutex(),
mFastCacheMutex(),
mHeaderAPRFile(NULL),
- mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
+ mReadOnly(true), //do not allow to change the texture cache until setReadOnly() is called.
mTexturesSizeTotal(0),
- mDoPurge(FALSE),
+ mDoPurge(false),
mFastCachep(NULL),
mFastCachePoolp(NULL),
mFastCachePadBuffer(NULL)
@@ -873,7 +873,7 @@ std::string LLTextureCache::getTextureFileName(const LLUUID& id)
}
//debug
-BOOL LLTextureCache::isInCache(const LLUUID& id)
+bool LLTextureCache::isInCache(const LLUUID& id)
{
LLMutexLock lock(&mHeaderMutex);
id_map_t::const_iterator iter = mHeaderIDMap.find(id);
@@ -882,7 +882,7 @@ BOOL LLTextureCache::isInCache(const LLUUID& id)
}
//debug
-BOOL LLTextureCache::isInLocal(const LLUUID& id)
+bool LLTextureCache::isInLocal(const LLUUID& id)
{
S32 local_size = 0;
std::string local_filename;
@@ -894,7 +894,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
if (local_size > 0)
{
- return TRUE ;
+ return true ;
}
}
@@ -904,7 +904,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
if (local_size > 0)
{
- return TRUE ;
+ return true ;
}
}
@@ -914,11 +914,11 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
if (local_size > 0)
{
- return TRUE ;
+ return true ;
}
}
- return FALSE ;
+ return false ;
}
//////////////////////////////////////////////////////////////////////////////
@@ -982,14 +982,14 @@ void LLTextureCache::purgeCache(ELLPath location, bool remove_dir)
}
//is called in the main thread before initCache(...) is called.
-void LLTextureCache::setReadOnly(BOOL read_only)
+void LLTextureCache::setReadOnly(bool read_only)
{
mReadOnly = read_only ;
}
// Called in the main thread.
// Returns the unused amount of max_size if any
-S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache_mismatch)
+S64 LLTextureCache::initCache(ELLPath location, S64 max_size, bool texture_cache_mismatch)
{
llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized.
@@ -1314,7 +1314,7 @@ bool LLTextureCache::updateEntry(S32& idx, Entry& entry, S32 new_image_size, S32
if (purge)
{
- mDoPurge = TRUE;
+ mDoPurge = true;
}
}
@@ -1961,7 +1961,7 @@ bool LLTextureCache::readComplete(handle_t handle, bool abort)
}
LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id,
- U8* data, S32 datasize, S32 imagesize,
+ const U8* data, S32 datasize, S32 imagesize,
LLPointer<LLImageRaw> rawimage, S32 discardlevel,
WriteResponder* responder)
{
@@ -2047,6 +2047,9 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
bool LLTextureCache::writeToFastCache(LLUUID image_id, S32 id, LLPointer<LLImageRaw> raw, S32 discardlevel)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
+
+ LLImageDataSharedLock lock(raw);
+
//rescale image if needed
if (raw.isNull() || raw->isBufferInvalid() || !raw->getData())
{
@@ -2282,11 +2285,11 @@ bool LLTextureCache::removeFromCache(const LLUUID& id)
LLTextureCache::ReadResponder::ReadResponder()
: mImageSize(0),
- mImageLocal(FALSE)
+ mImageLocal(false)
{
}
-void LLTextureCache::ReadResponder::setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal)
+void LLTextureCache::ReadResponder::setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, bool imagelocal)
{
if (mFormattedImage.notNull())
{