summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-12-29 20:20:40 +0200
committerandreykproductengine <akleshchev@productengine.com>2015-12-29 20:20:40 +0200
commitc73d9e5c444c7a263cc3507b371b21d0219bad83 (patch)
treea8f3b94ba2a51a3eb9713d0f31827632f36c3fe8 /indra/llui/lltextbase.cpp
parent6901fea2033663e16f7fe7ad2afcf0ba4654eef8 (diff)
MAINT-5984 FIXED Incorrect cursor position with UI scale >1.0
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rwxr-xr-xindra/llui/lltextbase.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index bf660849c4..4309e6557e 100755
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -673,7 +673,7 @@ void LLTextBase::drawText()
line_end = next_start;
}
- LLRect text_rect(line.mRect);
+ LLRectf text_rect(line.mRect.mLeft, line.mRect.mTop, line.mRect.mRight, line.mRect.mBottom);
text_rect.mRight = mDocumentView->getRect().getWidth(); // clamp right edge to document extents
text_rect.translate(mDocumentView->getRect().mLeft, mDocumentView->getRect().mBottom); // adjust by scroll position
@@ -746,7 +746,7 @@ void LLTextBase::drawText()
++misspell_it;
}
- text_rect.mLeft = (S32)(cur_segment->draw(seg_start - cur_segment->getStart(), clipped_end, selection_left, selection_right, text_rect));
+ text_rect.mLeft = cur_segment->draw(seg_start - cur_segment->getStart(), clipped_end, selection_left, selection_right, text_rect);
seg_start = clipped_end + cur_segment->getStart();
}
@@ -3030,7 +3030,7 @@ bool LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32
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) {}
-F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect) { return draw_rect.mLeft; }
+F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect) { return draw_rect.mLeft; }
bool LLTextSegment::canEdit() const { return false; }
void LLTextSegment::unlinkFromDocument(LLTextBase*) {}
void LLTextSegment::linkToDocument(LLTextBase*) {}
@@ -3096,7 +3096,7 @@ LLNormalTextSegment::~LLNormalTextSegment()
}
-F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
+F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
{
if( end - start > 0 )
{
@@ -3106,7 +3106,7 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec
}
// Draws a single text segment, reversing the color for selection if needed.
-F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect)
+F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRectf rect)
{
F32 alpha = LLViewDrawContext::getCurrentContext().mAlpha;
@@ -3138,7 +3138,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
&right_x,
mEditor.getUseEllipses());
}
- rect.mLeft = (S32)ceil(right_x);
+ rect.mLeft = right_x;
if( (selection_start < seg_end) && (selection_end > seg_start) )
{
@@ -3157,7 +3157,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
&right_x,
mEditor.getUseEllipses());
}
- rect.mLeft = (S32)ceil(right_x);
+ rect.mLeft = right_x;
if( selection_end < seg_end )
{
// Draw normally
@@ -3174,7 +3174,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
&right_x,
mEditor.getUseEllipses());
}
- return right_x;
+ return right_x;
}
BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask)
@@ -3405,7 +3405,7 @@ LLOnHoverChangeableTextSegment::LLOnHoverChangeableTextSegment( LLStyleConstSP s
mNormalStyle(normal_style){}
/*virtual*/
-F32 LLOnHoverChangeableTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
+F32 LLOnHoverChangeableTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
{
F32 result = LLNormalTextSegment::draw(start, end, selection_start, selection_end, draw_rect);
if (end == mEnd - mStart)
@@ -3483,7 +3483,7 @@ void LLInlineViewSegment::updateLayout(const LLTextBase& editor)
mView->setOrigin(start_rect.mLeft + mLeftPad, start_rect.mBottom + mBottomPad);
}
-F32 LLInlineViewSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
+F32 LLInlineViewSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
{
// return padded width of widget
// widget is actually drawn during mDocumentView's draw()
@@ -3524,7 +3524,7 @@ S32 LLLineBreakTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32
{
return 1;
}
-F32 LLLineBreakTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
+F32 LLLineBreakTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
{
return draw_rect.mLeft;
}
@@ -3590,7 +3590,7 @@ void LLImageTextSegment::setToolTip(const std::string& tooltip)
mTooltip = tooltip;
}
-F32 LLImageTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
+F32 LLImageTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
{
if ( (start >= 0) && (end <= mEnd - mStart))
{