mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
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:
parent
030600ac07
commit
3cf2281988
@ -182,8 +182,8 @@ bool Image::Create(unsigned int width, unsigned int height, const Color& color)
|
|||||||
myPixels.resize(width * height * 4);
|
myPixels.resize(width * height * 4);
|
||||||
|
|
||||||
// Fill it with the specified color
|
// Fill it with the specified color
|
||||||
Uint8* ptr = &*myPixels.begin();
|
Uint8* ptr = &myPixels[0];
|
||||||
Uint8* end = &*myPixels.end();
|
Uint8* end = ptr + myPixels.size();
|
||||||
while (ptr < end)
|
while (ptr < end)
|
||||||
{
|
{
|
||||||
*ptr++ = color.r;
|
*ptr++ = color.r;
|
||||||
@ -211,8 +211,8 @@ void Image::CreateMaskFromColor(const Color& color, Uint8 alpha)
|
|||||||
if (!myPixels.empty())
|
if (!myPixels.empty())
|
||||||
{
|
{
|
||||||
// Replace the alpha of the pixels that match the transparent color
|
// Replace the alpha of the pixels that match the transparent color
|
||||||
Uint8* ptr = &*myPixels.begin();
|
Uint8* ptr = &myPixels[0];
|
||||||
Uint8* end = &*myPixels.end();
|
Uint8* end = ptr + myPixels.size();
|
||||||
while (ptr < end)
|
while (ptr < end)
|
||||||
{
|
{
|
||||||
if ((ptr[0] == color.r) && (ptr[1] == color.g) && (ptr[2] == color.b) && (ptr[3] == color.a))
|
if ((ptr[0] == color.r) && (ptr[1] == color.g) && (ptr[2] == color.b) && (ptr[3] == color.a))
|
||||||
|
Loading…
Reference in New Issue
Block a user