diff options
Diffstat (limited to 'linden/indra/newview/llvlcomposition.cpp')
-rw-r--r-- | linden/indra/newview/llvlcomposition.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/linden/indra/newview/llvlcomposition.cpp b/linden/indra/newview/llvlcomposition.cpp index f2fa1e6..e0cb40d 100644 --- a/linden/indra/newview/llvlcomposition.cpp +++ b/linden/indra/newview/llvlcomposition.cpp | |||
@@ -269,6 +269,7 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, | |||
269 | 269 | ||
270 | // These have already been validated by generateComposition. | 270 | // These have already been validated by generateComposition. |
271 | U8* st_data[4]; | 271 | U8* st_data[4]; |
272 | S32 st_data_size[4]; // for debugging | ||
272 | 273 | ||
273 | for (S32 i = 0; i < 4; i++) | 274 | for (S32 i = 0; i < 4; i++) |
274 | { | 275 | { |
@@ -299,6 +300,7 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, | |||
299 | } | 300 | } |
300 | } | 301 | } |
301 | st_data[i] = mRawImages[i]->getData(); | 302 | st_data[i] = mRawImages[i]->getData(); |
303 | st_data_size[i] = mRawImages[i]->getDataSize(); | ||
302 | } | 304 | } |
303 | 305 | ||
304 | /////////////////////////////////////// | 306 | /////////////////////////////////////// |
@@ -413,9 +415,18 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, | |||
413 | for (U32 k = 0; k < tex_comps; k++) | 415 | for (U32 k = 0; k < tex_comps; k++) |
414 | { | 416 | { |
415 | // Linearly interpolate based on composition. | 417 | // Linearly interpolate based on composition. |
416 | F32 a = *(st_data[tex0] + st_offset); | 418 | if (st_offset >= st_data_size[tex0] || st_offset >= st_data_size[tex1]) |
417 | F32 b = *(st_data[tex1] + st_offset); | 419 | { |
418 | rawp[ offset ] = (U8)lltrunc( a + composition * (b - a) ); | 420 | // SJB: This shouldn't be happening, but does... Rounding error? |
421 | //llwarns << "offset 0 [" << tex0 << "] =" << st_offset << " >= size=" << st_data_size[tex0] << llendl; | ||
422 | //llwarns << "offset 1 [" << tex1 << "] =" << st_offset << " >= size=" << st_data_size[tex1] << llendl; | ||
423 | } | ||
424 | else | ||
425 | { | ||
426 | F32 a = *(st_data[tex0] + st_offset); | ||
427 | F32 b = *(st_data[tex1] + st_offset); | ||
428 | rawp[ offset ] = (U8)lltrunc( a + composition * (b - a) ); | ||
429 | } | ||
419 | offset++; | 430 | offset++; |
420 | st_offset++; | 431 | st_offset++; |
421 | } | 432 | } |