sdl12-compat: overlay: use nearest-neighbor scaling for YUV overlay rendering.

From 19f67e2e5c987526ea1c1b6c4d361f87494b6ad2 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 26 Aug 2022 11:30:11 -0400
Subject: [PATCH] overlay: use nearest-neighbor scaling for YUV overlay
 rendering.

Classic SDL 1.2 appears to scale YUV overlays with nearest as well, so
testoverlay2 becomes blocky, whereas previously sdl12-compat was making it
blurry.
---
 src/SDL12_compat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 02794a82..4a3c73fd 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -7097,6 +7097,7 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format12, SDL12_Surface *display12)
        rendering anyhow, we always make an SDL_Texture in here and draw over the screen pixels, in hopes that the GPU
        gives us a boost here. */
 
+    const char *old_scale_quality = SDL20_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
     SDL12_Overlay *retval = NULL;
     SDL12_YUVData *hwdata = NULL;
     Uint32 format20 = 0;
@@ -7150,7 +7151,9 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format12, SDL12_Surface *display12)
         hwdata->pitches[0] = w * 2;
     }
 
+    SDL20_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
     hwdata->texture20 = SDL20_CreateTexture(VideoRenderer20, format20, SDL_TEXTUREACCESS_STREAMING, w, h);
+    SDL20_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, old_scale_quality);
     if (!hwdata->texture20) {
         SDL20_free(hwdata->pixelbuf);
         SDL20_free(retval);