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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dt49z1ubK9x1bPq51APgz3
This commit is contained in:
Fabian Grajales
2026-10-18 12:41:21 +07:00
committed by bflatastic
co-authored by Claude Opus 5.5
parent cf5caa43d5
commit 9735518c84
+3 -2
View File
@@ -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