mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
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:
parent
668f8d3db8
commit
9483ecdfef
@ -60,18 +60,24 @@ myPixelsFlipped (false)
|
||||
/// Copy constructor
|
||||
////////////////////////////////////////////////////////////
|
||||
Image::Image(const 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)
|
||||
Resource<Image>(copy)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user