Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Small correction to src/Graphics/Image.cpp  (Read 2452 times)

0 Members and 1 Guest are viewing this topic.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Small correction to src/Graphics/Image.cpp
« on: May 22, 2013, 05:52:35 pm »
Starting at line 236:
Quote
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;
}
The operator marked in red serves no purpose in this function.
Sorry.. ;D
Back to C++ gamedev with SFML in May 2023

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Small correction to src/Graphics/Image.cpp
« Reply #1 on: May 22, 2013, 06:14:52 pm »
Yeah... and the compiler is certainly smart enough to generate no code for it ;)
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Small correction to src/Graphics/Image.cpp
« Reply #2 on: May 22, 2013, 06:23:51 pm »
Yeah, but since you accepted the trimming-whitespaces-from-empty-lines patch I guessed why not troll about that too.. :P
Back to C++ gamedev with SFML in May 2023

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Small correction to src/Graphics/Image.cpp
« Reply #3 on: May 22, 2013, 06:46:01 pm »
Sure, let's troll about that ;)
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Small correction to src/Graphics/Image.cpp
« Reply #4 on: May 23, 2013, 03:25:34 am »
Only thing I'm curious about: was that copy paste programming ;D?
Back to C++ gamedev with SFML in May 2023

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Small correction to src/Graphics/Image.cpp
« Reply #5 on: May 23, 2013, 08:04:00 am »
No, I think it was intentional. It's more beautiful this way ;)
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Small correction to src/Graphics/Image.cpp
« Reply #6 on: May 23, 2013, 08:52:11 am »
Hehe ;) Cool. Feel free to lock this thread now. :P
Back to C++ gamedev with SFML in May 2023