summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorrichard <none@none>2009-11-05 11:04:06 -0800
committerrichard <none@none>2009-11-05 11:04:06 -0800
commitd3d5965d8af250f76e143addcfb68b17390f483c (patch)
tree0f209c21c10fe775e582ce8a940a074af16dc458 /indra/llui
parent535a98ce163e37b3bc495489923413701ea67995 (diff)
parentbbbacf1c4d06e7a0b4a5f532565410496a72963a (diff)
merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lllocalcliprect.cpp3
-rw-r--r--indra/llui/lltextbase.cpp28
-rw-r--r--indra/llui/lltextbase.h6
3 files changed, 28 insertions, 9 deletions
diff --git a/indra/llui/lllocalcliprect.cpp b/indra/llui/lllocalcliprect.cpp
index 058b6ae178..43c21e250c 100644
--- a/indra/llui/lllocalcliprect.cpp
+++ b/indra/llui/lllocalcliprect.cpp
@@ -113,6 +113,9 @@ void LLScreenClipRect::updateScissorRegion()
{
if (sClipRectStack.empty()) return;
+ // finish any deferred calls in the old clipping region
+ gGL.flush();
+
LLRect rect = sClipRectStack.top();
stop_glerror();
S32 x,y,w,h;
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index e5aac0d5e7..97ba691341 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1108,7 +1108,7 @@ void LLTextBase::reflow(S32 start_index)
S32_MAX);
S32 segment_width, segment_height;
- segment->getDimensions(seg_offset, character_count, segment_width, segment_height);
+ bool force_newline = segment->getDimensions(seg_offset, character_count, segment_width, segment_height);
// grow line height as necessary based on reported height of this segment
line_height = llmax(line_height, segment_height);
remaining_pixels -= segment_width;
@@ -1153,6 +1153,18 @@ void LLTextBase::reflow(S32 start_index)
else
{
// subtract pixels used and increment segment
+ if (force_newline)
+ {
+ mLineInfoList.push_back(line_info(
+ line_start_index,
+ last_segment_char_on_line,
+ line_rect,
+ line_count));
+ line_start_index = segment->getStart() + seg_offset;
+ cur_top -= llround((F32)line_height * mLineSpacingMult) + mLineSpacingPixels;
+ line_height = 0;
+ remaining_pixels = text_width;
+ }
++seg_iter;
seg_offset = 0;
}
@@ -2124,7 +2136,7 @@ LLRect LLTextBase::getVisibleDocumentRect() const
LLTextSegment::~LLTextSegment()
{}
-void LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const { width = 0; height = 0; }
+bool LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const { width = 0; height = 0; return false;}
S32 LLTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const { return 0; }
S32 LLTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const { return 0; }
void LLTextSegment::updateLayout(const LLTextBase& editor) {}
@@ -2352,12 +2364,13 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip)
mTooltip = tooltip;
}
-void LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
+bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
{
LLWString text = mEditor.getWText();
height = mFontHeight;
width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
+ return num_chars >= 1 && text[mStart + num_chars - 1] == '\n';
}
S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const
@@ -2404,8 +2417,9 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin
// but not both
S32 last_char_in_run = mStart + segment_offset + num_chars;
// check length first to avoid indexing off end of string
- if (last_char_in_run >= mEditor.getLength()
- || text[last_char_in_run] == '\n')
+ if (last_char_in_run < mEnd
+ && (last_char_in_run >= mEditor.getLength()
+ || text[last_char_in_run] == '\n'))
{
num_chars++;
}
@@ -2444,7 +2458,7 @@ LLInlineViewSegment::~LLInlineViewSegment()
mView->die();
}
-void LLInlineViewSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
+bool LLInlineViewSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
{
if (first_char == 0 && num_chars == 0)
{
@@ -2458,6 +2472,8 @@ void LLInlineViewSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
width = mLeftPad + mRightPad + mView->getRect().getWidth();
height = mBottomPad + mTopPad + mView->getRect().getHeight();
}
+
+ return false;
}
S32 LLInlineViewSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 4cca522a23..8cae8fde22 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -370,7 +370,7 @@ public:
LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){};
virtual ~LLTextSegment();
- virtual void getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+ virtual bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
virtual S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
virtual S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
virtual void updateLayout(const class LLTextBase& editor);
@@ -421,7 +421,7 @@ public:
LLNormalTextSegment( const LLStyleSP& style, S32 start, S32 end, LLTextBase& editor );
LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
- /*virtual*/ void getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+ /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
/*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
/*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
/*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
@@ -474,7 +474,7 @@ public:
LLInlineViewSegment(const Params& p, S32 start, S32 end);
~LLInlineViewSegment();
- /*virtual*/ void getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
+ /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
/*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
/*virtual*/ void updateLayout(const class LLTextBase& editor);
/*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);