Fixed copy constructor in sf::Image (didn't properly copy the pixels when the source image was a RenderImage)

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1228 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-10-03 14:48:54 +00:00
parent 668f8d3db8
commit 9483ecdfef

View File

@ -60,18 +60,24 @@ myPixelsFlipped (false)
/// Copy constructor /// Copy constructor
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Image::Image(const Image& copy) : Image::Image(const Image& copy) :
Resource<Image> (copy), Resource<Image>(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)
{ {
// First make sure that the source image is up-to-date
const_cast<Image&>(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(); CreateTexture();
} }