SDL: Check for the sRGB color primaries rather than the transfer function

From 1457503bd2d90c68f028b980a66964a886fd8c69 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 28 Jul 2026 12:28:57 -0700
Subject: [PATCH] Check for the sRGB color primaries rather than the transfer
 function

---
 src/video/SDL_surface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
index 7074935c832e2..c3c77989f0e16 100644
--- a/src/video/SDL_surface.c
+++ b/src/video/SDL_surface.c
@@ -2834,7 +2834,7 @@ bool SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g
 
     if (bytes_per_pixel <= sizeof(pixel) &&
         !SDL_ISPIXELFORMAT_FOURCC(surface->format) &&
-        SDL_COLORSPACETRANSFER(surface->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
+        SDL_COLORSPACEPRIMARIES(surface->colorspace) == SDL_COLOR_PRIMARIES_BT709) {
         /* Fill the appropriate number of least-significant bytes of pixel,
          * leaving the most-significant bytes set to zero */
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -2913,7 +2913,7 @@ bool SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, flo
 
     if (SDL_BYTESPERPIXEL(surface->format) <= sizeof(Uint32) &&
         !SDL_ISPIXELFORMAT_FOURCC(surface->format) &&
-        SDL_COLORSPACETRANSFER(surface->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
+        SDL_COLORSPACEPRIMARIES(surface->colorspace) == SDL_COLOR_PRIMARIES_BT709) {
         Uint8 r8, g8, b8, a8;
 
         if (SDL_ReadSurfacePixel(surface, x, y, &r8, &g8, &b8, &a8)) {