diff options
Diffstat (limited to 'linden/indra/newview/lltexturefetch.cpp')
-rw-r--r-- | linden/indra/newview/lltexturefetch.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index 80b8b4d..24046cc 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2000&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2000&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2000-2008, Linden Research, Inc. | 7 | * Copyright (c) 2000-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -562,6 +562,14 @@ bool LLTextureFetchWorker::doWork(S32 param) | |||
562 | { | 562 | { |
563 | mFetchTimer.reset(); | 563 | mFetchTimer.reset(); |
564 | } | 564 | } |
565 | |||
566 | if (mImagePriority <= 0.0f) | ||
567 | { | ||
568 | if (mState < WRITE_TO_CACHE) | ||
569 | { | ||
570 | return true; // cancel request | ||
571 | } | ||
572 | } | ||
565 | 573 | ||
566 | if (mState == INIT) | 574 | if (mState == INIT) |
567 | { | 575 | { |
@@ -708,7 +716,7 @@ bool LLTextureFetchWorker::doWork(S32 param) | |||
708 | mFetcher->lockQueue(); | 716 | mFetcher->lockQueue(); |
709 | mFetcher->removeFromNetworkQueue(this); | 717 | mFetcher->removeFromNetworkQueue(this); |
710 | mFetcher->unlockQueue(); | 718 | mFetcher->unlockQueue(); |
711 | if (!mFormattedImage->getDataSize()) | 719 | if (mFormattedImage.isNull() || !mFormattedImage->getDataSize()) |
712 | { | 720 | { |
713 | // processSimulatorPackets() failed | 721 | // processSimulatorPackets() failed |
714 | // llwarns << "processSimulatorPackets() failed to load buffer" << llendl; | 722 | // llwarns << "processSimulatorPackets() failed to load buffer" << llendl; |
@@ -1050,17 +1058,22 @@ void LLTextureFetchWorker::removeFromCache() | |||
1050 | 1058 | ||
1051 | bool LLTextureFetchWorker::processSimulatorPackets() | 1059 | bool LLTextureFetchWorker::processSimulatorPackets() |
1052 | { | 1060 | { |
1061 | if (mFormattedImage.isNull() || mRequestedSize < 0) | ||
1062 | { | ||
1063 | // not sure how we got here, but not a valid state, abort! | ||
1064 | mFormattedImage = NULL; | ||
1065 | return true; | ||
1066 | } | ||
1067 | |||
1053 | if (mLastPacket >= mFirstPacket) | 1068 | if (mLastPacket >= mFirstPacket) |
1054 | { | 1069 | { |
1055 | llassert_always(mFormattedImage) ; | ||
1056 | S32 buffer_size = mFormattedImage->getDataSize(); | 1070 | S32 buffer_size = mFormattedImage->getDataSize(); |
1057 | for (S32 i = mFirstPacket; i<=mLastPacket; i++) | 1071 | for (S32 i = mFirstPacket; i<=mLastPacket; i++) |
1058 | { | 1072 | { |
1059 | llassert_always(mPackets[i]) ; | 1073 | llassert_always(mPackets[i]); |
1060 | buffer_size += mPackets[i]->mSize; | 1074 | buffer_size += mPackets[i]->mSize; |
1061 | } | 1075 | } |
1062 | bool have_all_data = mLastPacket >= mTotalPackets-1; | 1076 | bool have_all_data = mLastPacket >= mTotalPackets-1; |
1063 | llassert_always(mRequestedSize > 0); | ||
1064 | if (buffer_size >= mRequestedSize || have_all_data) | 1077 | if (buffer_size >= mRequestedSize || have_all_data) |
1065 | { | 1078 | { |
1066 | /// We have enough (or all) data | 1079 | /// We have enough (or all) data |
@@ -1227,7 +1240,12 @@ void LLTextureFetchWorker::callbackDecoded(bool success) | |||
1227 | 1240 | ||
1228 | bool LLTextureFetchWorker::decodeImage() | 1241 | bool LLTextureFetchWorker::decodeImage() |
1229 | { | 1242 | { |
1230 | llassert_always(mImageWorker); | 1243 | if(!mImageWorker) |
1244 | { | ||
1245 | //LLTextureFetchWorker is aborted, skip image decoding. | ||
1246 | return true ; | ||
1247 | } | ||
1248 | |||
1231 | bool res = true; | 1249 | bool res = true; |
1232 | if (mRawImage.isNull()) | 1250 | if (mRawImage.isNull()) |
1233 | { | 1251 | { |
@@ -1641,7 +1659,7 @@ void LLTextureFetch::sendRequestListToSimulators() | |||
1641 | S32 packet = req->mLastPacket + 1; | 1659 | S32 packet = req->mLastPacket + 1; |
1642 | gMessageSystem->nextBlockFast(_PREHASH_RequestImage); | 1660 | gMessageSystem->nextBlockFast(_PREHASH_RequestImage); |
1643 | gMessageSystem->addUUIDFast(_PREHASH_Image, req->mID); | 1661 | gMessageSystem->addUUIDFast(_PREHASH_Image, req->mID); |
1644 | gMessageSystem->addS8Fast(_PREHASH_DiscardLevel, (S8)req->mSimRequestedDiscard); | 1662 | gMessageSystem->addS8Fast(_PREHASH_DiscardLevel, (S8)req->mDesiredDiscard); |
1645 | gMessageSystem->addF32Fast(_PREHASH_DownloadPriority, req->mImagePriority); | 1663 | gMessageSystem->addF32Fast(_PREHASH_DownloadPriority, req->mImagePriority); |
1646 | gMessageSystem->addU32Fast(_PREHASH_Packet, packet); | 1664 | gMessageSystem->addU32Fast(_PREHASH_Packet, packet); |
1647 | gMessageSystem->addU8Fast(_PREHASH_Type, req->mType); | 1665 | gMessageSystem->addU8Fast(_PREHASH_Type, req->mType); |