diff options
author | simon <none@none> | 2014-03-26 10:04:53 -0700 |
---|---|---|
committer | simon <none@none> | 2014-03-26 10:04:53 -0700 |
commit | 33dfc0a8a1ed56d7d24611981736fd5baf6b03c2 (patch) | |
tree | 5dfdbcede0d8c689e796cf65ebc21bb149c17b8e /indra/llimage/llimage.cpp | |
parent | 00a325ccb90b1c6800ec78e1211b5097d9c27a58 (diff) | |
parent | 5c20e06dbd0845e2d45daae610c43fc89e24028f (diff) |
Pull in downstream -bear, viewer-release and become version 3.7.5
Diffstat (limited to 'indra/llimage/llimage.cpp')
-rwxr-xr-x | indra/llimage/llimage.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index c8a05e1fae..55609deb2b 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -230,7 +230,7 @@ const U8* LLImageBase::getData() const { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + llwarns << "Bad memory allocation for the image buffer!" << llendl ; } return mData; @@ -240,7 +240,7 @@ U8* LLImageBase::getData() { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + llwarns << "Bad memory allocation for the image buffer!" << llendl ; } return mData; @@ -293,7 +293,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_c { setDataAndSize(data, width, height, components); } - else if(allocateDataSize(width, height, components)) + else if(allocateDataSize(width, height, components) && getData()) { memcpy(getData(), data, width*height*components); } @@ -431,6 +431,11 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) // Reverses the order of the rows in the image void LLImageRaw::verticalFlip() { + if (!getData()) + { + return; + } + S32 row_bytes = getWidth() * getComponents(); llassert(row_bytes > 0); std::vector<U8> line_buffer(row_bytes); @@ -666,6 +671,11 @@ void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) // Fill the buffer with a constant color void LLImageRaw::fill( const LLColor4U& color ) { + if (!getData()) + { + return; + } + S32 pixels = getWidth() * getHeight(); if( 4 == getComponents() ) { @@ -867,6 +877,11 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) { + if (!getData()) + { + return FALSE; + } + llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); S32 old_width = getWidth(); @@ -901,7 +916,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) copyLineScaled( &temp_buffer[0] + (getComponents() * old_width * row), new_buffer + (getComponents() * new_width * row), old_width, new_width, 1, 1 ); } } - else + else if (getData()) { // copy out existing image data S32 temp_data_size = old_width * old_height * getComponents(); @@ -1478,7 +1493,7 @@ void LLImageFormatted::sanityCheck() BOOL LLImageFormatted::copyData(U8 *data, S32 size) { - if ( data && ((data != getData()) || (size != getDataSize())) ) + if ( data && getData() && ((data != getData()) || (size != getDataSize())) ) { deleteData(); allocateData(size); @@ -1564,6 +1579,11 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) BOOL LLImageFormatted::save(const std::string &filename) { + if (!getData()) + { + return FALSE; + } + resetLastError(); LLAPRFile outfile ; |