diff options
Diffstat (limited to 'indra/llimage')
-rwxr-xr-x | indra/llimage/llimage.cpp | 12 | ||||
-rwxr-xr-x | indra/llimage/llimage.h | 9 | ||||
-rwxr-xr-x | indra/llimage/llimagedimensionsinfo.cpp | 4 | ||||
-rwxr-xr-x | indra/llimage/llimagedimensionsinfo.h | 2 | ||||
-rwxr-xr-x | indra/llimage/llimagej2c.cpp | 2 | ||||
-rwxr-xr-x | indra/llimage/llimagejpeg.h | 1 | ||||
-rwxr-xr-x | indra/llimage/tests/llimageworker_test.cpp | 7 |
7 files changed, 27 insertions, 10 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 1c25256e95..655d7a381a 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -26,6 +26,7 @@ #include "linden_common.h" +#include "llimageworker.h" #include "llimage.h" #include "llmath.h" @@ -37,7 +38,6 @@ #include "llimagejpeg.h" #include "llimagepng.h" #include "llimagedxt.h" -#include "llimageworker.h" #include "llmemory.h" //--------------------------------------------------------------------------- @@ -50,6 +50,7 @@ LLMutex* LLImage::sMutex = NULL; bool LLImage::sUseNewByteRange = false; S32 LLImage::sMinimalReverseByteRangePercent = 75; LLPrivateMemoryPool* LLImageBase::sPrivatePoolp = NULL ; +LLTrace::MemStatHandle LLImageBase::sMemStat("LLImage"); //static void LLImage::initClass(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent) @@ -158,8 +159,8 @@ void LLImageBase::sanityCheck() void LLImageBase::deleteData() { FREE_MEM(sPrivatePoolp, mData) ; + memDisclaimAmount(mDataSize) = 0; mData = NULL; - mDataSize = 0; } // virtual @@ -201,6 +202,7 @@ U8* LLImageBase::allocateData(S32 size) mBadBufferAllocation = true ; } mDataSize = size; + memClaimAmount(mDataSize); } return mData; @@ -222,7 +224,7 @@ U8* LLImageBase::reallocateData(S32 size) FREE_MEM(sPrivatePoolp, mData) ; } mData = new_datap; - mDataSize = size; + memClaimAmount(memDisclaimAmount(mDataSize) = size); return mData; } @@ -288,7 +290,6 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components) LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy) : LLImageBase() { - if(no_copy) { setDataAndSize(data, width, height, components); @@ -1608,7 +1609,8 @@ static void avg4_colors2(const U8* a, const U8* b, const U8* c, const U8* d, U8* void LLImageBase::setDataAndSize(U8 *data, S32 size) { ll_assert_aligned(data, 16); - mData = data; mDataSize = size; + mData = data; + memClaimAmount(memDisclaimAmount(mDataSize) = size); } //static diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 4fc40ecff7..8ad6b49dd2 100755 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -29,7 +29,8 @@ #include "lluuid.h" #include "llstring.h" -#include "llthread.h" +#include "llpointer.h" +#include "lltrace.h" const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 const S32 MAX_IMAGE_MIP = 11; // 2048x2048 @@ -110,7 +111,9 @@ protected: //============================================================================ // Image base class -class LLImageBase : public LLThreadSafeRefCount +class LLImageBase +: public LLThreadSafeRefCount, + public LLTrace::MemTrackable<LLImageBase> { protected: virtual ~LLImageBase(); @@ -162,6 +165,8 @@ public: static void destroyPrivatePool() ; static LLPrivateMemoryPool* getPrivatePool() {return sPrivatePoolp;} + static LLTrace::MemStatHandle sMemStat; + private: U8 *mData; S32 mDataSize; diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index c6bfa50b40..383ae00fb7 100755 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -172,8 +172,8 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg() /* Make sure this is a JPEG file. */ const size_t JPEG_MAGIC_SIZE = 2; - const uint8_t jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; - uint8_t signature[JPEG_MAGIC_SIZE]; + const U8 jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; + U8 signature[JPEG_MAGIC_SIZE]; if (fread(signature, sizeof(signature), 1, fp) != 1) { diff --git a/indra/llimage/llimagedimensionsinfo.h b/indra/llimage/llimagedimensionsinfo.h index 382fdb2a0e..8f716c5d02 100755 --- a/indra/llimage/llimagedimensionsinfo.h +++ b/indra/llimage/llimagedimensionsinfo.h @@ -27,6 +27,8 @@ #ifndef LL_LLIMAGEDIMENSIONSINFO_H #define LL_LLIMAGEDIMENSIONSINFO_H +#include "llapr.h" + //----------------------------------------------------------------------------- // LLImageDimensionsInfo // helper class to get image dimensions WITHOUT loading image to memore diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5412f98ee5..8e2bcc3f94 100755 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -24,11 +24,13 @@ */ #include "linden_common.h" +#include "llapr.h" #include "lldir.h" #include "llimagej2c.h" #include "lltimer.h" #include "llmath.h" #include "llmemory.h" +#include "llsd.h" typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 7ac7f5d2e0..5b596d9fa4 100755 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -31,6 +31,7 @@ #include "llimage.h" +#include "llwin32headerslean.h" extern "C" { #ifdef LL_STANDALONE # include <jpeglib.h> diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp index e255d65b43..aba7883974 100755 --- a/indra/llimage/tests/llimageworker_test.cpp +++ b/indra/llimage/tests/llimageworker_test.cpp @@ -31,6 +31,8 @@ #include "../llimageworker.h" // For timer class #include "../llcommon/lltimer.h" +// for lltrace class +#include "../llcommon/lltrace.h" // Tut header #include "../test/lltut.h" @@ -42,6 +44,9 @@ // * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) // * A simulator for a class can be implemented here. Please comment and document thoroughly. +LLTrace::MemStatHandle LLImageBase::sMemStat("LLImage"); + + LLImageBase::LLImageBase() : mData(NULL), mDataSize(0), @@ -110,7 +115,6 @@ namespace tut { // Instance to be tested LLImageDecodeThread* mThread; - // Constructor and destructor of the test wrapper imagedecodethread_test() { @@ -136,6 +140,7 @@ namespace tut imagerequest_test() { done = false; + mRequest = new LLImageDecodeThread::ImageRequest(0, 0, LLQueuedThread::PRIORITY_NORMAL, 0, FALSE, new responder_test(&done)); |