Merge pull request #266 from adamharrison/QuickOptimization

Replaced fill loop with SDL_FillRect.
This commit is contained in:
Adam 2021-06-12 22:53:14 -04:00 committed by GitHub
commit 804429e3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -309,7 +309,8 @@ void ren_draw_rect(RenRect rect, RenColor color) {
int dr = surface->w - (x2 - x1); int dr = surface->w - (x2 - x1);
if (color.a == 0xff) { if (color.a == 0xff) {
rect_draw_loop(color); SDL_Rect rect = { x1, y1, x2 - x1, y2 - y1 };
SDL_FillRect(surface, &rect, SDL_MapRGBA(surface->format, color.r, color.g, color.b, color.a));
} else { } else {
rect_draw_loop(blend_pixel(*d, color)); rect_draw_loop(blend_pixel(*d, color));
} }