Fixed invalid iterator access in sf::Image (introduced in last modification)

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1766 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-12-30 19:14:59 +00:00
parent 030600ac07
commit 3cf2281988

View File

@ -182,8 +182,8 @@ bool Image::Create(unsigned int width, unsigned int height, const Color& color)
myPixels.resize(width * height * 4);
// Fill it with the specified color
Uint8* ptr = &*myPixels.begin();
Uint8* end = &*myPixels.end();
Uint8* ptr = &myPixels[0];
Uint8* end = ptr + myPixels.size();
while (ptr < end)
{
*ptr++ = color.r;
@ -211,8 +211,8 @@ void Image::CreateMaskFromColor(const Color& color, Uint8 alpha)
if (!myPixels.empty())
{
// Replace the alpha of the pixels that match the transparent color
Uint8* ptr = &*myPixels.begin();
Uint8* end = &*myPixels.end();
Uint8* ptr = &myPixels[0];
Uint8* end = ptr + myPixels.size();
while (ptr < end)
{
if ((ptr[0] == color.r) && (ptr[1] == color.g) && (ptr[2] == color.b) && (ptr[3] == color.a))