aboutsummaryrefslogtreecommitdiffstats
path: root/renderer.c
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-04-29 14:51:55 -0400
committerSam Anthony <sam@samanthony.xyz>2025-04-29 14:51:55 -0400
commit4700d22680347992f7c0a87715d162658eb6e4ef (patch)
tree950533e250c62f0771ed48d1832b1d5ca3dc94c3 /renderer.c
parenta7284d1250b3605a471daddb9a214c2fa5978f82 (diff)
downloadvolute-4700d22680347992f7c0a87715d162658eb6e4ef.zip
preserve image aspect ratio
Diffstat (limited to 'renderer.c')
-rw-r--r--renderer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/renderer.c b/renderer.c
index 900a6c9..6c5782f 100644
--- a/renderer.c
+++ b/renderer.c
@@ -337,3 +337,13 @@ r_remove_icon(int id) {
icon_list.idx--;
}
+
+void
+r_get_icon_size(int id, int *w, int *h) {
+ expect(id >= 0 && id < icon_list.idx);
+
+ *w = *h = 0;
+ if (SDL_QueryTexture(icon_list.items[id], NULL, NULL, w, h) != 0) {
+ fprintf(stderr, "%s\n", SDL_GetError());
+ }
+}