diff options
author | Jacek Antonelli | 2008-08-15 23:45:59 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:59 -0500 |
commit | 6e91a9cc3d5a610198cf526a76e2ab642f10ecd7 (patch) | |
tree | b023869f9daa7f61ea3ab27112d37524bdd88de4 /linden/indra/llimage/llimage.cpp | |
parent | Second Life viewer sources 1.20.12 (diff) | |
download | meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.zip meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.gz meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.bz2 meta-impy-6e91a9cc3d5a610198cf526a76e2ab642f10ecd7.tar.xz |
Second Life viewer sources 1.20.13
Diffstat (limited to 'linden/indra/llimage/llimage.cpp')
-rw-r--r-- | linden/indra/llimage/llimage.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp index 508be01..52a210f 100644 --- a/linden/indra/llimage/llimage.cpp +++ b/linden/indra/llimage/llimage.cpp | |||
@@ -147,7 +147,6 @@ U8* LLImageBase::allocateData(S32 size) | |||
147 | mData = new U8[size]; | 147 | mData = new U8[size]; |
148 | if (!mData) | 148 | if (!mData) |
149 | { | 149 | { |
150 | //llerrs << "allocate image data: " << size << llendl; | ||
151 | llwarns << "allocate image data: " << size << llendl; | 150 | llwarns << "allocate image data: " << size << llendl; |
152 | size = 0 ; | 151 | size = 0 ; |
153 | mWidth = mHeight = 0 ; | 152 | mWidth = mHeight = 0 ; |
@@ -245,8 +244,10 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components) | |||
245 | : LLImageBase() | 244 | : LLImageBase() |
246 | { | 245 | { |
247 | mMemType = LLMemType::MTYPE_IMAGERAW; | 246 | mMemType = LLMemType::MTYPE_IMAGERAW; |
248 | allocateDataSize(width, height, components); | 247 | if(allocateDataSize(width, height, components)) |
249 | memcpy(getData(), data, width*height*components); | 248 | { |
249 | memcpy(getData(), data, width*height*components); | ||
250 | } | ||
250 | ++sRawImageCount; | 251 | ++sRawImageCount; |
251 | } | 252 | } |
252 | 253 | ||
@@ -797,7 +798,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) | |||
797 | } | 798 | } |
798 | 799 | ||
799 | 800 | ||
800 | void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) | 801 | BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) |
801 | { | 802 | { |
802 | LLMemType mt1((LLMemType::EMemType)mMemType); | 803 | LLMemType mt1((LLMemType::EMemType)mMemType); |
803 | llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); | 804 | llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); |
@@ -807,7 +808,7 @@ void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) | |||
807 | 808 | ||
808 | if( (old_width == new_width) && (old_height == new_height) ) | 809 | if( (old_width == new_width) && (old_height == new_height) ) |
809 | { | 810 | { |
810 | return; // Nothing to do. | 811 | return TRUE; // Nothing to do. |
811 | } | 812 | } |
812 | 813 | ||
813 | // Reallocate the data buffer. | 814 | // Reallocate the data buffer. |
@@ -842,8 +843,10 @@ void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) | |||
842 | U8* temp_buffer = new U8[ temp_data_size ]; | 843 | U8* temp_buffer = new U8[ temp_data_size ]; |
843 | if (!temp_buffer) | 844 | if (!temp_buffer) |
844 | { | 845 | { |
845 | llerrs << "Out of memory in LLImageRaw::scale: old (w, h, c) = (" << old_width << ", " << old_height << ", " << (S32)getComponents() << | 846 | llwarns << "Out of memory in LLImageRaw::scale: old (w, h, c) = (" << old_width << ", " << old_height << ", " << (S32)getComponents() << |
846 | ") ; new (w, h, c) = (" << new_width << ", " << new_height << ", " << (S32)getComponents() << ")" << llendl; | 847 | ") ; new (w, h, c) = (" << new_width << ", " << new_height << ", " << (S32)getComponents() << ")" << llendl; |
848 | |||
849 | return FALSE ; | ||
847 | } | 850 | } |
848 | memcpy(temp_buffer, getData(), temp_data_size); /* Flawfinder: ignore */ | 851 | memcpy(temp_buffer, getData(), temp_data_size); /* Flawfinder: ignore */ |
849 | 852 | ||
@@ -871,6 +874,8 @@ void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) | |||
871 | // Clean up | 874 | // Clean up |
872 | delete[] temp_buffer; | 875 | delete[] temp_buffer; |
873 | } | 876 | } |
877 | |||
878 | return TRUE ; | ||
874 | } | 879 | } |
875 | 880 | ||
876 | void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ) | 881 | void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ) |