testcolorspace: don't tonemap from HDR to SDR when reading pixels

Our source content is in the SDR range, so we don't need to tonemap when reading it back.
This commit is contained in:
Sam Lantinga 2024-09-11 13:25:00 -07:00
parent 4e43da684c
commit 3f7f6f624b
1 changed files with 3 additions and 0 deletions

View File

@ -157,6 +157,9 @@ static SDL_bool ReadPixel(int x, int y, SDL_Color *c)
surface = SDL_RenderReadPixels(renderer, &r); surface = SDL_RenderReadPixels(renderer, &r);
if (surface) { if (surface) {
/* Don't tonemap back to SDR, our source content was SDR */
SDL_SetStringProperty(SDL_GetSurfaceProperties(surface), SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING, "*=1");
if (SDL_ReadSurfacePixel(surface, 0, 0, &c->r, &c->g, &c->b, &c->a)) { if (SDL_ReadSurfacePixel(surface, 0, 0, &c->r, &c->g, &c->b, &c->a)) {
result = SDL_TRUE; result = SDL_TRUE;
} else { } else {