SFML community forums

General => Feature requests => Topic started by: grok on January 27, 2015, 01:21:10 pm

Title: Image::SetPixel, is the last one post-increment really needed?
Post by: grok on January 27, 2015, 01:21:10 pm
Hi.
Out of curiosity,  is the last post-increment really needed in the code below?
void Image::setPixel(unsigned int x, unsigned int y, const Color& color)
{
Uint8* pixel = &m_pixels[(x + y * m_size.x) * 4];
*pixel++ = color.r;
*pixel++ = color.g;
*pixel++ = color.b;
*pixel++ = color.a; //this one
}
 

Please don't throw rocks at me, I know it has almost nothing to do with the optimization, but anyway...
Title: Re: Image::SetPixel, is the last one post-increment really needed?
Post by: Laurent on January 27, 2015, 02:57:33 pm
No, it is not needed.