From 323aa4e3e7cb399b14dbe716fd3ae6cd69f13cac Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Wed, 1 May 2013 09:50:57 +0200 Subject: [PATCH] Fixed Shape::setTextureRect not working when called before setTexture --- src/SFML/Graphics/Shape.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index d72d1ce8e..16524f5e9 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -63,9 +63,12 @@ Shape::~Shape() //////////////////////////////////////////////////////////// void Shape::setTexture(const Texture* texture, bool resetRect) { - // Recompute the texture area if requested, or if there was no texture before - if (texture && (resetRect || !m_texture)) - setTextureRect(IntRect(0, 0, texture->getSize().x, texture->getSize().y)); + if (texture) + { + // Recompute the texture area if requested, or if there was no texture & rect before + if (resetRect || (!m_texture && (m_textureRect == sf::IntRect()))) + setTextureRect(IntRect(0, 0, texture->getSize().x, texture->getSize().y)); + } // Assign the new texture m_texture = texture;