[intro] avoid dividing by zero without cell-pixel geometry

This commit is contained in:
nick black 2021-10-06 21:50:38 -04:00
parent c40cdc1528
commit b9d774f746
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -83,6 +83,12 @@ orcashow(struct notcurses* nc, int dimy, int dimx){
&cellpxy, &cellpxx, NULL, NULL);
int odimy, odimx, scaley, scalex;
ncvisual_blitter_geom(nc, ncv, &vopts, &odimy, &odimx, &scaley, &scalex, NULL);
// even if we can't do pixel output, we want her the same size as if weu
// *could* do pixel output. if we have no idea as to the geom, use scale.
if(cellpxy == 0){
cellpxy = scaley;
cellpxx = scalex;
}
struct ncplane_options nopts = {
.rows = (odimy / cellpxy) + !!(odimy % cellpxy),
.cols = (odimx / cellpxx) + !!(odimx % cellpxx),