From 69907f123d2f17bc1f9a04c0bda7430f250404de Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 16 Jan 2024 09:45:47 +0400 Subject: Add live-reload of output scales --- src/screenshot_ui.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/screenshot_ui.rs') diff --git a/src/screenshot_ui.rs b/src/screenshot_ui.rs index 57993800..2d097a24 100644 --- a/src/screenshot_ui.rs +++ b/src/screenshot_ui.rs @@ -41,6 +41,7 @@ pub enum ScreenshotUi { pub struct OutputData { size: Size, + scale: i32, texture: GlesTexture, texture_buffer: TextureBuffer, buffers: [SolidColorBuffer; 8], @@ -106,10 +107,11 @@ impl ScreenshotUi { let output_transform = output.current_transform(); let output_mode = output.current_mode().unwrap(); let size = output_transform.transform_size(output_mode.size); + let scale = output.current_scale().integer_scale(); let texture_buffer = TextureBuffer::from_texture( renderer, texture.clone(), - output.current_scale().integer_scale(), + scale, Transform::Normal, None, ); @@ -126,6 +128,7 @@ impl ScreenshotUi { let locations = [Default::default(); 8]; let data = OutputData { size, + scale, texture, texture_buffer, buffers, @@ -330,9 +333,10 @@ impl ScreenshotUi { } } - pub fn output_size(&self, output: &Output) -> Option> { + pub fn output_size(&self, output: &Output) -> Option<(Size, i32)> { if let Self::Open { output_data, .. } = self { - Some(output_data.get(output)?.size) + let data = output_data.get(output)?; + Some((data.size, data.scale)) } else { None } -- cgit