diff options
author | Richard Nelson <none@none> | 2010-07-30 15:17:32 -0700 |
---|---|---|
committer | Richard Nelson <none@none> | 2010-07-30 15:17:32 -0700 |
commit | d72a21aca1b9692941c066b7aaca69952c27de68 (patch) | |
tree | eb5edc9a7533e528a4a95fa7e00d6176b741a88c /indra/llui/lltextbase.cpp | |
parent | 76a9c1214fd371bdccf11857156d318cd21ae8bd (diff) |
further UI rendering performance improvements
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r-- | indra/llui/lltextbase.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 4bcf7e6980..cde08c7b19 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1495,24 +1495,32 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) { + static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment(); + if (index > getLength()) { return mSegments.end(); } // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } //FIXME: avoid operator new somehow (without running into refcount problems) - segment_set_t::iterator it = mSegments.upper_bound(new LLIndexSegment(index)); + index_segment->setStart(index); + index_segment->setEnd(index); + segment_set_t::iterator it = mSegments.upper_bound(index_segment); return it; } LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 index) const { + static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment(); + if (index > getLength()) { return mSegments.end(); } // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } - LLTextBase::segment_set_t::const_iterator it = mSegments.upper_bound(new LLIndexSegment(index)); + index_segment->setStart(index); + index_segment->setEnd(index); + LLTextBase::segment_set_t::const_iterator it = mSegments.upper_bound(index_segment); return it; } |