From 9735518c84bf2575371db43761c2a90fee798e01 Mon Sep 17 00:00:00 2001 From: Fabian Grajales Date: Sat, 17 Oct 2026 13:11:03 -0500 Subject: [PATCH] Render: a gradient mesh is rasterized into at most 4 MP (16 MB) at once The image a mesh's quads are filled into is clipped to the frame; at 16 MP a mesh filling a large canvas allocated up to 64 MB per frame. A larger mesh is drawn quad by quad, backed by its patches' outlines. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Dt49z1ubK9x1bPq51APgz3 --- crates/render/src/live.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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