1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-12 14:09:43 +01:00

Fix two versions of FillRect() unnecessarily creating SDL_Rects

When you pass NULL in for the SDL_Rect* parameter to SDL_FillRect(), SDL
will automatically fill the entire surface with that color. There's no
need for us to create the SDL_Rect ourselves.
This commit is contained in:
Misa 2021-02-25 15:34:59 -08:00 committed by Ethan Lee
parent 163b85d206
commit e641063d68

View file

@ -360,16 +360,13 @@ void FillRect( SDL_Surface* _surface, const int _x, const int _y, const int _w,
void FillRect( SDL_Surface* _surface, const int r, int g, int b )
{
SDL_Rect rect = {0,0,Uint16(_surface->w) ,Uint16(_surface->h) };
Uint32 color;
color = SDL_MapRGB(_surface->format, r, g, b);
SDL_FillRect(_surface, &rect, color);
Uint32 color = SDL_MapRGB(_surface->format, r, g, b);
SDL_FillRect(_surface, NULL, color);
}
void FillRect( SDL_Surface* _surface, const int color )
{
SDL_Rect rect = {0,0,Uint16(_surface->w) ,Uint16(_surface->h) };
SDL_FillRect(_surface, &rect, color);
SDL_FillRect(_surface, NULL, color);
}
void FillRect( SDL_Surface* _surface, const int x, const int y, const int w, const int h, int rgba )