From 14dd503c8ac04ee89f1ea6da06ef003db840049b Mon Sep 17 00:00:00 2001 From: Maximilian Wagenbach Date: Fri, 26 Jan 2018 15:19:41 +0100 Subject: [PATCH] Generate shape outline vertices only if necessary. --- src/SFML/Graphics/Shape.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index c0d4f8215..24affe782 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -251,6 +251,14 @@ void Shape::updateTexCoords() //////////////////////////////////////////////////////////// void Shape::updateOutline() { + // Return if there is no outline + 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);