diff options
Diffstat (limited to 'indra/llimage')
-rw-r--r-- | indra/llimage/llimage.cpp | 8 | ||||
-rw-r--r-- | indra/llimage/llimagepng.cpp | 21 | ||||
-rw-r--r-- | indra/llimage/llimagepng.h | 3 |
3 files changed, 8 insertions, 24 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index aa7c8c789a..0fc5ca1ad6 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -168,8 +168,8 @@ U8* LLImageBase::allocateData(S32 size) } else { - llerrs << "LLImageBase::allocateData: bad size: " << size << llendl; - } + llerrs << "LLImageBase::allocateData: bad size: " << size << llendl; + } } if (!mData || size != mDataSize) { @@ -267,10 +267,6 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components) { mMemType = LLMemType::MTYPE_IMAGERAW; //llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE ); - if(S32(width) * S32(height) * S32(components) > MAX_IMAGE_DATA_SIZE) - { - llwarns << "over size: width: " << (S32)width << " height: " << (S32)height << " components: " << (S32)components << llendl ; - } allocateDataSize(width, height, components); ++sRawImageCount; } diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index a6ab246a2c..018ce993b5 100644 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -42,17 +42,12 @@ // LLImagePNG // --------------------------------------------------------------------------- LLImagePNG::LLImagePNG() - : LLImageFormatted(IMG_CODEC_PNG), - mTmpWriteBuffer(NULL) + : LLImageFormatted(IMG_CODEC_PNG) { } LLImagePNG::~LLImagePNG() { - if (mTmpWriteBuffer) - { - delete[] mTmpWriteBuffer; - } } // Virtual @@ -123,28 +118,24 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) // Temporary buffer to hold the encoded image. Note: the final image // size should be much smaller due to compression. - if (mTmpWriteBuffer) - { - delete[] mTmpWriteBuffer; - } U32 bufferSize = getWidth() * getHeight() * getComponents() + 1024; - U8* mTmpWriteBuffer = new U8[ bufferSize ]; + U8* tmpWriteBuffer = new U8[ bufferSize ]; // Delegate actual encoding work to wrapper LLPngWrapper pngWrapper; - if (! pngWrapper.writePng(raw_image, mTmpWriteBuffer)) + if (! pngWrapper.writePng(raw_image, tmpWriteBuffer)) { setLastError(pngWrapper.getErrorMessage()); - delete[] mTmpWriteBuffer; + delete[] tmpWriteBuffer; return FALSE; } // Resize internal buffer and copy from temp U32 encodedSize = pngWrapper.getFinalSize(); allocateData(encodedSize); - memcpy(getData(), mTmpWriteBuffer, encodedSize); + memcpy(getData(), tmpWriteBuffer, encodedSize); - delete[] mTmpWriteBuffer; + delete[] tmpWriteBuffer; return TRUE; } diff --git a/indra/llimage/llimagepng.h b/indra/llimage/llimagepng.h index 083dda73b9..4d6e2ee70a 100644 --- a/indra/llimage/llimagepng.h +++ b/indra/llimage/llimagepng.h @@ -47,9 +47,6 @@ public: /*virtual*/ BOOL updateData(); /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); - -private: - U8* mTmpWriteBuffer; }; #endif |