From ce0a5fe14590b8d675b885fccd5f79d7ea17a302 Mon Sep 17 00:00:00 2001 From: Christian Goetze Date: Tue, 21 Aug 2007 22:17:53 +0000 Subject: EFFECTIVE MERGE: svn merge -r 66133:68118 svn+ssh://svn/svn/linden/branches/maintenance into release Actual action: branched maintenance-r68118, merged in release, then copied result into release --- indra/llimage/llimage.cpp | 41 +++++++---------------------------------- indra/llimage/llimage.h | 2 +- indra/llimage/llimagej2c.cpp | 16 +++++++++------- indra/llimage/llimagej2c.h | 4 +++- 4 files changed, 20 insertions(+), 43 deletions(-) (limited to 'indra/llimage') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 5ef3e9de3b..1ea0ac2714 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -290,42 +290,15 @@ BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, // Should do some simple bounds checking U32 i; - U32 to_offset; - U32 from_offset; - if (!reverse_y) + for (i = 0; i < height; i++) { - for (i = 0; i < height; i++) - { - to_offset = (y_pos + i)*getWidth() + x_pos; - if (stride != 0) - { - from_offset = i*stride; - } - else - { - from_offset = i*width*getComponents(); - } - memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */ - data + from_offset, getComponents()*width); - } - } - else - { - for (i = 0; i < height; i++) - { - to_offset = (y_pos + i)*getWidth() + x_pos; - if (stride != 0) - { - from_offset = (height - 1 - i)*stride; - } - else - { - from_offset = (height - 1 - i)*width*getComponents(); - } - memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */ - data + from_offset, getComponents()*width); - } + const U32 row = reverse_y ? height - 1 - i : i; + const U32 from_offset = row * ((stride == 0) ? width*getComponents() : stride); + const U32 to_offset = (y_pos + i)*getWidth() + x_pos; + memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */ + data + from_offset, getComponents()*width); } + return TRUE; } diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 99e60c48a8..5ffed9fbb1 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -96,7 +96,7 @@ public: static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels); - // Function for calculating the download priority for textes + // Function for calculating the download priority for textures // <= 0 priority means that there's no need for more data. static F32 calc_download_priority(F32 virtual_size, F32 visible_area, S32 bytes_sent); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 398e7c9e32..1f345e9d04 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -132,7 +132,9 @@ void LLImageJ2C::closeDSO() LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mMaxBytes(0), mRawDiscardLevel(-1), - mRate(0.0f) + mRate(0.0f), + mReversible(FALSE) + { //We assume here that if we wanted to destory via //a dynamic library that the approriate open calls were made @@ -252,7 +254,7 @@ BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time) BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time) { LLMemType mt1((LLMemType::EMemType)mMemType); - return mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time); + return mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible); } //static @@ -321,11 +323,11 @@ void LLImageJ2C::setMaxBytes(S32 max_bytes) { mMaxBytes = max_bytes; } -// NOT USED -// void LLImageJ2C::setReversible(const BOOL reversible) -// { -// mReversible = reversible; -// } + +void LLImageJ2C::setReversible(const BOOL reversible) +{ + mReversible = reversible; +} BOOL LLImageJ2C::loadAndValidate(const LLString &filename) diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index 8a832677a3..08bb12b214 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -59,6 +59,7 @@ protected: S32 mMaxBytes; // Maximum number of bytes of data to use... S8 mRawDiscardLevel; F32 mRate; + BOOL mReversible; LLImageJ2CImpl *mImpl; }; @@ -80,7 +81,8 @@ protected: // true: decoding complete (even if it failed) // false: time expired while decoding virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0; - virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0) = 0; + virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, + BOOL reversible=FALSE) = 0; friend class LLImageJ2C; }; -- cgit v1.2.3