-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resizing #97
base: simulator
Are you sure you want to change the base?
Conversation
src/config/environment.rs
Outdated
@@ -22,53 +22,61 @@ lazy_static! { | |||
if *SIMULATOR_ENABLED { 3 } else { 2 }; | |||
} | |||
|
|||
pub const FACTORF64: f64 = 2.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can get this value from an env variable at compile-time (see option_env!), and use 1
as default value?
Something like this? (not tested)
pub const FACTORF64: f64 = 2.0; | |
pub const FACTOR: f64 = option_env!("SCALE_FACTOR").and_then(|f| f64::from_str(&f).ok()).unwrap_or(1.0); |
If necessary this can also be the place to validate the value (and if not valid we take the default one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, const types doesnt support non const operation.
); | ||
let src = (image).as_rgba(); | ||
|
||
let mut dst = vec![RGBA::new(0, 0, 0, 0); (w2 * h2).try_into().unwrap()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this part useful?
let mut dst = vec![RGBA::new(0, 0, 0, 0); (w2 * h2).try_into().unwrap()]; | |
let mut dst = vec![RGBA::new(0, 0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it was a mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know why, but it appears to be necessary to keep this code, otherwise the app crashes
Co-authored-by: David Sferruzza <david.sferruzza@gmail.com>
Co-authored-by: David Sferruzza <david.sferruzza@gmail.com>
Co-authored-by: David Sferruzza <david.sferruzza@gmail.com>
Co-authored-by: David Sferruzza <david.sferruzza@gmail.com>
Allow resizing of the UI.
This PR is still WIP