From 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:50 -0500 Subject: Second Life viewer sources 1.14.0.0 --- linden/indra/llimage/llimagedxt.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'linden/indra/llimage/llimagedxt.cpp') 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) } raw_image->resize(width, height, ncomponents); - memcpy(raw_image->getData(), data, image_size); + memcpy(raw_image->getData(), data, image_size); /* Flawfinder: ignore */ return TRUE; } -// virtual -BOOL LLImageDXT::requestDecodedData(LLPointer& raw, S32 discard, F32 decode_time) +BOOL LLImageDXT::getMipData(LLPointer& raw, S32 discard) { if (discard < 0) { @@ -302,11 +301,6 @@ BOOL LLImageDXT::requestDecodedData(LLPointer& raw, S32 discard, F32 return TRUE; } -void LLImageDXT::releaseDecodedData() -{ - // nothing to do -} - BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mips) { llassert_always(raw_image); @@ -373,7 +367,7 @@ BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time, bool explicit_mip S32 bytes = formatBytes(format, w, h); if (mip==0) { - memcpy(mipdata, raw_image->getData(), bytes); + memcpy(mipdata, raw_image->getData(), bytes); /* Flawfinder: ignore */ } else if (explicit_mips) { @@ -425,21 +419,27 @@ bool LLImageDXT::convertToDXR() S32 total_bytes = getDataSize(); U8* olddata = getData(); U8* newdata = new U8[total_bytes]; + if (!newdata) + { + llerrs << "Out of memory in LLImageDXT::convertToDXR()" << llendl; + return false; + } llassert(total_bytes > 0); memset(newdata, 0, total_bytes); - memcpy(newdata, olddata, mHeaderSize); + memcpy(newdata, olddata, mHeaderSize); /* Flawfinder: ignore */ for (S32 mip=0; mip>= 1; height >>= 1; } dxtfile_header_t* header = (dxtfile_header_t*)newdata; header->pixel_fmt.fourcc = getFourCC(newformat); setData(newdata, total_bytes); + updateData(); return true; } @@ -487,7 +487,7 @@ void LLImageDXT::extractMip(const U8 *indata, U8* mipdata, int width, int height for (int h=0;h