From 5714a2cbd998617ab3b848d21e841b5fe32cac68 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Thu, 12 Nov 2015 23:15:03 +0000 Subject: 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. --- src/texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3