Minor cleanup to Render size

This commit is contained in:
2020-10-03 22:13:59 -07:00
parent 0642f52172
commit 4ac48bd3f1
4 changed files with 24 additions and 17 deletions

View File

@@ -62,12 +62,13 @@ struct RenderSteps<'a> {
impl<'a> RenderSteps<'a> {
fn render(state: &'a dyn GenericSim, measurements: &'a [Box<dyn AbstractMeasurement>], z: u32) -> RgbImage {
let mut width = 1920;
let mut width = 640;
let max_height = 480;
let mut height = width * state.height() / state.width();
if height > 1080 {
let stretch = 1080 as f32 / height as f32;
if height > max_height {
let stretch = max_height as f32 / height as f32;
width = (width as f32 * stretch) as _;
height = 1080;
height = max_height;
}
trace!("rendering at {}x{}", width, height);
let mut me = Self::new(state, measurements, width, height, z);