diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llimage/llimagedxt.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/llimage/llimagedxt.cpp')
-rw-r--r-- | linden/indra/llimage/llimagedxt.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/linden/indra/llimage/llimagedxt.cpp b/linden/indra/llimage/llimagedxt.cpp index 8b16f97..6676366 100644 --- a/linden/indra/llimage/llimagedxt.cpp +++ b/linden/indra/llimage/llimagedxt.cpp | |||
@@ -279,13 +279,12 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) | |||
279 | } | 279 | } |
280 | 280 | ||
281 | raw_image->resize(width, height, ncomponents); | 281 | raw_image->resize(width, height, ncomponents); |
282 | memcpy(raw_image->getData(), data, image_size); | 282 | memcpy(raw_image->getData(), data, image_size); /* Flawfinder: ignore */ |
283 | 283 | ||
284 | return TRUE; | 284 | return TRUE; |
285 | } | 285 | } |
286 | 286 | ||
287 | // virtual | 287 | BOOL LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) |
288 | BOOL LLImageDXT::requestDecodedData(LLPointer<LLImageRaw>& raw, S32 discard, F32 decode_time) | ||
289 | { | 288 | { |
290 | if (discard < 0) | 289 | if (discard < 0) |
291 | { | 290 | { |
@@ -302,11 +301,6 @@ BOOL LLImageDXT::requestDecodedData(LLPointer<LLImageRaw>& raw, S32 discard, F32 | |||
302 | return TRUE; | 301 | return TRUE; |
303 | } | 302 | } |
304 | 303 | ||
305 | void LLImageDXT::releaseDecodedData() | ||
306 | { | ||
307 | // nothing to do | ||
308 | } | ||
309 | |||
310 | BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mips) | 304 | BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mips) |
311 | { | 305 | { |
312 | llassert_always(raw_image); | 306 | llassert_always(raw_image); |
@@ -373,7 +367,7 @@ BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mip | |||
373 | S32 bytes = formatBytes(format, w, h); | 367 | S32 bytes = formatBytes(format, w, h); |
374 | if (mip==0) | 368 | if (mip==0) |
375 | { | 369 | { |
376 | memcpy(mipdata, raw_image->getData(), bytes); | 370 | memcpy(mipdata, raw_image->getData(), bytes); /* Flawfinder: ignore */ |
377 | } | 371 | } |
378 | else if (explicit_mips) | 372 | else if (explicit_mips) |
379 | { | 373 | { |
@@ -425,21 +419,27 @@ bool LLImageDXT::convertToDXR() | |||
425 | S32 total_bytes = getDataSize(); | 419 | S32 total_bytes = getDataSize(); |
426 | U8* olddata = getData(); | 420 | U8* olddata = getData(); |
427 | U8* newdata = new U8[total_bytes]; | 421 | U8* newdata = new U8[total_bytes]; |
422 | if (!newdata) | ||
423 | { | ||
424 | llerrs << "Out of memory in LLImageDXT::convertToDXR()" << llendl; | ||
425 | return false; | ||
426 | } | ||
428 | llassert(total_bytes > 0); | 427 | llassert(total_bytes > 0); |
429 | memset(newdata, 0, total_bytes); | 428 | memset(newdata, 0, total_bytes); |
430 | memcpy(newdata, olddata, mHeaderSize); | 429 | memcpy(newdata, olddata, mHeaderSize); /* Flawfinder: ignore */ |
431 | for (S32 mip=0; mip<nmips; mip++) | 430 | for (S32 mip=0; mip<nmips; mip++) |
432 | { | 431 | { |
433 | S32 bytes = formatBytes(mFileFormat, width, height); | 432 | S32 bytes = formatBytes(mFileFormat, width, height); |
434 | S32 newoffset = getMipOffset(mip); | 433 | S32 newoffset = getMipOffset(mip); |
435 | S32 oldoffset = mHeaderSize + (total_bytes - newoffset - bytes); | 434 | S32 oldoffset = mHeaderSize + (total_bytes - newoffset - bytes); |
436 | memcpy(newdata + newoffset, olddata + oldoffset, bytes); | 435 | memcpy(newdata + newoffset, olddata + oldoffset, bytes); /* Flawfinder: ignore */ |
437 | width >>= 1; | 436 | width >>= 1; |
438 | height >>= 1; | 437 | height >>= 1; |
439 | } | 438 | } |
440 | dxtfile_header_t* header = (dxtfile_header_t*)newdata; | 439 | dxtfile_header_t* header = (dxtfile_header_t*)newdata; |
441 | header->pixel_fmt.fourcc = getFourCC(newformat); | 440 | header->pixel_fmt.fourcc = getFourCC(newformat); |
442 | setData(newdata, total_bytes); | 441 | setData(newdata, total_bytes); |
442 | updateData(); | ||
443 | return true; | 443 | return true; |
444 | } | 444 | } |
445 | 445 | ||
@@ -487,7 +487,7 @@ void LLImageDXT::extractMip(const U8 *indata, U8* mipdata, int width, int height | |||
487 | for (int h=0;h<mip_height;++h) | 487 | for (int h=0;h<mip_height;++h) |
488 | { | 488 | { |
489 | int start_offset = initial_offset + line_width * h + line_offset; | 489 | int start_offset = initial_offset + line_width * h + line_offset; |
490 | memcpy(mipdata + mip_line_width*h, indata + start_offset, mip_line_width); | 490 | memcpy(mipdata + mip_line_width*h, indata + start_offset, mip_line_width); /* Flawfinder: ignore */ |
491 | } | 491 | } |
492 | } | 492 | } |
493 | 493 | ||