Add support for WASM transforms

This commit is contained in:
alonso.torres 2025-02-06 15:30:31 +01:00 committed by Alejandro Alonso
parent a3a757f842
commit 1bb337c3dd
18 changed files with 658 additions and 153 deletions

View file

@ -1,5 +1,6 @@
use std::collections::HashMap;
use crate::matrix;
use skia_safe as skia;
use uuid::Uuid;
@ -16,6 +17,7 @@ pub(crate) struct State<'a> {
pub current_id: Option<Uuid>,
pub current_shape: Option<&'a mut Shape>,
pub shapes: HashMap<Uuid, Shape>,
pub modifiers: HashMap<Uuid, matrix::Matrix>,
}
impl<'a> State<'a> {
@ -25,6 +27,7 @@ impl<'a> State<'a> {
current_id: None,
current_shape: None,
shapes: HashMap::with_capacity(capacity),
modifiers: HashMap::new(),
}
}
@ -38,13 +41,13 @@ impl<'a> State<'a> {
pub fn start_render_loop(&mut self, timestamp: i32) -> Result<(), String> {
self.render_state
.start_render_loop(&mut self.shapes, timestamp)?;
.start_render_loop(&mut self.shapes, &self.modifiers, timestamp)?;
Ok(())
}
pub fn process_animation_frame(&mut self, timestamp: i32) -> Result<(), String> {
self.render_state
.process_animation_frame(&mut self.shapes, timestamp)?;
.process_animation_frame(&mut self.shapes, &self.modifiers, timestamp)?;
Ok(())
}