mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
render: avoid a couple redundant memcmp calls in all drawing functions. Improves performance slightly.
This commit is contained in:
parent
e8278d0d5b
commit
1be03b4089
@ -410,14 +410,17 @@ QueueCmdClear(SDL_Renderer *renderer)
|
|||||||
static int
|
static int
|
||||||
PrepQueueCmdDraw(SDL_Renderer *renderer, const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a)
|
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;
|
int retval = 0;
|
||||||
if (retval == 0) {
|
if (retval == 0 && !renderer->color_queued) {
|
||||||
retval = QueueCmdSetDrawColor(renderer, r, g, b, a);
|
retval = QueueCmdSetDrawColor(renderer, r, g, b, a);
|
||||||
}
|
}
|
||||||
if (retval == 0) {
|
if (retval == 0 && !renderer->viewport_queued) {
|
||||||
retval = QueueCmdSetViewport(renderer);
|
retval = QueueCmdSetViewport(renderer);
|
||||||
}
|
}
|
||||||
if (retval == 0) {
|
if (retval == 0 && !renderer->cliprect_queued) {
|
||||||
retval = QueueCmdSetClipRect(renderer);
|
retval = QueueCmdSetClipRect(renderer);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
Loading…
Reference in New Issue
Block a user