Replace Primitive::Translate with Transform

This commit is contained in:
Héctor Ramón Jiménez 2023-10-23 03:13:28 +02:00
parent 759f0e9225
commit 5467c19c80
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
11 changed files with 205 additions and 133 deletions

View file

@ -8,6 +8,7 @@ use crate::graphics::geometry::{
};
use crate::graphics::gradient::{self, Gradient};
use crate::graphics::mesh::{self, Mesh};
use crate::graphics::Transformation;
use crate::primitive::{self, Primitive};
use lyon::geom::euclid;
@ -435,7 +436,7 @@ impl Frame {
pub fn clip(&mut self, frame: Frame, at: Point) {
let size = frame.size();
let primitives = frame.into_primitives();
let translation = Vector::new(at.x, at.y);
let transformation = Transformation::translate(at.x, at.y);
let (text, meshes) = primitives
.into_iter()
@ -443,12 +444,12 @@ impl Frame {
self.primitives.push(Primitive::Group {
primitives: vec![
Primitive::Translate {
translation,
Primitive::Transform {
transformation,
content: Box::new(Primitive::Group { primitives: meshes }),
},
Primitive::Translate {
translation,
Primitive::Transform {
transformation,
content: Box::new(Primitive::Clip {
bounds: Rectangle::with_size(size),
content: Box::new(Primitive::Group {