diff options
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r-- | indra/llui/lltextbase.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 1d358a0e9d..8c3b317838 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -401,8 +401,8 @@ std::vector<LLRect> LLTextBase::getSelectionRects() // Use F32 otherwise a string of multiple segments // will accumulate a large error - F32 left_precise = line_iter->mRect.mLeft; - F32 right_precise = line_iter->mRect.mLeft; + F32 left_precise = (F32)line_iter->mRect.mLeft; + F32 right_precise = (F32)line_iter->mRect.mLeft; for (; segment_iter != mSegments.end(); ++segment_iter, segment_offset = 0) { @@ -448,8 +448,8 @@ std::vector<LLRect> LLTextBase::getSelectionRects() } LLRect selection_rect; - selection_rect.mLeft = left_precise; - selection_rect.mRight = right_precise; + selection_rect.mLeft = (S32)left_precise; + selection_rect.mRight = (S32)right_precise; selection_rect.mBottom = line_iter->mRect.mBottom; selection_rect.mTop = line_iter->mRect.mTop; @@ -598,7 +598,7 @@ void LLTextBase::drawCursor() // Make sure the IME is in the right place LLRect screen_pos = calcScreenRect(); - LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_rect.mLeft), screen_pos.mBottom + llfloor(cursor_rect.mTop) ); + LLCoordGL ime_pos( screen_pos.mLeft + cursor_rect.mLeft, screen_pos.mBottom + cursor_rect.mTop ); ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]); ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]); @@ -755,9 +755,9 @@ void LLTextBase::drawText() line_end = next_start; } - 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 + LLRectf text_rect((F32)line.mRect.mLeft, (F32)line.mRect.mTop, (F32)line.mRect.mRight, (F32)line.mRect.mBottom); + text_rect.mRight = (F32)mDocumentView->getRect().getWidth(); // clamp right edge to document extents + text_rect.translate((F32)mDocumentView->getRect().mLeft, (F32)mDocumentView->getRect().mBottom); // adjust by scroll position // draw a single line of text S32 seg_start = line_start; @@ -802,13 +802,13 @@ void LLTextBase::drawText() S32 squiggle_start = 0, squiggle_end = 0, pony = 0; cur_segment->getDimensions(seg_start - cur_segment->getStart(), misspell_start - seg_start, squiggle_start, pony); cur_segment->getDimensions(misspell_start - cur_segment->getStart(), misspell_end - misspell_start, squiggle_end, pony); - squiggle_start += text_rect.mLeft; + squiggle_start += (S32)text_rect.mLeft; pony = (squiggle_end + 3) / 6; squiggle_start += squiggle_end / 2 - pony * 3; squiggle_end = squiggle_start + pony * 6; - S32 squiggle_bottom = text_rect.mBottom + (S32)cur_segment->getStyle()->getFont()->getDescenderHeight(); + S32 squiggle_bottom = (S32)text_rect.mBottom + (S32)cur_segment->getStyle()->getFont()->getDescenderHeight(); gGL.color4ub(255, 0, 0, 200); while (squiggle_start + 1 < squiggle_end) @@ -1674,7 +1674,7 @@ void LLTextBase::reflow() segment_set_t::iterator seg_iter = mSegments.begin(); S32 seg_offset = 0; S32 line_start_index = 0; - const F32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin + const F32 text_available_width = (F32)(mVisibleTextRect.getWidth() - mHPad); // reserve room for margin F32 remaining_pixels = text_available_width; S32 line_count = 0; @@ -1881,7 +1881,7 @@ S32 LLTextBase::getLineNumFromDocIndex( S32 doc_index, bool include_wordwrap) co line_list_t::const_iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), doc_index, line_end_compare()); if (include_wordwrap) { - return iter - mLineInfoList.begin(); + return (S32)(iter - mLineInfoList.begin()); } else { @@ -1918,7 +1918,7 @@ S32 LLTextBase::getFirstVisibleLine() const // binary search for line that starts before top of visible buffer line_list_t::const_iterator iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mTop, compare_bottom()); - return iter - mLineInfoList.begin(); + return (S32)(iter - mLineInfoList.begin()); } std::pair<S32, S32> LLTextBase::getVisibleLines(bool require_fully_visible) @@ -1940,7 +1940,7 @@ std::pair<S32, S32> LLTextBase::getVisibleLines(bool require_fully_visible) first_iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mTop, compare_bottom()); last_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mBottom, compare_top()); } - return std::pair<S32, S32>(first_iter - mLineInfoList.begin(), last_iter - mLineInfoList.begin()); + return std::pair<S32, S32>((S32)(first_iter - mLineInfoList.begin()), (S32)(last_iter - mLineInfoList.begin())); } @@ -2608,7 +2608,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, } S32 pos = getLength(); - F32 start_x = line_iter->mRect.mLeft + doc_rect.mLeft; + F32 start_x = (F32)(line_iter->mRect.mLeft + doc_rect.mLeft); segment_set_t::iterator line_seg_iter; S32 line_seg_offset; @@ -2626,7 +2626,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, if(newline) { - pos = segment_line_start + segmentp->getOffset(local_x - start_x, line_seg_offset, segment_line_length, round); + pos = segment_line_start + segmentp->getOffset(local_x - (S32)start_x, line_seg_offset, segment_line_length, round); break; } @@ -2656,7 +2656,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, } else { - offset = segmentp->getOffset(local_x - start_x, line_seg_offset, segment_line_length, round); + offset = segmentp->getOffset(local_x - (S32)start_x, line_seg_offset, segment_line_length, round); } pos = segment_line_start + offset; break; @@ -2703,7 +2703,7 @@ LLRect LLTextBase::getDocRectFromDocIndex(S32 pos) const getSegmentAndOffset(line_iter->mDocIndexStart, &line_seg_iter, &line_seg_offset); getSegmentAndOffset(pos, &cursor_seg_iter, &cursor_seg_offset); - F32 doc_left_precise = line_iter->mRect.mLeft; + F32 doc_left_precise = (F32)line_iter->mRect.mLeft; while(line_seg_iter != mSegments.end()) { @@ -2734,7 +2734,7 @@ LLRect LLTextBase::getDocRectFromDocIndex(S32 pos) const } LLRect doc_rect; - doc_rect.mLeft = doc_left_precise; + doc_rect.mLeft = (S32)doc_left_precise; doc_rect.mBottom = line_iter->mRect.mBottom; doc_rect.mTop = line_iter->mRect.mTop; @@ -3720,7 +3720,7 @@ bool LLInlineViewSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& w } else { - width = mLeftPad + mRightPad + mView->getRect().getWidth(); + width = (F32)(mLeftPad + mRightPad + mView->getRect().getWidth()); height = mBottomPad + mTopPad + mView->getRect().getHeight(); } @@ -3871,10 +3871,10 @@ F32 LLImageTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 select S32 style_image_width = image->getWidth(); // Text is drawn from the top of the draw_rect downward - S32 text_center = draw_rect.mTop - (draw_rect.getHeight() / 2); + S32 text_center = (S32)(draw_rect.mTop - (draw_rect.getHeight() / 2.f)); // Align image to center of draw rect S32 image_bottom = text_center - (style_image_height / 2); - image->draw(draw_rect.mLeft, image_bottom, + image->draw((S32)draw_rect.mLeft, image_bottom, style_image_width, style_image_height, color); const S32 IMAGE_HPAD = 3; |