diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-07-24 15:39:56 -0700 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-07-24 15:39:56 -0700 |
commit | b47dbc2acadb1fa478daf89dbc3d54225c6e4629 (patch) | |
tree | 9bc0cbf4795e1ebdfcb80848fea8ffe092b4983d /indra/llprimitive/llprimtexturelist.cpp | |
parent | 9c394b3aaecacc9a70354c544bd728a4f4f966d2 (diff) | |
parent | 90e25f6ba80b773117582d6a392037ac274fff39 (diff) |
Merge with an oldish change of mine
Diffstat (limited to 'indra/llprimitive/llprimtexturelist.cpp')
-rw-r--r-- | indra/llprimitive/llprimtexturelist.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index c9632ebdad..b02d4c50bd 100644 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -134,13 +134,12 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te) { if (S32(index) >= mEntryList.size()) { - // TODO -- assert here S32 current_size = mEntryList.size(); - llerrs << "index = " << S32(index) << " current_size = " << current_size << llendl; + llwarns << "ignore copy of index = " << S32(index) << " into texture entry list of size = " << current_size << llendl; return TEM_CHANGE_NONE; } - // we're changing an existing entry + // we're changing an existing entry llassert(mEntryList[index]); delete (mEntryList[index]); if (&te) @@ -386,8 +385,18 @@ void LLPrimTextureList::setSize(S32 new_size) mEntryList.resize(new_size); for (S32 index = current_size; index < new_size; ++index) { - LLTextureEntry* new_entry = LLPrimTextureList::newTextureEntry(); - mEntryList[index] = new_entry; + if (current_size > 0 + && mEntryList[current_size - 1]) + { + // copy the last valid entry for the new one + mEntryList[index] = mEntryList[current_size - 1]->newCopy(); + } + else + { + // no valid enries to copy, so we new one up + LLTextureEntry* new_entry = LLPrimTextureList::newTextureEntry(); + mEntryList[index] = new_entry; + } } } else if (new_size < current_size) |