mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
Correct scaling in qrcode_rows()
This commit is contained in:
parent
e682b4fae8
commit
4e9f46e063
@ -7,7 +7,7 @@
|
||||
#define PER_QR_VERSION 4
|
||||
static inline int
|
||||
qrcode_rows(int version){
|
||||
return QR_BASE_SIZE + (version * PER_QR_VERSION / 2);
|
||||
return (QR_BASE_SIZE + (version * PER_QR_VERSION)) / 2;
|
||||
}
|
||||
|
||||
static inline int
|
||||
@ -38,6 +38,8 @@ int qrcode_demo(struct notcurses* nc){
|
||||
int qlen = ncplane_qrcode(n, 0, data, len);
|
||||
// can fail due to being too large for the terminal
|
||||
if(qlen > 0){
|
||||
ncplane_move_yx(n, dimy / 2 - qrcode_rows(qlen) / 2,
|
||||
dimx / 2 - qrcode_cols(qlen) / 2);
|
||||
if(ncplane_cursor_move_yx(n, 0, 0)){
|
||||
ncplane_destroy(n);
|
||||
return -1;
|
||||
|
@ -600,7 +600,7 @@ int ncplane_rotate_ccw(ncplane* n){
|
||||
|
||||
static inline int
|
||||
qrcode_rows(int version){
|
||||
return QR_BASE_SIZE + (version * PER_QR_VERSION / 2);
|
||||
return (QR_BASE_SIZE + (version * PER_QR_VERSION)) / 2;
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
Loading…
x
Reference in New Issue
Block a user