diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-06-09 11:55:43 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-06-10 18:08:01 +0300 |
| commit | dbe810d3d8086770fa27b1b78c615f2dccd72a11 (patch) | |
| tree | dfed95cbe1556233ad91336645b05ca8bab4c76f /src/ui/config_error_notification.rs | |
| parent | a1563b9132c3ba49ed80dbb9011846ea0c825caf (diff) | |
| download | niri-dbe810d3d8086770fa27b1b78c615f2dccd72a11.tar.gz niri-dbe810d3d8086770fa27b1b78c615f2dccd72a11.tar.bz2 niri-dbe810d3d8086770fa27b1b78c615f2dccd72a11.zip | |
Move apply_scale() to utils
Diffstat (limited to 'src/ui/config_error_notification.rs')
| -rw-r--r-- | src/ui/config_error_notification.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/ui/config_error_notification.rs b/src/ui/config_error_notification.rs index cdef5d6e..ffa5e130 100644 --- a/src/ui/config_error_notification.rs +++ b/src/ui/config_error_notification.rs @@ -18,7 +18,7 @@ use crate::render_helpers::memory::MemoryBuffer; use crate::render_helpers::primary_gpu_texture::PrimaryGpuTextureRenderElement; use crate::render_helpers::renderer::NiriRenderer; use crate::render_helpers::texture::{TextureBuffer, TextureRenderElement}; -use crate::utils::output_size; +use crate::utils::{apply_scale, output_size}; const TEXT: &str = "Failed to parse the config file. \ Please run <span face='monospace' bgcolor='#000000'>niri validate</span> \ @@ -171,9 +171,7 @@ impl ConfigErrorNotification { fn render(scale: f64, created_path: Option<&Path>) -> anyhow::Result<MemoryBuffer> { let _span = tracy_client::span!("config_error_notification::render"); - let apply_scale = |val: i32| (f64::from(val) * scale).round() as i32; - - let padding = apply_scale(PADDING); + let padding = apply_scale(scale, PADDING); let mut text = String::from(TEXT); let mut border_color = (1., 0.3, 0.3); @@ -187,7 +185,7 @@ fn render(scale: f64, created_path: Option<&Path>) -> anyhow::Result<MemoryBuffe }; let mut font = FontDescription::from_string(FONT); - font.set_absolute_size(apply_scale(font.size()).into()); + font.set_absolute_size(apply_scale(scale, font.size()).into()); let surface = ImageSurface::create(cairo::Format::ARgb32, 0, 0)?; let cr = cairo::Context::new(&surface)?; |
