Add flag to disable fill-scaling album art

This commit is contained in:
Stephen Seo 2021-12-15 19:32:37 +09:00
parent 0cc86743a4
commit 570b6ab33c
2 changed files with 10 additions and 2 deletions

View file

@ -455,7 +455,10 @@ impl EventHandler for MPDDisplay {
self.album_art = None;
self.album_art_draw_transform = None;
} else {
self.get_album_art_transform(ctx, true);
self.get_album_art_transform(
ctx,
!self.opts.do_not_fill_scale_album_art,
);
}
} else {
self.album_art = None;
@ -576,7 +579,7 @@ impl EventHandler for MPDDisplay {
}
fn resize_event(&mut self, ctx: &mut Context, _width: f32, _height: f32) {
self.get_album_art_transform(ctx, true);
self.get_album_art_transform(ctx, !self.opts.do_not_fill_scale_album_art);
self.refresh_text_transforms(ctx)
.expect("Failed to set text transforms");
}

View file

@ -30,6 +30,11 @@ pub struct Opt {
disable_show_filename: bool,
#[structopt(long = "pprompt", help = "input password via prompt")]
enable_prompt_password: bool,
#[structopt(
long = "no-scale-fill",
help = "don't scale-fill the album art to the window"
)]
do_not_fill_scale_album_art: bool,
}
fn main() -> Result<(), String> {