diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2009-11-06 06:52:24 +0000 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2009-11-06 06:52:24 +0000 |
commit | 35e200881c38eb6c1bfd1f14ef440d4bc4da8c74 (patch) | |
tree | 8fceb759ef8f8259fd574c398ac02965566a05ff /indra/llimage/llimagedxt.cpp | |
parent | 2f2bdd83d6e078fb6cdcbb0ba0a9eaa38d45cc90 (diff) |
merge QAR-1829: texture pipeline branch in viewer-2.0.0.3
Diffstat (limited to 'indra/llimage/llimagedxt.cpp')
-rw-r--r-- | indra/llimage/llimagedxt.cpp | 19 |
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; |