diff options
author | Nicky <none@none> | 2013-08-14 01:00:41 +0200 |
---|---|---|
committer | Nicky <none@none> | 2013-08-14 01:00:41 +0200 |
commit | e7bc0e6e6388481db1ef98407021f83870dc6351 (patch) | |
tree | 67b035837e37beb65424770ff56ed4e0efa5806d | |
parent | 6505ddb204082a0d327fb09210f2811be265e706 (diff) |
BUG-3605 / CHUIBUG-197 Don't create excessive amounts of string objects in LLNormalTextSegment::getNumChars.
-rwxr-xr-x | doc/contributions.txt | 2 | ||||
-rwxr-xr-x | indra/llui/lltextbase.cpp | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt index 9d65411563..ebd8e54fe8 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -905,6 +905,8 @@ Nicky Dasmijn MAINT-873 SUN-72 BUG-2432 + BUG-3605 + CHUIBUG-197 Nicky Perian OPEN-1 STORM-1087 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); |