diff options
author | andreykproductengine <akleshchev@productengine.com> | 2015-12-29 20:20:40 +0200 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2015-12-29 20:20:40 +0200 |
commit | c73d9e5c444c7a263cc3507b371b21d0219bad83 (patch) | |
tree | a8f3b94ba2a51a3eb9713d0f31827632f36c3fe8 /indra/llrender | |
parent | 6901fea2033663e16f7fe7ad2afcf0ba4654eef8 (diff) |
MAINT-5984 FIXED Incorrect cursor position with UI scale >1.0
Diffstat (limited to 'indra/llrender')
-rwxr-xr-x | indra/llrender/llfontgl.cpp | 26 | ||||
-rwxr-xr-x | indra/llrender/llfontgl.h | 9 |
2 files changed, 28 insertions, 7 deletions
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 53ca080d66..0e2946632a 100755 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -94,26 +94,33 @@ BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, F32 vert_dp static LLTrace::BlockTimerStatHandle FTM_RENDER_FONTS("Fonts"); -S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, +S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, + ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const +{ + LLRectf rect_float(rect.mLeft, rect.mTop, rect.mRight, rect.mBottom); + return render(wstr, begin_offset, rect_float, color, halign, valign, style, shadow, max_chars, right_x, use_ellipses); +} + +S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRectf& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const { - F32 x = (F32)rect.mLeft; + F32 x = rect.mLeft; F32 y = 0.f; switch(valign) { case TOP: - y = (F32)rect.mTop; + y = rect.mTop; break; case VCENTER: - y = (F32)rect.getCenterY(); + y = rect.getCenterY(); break; case BASELINE: case BOTTOM: - y = (F32)rect.mBottom; + y = rect.mBottom; break; default: - y = (F32)rect.mBottom; + y = rect.mBottom; break; } return render(wstr, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, rect.getWidth(), right_x, use_ellipses); @@ -357,7 +364,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if (right_x) { - *right_x = (cur_x - origin.mV[VX]) / sScaleX; + F32 cr_x = (cur_x - origin.mV[VX]) / sScaleX; + if (*right_x < cr_x) + { + // rightmost edge of previously drawn text, don't draw over previous text + *right_x = cr_x; + } } //FIXME: add underline as glyph? diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 0988e99deb..7d0e53f60f 100755 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -99,6 +99,15 @@ public: BOOL use_ellipses = FALSE) const; S32 render(const LLWString &text, S32 begin_offset, + const LLRectf& rect, + const LLColor4 &color, + HAlign halign = LEFT, VAlign valign = BASELINE, + U8 style = NORMAL, ShadowType shadow = NO_SHADOW, + S32 max_chars = S32_MAX, + F32* right_x=NULL, + BOOL use_ellipses = FALSE) const; + + S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign = LEFT, VAlign valign = BASELINE, |