aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llimage/llimage.cpp41
1 files changed, 7 insertions, 34 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