mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Partial revert from 40a0584636
This reverts the change to addLine(), which no longer had its outline drawn after the offending commit.
This commit is contained in:
parent
d950c9387a
commit
912422f486
@ -34,17 +34,17 @@
|
||||
namespace
|
||||
{
|
||||
// Add an underline or strikethrough line to the vertex array
|
||||
void addLine(sf::VertexArray& vertices, float lineLength, float lineTop, const sf::Color& color, float offset, float thickness)
|
||||
void addLine(sf::VertexArray& vertices, float lineLength, float lineTop, const sf::Color& color, float offset, float thickness, float outlineThickness = 0)
|
||||
{
|
||||
float top = std::floor(lineTop + offset - (thickness / 2) + 0.5f);
|
||||
float bottom = top + std::floor(thickness + 0.5f);
|
||||
|
||||
vertices.append(sf::Vertex(sf::Vector2f(0, top), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(lineLength, top), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(0, bottom), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(0, bottom), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(lineLength, top), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(lineLength, bottom), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(-outlineThickness, top - outlineThickness), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(lineLength + outlineThickness, top - outlineThickness), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(-outlineThickness, bottom + outlineThickness), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(-outlineThickness, bottom + outlineThickness), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(lineLength + outlineThickness, top - outlineThickness), color, sf::Vector2f(1, 1)));
|
||||
vertices.append(sf::Vertex(sf::Vector2f(lineLength + outlineThickness, bottom + outlineThickness), color, sf::Vector2f(1, 1)));
|
||||
}
|
||||
|
||||
// Add a glyph quad to the vertex array
|
||||
@ -459,7 +459,7 @@ void Text::ensureGeometryUpdate() const
|
||||
addLine(m_vertices, x, y, m_fillColor, underlineOffset, underlineThickness);
|
||||
|
||||
if (m_outlineThickness != 0)
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, underlineOffset, underlineThickness);
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, underlineOffset, underlineThickness, m_outlineThickness);
|
||||
}
|
||||
|
||||
// If we're using the strike through style and there's a new line, draw a line across all characters
|
||||
@ -468,7 +468,7 @@ void Text::ensureGeometryUpdate() const
|
||||
addLine(m_vertices, x, y, m_fillColor, strikeThroughOffset, underlineThickness);
|
||||
|
||||
if (m_outlineThickness != 0)
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, strikeThroughOffset, underlineThickness);
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, strikeThroughOffset, underlineThickness, m_outlineThickness);
|
||||
}
|
||||
|
||||
prevChar = curChar;
|
||||
@ -545,7 +545,7 @@ void Text::ensureGeometryUpdate() const
|
||||
addLine(m_vertices, x, y, m_fillColor, underlineOffset, underlineThickness);
|
||||
|
||||
if (m_outlineThickness != 0)
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, underlineOffset, underlineThickness);
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, underlineOffset, underlineThickness, m_outlineThickness);
|
||||
}
|
||||
|
||||
// If we're using the strike through style, add the last line across all characters
|
||||
@ -554,7 +554,7 @@ void Text::ensureGeometryUpdate() const
|
||||
addLine(m_vertices, x, y, m_fillColor, strikeThroughOffset, underlineThickness);
|
||||
|
||||
if (m_outlineThickness != 0)
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, strikeThroughOffset, underlineThickness);
|
||||
addLine(m_outlineVertices, x, y, m_outlineColor, strikeThroughOffset, underlineThickness, m_outlineThickness);
|
||||
}
|
||||
|
||||
// Update the bounding rectangle
|
||||
|
Loading…
Reference in New Issue
Block a user