Skip to content

Commit

Permalink
Merge pull request #1266 from erenoku/fix_blurry_egui
Browse files Browse the repository at this point in the history
Fix blurry egui
  • Loading branch information
hannobraun authored Oct 25, 2022
2 parents 8c42309 + 5b579b0 commit 668e79d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions crates/fj-viewer/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ impl Gui {

pub(crate) fn update(
&mut self,
pixels_per_point: f32,
egui_input: egui::RawInput,
config: &mut DrawConfig,
aabb: &Aabb<3>,
status: &StatusReport,
line_drawing_available: bool,
) {
self.context.set_pixels_per_point(pixels_per_point);
self.context.begin_frame(egui_input);

let bounding_box_size = {
Expand Down
5 changes: 3 additions & 2 deletions crates/fj-viewer/src/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Viewer {
/// Draw the graphics
pub fn draw(
&mut self,
scale_factor: f32,
pixels_per_point: f32,
status: &mut StatusReport,
egui_input: egui::RawInput,
) {
Expand All @@ -132,6 +132,7 @@ impl Viewer {
self.camera.update_planes(&aabb);

self.gui.update(
pixels_per_point,
egui_input,
&mut self.draw_config,
&aabb,
Expand All @@ -142,7 +143,7 @@ impl Viewer {
if let Err(err) = self.renderer.draw(
&self.camera,
&self.draw_config,
scale_factor,
pixels_per_point,
&mut self.gui,
) {
warn!("Draw error: {}", err);
Expand Down
9 changes: 4 additions & 5 deletions crates/fj-window/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,13 @@ pub fn run(
viewer.handle_screen_resize(size);
}

let pixels_per_point = window.window().scale_factor() as f32;

egui_winit_state.set_pixels_per_point(pixels_per_point);
let egui_input =
egui_winit_state.take_egui_input(window.window());

viewer.draw(
window.window().scale_factor() as f32,
&mut status,
egui_input,
);
viewer.draw(pixels_per_point, &mut status, egui_input);
}
_ => {}
}
Expand Down

0 comments on commit 668e79d

Please sign in to comment.