aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2015-11-12 23:15:03 +0000
committerHarry Jeffery <harry@exec64.co.uk>2015-11-12 23:15:03 +0000
commit5714a2cbd998617ab3b848d21e841b5fe32cac68 (patch)
tree417aeaf7167d846b9e46f49d32cb79153847bf13
parentba6d0c7867707e7041172eed7684d197689f58eb (diff)
downloadimv-5714a2cbd998617ab3b848d21e841b5fe32cac68.tar.gz
Fix crash 0 when max texture dimensions = 0
In software rendering mode SDL sets the maximum dimensions to 0. In this case, switch back to 4096 pixel maximum chunk sizes as a reasonable default.
-rw-r--r--src/texture.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/texture.c b/src/texture.c
index 2ce328f..a5c5001 100644
--- a/src/texture.c
+++ b/src/texture.c
@@ -25,8 +25,8 @@ void imv_init_texture(struct imv_texture *tex, SDL_Renderer *r)
SDL_RendererInfo ri;
SDL_GetRendererInfo(r, &ri);
- tex->chunk_width = ri.max_texture_width;
- tex->chunk_height = ri.max_texture_height;
+ tex->chunk_width = ri.max_texture_width != 0 ? ri.max_texture_width : 4096;
+ tex->chunk_height = ri.max_texture_height != 0 ? ri.max_texture_height : 4096;
}
void imv_destroy_texture(struct imv_texture *tex)