From 61dcba363a80909a4ed32cbfddfd927a4e9ed574 Mon Sep 17 00:00:00 2001 From: Tyler Ellis Date: Sat, 3 Oct 2015 17:39:04 -0700 Subject: [PATCH] Update outline vertices only if there is an outline. --- src/SFML/Graphics/Shape.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index 5403b40483..c37f441d63 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -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); } @@ -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);