Weird *1.5 scale on rendered images
Hi there,
I'm using the latest version of piston_window (0.117.0) on linux (updated arch), and I'm having this weird issue where images I render using the code below are all *1.5 zoomed. I can get it to kinda work with something hacky along the lines of c.transform.zoom(0.667) but it's weird + the scaling isn't perfect and I get bad aliasing.
use piston_window::*;
use std::path::Path;
fn main() {
let mut window: PistonWindow = WindowSettings::new("foo", (640, 480))
.exit_on_esc(true)
.build()
.unwrap();
let mut ctx = window.create_texture_context();
let mask = Texture::from_path(
&mut ctx,
Path::new("assets/foo.png"),
Flip::None,
&TextureSettings::new(),
)
.unwrap();
while let Some(e) = window.next() {
match e {
Event::Loop(Loop::Render(_)) => {
window.draw_2d(&e, |c, g, d| {
clear(color::hex("4d4d4d"), g);
image(&mask, c.transform, g);
ctx.encoder.flush(d);
});
}
_ => {}
}
}
}
So I found a temporary fix that avoids the aliasing, c.transform.zoom(2.0 / 3.0) instead of c.transform.zoom(0.667). Still, weird solution I'd love to avoid + idk what runtime performance issues may arise from scaling each loaded asset
This does not seem to happen with the Sdl2Window backend.
Do you have a retina screen?