diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-04-03 19:21:14 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-04-03 19:21:14 +0000 |
commit | b5936a4b1d8780b5b8cd425998eacd2c64ffa693 (patch) | |
tree | c1581bcf34e96a897c6e1d9a4aed95f353713baa /indra/llimage | |
parent | 55c25229b79b1755c989e5996c8e8d118f369721 (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')
-rw-r--r-- | indra/llimage/llimage.cpp | 34 | ||||
-rw-r--r-- | indra/llimage/llimage.h | 15 | ||||
-rw-r--r-- | indra/llimage/llimagebmp.h | 4 | ||||
-rw-r--r-- | indra/llimage/llimagedxt.cpp | 4 | ||||
-rw-r--r-- | indra/llimage/llimagedxt.h | 8 | ||||
-rw-r--r-- | indra/llimage/llimagej2c.cpp | 4 | ||||
-rw-r--r-- | indra/llimage/llimagej2c.h | 6 | ||||
-rw-r--r-- | indra/llimage/llimagejpeg.h | 4 | ||||
-rw-r--r-- | indra/llimage/llimagepng.h | 4 | ||||
-rw-r--r-- | indra/llimage/llimageworker.cpp | 2 |
10 files changed, 60 insertions, 25 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. diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index ca19198332..ee29e5c4a4 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -101,9 +101,10 @@ public: S8 getComponents() const { return mComponents; } S32 getDataSize() const { return mDataSize; } - const U8 *getData() const { return mData; } // read only - U8 *getData() { return mData; } - + const U8 *getData() const ; + U8 *getData() ; + BOOL isBufferInvalid() ; + void setSize(S32 width, S32 height, S32 ncomponents); U8* allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 size = -1); // setSize() + allocateData() @@ -135,6 +136,8 @@ private: S8 mComponents; + BOOL mBadBufferAllocation ; + public: S16 mMemType; // debug @@ -270,11 +273,11 @@ public: void appendData(U8 *data, S32 size); // Loads first 4 channels. - virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0) = 0; + virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time) = 0; // Subclasses that can handle more than 4 channels should override this function. - virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); + virtual BOOL decodeChannels(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); - virtual BOOL encode(const LLImageRaw* raw_image, F32 encode_time=0.0) = 0; + virtual BOOL encode(const LLImageRaw* raw_image, F32 encode_time) = 0; S8 getCodec() const; BOOL isDecoding() const { return mDecoding ? TRUE : FALSE; } diff --git a/indra/llimage/llimagebmp.h b/indra/llimage/llimagebmp.h index 2924ff412c..00d3e957e4 100644 --- a/indra/llimage/llimagebmp.h +++ b/indra/llimage/llimagebmp.h @@ -45,8 +45,8 @@ public: LLImageBMP(); /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 time=0.0); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 time=0.0); + /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); protected: BOOL decodeColorTable8( U8* dst, U8* src ); diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index 6feece4ad9..be9de3be49 100644 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -308,7 +308,7 @@ BOOL LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) return TRUE; } -BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mips) +BOOL LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_mips) { llassert_always(raw_image); @@ -396,7 +396,7 @@ BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mip // virtual BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time) { - return encode(raw_image, time, false); + return encodeDXT(raw_image, time, false); } // virtual diff --git a/indra/llimage/llimagedxt.h b/indra/llimage/llimagedxt.h index 23a5047f0d..b6df098456 100644 --- a/indra/llimage/llimagedxt.h +++ b/indra/llimage/llimagedxt.h @@ -95,15 +95,17 @@ public: protected: /*virtual*/ ~LLImageDXT(); + +private: + BOOL encodeDXT(const LLImageRaw* raw_image, F32 decode_time, bool explicit_mips); public: LLImageDXT(); /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 time=0.0); - BOOL encode(const LLImageRaw* raw_image, F32 time, bool explicit_mips); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 time=0.0); + /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); /*virtual*/ S32 calcHeaderSize(); /*virtual*/ S32 calcDataSize(S32 discard_level = 0); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 0911c43674..450d6ff93a 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -250,11 +250,11 @@ BOOL LLImageJ2C::updateData() BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time) { - return decode(raw_imagep, decode_time, 0, 4); + return decodeChannels(raw_imagep, decode_time, 0, 4); } -BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count ) +BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count ) { LLMemType mt1((LLMemType::EMemType)mMemType); diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index 35b4d6b8b4..6c720df586 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -46,9 +46,9 @@ public: // Base class overrides /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw *raw_imagep, F32 decode_time=0.0); - /*virtual*/ BOOL decode(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count); - /*virtual*/ BOOL encode(const LLImageRaw *raw_imagep, F32 encode_time=0.0); + /*virtual*/ BOOL decode(LLImageRaw *raw_imagep, F32 decode_time); + /*virtual*/ BOOL decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count); + /*virtual*/ BOOL encode(const LLImageRaw *raw_imagep, F32 encode_time); /*virtual*/ S32 calcHeaderSize(); /*virtual*/ S32 calcDataSize(S32 discard_level = 0); /*virtual*/ S32 calcDiscardLevelBytes(S32 bytes); diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 0be4002791..7ba1520a31 100644 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -55,8 +55,8 @@ public: LLImageJPEG(); /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 time=0.0); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 time=0.0); + /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); void setEncodeQuality( S32 q ) { mEncodeQuality = q; } // on a scale from 1 to 100 S32 getEncodeQuality() { return mEncodeQuality; } diff --git a/indra/llimage/llimagepng.h b/indra/llimage/llimagepng.h index 7a8e1f93b1..027caf9780 100644 --- a/indra/llimage/llimagepng.h +++ b/indra/llimage/llimagepng.h @@ -43,8 +43,8 @@ public: LLImagePNG(); BOOL updateData(); - BOOL decode(LLImageRaw* raw_image, F32 decode_time = 0.0); - BOOL encode(const LLImageRaw* raw_image, F32 encode_time = 0.0); + BOOL decode(LLImageRaw* raw_image, F32 decode_time); + BOOL encode(const LLImageRaw* raw_image, F32 encode_time); private: U8* mTmpWriteBuffer; diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 61b15b2092..cdec2bfe6c 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -115,7 +115,7 @@ bool LLImageWorker::doWork(S32 param) else { // Decode aux channel - decoded = mFormattedImage->decode(mDecodedImage, .1f, param, param); // 1ms + decoded = mFormattedImage->decodeChannels(mDecodedImage, .1f, param, param); // 1ms } } if (decoded) |