summaryrefslogtreecommitdiff
path: root/indra/llimage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llimage')
-rw-r--r--indra/llimage/llimage.cpp41
-rw-r--r--indra/llimage/llimage.h2
-rw-r--r--indra/llimage/llimagej2c.cpp16
-rw-r--r--indra/llimage/llimagej2c.h4
4 files changed, 20 insertions, 43 deletions
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;
};