From 76372e4f97bd64ac46e2a6fee191a9dcc00609c9 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 20 Sep 2021 22:08:36 +0900 Subject: [PATCH] Minor refactorings --- src/main.rs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index 43ea317..ce4d146 100644 --- a/src/main.rs +++ b/src/main.rs @@ -928,14 +928,12 @@ async fn main() -> Result<(), String> { } } + let temp_dim_opt = artist_dim_opt.as_ref().unwrap(); draw_rectangle( TEXT_X_OFFSET, - prev_height - - temp_offset_y - - TEXT_Y_OFFSET - - artist_dim_opt.as_ref().unwrap().height, - artist_dim_opt.as_ref().unwrap().width, - artist_dim_opt.as_ref().unwrap().height, + prev_height - temp_offset_y - TEXT_Y_OFFSET - temp_dim_opt.height, + temp_dim_opt.width, + temp_dim_opt.height, Color::new(0.0, 0.0, 0.0, 0.4), ); draw_text( @@ -946,18 +944,16 @@ async fn main() -> Result<(), String> { WHITE, ); - temp_offset_y += TEXT_Y_OFFSET + artist_dim_opt.as_ref().unwrap().height; + temp_offset_y += TEXT_Y_OFFSET + temp_dim_opt.height; } if !title.is_empty() && !opt.disable_show_title { + let temp_dim_opt = title_dim_opt.as_ref().unwrap(); draw_rectangle( TEXT_X_OFFSET, - prev_height - - temp_offset_y - - TEXT_Y_OFFSET - - title_dim_opt.as_ref().unwrap().height, - title_dim_opt.as_ref().unwrap().width, - title_dim_opt.as_ref().unwrap().height, + prev_height - temp_offset_y - TEXT_Y_OFFSET - temp_dim_opt.height, + temp_dim_opt.width, + temp_dim_opt.height, Color::new(0.0, 0.0, 0.0, 0.4), ); draw_text( @@ -968,7 +964,7 @@ async fn main() -> Result<(), String> { WHITE, ); - temp_offset_y += TEXT_Y_OFFSET + title_dim_opt.as_ref().unwrap().height; + temp_offset_y += TEXT_Y_OFFSET + temp_dim_opt.height; } let timer_string = seconds_to_time(track_timer);