SDL_image: Updated to set the SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING property on HDR images

From b6dd334648121a24d2e917713d9f78877bc89e39 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 2 Feb 2024 15:02:24 -0800
Subject: [PATCH] Updated to set the SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING
 property on HDR images

---
 src/IMG_avif.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/IMG_avif.c b/src/IMG_avif.c
index dce2f4a6..e650d0f4 100644
--- a/src/IMG_avif.c
+++ b/src/IMG_avif.c
@@ -449,6 +449,10 @@ SDL_Surface *IMG_LoadAVIF_RW(SDL_RWops *src)
             SDL_SetNumberProperty(props, SDL_PROP_SURFACE_COLORSPACE_NUMBER, colorspace);
             SDL_SetNumberProperty(props, SDL_PROP_SURFACE_MAXCLL_NUMBER, image->clli.maxCLL);
             SDL_SetNumberProperty(props, SDL_PROP_SURFACE_MAXFALL_NUMBER, image->clli.maxPALL);
+
+            // A good approximation to compress HDR content to SDR
+            // More complex tone mapping algorithms can be added and set by the caller in the future.
+            SDL_SetStringProperty(props, SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING, "*=0.2");
         }
     }