Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new_scaled_dims vs new_dims #18

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/software_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn render_scene(
renderer: &mut Renderer,
state: &LayoutState,
image_cache: &ImageCache,
) -> Option<[f32; 2]> {
) -> Option<(f64, f64)> {
let size = paint_ctx.size();
let scale = paint_ctx.scale();
let scaled_width = size.width * scale.x();
Expand All @@ -19,7 +19,8 @@ pub fn render_scene(
let (width, height) = (scaled_width as u32, scaled_height as u32);
let dimensions = renderer.image().dimensions();

let new_dims = renderer.render(state, image_cache, [width, height]);
let new_scaled_dims = renderer.render(state, image_cache, [width, height]);
let new_dims = new_scaled_dims.map(|[w, h]| scale.px_to_dp_xy(w, h));

let bottom_image = if bottom_image.is_none() || dimensions != (width, height) {
bottom_image.insert(
Expand Down
4 changes: 2 additions & 2 deletions src/timer_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,15 +763,15 @@
// &data.image_cache.borrow(),
// );

if let Some([new_width, new_height]) = software_renderer::render_scene(
if let Some((new_width, new_height)) = software_renderer::render_scene(
ctx,
&mut self.bottom_image,
&mut self.renderer,
&layout_data.layout_state,

Check failure on line 770 in src/timer_form.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/livesplit-one-druid/livesplit-one-druid/src/timer_form.rs
&data.image_cache.borrow(),
) {
ctx.window()
.set_size(Size::new(new_width as _, new_height as _));
.set_size(Size::new(new_width, new_height));
}
data.image_cache.borrow_mut().collect();
}
Expand Down Expand Up @@ -925,7 +925,7 @@
data.config.borrow_mut().set_hotkeys(hotkey_config);
}
data.settings_editor = None;
let _ = HOTKEY_SYSTEM.write().unwrap().as_mut().unwrap().activate();

Check warning on line 928 in src/timer_form.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded `return` statement
return;
}
}
Expand Down
Loading