Rasterize: art that is exactly 32,768 pixels a side at the resolution is accepted

The side limit compared the region's height in points times the scale
with 32,768. Far from the origin the snapped region can come back a
fraction of a pixel over, so art that the renderer draws at exactly
32,768 pixels was refused (a rectangle at y = 100,000 rasterized at
400 ppi). The check now uses the renderer's own rounded pixel width and
height.
This commit is contained in:
dotCooCoo
2026-11-11 04:00:39 -08:00
parent a5a42e45ac
commit 80b452ad6c
2 changed files with 21 additions and 3 deletions
+5 -3
View File
@@ -670,9 +670,11 @@ fn render_pixels(
opts: &vectorcraft_render::RenderOptions,
color: RasterColorModel,
) -> Result<(vectorcraft_render::Rendered, Option<&'static str>)> {
// No side longer than the renderer draws: it would cut the image off there.
let side = f64::from(vectorcraft_render::MAX_RASTER_SIDE);
if region.width() * region.height() * scale * scale > MAX_PIXELS || region.width() * scale > side || region.height() * scale > side {
// No side longer than the renderer draws: it would cut the image off there. The sides are
// measured in the renderer's whole pixels.
let side = vectorcraft_render::MAX_RASTER_SIDE;
let (w, h) = vectorcraft_render::region_pixels(region, scale);
if region.width() * region.height() * scale * scale > MAX_PIXELS || w > side || h > side {
return Err(EngineError::Other("image would be too large; lower the resolution".into()));
}
let mut r = vectorcraft_render::Renderer::new();