render: cgmath -> glam
This commit is contained in:
parent
2d95d46a37
commit
160bd39ba4
5 changed files with 41 additions and 41 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::borrow::{Borrow, BorrowMut};
|
||||
|
||||
use cgmath::{Matrix3, Vector2};
|
||||
use glam::{Mat3, Vec2};
|
||||
use smithay::utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform};
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
|
|
@ -63,18 +63,18 @@ where
|
|||
let view = elem.view();
|
||||
|
||||
let transform = elem.transform();
|
||||
let transform_matrix = Matrix3::<f32>::from_translation(Vector2::new(0.5, 0.5))
|
||||
let transform_matrix = Mat3::from_translation(Vec2::new(0.5, 0.5))
|
||||
* transform.matrix()
|
||||
* Matrix3::<f32>::from_translation(-Vector2::new(0.5, 0.5));
|
||||
* Mat3::from_translation(-Vec2::new(0.5, 0.5));
|
||||
|
||||
let geo_scale = {
|
||||
let Scale { x, y } = elem_geo.size.to_f64() / geo.size.to_f64();
|
||||
Matrix3::from_nonuniform_scale(x as f32, y as f32)
|
||||
Mat3::from_scale(Vec2::new(x as f32, y as f32))
|
||||
};
|
||||
|
||||
let geo_translation = {
|
||||
let offset = (elem_geo.loc - geo.loc).to_f64();
|
||||
Matrix3::from_translation(Vector2::new(
|
||||
Mat3::from_translation(Vec2::new(
|
||||
(offset.x / elem_geo.size.w as f64) as f32,
|
||||
(offset.y / elem_geo.size.h as f64) as f32,
|
||||
))
|
||||
|
|
@ -82,10 +82,10 @@ where
|
|||
|
||||
let buf_scale = {
|
||||
let Scale { x, y } = buf_size.to_f64() / view.src.size.to_f64();
|
||||
Matrix3::from_nonuniform_scale(x as f32, y as f32)
|
||||
Mat3::from_scale(Vec2::new(x as f32, y as f32))
|
||||
};
|
||||
|
||||
let buf_translation = Matrix3::from_translation(Vector2::new(
|
||||
let buf_translation = Mat3::from_translation(Vec2::new(
|
||||
(view.src.loc.x / buf_size.w as f64) as f32,
|
||||
(view.src.loc.y / buf_size.h as f64) as f32,
|
||||
));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue