Skip to content

Commit

Permalink
Avoid calculation mistakes in full screen display
Browse files Browse the repository at this point in the history
  • Loading branch information
yoichi committed Oct 17, 2020
1 parent c370cb4 commit ce36353
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/onefetch/image_backends/sixel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ impl super::ImageBackend for SixelBackend {
ioctl(STDOUT_FILENO, TIOCGWINSZ, &tty_size);
tty_size
};
let width_ratio = tty_size.ws_col as f64 / tty_size.ws_xpixel as f64;
let height_ratio = tty_size.ws_row as f64 / tty_size.ws_ypixel as f64;
let cw = tty_size.ws_xpixel / tty_size.ws_col;
let lh = tty_size.ws_ypixel / tty_size.ws_row;
let width_ratio = 1.0 / cw as f64;
let height_ratio = 1.0 / lh as f64;

// resize image to fit the text height with the Lanczos3 algorithm
let image = image.resize(
Expand Down

0 comments on commit ce36353

Please sign in to comment.