diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llimage/llimagedxt.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/linden/indra/llimage/llimagedxt.cpp b/linden/indra/llimage/llimagedxt.cpp index 1ce4517..0aa6840 100644 --- a/linden/indra/llimage/llimagedxt.cpp +++ b/linden/indra/llimage/llimagedxt.cpp | |||
@@ -264,6 +264,8 @@ void LLImageDXT::setFormat() | |||
264 | // virtual | 264 | // virtual |
265 | BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) | 265 | BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) |
266 | { | 266 | { |
267 | // *TODO: Test! This has been tweaked since its intial inception, | ||
268 | // but we don't use it any more! | ||
267 | llassert_always(raw_image); | 269 | llassert_always(raw_image); |
268 | 270 | ||
269 | if (mFileFormat >= FORMAT_DXT1 && mFileFormat <= FORMAT_DXR5) | 271 | if (mFileFormat >= FORMAT_DXT1 && mFileFormat <= FORMAT_DXR5) |
@@ -274,8 +276,17 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) | |||
274 | 276 | ||
275 | S32 width = getWidth(), height = getHeight(); | 277 | S32 width = getWidth(), height = getHeight(); |
276 | S32 ncomponents = getComponents(); | 278 | S32 ncomponents = getComponents(); |
279 | U8* data = NULL; | ||
280 | if (mDiscardLevel >= 0) | ||
281 | { | ||
282 | data = getData() + getMipOffset(mDiscardLevel); | ||
283 | calcDiscardWidthHeight(mDiscardLevel, mFileFormat, width, height); | ||
284 | } | ||
285 | else | ||
286 | { | ||
287 | data = getData() + getMipOffset(0); | ||
288 | } | ||
277 | S32 image_size = formatBytes(mFileFormat, width, height); | 289 | S32 image_size = formatBytes(mFileFormat, width, height); |
278 | U8* data = getData() + getMipOffset(0); | ||
279 | 290 | ||
280 | if ((!getData()) || (data + image_size > getData() + getDataSize())) | 291 | if ((!getData()) || (data + image_size > getData() + getDataSize())) |
281 | { | 292 | { |
@@ -300,10 +311,8 @@ BOOL LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) | |||
300 | llerrs << "Request for invalid discard level" << llendl; | 311 | llerrs << "Request for invalid discard level" << llendl; |
301 | } | 312 | } |
302 | U8* data = getData() + getMipOffset(discard); | 313 | U8* data = getData() + getMipOffset(discard); |
303 | // I'm not sure these are the correct initial values for height and width, | 314 | S32 width = 0; |
304 | // but previously they were being used uninitialized. JC | 315 | S32 height = 0; |
305 | S32 width = raw->getWidth(); | ||
306 | S32 height = raw->getHeight(); | ||
307 | calcDiscardWidthHeight(discard, mFileFormat, width, height); | 316 | calcDiscardWidthHeight(discard, mFileFormat, width, height); |
308 | raw = new LLImageRaw(data, width, height, getComponents()); | 317 | raw = new LLImageRaw(data, width, height, getComponents()); |
309 | return TRUE; | 318 | return TRUE; |