summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNicky <none@none>2013-08-14 01:00:41 +0200
committerNicky <none@none>2013-08-14 01:00:41 +0200
commite7bc0e6e6388481db1ef98407021f83870dc6351 (patch)
tree67b035837e37beb65424770ff56ed4e0efa5806d /indra
parent6505ddb204082a0d327fb09210f2811be265e706 (diff)
BUG-3605 / CHUIBUG-197 Don't create excessive amounts of string objects in LLNormalTextSegment::getNumChars.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llui/lltextbase.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 0276ade3e1..3c284b3f03 100755
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3250,7 +3250,7 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin
: LLFontGL::ONLY_WORD_BOUNDARIES;
- LLWString offsetString(text.c_str() + segment_offset + mStart);
+ S32 offsetLength = text.length() - (segment_offset + mStart);
if(getLength() < segment_offset + mStart)
{
@@ -3258,13 +3258,13 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin
<< segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << "\tmax_chars\t" << max_chars << llendl;
}
- if(offsetString.length() + 1 < max_chars)
+ if( (offsetLength + 1) < max_chars)
{
- llinfos << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetString.length() << " getLength() : "
+ llinfos << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetLength:\t" << offsetLength << " getLength() : "
<< getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << llendl;
}
- S32 num_chars = mStyle->getFont()->maxDrawableChars(offsetString.c_str(),
+ S32 num_chars = mStyle->getFont()->maxDrawableChars( text.c_str() + (segment_offset + mStart),
(F32)num_pixels,
max_chars,
word_wrap_style);