summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagepng.cpp
diff options
context:
space:
mode:
authorKent Quirk <q@lindenlab.com>2010-06-17 11:37:21 -0400
committerKent Quirk <q@lindenlab.com>2010-06-17 11:37:21 -0400
commitb770415b6a2f52946eafb99800af7409b900cd8e (patch)
tree11c6e9bdeee80d486445ea301e97742c00cdff7a /indra/llimage/llimagepng.cpp
parentbe72a10a89f98a5c7c372ecee3d839be2031b80a (diff)
parent7cc006347822a70f36175dc2627814a0eaeb9c0a (diff)
Merge (and resolve conflict) from q/viewer-release
Diffstat (limited to 'indra/llimage/llimagepng.cpp')
-rw-r--r--indra/llimage/llimagepng.cpp21
1 files changed, 6 insertions, 15 deletions
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;
}