Skip to content
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

Make Matrix3x2::identity() and Matrix3x2::translation(f32, f32) const #1695

Merged
merged 1 commit into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/libs/bindgen/src/extensions/matrix3x2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::*;
pub fn gen() -> TokenStream {
quote! {
impl Matrix3x2 {
pub fn identity() -> Self {
pub const fn identity() -> Self {
Self {
M11: 1.0,
M12: 0.0,
Expand All @@ -13,7 +13,7 @@ pub fn gen() -> TokenStream {
M32: 0.0,
}
}
pub fn translation(x: f32, y: f32) -> Self {
pub const fn translation(x: f32, y: f32) -> Self {
Self {
M11: 1.0,
M12: 0.0,
Expand Down
4 changes: 2 additions & 2 deletions crates/libs/windows/src/Windows/Foundation/Numerics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ impl ::core::default::Default for Matrix3x2 {
}
}
impl Matrix3x2 {
pub fn identity() -> Self {
pub const fn identity() -> Self {
Self { M11: 1.0, M12: 0.0, M21: 0.0, M22: 1.0, M31: 0.0, M32: 0.0 }
}
pub fn translation(x: f32, y: f32) -> Self {
pub const fn translation(x: f32, y: f32) -> Self {
Self { M11: 1.0, M12: 0.0, M21: 0.0, M22: 1.0, M31: x, M32: y }
}
pub fn rotation(angle: f32, x: f32, y: f32) -> Self {
Expand Down