Skip to content

Commit

Permalink
Update outline vertices only if there is an outline.
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerellis21 committed Oct 4, 2015
1 parent da8a325 commit 61dcba3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/SFML/Graphics/Shape.cpp
Expand Up @@ -219,11 +219,8 @@ void Shape::draw(RenderTarget& target, RenderStates states) const
target.draw(m_vertices, states);

// Render the outline
if (m_outlineThickness != 0)
{
states.texture = NULL;
target.draw(m_outlineVertices, states);
}
states.texture = NULL;
target.draw(m_outlineVertices, states);
}


Expand Down Expand Up @@ -251,6 +248,14 @@ void Shape::updateTexCoords()
////////////////////////////////////////////////////////////
void Shape::updateOutline()
{
// Return if there is no outline to build.
if (m_outlineThickness == 0.f)
{
m_outlineVertices.clear();
m_bounds = m_insideBounds;
return;
}

std::size_t count = m_vertices.getVertexCount() - 2;
m_outlineVertices.resize((count + 1) * 2);

Expand Down

0 comments on commit 61dcba3

Please sign in to comment.