summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wpf-gpu-raster/src/matrix.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/wpf-gpu-raster/src/matrix.rs
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/wpf-gpu-raster/src/matrix.rs')
-rw-r--r--third_party/rust/wpf-gpu-raster/src/matrix.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/third_party/rust/wpf-gpu-raster/src/matrix.rs b/third_party/rust/wpf-gpu-raster/src/matrix.rs
new file mode 100644
index 0000000000..ed873410f8
--- /dev/null
+++ b/third_party/rust/wpf-gpu-raster/src/matrix.rs
@@ -0,0 +1,37 @@
+use std::marker::PhantomData;
+
+use crate::types::CoordinateSpace;
+
+pub type CMILMatrix = CMatrix<CoordinateSpace::Shape,CoordinateSpace::Device>;
+#[derive(Default, Clone)]
+pub struct CMatrix<InCoordSpace, OutCoordSpace> {
+ _11: f32, _12: f32, _13: f32, _14: f32,
+ _21: f32, _22: f32, _23: f32 , _24: f32,
+ _31: f32, _32: f32, _33: f32, _34: f32,
+ _41: f32, _42: f32, _43: f32, _44: f32,
+ in_coord: PhantomData<InCoordSpace>,
+ out_coord: PhantomData<OutCoordSpace>
+}
+
+impl<InCoordSpace: Default, OutCoordSpace: Default> CMatrix<InCoordSpace, OutCoordSpace> {
+ pub fn Identity() -> Self { let mut ret: Self = Default::default();
+ ret._11 = 1.;
+ ret._22 = 1.;
+ ret._33 = 1.;
+ ret._44 = 1.;
+ ret
+ }
+ pub fn GetM11(&self) -> f32 { self._11 }
+ pub fn GetM12(&self) -> f32 { self._12 }
+ pub fn GetM21(&self) -> f32 { self._21 }
+ pub fn GetM22(&self) -> f32 { self._22 }
+ pub fn GetDx(&self) -> f32 { self._41 }
+ pub fn GetDy(&self) -> f32 { self._42 }
+
+ pub fn SetM11(&mut self, r: f32) { self._11 = r}
+ pub fn SetM12(&mut self, r: f32) { self._12 = r}
+ pub fn SetM21(&mut self, r: f32) { self._21 = r}
+ pub fn SetM22(&mut self, r: f32) { self._22 = r}
+ pub fn SetDx(&mut self, dx: f32) { self._41 = dx }
+ pub fn SetDy(&mut self, dy: f32) { self._42 = dy }
+} \ No newline at end of file