From 8d95be60ea34462cb178389e5ce9c92ad41ecd8b Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Mon, 17 Feb 2025 21:14:45 -0500 Subject: Don't upscale at all in no-resize mode --- src/framebuffer.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/framebuffer.rs') diff --git a/src/framebuffer.rs b/src/framebuffer.rs index b3ce859..db808e4 100644 --- a/src/framebuffer.rs +++ b/src/framebuffer.rs @@ -12,7 +12,11 @@ pub struct Framebuffer { impl Framebuffer { pub fn screen(ctx: &context::Context) -> Self { #[cfg(target_arch = "wasm32")] - let (windoww, windowh): (f32, f32) = ctx.window.inner_size().into(); + let (windoww, windowh): (f32, f32) = if ctx.resize { + ctx.window.inner_size().into() + } else { + (ctx.render_width, ctx.render_height) + }; #[cfg(not(target_arch = "wasm32"))] let (windoww, windowh) = { let (w, h) = ctx.window.borrow().get_size(); @@ -23,6 +27,7 @@ impl Framebuffer { let upscaleh = ctx.render_height * ratio; let offsetx = (windoww - upscalew) / 2.0; let offsety = (windowh - upscaleh) / 2.0; + log::info!("resize window: {:?}, upscale: {:?}, offset: {:?}", (windoww, windowh), (upscalew, upscaleh), (offsetx, offsety)); Self { tex: None, fbo: None, -- cgit v1.2.3