summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-02-17 21:14:45 -0500
committerLLLL Colonq <llll@colonq>2025-02-17 21:14:45 -0500
commit8d95be60ea34462cb178389e5ce9c92ad41ecd8b (patch)
tree11ca46b435023409f36b3c96dff61c25e0a8036f
parent3c56138527b9b6baa6a6b23733cd54b4d281170f (diff)
Don't upscale at all in no-resize mode
-rw-r--r--src/framebuffer.rs7
1 files changed, 6 insertions, 1 deletions
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,