mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-12 22:38:13 +00:00
Implemented scRGB colorspace and HDR support on macOS
This commit is contained in:
@@ -295,6 +295,7 @@ static int FlushRenderCommands(SDL_Renderer *renderer)
|
||||
renderer->vertex_data_used = 0;
|
||||
renderer->render_command_generation++;
|
||||
renderer->color_queued = SDL_FALSE;
|
||||
renderer->color_scale_queued = SDL_FALSE;
|
||||
renderer->viewport_queued = SDL_FALSE;
|
||||
renderer->cliprect_queued = SDL_FALSE;
|
||||
return retval;
|
||||
@@ -481,6 +482,31 @@ static int QueueCmdSetDrawColor(SDL_Renderer *renderer, SDL_FColor *color)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int QueueCmdSetColorScale(SDL_Renderer *renderer)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
if (!renderer->color_scale_queued ||
|
||||
renderer->color_scale != renderer->last_queued_color_scale) {
|
||||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
retval = -1;
|
||||
|
||||
if (cmd) {
|
||||
cmd->command = SDL_RENDERCMD_SETCOLORSCALE;
|
||||
cmd->data.color.first = 0; /* render backend will fill this in. */
|
||||
cmd->data.color.color_scale = renderer->color_scale;
|
||||
retval = renderer->QueueSetColorScale(renderer, cmd);
|
||||
if (retval < 0) {
|
||||
cmd->command = SDL_RENDERCMD_NO_OP;
|
||||
} else {
|
||||
renderer->last_queued_color_scale = renderer->color_scale;
|
||||
renderer->color_scale_queued = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int QueueCmdClear(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
@@ -514,6 +540,10 @@ static SDL_RenderCommand *PrepQueueCmdDraw(SDL_Renderer *renderer, const SDL_Ren
|
||||
retval = QueueCmdSetDrawColor(renderer, color);
|
||||
}
|
||||
|
||||
if (retval == 0) {
|
||||
retval = QueueCmdSetColorScale(renderer);
|
||||
}
|
||||
|
||||
/* Set the viewport and clip rect directly before draws, so the backends
|
||||
* don't have to worry about that state not being valid at draw time. */
|
||||
if (retval == 0 && !renderer->viewport_queued) {
|
||||
|
Reference in New Issue
Block a user