Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Render: a gradient mesh is rasterized into at most 4 MP (16 MB) at once

Fabian Grajales9735518c84bf
diff --git a/crates/render/src/live.rs b/crates/render/src/live.rs
index 162a476a4..285aaab5f 100644
--- a/crates/render/src/live.rs
+++ b/crates/render/src/live.rs
@@ -173,8 +173,9 @@ fn mesh_level(m: &GradientMesh, bounds_px: f64) -> usize {
}
/// The most pixels a gradient mesh is rasterized into at once ([`draw_mesh_raster`]); a larger
-/// one is drawn quad by quad.
-const MESH_RASTER_MAX_PIXELS: usize = 16 << 20;
+/// one is drawn quad by quad. The buffer is clipped to the frame; at 4 MP it holds at most 16 MB
+/// of pixels per mesh and frame.
+const MESH_RASTER_MAX_PIXELS: usize = 4 << 20;
/// Draw a tessellated gradient mesh as one image: its quads are filled into a pixel buffer of the
/// mesh's on-screen box by scanline (each pixel takes the quad its centre is in, so neighbouring