summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-08-28 14:03:26 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-08-28 14:03:26 +0100
commita254ca8b442e0a17e7048b792fbba48c8db592ee (patch)
tree44d591046709d7b8331ab3e8657019326b14cdfe /indra/newview/llviewertexture.cpp
parente27efe894740c0c3c959115524ac49db9615262a (diff)
parent08cbed55ef5689fcc5a02dfb3b9afde15487036e (diff)
merge
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r--indra/newview/llviewertexture.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 6abd6f7b64..cd8dd54fa6 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1462,9 +1462,17 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
}
bool size_okay = true;
-
- U32 raw_width = mRawImage->getWidth() << mRawDiscardLevel;
- U32 raw_height = mRawImage->getHeight() << mRawDiscardLevel;
+
+ S32 discard_level = mRawDiscardLevel;
+ if (mRawDiscardLevel < 0)
+ {
+ LL_DEBUGS() << "Negative raw discard level when creating image: " << mRawDiscardLevel << LL_ENDL;
+ discard_level = 0;
+ }
+
+ U32 raw_width = mRawImage->getWidth() << discard_level;
+ U32 raw_height = mRawImage->getHeight() << discard_level;
+
if( raw_width > MAX_IMAGE_SIZE || raw_height > MAX_IMAGE_SIZE )
{
LL_INFOS() << "Width or height is greater than " << MAX_IMAGE_SIZE << ": (" << raw_width << "," << raw_height << ")" << LL_ENDL;
@@ -2081,7 +2089,9 @@ bool LLViewerFetchedTexture::updateFetch()
{
make_request = false;
}
- else if(mCachedRawImage.notNull() && (current_discard < 0 || current_discard > mCachedRawDiscardLevel))
+ else if(mCachedRawImage.notNull() // can be empty
+ && mCachedRawImageReady
+ && (current_discard < 0 || current_discard > mCachedRawDiscardLevel))
{
make_request = false;
switchToCachedImage(); //use the cached raw data first