summaryrefslogtreecommitdiff
path: root/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-04-03 19:21:14 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-04-03 19:21:14 +0000
commitb5936a4b1d8780b5b8cd425998eacd2c64ffa693 (patch)
treec1581bcf34e96a897c6e1d9a4aed95f353713baa /indra/llimage/llimage.cpp
parent55c25229b79b1755c989e5996c8e8d118f369721 (diff)
1.19.1 Viewer merge: QAR_367, QAR-374, QAR-408, QAR-426
QAR_367 (RC1) - merge Branch_1-19-1-Viewer -r 81609 : 81993 -> release QAR-374 (RC2) - merge Branch_1-19-1-Viewer -r 81993 : 82589 -> release QAR-408 (RC3) - merge Branch_1-19-1-Viewer -r 82589 : 83128 -> release QAR-426 (rc4) - merge Branch_1-19-1-Viewer -r 83125 : 83719 -> release (Actual merge: release@83793 Branch_1-19-1-Viewer-merge@83953 -> release)
Diffstat (limited to 'indra/llimage/llimage.cpp')
-rw-r--r--indra/llimage/llimage.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index a61b9cb0c0..c8cfad84f6 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -58,6 +58,7 @@ LLImageBase::LLImageBase()
mComponents(0),
mMemType(LLMemType::MTYPE_IMAGEBASE)
{
+ mBadBufferAllocation = FALSE ;
}
// virtual
@@ -142,10 +143,15 @@ U8* LLImageBase::allocateData(S32 size)
if (!mData || size != mDataSize)
{
deleteData(); // virtual
+ mBadBufferAllocation = FALSE ;
mData = new U8[size];
if (!mData)
{
- llerrs << "allocate image data: " << size << llendl;
+ //llerrs << "allocate image data: " << size << llendl;
+ llwarns << "allocate image data: " << size << llendl;
+ size = 0 ;
+ mWidth = mHeight = 0 ;
+ mBadBufferAllocation = TRUE ;
}
mDataSize = size;
}
@@ -174,6 +180,30 @@ U8* LLImageBase::reallocateData(S32 size)
return mData;
}
+const U8* LLImageBase::getData() const
+{
+ if(mBadBufferAllocation)
+ {
+ llerrs << "Bad memory allocation for the image buffer!" << llendl ;
+ }
+
+ return mData;
+} // read only
+
+U8* LLImageBase::getData()
+{
+ if(mBadBufferAllocation)
+ {
+ llerrs << "Bad memory allocation for the image buffer!" << llendl ;
+ }
+
+ return mData;
+}
+
+BOOL LLImageBase::isBufferInvalid()
+{
+ return mBadBufferAllocation || mData == NULL ;
+}
void LLImageBase::setSize(S32 width, S32 height, S32 ncomponents)
{
@@ -1339,7 +1369,7 @@ S32 LLImageFormatted::calcDiscardLevelBytes(S32 bytes)
//----------------------------------------------------------------------------
// Subclasses that can handle more than 4 channels should override this function.
-BOOL LLImageFormatted::decode(LLImageRaw* raw_image,F32 decode_time, S32 first_channel, S32 max_channel)
+BOOL LLImageFormatted::decodeChannels(LLImageRaw* raw_image,F32 decode_time, S32 first_channel, S32 max_channel)
{
llassert( (first_channel == 0) && (max_channel == 4) );
return decode( raw_image, decode_time ); // Loads first 4 channels by default.