From 742d30f7567c2de1d8183f97a896305bfabae7b1 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 29 Jan 2025 09:52:13 -0800
Subject: [PATCH] Don't render color images using grayscale composition
functions
---
src/SDL_ttf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index cb07a00d..aca390da 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -1250,7 +1250,7 @@ static bool Render_Line_##NAME(TTF_Font *font, SDL_Surface *textbuf, int xstart,
BLIT_GLYPH_BLENDED_OPAQUE_OPTIM(image, (Uint32 *)dst, srcskip, dstskip); \
} else if (IS_BLENDED) { \
BLIT_GLYPH_BLENDED_OPTIM(image, (Uint32 *)dst, srcskip, dstskip, fg_alpha); \
- } else { \
+ } else if (image->is_color == 0) { \
BLIT_GLYPH_OPTIM(image, dst, srcskip, dstskip); \
} \
} else if (IS_BLENDED && image->is_color) { \
@@ -1284,7 +1284,7 @@ static bool Render_Line_##NAME(TTF_Font *font, SDL_Surface *textbuf, int xstart,
BG_Blended_Opaque(&image_clipped, (Uint32 *)dst, srcskip, dstskip); \
} else if (IS_BLENDED) { \
BG_Blended(&image_clipped, (Uint32 *)dst, srcskip, dstskip, fg_alpha); \
- } else { \
+ } else if (image->is_color == 0) { \
BG(&image_clipped, dst, srcskip, dstskip); \
} \
} else if (IS_BLENDED && image->is_color) { \