forked from organicmaps/organicmaps
aligning every glyph in StraightTextElement to pixel boundary for non-blurry rendering of GUI elements.
This commit is contained in:
parent
3446dc455a
commit
336b6c2c1d
4 changed files with 15 additions and 7 deletions
|
@ -70,11 +70,11 @@ namespace yg
|
|||
|
||||
if (desc.m_isMasked)
|
||||
{
|
||||
drawTextImpl(m_glyphLayout, screen, m, false, desc, yg::maxDepth - 1);
|
||||
drawTextImpl(m_glyphLayout, screen, m, false, false, desc, yg::maxDepth - 1);
|
||||
desc.m_isMasked = false;
|
||||
}
|
||||
|
||||
drawTextImpl(m_glyphLayout, screen, m, false, desc, yg::maxDepth);
|
||||
drawTextImpl(m_glyphLayout, screen, m, false, false, desc, yg::maxDepth);
|
||||
}
|
||||
|
||||
void PathTextElement::setPivot(m2::PointD const & pivot)
|
||||
|
|
|
@ -271,14 +271,14 @@ namespace yg
|
|||
for (unsigned i = 0; i < m_glyphLayouts.size(); ++i)
|
||||
{
|
||||
if (m_glyphLayouts[i].fontDesc().m_isMasked)
|
||||
drawTextImpl(m_glyphLayouts[i], screen, m, true, m_glyphLayouts[i].fontDesc(), yg::maxDepth - 1);
|
||||
drawTextImpl(m_glyphLayouts[i], screen, m, true, true, m_glyphLayouts[i].fontDesc(), yg::maxDepth - 1);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < m_glyphLayouts.size(); ++i)
|
||||
{
|
||||
yg::FontDesc fontDesc = m_glyphLayouts[i].fontDesc();
|
||||
fontDesc.m_isMasked = false;
|
||||
drawTextImpl(m_glyphLayouts[i], screen, m, true, fontDesc, yg::maxDepth);
|
||||
drawTextImpl(m_glyphLayouts[i], screen, m, true, true, fontDesc, yg::maxDepth);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ namespace yg
|
|||
gl::OverlayRenderer * screen,
|
||||
math::Matrix<double, 3, 3> const & m,
|
||||
bool doTransformPivotOnly,
|
||||
bool doAlignPivot,
|
||||
FontDesc const & fontDesc,
|
||||
double depth) const
|
||||
{
|
||||
|
@ -113,12 +114,18 @@ namespace yg
|
|||
|
||||
if (doTransformPivotOnly)
|
||||
{
|
||||
#ifdef USING_GLSL
|
||||
m2::PointD offsPt = offs + elem.m_pt;
|
||||
m2::PointD fullPt = pv + offs + elem.m_pt;
|
||||
|
||||
offsPt.x -= fullPt.x - floor(fullPt.x);
|
||||
offsPt.y -= fullPt.y - floor(fullPt.y);
|
||||
|
||||
screen->drawStraightGlyph(pv, offsPt, glyphStyle, depth);
|
||||
#else
|
||||
glyphPt = pv + offs + elem.m_pt;
|
||||
glyphAngle = elem.m_angle;
|
||||
|
||||
#ifdef USING_GLSL
|
||||
screen->drawStraightGlyph(pv, offs + elem.m_pt, glyphStyle, depth);
|
||||
#else
|
||||
screen->drawGlyph(glyphPt, m2::PointD(0.0, 0.0), glyphAngle, 0, glyphStyle, depth);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace yg
|
|||
gl::OverlayRenderer * r,
|
||||
math::Matrix<double, 3, 3> const & m,
|
||||
bool doTransformPivotOnly,
|
||||
bool doAlignPivot,
|
||||
FontDesc const & desc,
|
||||
double depth) const;
|
||||
strings::UniString const & logText() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue