aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llimage')
-rw-r--r--linden/indra/llimage/llimage.cpp41
-rw-r--r--linden/indra/llimage/llimage.h2
-rw-r--r--linden/indra/llimage/llimagej2c.cpp16
-rw-r--r--linden/indra/llimage/llimagej2c.h4
4 files changed, 20 insertions, 43 deletions
diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp
index b846606..fccd7b3 100644
--- a/linden/indra/llimage/llimage.cpp
+++ b/linden/indra/llimage/llimage.cpp
@@ -310,42 +310,15 @@ BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
310 // Should do some simple bounds checking 310 // Should do some simple bounds checking
311 311
312 U32 i; 312 U32 i;
313 U32 to_offset; 313 for (i = 0; i < height; i++)
314 U32 from_offset;
315 if (!reverse_y)
316 { 314 {
317 for (i = 0; i < height; i++) 315 const U32 row = reverse_y ? height - 1 - i : i;
318 { 316 const U32 from_offset = row * ((stride == 0) ? width*getComponents() : stride);
319 to_offset = (y_pos + i)*getWidth() + x_pos; 317 const U32 to_offset = (y_pos + i)*getWidth() + x_pos;
320 if (stride != 0) 318 memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */
321 { 319 data + from_offset, getComponents()*width);
322 from_offset = i*stride;
323 }
324 else
325 {
326 from_offset = i*width*getComponents();
327 }
328 memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */
329 data + from_offset, getComponents()*width);
330 }
331 }
332 else
333 {
334 for (i = 0; i < height; i++)
335 {
336 to_offset = (y_pos + i)*getWidth() + x_pos;
337 if (stride != 0)
338 {
339 from_offset = (height - 1 - i)*stride;
340 }
341 else
342 {
343 from_offset = (height - 1 - i)*width*getComponents();
344 }
345 memcpy(getData() + to_offset*getComponents(), /* Flawfinder: ignore */
346 data + from_offset, getComponents()*width);
347 }
348 } 320 }
321
349 return TRUE; 322 return TRUE;
350} 323}
351 324
diff --git a/linden/indra/llimage/llimage.h b/linden/indra/llimage/llimage.h
index cd559ec..e706c0a 100644
--- a/linden/indra/llimage/llimage.h
+++ b/linden/indra/llimage/llimage.h
@@ -116,7 +116,7 @@ public:
116 116
117 static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels); 117 static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels);
118 118
119 // Function for calculating the download priority for textes 119 // Function for calculating the download priority for textures
120 // <= 0 priority means that there's no need for more data. 120 // <= 0 priority means that there's no need for more data.
121 static F32 calc_download_priority(F32 virtual_size, F32 visible_area, S32 bytes_sent); 121 static F32 calc_download_priority(F32 virtual_size, F32 visible_area, S32 bytes_sent);
122 122
diff --git a/linden/indra/llimage/llimagej2c.cpp b/linden/indra/llimage/llimagej2c.cpp
index b116027..305b11d 100644
--- a/linden/indra/llimage/llimagej2c.cpp
+++ b/linden/indra/llimage/llimagej2c.cpp
@@ -152,7 +152,9 @@ void LLImageJ2C::closeDSO()
152LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), 152LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
153 mMaxBytes(0), 153 mMaxBytes(0),
154 mRawDiscardLevel(-1), 154 mRawDiscardLevel(-1),
155 mRate(0.0f) 155 mRate(0.0f),
156 mReversible(FALSE)
157
156{ 158{
157 //We assume here that if we wanted to destory via 159 //We assume here that if we wanted to destory via
158 //a dynamic library that the approriate open calls were made 160 //a dynamic library that the approriate open calls were made
@@ -272,7 +274,7 @@ BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time)
272BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time) 274BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time)
273{ 275{
274 LLMemType mt1((LLMemType::EMemType)mMemType); 276 LLMemType mt1((LLMemType::EMemType)mMemType);
275 return mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time); 277 return mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible);
276} 278}
277 279
278//static 280//static
@@ -341,11 +343,11 @@ void LLImageJ2C::setMaxBytes(S32 max_bytes)
341{ 343{
342 mMaxBytes = max_bytes; 344 mMaxBytes = max_bytes;
343} 345}
344// NOT USED 346
345// void LLImageJ2C::setReversible(const BOOL reversible) 347void LLImageJ2C::setReversible(const BOOL reversible)
346// { 348{
347// mReversible = reversible; 349 mReversible = reversible;
348// } 350}
349 351
350 352
351BOOL LLImageJ2C::loadAndValidate(const LLString &filename) 353BOOL LLImageJ2C::loadAndValidate(const LLString &filename)
diff --git a/linden/indra/llimage/llimagej2c.h b/linden/indra/llimage/llimagej2c.h
index 63ebe38..00cb919 100644
--- a/linden/indra/llimage/llimagej2c.h
+++ b/linden/indra/llimage/llimagej2c.h
@@ -79,6 +79,7 @@ protected:
79 S32 mMaxBytes; // Maximum number of bytes of data to use... 79 S32 mMaxBytes; // Maximum number of bytes of data to use...
80 S8 mRawDiscardLevel; 80 S8 mRawDiscardLevel;
81 F32 mRate; 81 F32 mRate;
82 BOOL mReversible;
82 LLImageJ2CImpl *mImpl; 83 LLImageJ2CImpl *mImpl;
83}; 84};
84 85
@@ -100,7 +101,8 @@ protected:
100 // true: decoding complete (even if it failed) 101 // true: decoding complete (even if it failed)
101 // false: time expired while decoding 102 // false: time expired while decoding
102 virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0; 103 virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0;
103 virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0) = 0; 104 virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
105 BOOL reversible=FALSE) = 0;
104 106
105 friend class LLImageJ2C; 107 friend class LLImageJ2C;
106}; 108};