Partial revert "Crashfix texture viewer, update"
This reverts commit 85e26c05d1.
This commit is contained in:
@@ -139,7 +139,8 @@ BOOL LLImageBase::sSizeOverride = FALSE;
|
|||||||
// virtual
|
// virtual
|
||||||
void LLImageBase::deleteData()
|
void LLImageBase::deleteData()
|
||||||
{
|
{
|
||||||
delete[] mData;
|
if(mData)
|
||||||
|
free(mData);//delete[] mData;
|
||||||
mData = NULL;
|
mData = NULL;
|
||||||
mDataSize = 0;
|
mDataSize = 0;
|
||||||
}
|
}
|
||||||
@@ -154,7 +155,7 @@ U8* LLImageBase::allocateData(S32 size)
|
|||||||
size = mWidth * mHeight * mComponents;
|
size = mWidth * mHeight * mComponents;
|
||||||
if (size <= 0)
|
if (size <= 0)
|
||||||
{
|
{
|
||||||
llerrs << llformat("LLImageBase::allocateData called with bad dimentions: %dx%dx%d",mWidth,mHeight,mComponents) << llendl;
|
llerrs << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,mComponents) << llendl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (size <= 0 || (size > 4096*4096*16 && sSizeOverride == FALSE))
|
else if (size <= 0 || (size > 4096*4096*16 && sSizeOverride == FALSE))
|
||||||
@@ -166,14 +167,17 @@ U8* LLImageBase::allocateData(S32 size)
|
|||||||
{
|
{
|
||||||
deleteData(); // virtual
|
deleteData(); // virtual
|
||||||
mBadBufferAllocation = FALSE ;
|
mBadBufferAllocation = FALSE ;
|
||||||
mData = new U8[size];
|
U8 *data = (U8 *)realloc(mData,sizeof(U8)*size);//new U8[size];
|
||||||
if (!mData)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
if(mData)
|
||||||
|
free(mData);
|
||||||
llwarns << "allocate image data: " << size << llendl;
|
llwarns << "allocate image data: " << size << llendl;
|
||||||
size = 0 ;
|
size = 0 ;
|
||||||
mWidth = mHeight = 0 ;
|
mWidth = mHeight = 0 ;
|
||||||
mBadBufferAllocation = TRUE ;
|
mBadBufferAllocation = TRUE ;
|
||||||
}
|
}
|
||||||
|
mData = data;
|
||||||
mDataSize = size;
|
mDataSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,21 +188,16 @@ U8* LLImageBase::allocateData(S32 size)
|
|||||||
U8* LLImageBase::reallocateData(S32 size)
|
U8* LLImageBase::reallocateData(S32 size)
|
||||||
{
|
{
|
||||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||||
U8 *new_datap = new U8[size];
|
U8 *data = (U8 *)realloc(mData,sizeof(U8)*size);
|
||||||
if (!new_datap)
|
if(data)
|
||||||
{
|
{
|
||||||
|
mData = data;
|
||||||
|
mDataSize = size;
|
||||||
|
}
|
||||||
|
else
|
||||||
llwarns << "Out of memory in LLImageBase::reallocateData" << llendl;
|
llwarns << "Out of memory in LLImageBase::reallocateData" << llendl;
|
||||||
return 0;
|
|
||||||
}
|
return data;
|
||||||
if (mData)
|
|
||||||
{
|
|
||||||
S32 bytes = llmin(mDataSize, size);
|
|
||||||
memcpy(new_datap, mData, bytes); /* Flawfinder: ignore */
|
|
||||||
delete[] mData;
|
|
||||||
}
|
|
||||||
mData = new_datap;
|
|
||||||
mDataSize = size;
|
|
||||||
return mData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const U8* LLImageBase::getData() const
|
const U8* LLImageBase::getData() const
|
||||||
@@ -659,6 +658,12 @@ void LLImageRaw::fill( const LLColor4U& color )
|
|||||||
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
|
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
|
||||||
void LLImageRaw::copy(LLImageRaw* src)
|
void LLImageRaw::copy(LLImageRaw* src)
|
||||||
{
|
{
|
||||||
|
if (!src)
|
||||||
|
{
|
||||||
|
llwarns << "LLImageRaw::copy called with a null src pointer" << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LLImageRaw* dst = this; // Just for clarity.
|
LLImageRaw* dst = this; // Just for clarity.
|
||||||
|
|
||||||
llassert( (3 == src->getComponents()) || (4 == src->getComponents()) );
|
llassert( (3 == src->getComponents()) || (4 == src->getComponents()) );
|
||||||
@@ -839,6 +844,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
|
|||||||
{
|
{
|
||||||
// Vertical
|
// Vertical
|
||||||
S32 temp_data_size = old_width * new_height * getComponents();
|
S32 temp_data_size = old_width * new_height * getComponents();
|
||||||
|
llassert_always(temp_data_size > 0);
|
||||||
U8* temp_buffer = new U8[ temp_data_size ];
|
U8* temp_buffer = new U8[ temp_data_size ];
|
||||||
for( S32 col = 0; col < old_width; col++ )
|
for( S32 col = 0; col < old_width; col++ )
|
||||||
{
|
{
|
||||||
@@ -1500,7 +1506,7 @@ void LLImageFormatted::appendData(U8 *data, S32 size)
|
|||||||
S32 newsize = cursize + size;
|
S32 newsize = cursize + size;
|
||||||
reallocateData(newsize);
|
reallocateData(newsize);
|
||||||
memcpy(getData() + cursize, data, size);
|
memcpy(getData() + cursize, data, size);
|
||||||
delete[] data;
|
delete[] data; //Fixing leak from CommentCacheReadResponder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
S16 mMemType; // debug
|
S16 mMemType; // debug
|
||||||
|
|
||||||
static BOOL sSizeOverride;
|
static BOOL sSizeOverride;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user