Skip to content

Commit

Permalink
render: avoid a couple redundant memcmp calls in all drawing function…
Browse files Browse the repository at this point in the history
…s. Improves performance slightly.
  • Loading branch information
slime73 committed Aug 18, 2019
1 parent e8278d0 commit 1be03b4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/render/SDL_render.c
Expand Up @@ -410,14 +410,17 @@ QueueCmdClear(SDL_Renderer *renderer)
static int
PrepQueueCmdDraw(SDL_Renderer *renderer, const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a)
{
/* Guarantee that the draw color, viewport, and clip rect are set before
* draws, so the backends don't have to worry about that state not being
* valid at draw time. */
int retval = 0;
if (retval == 0) {
if (retval == 0 && !renderer->color_queued) {
retval = QueueCmdSetDrawColor(renderer, r, g, b, a);
}
if (retval == 0) {
if (retval == 0 && !renderer->viewport_queued) {
retval = QueueCmdSetViewport(renderer);
}
if (retval == 0) {
if (retval == 0 && !renderer->cliprect_queued) {
retval = QueueCmdSetClipRect(renderer);
}
return retval;
Expand Down

0 comments on commit 1be03b4

Please sign in to comment.