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

From 3f7f6f624b06c5a193b5649fd983b87a90ca363c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 11 Sep 2024 13:25:00 -0700
Subject: [PATCH] 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.
---
 test/testcolorspace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/testcolorspace.c b/test/testcolorspace.c
index f04defaac8fb0..53ddb8e8ff900 100644
--- a/test/testcolorspace.c
+++ b/test/testcolorspace.c
@@ -157,6 +157,9 @@ static SDL_bool ReadPixel(int x, int y, SDL_Color *c)
 
     surface = SDL_RenderReadPixels(renderer, &r);
     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)) {
             result = SDL_TRUE;
         } else {