Fix rasterize node document leakage with hashmap and eq check (#3550)

* fix: rasterize node document leakage with hashmap and eq check

* Use single Hashmap and ignore source id

* use or_insert_with instead of Entry match

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
Ayush Amawate
2026-01-04 17:03:18 +05:30
committed by GitHub
parent ee2e61f38f
commit 42440c0d0b
4 changed files with 27 additions and 17 deletions

View File

@@ -13,12 +13,13 @@ use graphic_types::raster_types::Image;
use graphic_types::raster_types::{CPU, Raster};
use rendering::{Render, RenderOutputType as RenderOutputTypeRequest, RenderParams, RenderSvgSegmentList, SvgRender, format_transform_matrix};
use rendering::{RenderMetadata, SvgSegment};
use std::collections::HashMap;
use std::sync::Arc;
use vector_types::GradientStops;
use wgpu_executor::RenderContext;
/// List of (canvas id, image data) pairs for embedding images as canvases in the final SVG string.
type ImageData = Vec<(u64, Image<Color>)>;
type ImageData = HashMap<Image<Color>, u64>;
#[derive(Clone, dyn_any::DynAny)]
pub enum RenderIntermediateType {
@@ -162,7 +163,7 @@ async fn render<'a: 'n>(ctx: impl Ctx + ExtractFootprint + ExtractVarArgs, edito
rendering.wrap_with_transform(footprint.transform, Some(logical_resolution));
RenderOutputType::Svg {
svg: rendering.svg.to_svg_string(),
image_data: rendering.image_data,
image_data: rendering.image_data.into_iter().map(|(image, id)| (id, image)).collect(),
}
}
(RenderOutputTypeRequest::Vello, RenderIntermediateType::Vello(vello_data)) => {