From 3cf228198849ea2b8b4f3bb087e243947bf584bf Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Thu, 30 Dec 2010 19:14:59 +0000 Subject: [PATCH] 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 --- src/SFML/Graphics/Image.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index baf3d750a..46170cde5 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -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))