summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagedxt.cpp
diff options
context:
space:
mode:
authorRick Pasetto <rick@lindenlab.com>2009-11-06 13:09:48 -0800
committerRick Pasetto <rick@lindenlab.com>2009-11-06 13:09:48 -0800
commit78db8dd83b76466df83abc32d56aa74ac7b180f3 (patch)
tree369b4d8db3081fcf71a27572a00d310c7b9aaaf6 /indra/llimage/llimagedxt.cpp
parentd4f790f72866b43956ce4216bf6471c85f4afc6c (diff)
parent3f8172707833f30d3c39d165c975bd3d97511080 (diff)
merge from remote repo
Diffstat (limited to 'indra/llimage/llimagedxt.cpp')
-rw-r--r--indra/llimage/llimagedxt.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp
index 1ce4517a0d..0aa6840ff6 100644
--- a/indra/llimage/llimagedxt.cpp
+++ b/indra/llimage/llimagedxt.cpp
@@ -264,6 +264,8 @@ void LLImageDXT::setFormat()
// virtual
BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time)
{
+ // *TODO: Test! This has been tweaked since its intial inception,
+ // but we don't use it any more!
llassert_always(raw_image);
if (mFileFormat >= FORMAT_DXT1 && mFileFormat <= FORMAT_DXR5)
@@ -274,8 +276,17 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time)
S32 width = getWidth(), height = getHeight();
S32 ncomponents = getComponents();
+ U8* data = NULL;
+ if (mDiscardLevel >= 0)
+ {
+ data = getData() + getMipOffset(mDiscardLevel);
+ calcDiscardWidthHeight(mDiscardLevel, mFileFormat, width, height);
+ }
+ else
+ {
+ data = getData() + getMipOffset(0);
+ }
S32 image_size = formatBytes(mFileFormat, width, height);
- U8* data = getData() + getMipOffset(0);
if ((!getData()) || (data + image_size > getData() + getDataSize()))
{
@@ -300,10 +311,8 @@ BOOL LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard)
llerrs << "Request for invalid discard level" << llendl;
}
U8* data = getData() + getMipOffset(discard);
- // I'm not sure these are the correct initial values for height and width,
- // but previously they were being used uninitialized. JC
- S32 width = raw->getWidth();
- S32 height = raw->getHeight();
+ S32 width = 0;
+ S32 height = 0;
calcDiscardWidthHeight(discard, mFileFormat, width, height);
raw = new LLImageRaw(data, width, height, getComponents());
return TRUE;