Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outline vertices are only updated if there is an outline. #925

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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