Skip to content

Commit

Permalink
fix: DOMMatrix to skia Transform (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 11, 2023
1 parent c82d41d commit f43ccbd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
10 changes: 0 additions & 10 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,14 @@ rustflags = ["-C", "link-args=/NODEFAULTLIB:libcmt.lib"]
rustflags = ["-C", "target-cpu=apple-a14"]

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
rustflags = ["-C", "target-cpu=cortex-a57"]

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
rustflags = ["-C", "target-cpu=cortex-a7"]

[target.x86_64-unknown-linux-musl]
rustflags = [
"-C",
"target-feature=-crt-static",
]

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = [
"-C",
"target-feature=-crt-static",
"-C",
"target-cpu=cortex-a57",
]
19 changes: 16 additions & 3 deletions src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ impl CanvasRenderingContext2D {
Either::A(a) => Transform::new(
a as f32, c? as f32, e? as f32, b? as f32, d? as f32, f? as f32,
),
Either::B(transform) => transform.into(),
Either::B(transform) => transform.into_context_transform(),
};
self
.context
Expand Down Expand Up @@ -1915,14 +1915,27 @@ pub struct TransformObject {
pub f: f64,
}

impl TransformObject {
pub(crate) fn into_context_transform(self) -> Transform {
Transform::new(
self.a as f32,
self.c as f32,
self.e as f32,
self.b as f32,
self.d as f32,
self.f as f32,
)
}
}

impl From<TransformObject> for Transform {
fn from(value: TransformObject) -> Self {
Self::new(
value.a as f32,
value.c as f32,
value.e as f32,
value.b as f32,
value.c as f32,
value.d as f32,
value.e as f32,
value.f as f32,
)
}
Expand Down

0 comments on commit f43ccbd

Please sign in to comment.