SDL: testclipboard: support both BMP and PNG clipboard images

From ec0e84fc0a528069c3aac86c55203644fce82a21 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 9 Oct 2025 10:03:02 -0700
Subject: [PATCH] testclipboard: support both BMP and PNG clipboard images

---
 test/testclipboard.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/testclipboard.c b/test/testclipboard.c
index 9fe4cba6a1ff5..85e887b6b8b73 100644
--- a/test/testclipboard.c
+++ b/test/testclipboard.c
@@ -113,7 +113,9 @@ static float PrintPrimarySelectionText(float x, float y)
 static float PrintClipboardImage(float x, float y, const char *mime_type)
 {
     /* We don't actually need to read this data each frame, but this is a simple example */
-    if (SDL_strcmp(mime_type, "image/png") == 0) {
+    bool isBMP = (SDL_strcmp(mime_type, "image/bmp") == 0);
+    bool isPNG = (SDL_strcmp(mime_type, "image/png") == 0);
+    if (isBMP || isPNG) {
         size_t size;
         void *data = SDL_GetClipboardData(mime_type, &size);
         if (data) {
@@ -121,7 +123,12 @@ static float PrintClipboardImage(float x, float y, const char *mime_type)
             bool rendered = false;
             SDL_IOStream *stream = SDL_IOFromConstMem(data, size);
             if (stream) {
-                SDL_Surface *surface = SDL_LoadPNG_IO(stream, false);
+                SDL_Surface *surface;
+                if (isBMP) {
+                    surface = SDL_LoadBMP_IO(stream, false);
+                } else {
+                    surface = SDL_LoadPNG_IO(stream, false);
+                }
                 if (surface) {
                     SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surface);
                     if (texture) {