MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / QueueCmdSetDrawColor

Function QueueCmdSetDrawColor

deps/SDL2/src/render/SDL_render.c:370–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370static int
371QueueCmdSetDrawColor(SDL_Renderer *renderer, const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a)
372{
373 const Uint32 color = ((a << 24) | (r << 16) | (g << 8) | b);
374 int retval = 0;
375
376 if (!renderer->color_queued || (color != renderer->last_queued_color)) {
377 SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
378 retval = -1;
379
380 if (cmd != NULL) {
381 cmd->command = SDL_RENDERCMD_SETDRAWCOLOR;
382 cmd->data.color.first = 0; /* render backend will fill this in. */
383 cmd->data.color.r = r;
384 cmd->data.color.g = g;
385 cmd->data.color.b = b;
386 cmd->data.color.a = a;
387 retval = renderer->QueueSetDrawColor(renderer, cmd);
388 if (retval < 0) {
389 cmd->command = SDL_RENDERCMD_NO_OP;
390 } else {
391 renderer->last_queued_color = color;
392 renderer->color_queued = SDL_TRUE;
393 }
394 }
395 }
396 return retval;
397}
398
399static int
400QueueCmdClear(SDL_Renderer *renderer)

Callers 1

PrepQueueCmdDrawFunction · 0.85

Calls 1

AllocateRenderCommandFunction · 0.85

Tested by

no test coverage detected