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.
This commit is contained in:
Harry Jeffery 2015-11-12 23:15:03 +00:00
parent ba6d0c7867
commit 5714a2cbd9

View file

@ -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)