mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-13 09:20:56 -06:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user