From b5936a4b1d8780b5b8cd425998eacd2c64ffa693 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 3 Apr 2008 19:21:14 +0000 Subject: 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) --- indra/llimage/llimage.cpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'indra/llimage/llimage.cpp') 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. -- cgit v1.2.3