[visual] implement NCVISUAL_OPTION_HORALIGNED for cells 1443

pull/1466/head
nick black 4 years ago committed by Nick Black
parent f714337fe1
commit 1c3e10f926

@ -463,14 +463,16 @@ ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitse
ncplane_dim_yx(n, &disprows, &dispcols); ncplane_dim_yx(n, &disprows, &dispcols);
dispcols *= encoding_x_scale(&nc->tcache, bset); dispcols *= encoding_x_scale(&nc->tcache, bset);
disprows *= encoding_y_scale(&nc->tcache, bset); disprows *= encoding_y_scale(&nc->tcache, bset);
if(!(flags & NCVISUAL_OPTION_HORALIGNED)){
dispcols -= placex;
}
disprows -= placey; disprows -= placey;
dispcols -= placex;
if(scaling == NCSCALE_SCALE || scaling == NCSCALE_SCALE_HIRES){ if(scaling == NCSCALE_SCALE || scaling == NCSCALE_SCALE_HIRES){
scale_visual(ncv, &disprows, &dispcols); scale_visual(ncv, &disprows, &dispcols);
} // else stretch } // else stretch
} }
if(flags & NCVISUAL_OPTION_HORALIGNED){ if(flags & NCVISUAL_OPTION_HORALIGNED){
placex = (ncplane_dim_x(n) - dispcols) / 2; placex = (ncplane_dim_x(n) - dispcols / encoding_x_scale(&nc->tcache, bset)) / 2;
} }
} }
leny = (leny / (double)ncv->rows) * ((double)disprows); leny = (leny / (double)ncv->rows) * ((double)disprows);

Loading…
Cancel
Save