From 29655ede17005994f41730943b09aa74e1d6b4fd Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 5 Jan 2026 12:39:39 -0800
Subject: [PATCH] showimage/showanim: fill the entire background
This is needed in case the actual output size doesn't match the requested window size.
---
Xcode/showimage/showimage.xcodeproj/project.pbxproj | 10 ++++++++++
examples/showanim.c | 8 +++++---
examples/showimage.c | 10 ++++++----
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/Xcode/showimage/showimage.xcodeproj/project.pbxproj b/Xcode/showimage/showimage.xcodeproj/project.pbxproj
index ab7edc617..de7fed8ae 100644
--- a/Xcode/showimage/showimage.xcodeproj/project.pbxproj
+++ b/Xcode/showimage/showimage.xcodeproj/project.pbxproj
@@ -7,6 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
+ F31BA87D2F0C57B400646176 /* clock.png in Resources */ = {isa = PBXBuildFile; fileRef = F31BA87C2F0C57B400646176 /* clock.png */; };
+ F31BA87E2F0C57B400646176 /* clock.png in Resources */ = {isa = PBXBuildFile; fileRef = F31BA87C2F0C57B400646176 /* clock.png */; };
+ F31BA87F2F0C57B400646176 /* clock.png in Resources */ = {isa = PBXBuildFile; fileRef = F31BA87C2F0C57B400646176 /* clock.png */; };
F341283C2D4B496D00D6C2B7 /* SDL3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F34123152D4077A600D6C2B7 /* SDL3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F341283D2D4B498100D6C2B7 /* SDL3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F34123152D4077A600D6C2B7 /* SDL3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F341283E2D4B498700D6C2B7 /* SDL3.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = F34123152D4077A600D6C2B7 /* SDL3.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -148,6 +151,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ F31BA87C2F0C57B400646176 /* clock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock.png; sourceTree = "<group>"; };
F344001D2D401E16003F26D7 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../../../SDL/Xcode/SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; };
F35474462828CADB007E9EDA /* jxl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = jxl.xcodeproj; path = ../jxl/jxl.xcodeproj; sourceTree = "<group>"; };
F35475E52829BAB1007E9EDA /* avif.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = avif.xcodeproj; path = ../avif/avif.xcodeproj; sourceTree = "<group>"; };
@@ -234,6 +238,7 @@
F3ED80A6281D9E8800C33C5B = {
isa = PBXGroup;
children = (
+ F31BA87C2F0C57B400646176 /* clock.png */,
F3E1F7742A78A12600AC76D3 /* config.xcconfig */,
F344001D2D401E16003F26D7 /* SDL.xcodeproj */,
F3ED80CD281D9ED600C33C5B /* SDL_image.xcodeproj */,
@@ -503,6 +508,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ F31BA87E2F0C57B400646176 /* clock.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -510,6 +516,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ F31BA87F2F0C57B400646176 /* clock.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -517,6 +524,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ F31BA87D2F0C57B400646176 /* clock.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -588,6 +596,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = MXGJJ98X76;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
@@ -612,6 +621,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = MXGJJ98X76;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
diff --git a/examples/showanim.c b/examples/showanim.c
index c17adfdb0..ecb62a487 100644
--- a/examples/showanim.c
+++ b/examples/showanim.c
@@ -25,7 +25,7 @@
/* Draw a Gimpish background pattern to show transparency in the image */
-static void draw_background(SDL_Renderer *renderer, int w, int h)
+static void draw_background(SDL_Renderer *renderer)
{
const SDL_Color col[2] = {
{ 0x66, 0x66, 0x66, 0xff },
@@ -33,7 +33,9 @@ static void draw_background(SDL_Renderer *renderer, int w, int h)
};
const int dx = 8, dy = 8;
SDL_FRect rect;
- int i, x, y;
+ int i, x, y, w, h;
+
+ SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
rect.w = (float)dx;
rect.h = (float)dy;
@@ -185,7 +187,7 @@ int main(int argc, char *argv[])
}
}
/* Draw a background pattern in case the image has transparency */
- draw_background(renderer, w, h);
+ draw_background(renderer);
/* Display the image */
SDL_RenderTexture(renderer, textures[current_frame], NULL, NULL);
diff --git a/examples/showimage.c b/examples/showimage.c
index 1b34733c7..9e00d5f8c 100644
--- a/examples/showimage.c
+++ b/examples/showimage.c
@@ -25,7 +25,7 @@
/* Draw a Gimpish background pattern to show transparency in the image */
-static void draw_background(SDL_Renderer *renderer, int w, int h)
+static void draw_background(SDL_Renderer *renderer)
{
const SDL_Color col[2] = {
{ 0x66, 0x66, 0x66, 0xff },
@@ -33,7 +33,9 @@ static void draw_background(SDL_Renderer *renderer, int w, int h)
};
const int dx = 8, dy = 8;
SDL_FRect rect;
- int i, x, y;
+ int i, x, y, w, h;
+
+ SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
rect.w = (float)dx;
rect.h = (float)dy;
@@ -284,7 +286,7 @@ int main(int argc, char *argv[])
}
}
/* Draw a background pattern in case the image has transparency */
- draw_background(renderer, (int)w, (int)h);
+ draw_background(renderer);
/* Display the image */
SDL_RenderTexture(renderer, texture, NULL, NULL);
@@ -344,7 +346,7 @@ int main(int argc, char *argv[])
}
/* Draw a background pattern in case the image has transparency */
- draw_background(renderer, (int)w, (int)h);
+ draw_background(renderer);
/* Display the image */
SDL_RenderTexture(renderer, texture, NULL, NULL);