From cacde9ec9d00f932ec4f6ba78d59d0b235008cd8 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 14 Jul 2021 10:47:57 -0700 Subject: [PATCH] fix initial window positioning --- src/renderer/mod.rs | 2 -- src/window/window_wrapper/mod.rs | 10 ++++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 0c149d2..104f981 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -266,9 +266,7 @@ impl Renderer { } root_canvas.clear(self.default_style.colors.background.unwrap().to_color()); - root_canvas.save(); - root_canvas.reset_matrix(); if let Some(root_window) = self.rendered_windows.get(&1) { diff --git a/src/window/window_wrapper/mod.rs b/src/window/window_wrapper/mod.rs index 494184a..82d2a0e 100644 --- a/src/window/window_wrapper/mod.rs +++ b/src/window/window_wrapper/mod.rs @@ -222,10 +222,10 @@ pub fn start_loop( .unwrap(); let windowed_context = unsafe { windowed_context.make_current().unwrap() }; - let skia_renderer = SkiaRenderer::new(&windowed_context); + let window = windowed_context.window(); + let scale_factor = windowed_context.window().scale_factor(); let renderer = Renderer::new(batched_draw_command_receiver, scale_factor); - let window = windowed_context.window(); if !window.is_maximized() { window.set_inner_size(get_initial_window_size(( @@ -234,6 +234,10 @@ pub fn start_loop( ))); } + let saved_inner_size = window.inner_size(); + + let skia_renderer = SkiaRenderer::new(&windowed_context); + log::info!( "window created (scale_factor: {}, font_size: {}x{})", scale_factor, @@ -241,8 +245,6 @@ pub fn start_loop( renderer.font_height, ); - let saved_inner_size = window.inner_size(); - let mut window_wrapper = GlutinWindowWrapper { windowed_context, skia_renderer,