SDL: testffmpeg: Only enable blending if we're using a texture format that supports it

From f91bde64d5898f2980bd30ff1d1a62ea8e848e69 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 12 Oct 2023 14:26:46 -0700
Subject: [PATCH] testffmpeg: Only enable blending if we're using a texture
 format that supports it

---
 test/testffmpeg.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/testffmpeg.c b/test/testffmpeg.c
index 962e1c32a84c..f5b3a7cc4aa2 100644
--- a/test/testffmpeg.c
+++ b/test/testffmpeg.c
@@ -119,9 +119,6 @@ static SDL_bool CreateWindowAndRenderer(Uint32 window_flags, const char *driver)
         SDL_Log("Created renderer %s\n", info.name);
     }
 
-    /* Use linear scaling in case the user resizes the window */
-    SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
-
 #ifdef HAVE_EGL
     if (useEGL) {
         const char *extensions = eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS);
@@ -446,7 +443,13 @@ static SDL_bool GetTextureForMemoryFrame(AVFrame *frame, SDL_Texture **texture)
         if (!*texture) {
             return SDL_FALSE;
         }
-        SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_BLEND);
+
+        if (frame_format == SDL_PIXELFORMAT_UNKNOWN || SDL_ISPIXELFORMAT_ALPHA(frame_format)) {
+            SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_BLEND);
+        } else {
+            SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_NONE);
+        }
+        SDL_SetTextureScaleMode(*texture, SDL_SCALEMODE_LINEAR);
     }
 
     switch (frame_format) {
@@ -530,6 +533,8 @@ static SDL_bool GetTextureForDRMFrame(AVFrame *frame, SDL_Texture **texture)
     if (!*texture) {
         return SDL_FALSE;
     }
+    SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_NONE);
+    SDL_SetTextureScaleMode(*texture, SDL_SCALEMODE_LINEAR);
 
     /* Bind the texture for importing */
     SDL_GL_BindTexture(*texture, NULL, NULL);