This commit is contained in:
Aitor Moreno
2025-06-10 12:37:42 +02:00
parent 446fc53f00
commit ee3bf72034
3 changed files with 31 additions and 16 deletions

View File

@@ -99,7 +99,7 @@
;; This should never be called from the outside. ;; This should never be called from the outside.
(defn- render (defn- render
([timestamp] ([timestamp]
(render timestamp true)) (render timestamp false))
([timestamp full] ([timestamp full]
(h/call wasm/internal-module "_render" timestamp full) (h/call wasm/internal-module "_render" timestamp full)

View File

@@ -693,14 +693,20 @@ impl RenderState {
modifiers: &HashMap<Uuid, Matrix>, modifiers: &HashMap<Uuid, Matrix>,
structure: &HashMap<Uuid, Vec<StructureEntry>>, structure: &HashMap<Uuid, Vec<StructureEntry>>,
scale_content: &HashMap<Uuid, f32>, scale_content: &HashMap<Uuid, f32>,
timestamp: i32 timestamp: i32,
) -> Result<(), String> { ) -> Result<(), String> {
performance::begin_measure!("process_animation_frame"); performance::begin_measure!("process_animation_frame");
if self.render_in_progress { if self.render_in_progress {
if self.render_is_full { if self.render_is_full {
self.render_shape_tree_full(tree, modifiers, structure, scale_content, timestamp)?; self.render_shape_tree_full(tree, modifiers, structure, scale_content, timestamp)?;
} else { } else {
self.render_shape_tree_partial(tree, modifiers, structure, scale_content, timestamp)?; self.render_shape_tree_partial(
tree,
modifiers,
structure,
scale_content,
timestamp,
)?;
} }
self.flush_and_submit(); self.flush_and_submit();
@@ -895,7 +901,13 @@ impl RenderState {
scale_content: &HashMap<Uuid, f32>, scale_content: &HashMap<Uuid, f32>,
timestamp: i32, timestamp: i32,
) -> Result<(bool, bool), String> { ) -> Result<(bool, bool), String> {
let result = self.render_shape_tree_full_uncached(tree, modifiers, structure, scale_content, timestamp); let result = self.render_shape_tree_full_uncached(
tree,
modifiers,
structure,
scale_content,
timestamp,
);
let (is_empty, should_stop_rendering) = result?; let (is_empty, should_stop_rendering) = result?;
if should_stop_rendering { if should_stop_rendering {
@@ -921,11 +933,12 @@ impl RenderState {
) -> Result<(bool, bool), String> { ) -> Result<(bool, bool), String> {
let mut iteration = 0; let mut iteration = 0;
let mut is_empty = true; let mut is_empty = true;
let scale = self.get_scale();
let tile_hashmap = &self.tiles;
println!("render_shape_tree_full_uncached::while::start"); println!("render_shape_tree_full_uncached::while::start");
while let Some(node_render_state) = self.pending_nodes.pop() { while let Some(node_render_state) = self.pending_nodes.pop() {
println!("render_shape_tree_full_uncached::while::pop {}", self.pending_nodes.len()); println!(
"render_shape_tree_full_uncached::while::pop {}",
self.pending_nodes.len()
);
let NodeRenderState { let NodeRenderState {
id: node_id, id: node_id,
visited_children, visited_children,
@@ -940,19 +953,20 @@ impl RenderState {
.to_string(), .to_string(),
)?; )?;
let tiles = tile_hashmap.get_tiles_of(node_id);
// If the shape is not in the tile set, then we update // If the shape is not in the tile set, then we update
// it. // it.
if tiles.is_none() { if self.tiles.get_tiles_of(node_id).is_none() {
self.update_tile_for(element); self.update_tile_for(element);
} }
let tiles = self.tiles.get_tiles_of(node_id).as_mut().unwrap();
// We need to iterate over every tile of the element. // We need to iterate over every tile of the element.
for tile in tiles.unwrap() { for tile in tiles.iter() {
println!("render_shape_tree_full_uncached::while::start {} {}", tile.0, tile.1); println!(
self.current_tile = Some(*tile); "render_shape_tree_full_uncached::for::start {} {}",
self.render_area = tiles::get_tile_rect(*tile, scale); tile.0, tile.1
);
self.update_render_context(*tile);
if visited_children { if visited_children {
if !visited_mask { if !visited_mask {
if let Type::Group(group) = element.shape_type { if let Type::Group(group) = element.shape_type {
@@ -994,7 +1008,7 @@ impl RenderState {
let is_visible = transformed_element.extrect().intersects(self.render_area) let is_visible = transformed_element.extrect().intersects(self.render_area)
&& !transformed_element.hidden && !transformed_element.hidden
&& !transformed_element.visually_insignificant(scale); && !transformed_element.visually_insignificant(self.get_scale_mut());
if self.options.is_debug_visible() { if self.options.is_debug_visible() {
debug::render_debug_shape(self, &transformed_element, is_visible); debug::render_debug_shape(self, &transformed_element, is_visible);
@@ -1016,6 +1030,7 @@ impl RenderState {
} else { } else {
self.apply_drawing_to_render_canvas(Some(element)); self.apply_drawing_to_render_canvas(Some(element));
} }
println!("render_shape_tree_full_uncached::for::end");
} }
// Set the node as visited_children before processing children // Set the node as visited_children before processing children

View File

@@ -62,7 +62,7 @@ impl State {
&self.structure, &self.structure,
&self.scale_content, &self.scale_content,
timestamp, timestamp,
full full,
)?; )?;
Ok(()) Ok(())
} }