BUG-3605 / CHUIBUG-197 Don't create excessive amounts of string objects in LLNormalTextSegment::getNumChars.

meow-7.2.2
Nicky 2013-08-14 01:00:41 +02:00
parent 6505ddb204
commit e7bc0e6e63
2 changed files with 6 additions and 4 deletions

View File

@ -905,6 +905,8 @@ Nicky Dasmijn
MAINT-873
SUN-72
BUG-2432
BUG-3605
CHUIBUG-197
Nicky Perian
OPEN-1
STORM-1087

View File

@ -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);