summaryrefslogtreecommitdiff
path: root/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
authorChristian Goetze <cg@lindenlab.com>2007-08-21 22:17:53 +0000
committerChristian Goetze <cg@lindenlab.com>2007-08-21 22:17:53 +0000
commitce0a5fe14590b8d675b885fccd5f79d7ea17a302 (patch)
tree3388e6f8ff02292ec4521d278c841801462945b8 /indra/llimage/llimage.cpp
parentb699ae454d8477d19342d320758cd993d1d28cec (diff)
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
Diffstat (limited to 'indra/llimage/llimage.cpp')
-rw-r--r--indra/llimage/llimage.cpp41
1 files changed, 7 insertions, 34 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;
}