Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions node-graph/libraries/rendering/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use kurbo::Shape;
use num_traits::Zero;
use std::collections::{HashMap, HashSet};
use std::fmt::Write;
use std::hash::{DefaultHasher, Hash, Hasher};
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::sync::{Arc, LazyLock};
use vello::*;
Expand Down Expand Up @@ -1246,21 +1246,17 @@ impl Render for Table<Raster<CPU>> {
}

if render_params.to_canvas() {
let id = row.source_node_id.map(|x| x.0).unwrap_or_else(|| {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't fully understand this syntax but from what I can see this generates an ID for an image and was used in deduplication for similar images . Since we are no more deduplicating similar images and each new image is getting its own ID , figured it would be best to use a simple generate_uuid instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without doing so , its still causing the same image leakage for me

let mut state = DefaultHasher::new();
image.data().hash(&mut state);
state.finish()
});
if !render.image_data.iter().any(|(old_id, _)| *old_id == id) {
let mut image = image.data().clone();
image.map_pixels(|p| p.to_unassociated_alpha());
render.image_data.push((id, image));
}
let id = row.source_node_id.map(|x| x.0).unwrap_or_else(core_types::uuid::generate_uuid);
let mut image = image.data().clone();
image.map_pixels(|p| p.to_unassociated_alpha());
let image_width = image.width;
let image_height = image.height;
render.image_data.push((id, image));
render.parent_tag(
"foreignObject",
|attributes| {
let mut transform_values = transform.to_scale_angle_translation();
let size = DVec2::new(image.width as f64, image.height as f64);
let size = DVec2::new(image_width as f64, image_height as f64);
transform_values.0 /= size;

let matrix = DAffine2::from_scale_angle_translation(transform_values.0, transform_values.1, transform_values.2);
Expand Down