diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index 8b9570055..7920b32b2 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -60,18 +60,24 @@ myPixelsFlipped (false) /// Copy constructor //////////////////////////////////////////////////////////// Image::Image(const Image& copy) : -Resource (copy), -myWidth (copy.myWidth), -myHeight (copy.myHeight), -myTextureWidth (copy.myTextureWidth), -myTextureHeight (copy.myTextureHeight), -myTexture (0), -myIsSmooth (copy.myIsSmooth), -myPixels (copy.myPixels), -myNeedTextureUpdate(false), -myNeedArrayUpdate (false), -myPixelsFlipped (copy.myPixelsFlipped) +Resource(copy) { + // First make sure that the source image is up-to-date + const_cast(copy).EnsureArrayUpdate(); + + // Copy all its members + myWidth = copy.myWidth; + myHeight = copy.myHeight; + myTextureWidth = copy.myTextureWidth; + myTextureHeight = copy.myTextureHeight; + myTexture = 0; + myIsSmooth = copy.myIsSmooth; + myPixels = copy.myPixels; + myNeedTextureUpdate = false; + myNeedArrayUpdate = false; + myPixelsFlipped = copy.myPixelsFlipped; + + // Create the texture CreateTexture(); }