Merge branch 'V2MultiWear' of git://github.com/siana/SingularityViewer into V2MultiWear

This commit is contained in:
Lirusaito
2012-07-03 08:44:10 -04:00

View File

@@ -1282,6 +1282,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
return true ; //abort. return true ; //abort.
} }
} }
resetFormattedData();
cur_size = 0;
} }
mRequestedSize = mDesiredSize; mRequestedSize = mDesiredSize;
mRequestedDiscard = mDesiredDiscard; mRequestedDiscard = mDesiredDiscard;
@@ -1315,7 +1317,6 @@ bool LLTextureFetchWorker::doWork(S32 param)
LLImageBase::TYPE_AVATAR_BAKE == mType); LLImageBase::TYPE_AVATAR_BAKE == mType);
#endif #endif
if(cur_size > 0) offset--;
// Will call callbackHttpGet when curl request completes // Will call callbackHttpGet when curl request completes
std::vector<std::string> headers; std::vector<std::string> headers;
headers.push_back("Accept: image/x-j2c"); headers.push_back("Accept: image/x-j2c");
@@ -1460,14 +1461,11 @@ bool LLTextureFetchWorker::doWork(S32 param)
} }
U8* buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mBufferSize); U8* buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mBufferSize);
if (cur_size > 0) { if (cur_size > 0)
{
memcpy(buffer, mFormattedImage->getData(), cur_size); memcpy(buffer, mFormattedImage->getData(), cur_size);
mBufferSize--;
if(mRequestedSize == 1) mRequestedDiscard = 0;
else memcpy(buffer + cur_size, mBuffer+1, mRequestedSize-1); // append
} }
else memcpy(buffer + cur_size, mBuffer, mRequestedSize); // append memcpy(buffer + cur_size, mBuffer, mRequestedSize); // append
// NOTE: setData releases current data and owns new data (buffer) // NOTE: setData releases current data and owns new data (buffer)
mFormattedImage->setData(buffer, mBufferSize); mFormattedImage->setData(buffer, mBufferSize);
// delete temp data // delete temp data
@@ -1830,11 +1828,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
mBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size); mBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size);
buffer->readAfter(channels.in(), NULL, mBuffer, data_size); buffer->readAfter(channels.in(), NULL, mBuffer, data_size);
mBufferSize += data_size; mBufferSize += data_size;
if(mFormattedImage.notNull() && mFormattedImage->getDataSize() > 0 && data_size == 1) if (data_size < mRequestedSize && mRequestedDiscard == 0)
{
mHaveAllData = TRUE;
}
else if (data_size < mRequestedSize && mRequestedDiscard == 0)
{ {
mHaveAllData = TRUE; mHaveAllData = TRUE;
} }