mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-21 20:38:48 +00:00
render: enforce max_coverage via craft-libs #2546 (storytold/craft-libs#778) (#7961)
This commit is contained in:
Generated
+7
-7
@@ -1579,7 +1579,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pdf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a6e9a7e6c596982f3aaee1abf9a391383fb0a99e#a6e9a7e6c596982f3aaee1abf9a391383fb0a99e"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=9eb02be84f21898e247daeb2af5827c9fe85a3a0#9eb02be84f21898e247daeb2af5827c9fe85a3a0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"bytemuck",
|
||||
@@ -1695,7 +1695,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-stream-codecs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a6e9a7e6c596982f3aaee1abf9a391383fb0a99e#a6e9a7e6c596982f3aaee1abf9a391383fb0a99e"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=9eb02be84f21898e247daeb2af5827c9fe85a3a0#9eb02be84f21898e247daeb2af5827c9fe85a3a0"
|
||||
dependencies = [
|
||||
"fax",
|
||||
"hayro-ccitt",
|
||||
@@ -3319,7 +3319,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro"
|
||||
version = "0.7.1"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a6e9a7e6c596982f3aaee1abf9a391383fb0a99e#a6e9a7e6c596982f3aaee1abf9a391383fb0a99e"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=9eb02be84f21898e247daeb2af5827c9fe85a3a0#9eb02be84f21898e247daeb2af5827c9fe85a3a0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"hayro-interpret",
|
||||
@@ -3339,7 +3339,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
|
||||
[[package]]
|
||||
name = "hayro-cmap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a6e9a7e6c596982f3aaee1abf9a391383fb0a99e#a6e9a7e6c596982f3aaee1abf9a391383fb0a99e"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=9eb02be84f21898e247daeb2af5827c9fe85a3a0#9eb02be84f21898e247daeb2af5827c9fe85a3a0"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"hayro-postscript",
|
||||
@@ -3348,7 +3348,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-interpret"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a6e9a7e6c596982f3aaee1abf9a391383fb0a99e#a6e9a7e6c596982f3aaee1abf9a391383fb0a99e"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=9eb02be84f21898e247daeb2af5827c9fe85a3a0#9eb02be84f21898e247daeb2af5827c9fe85a3a0"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"hayro-cmap",
|
||||
@@ -3366,7 +3366,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-jbig2"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a6e9a7e6c596982f3aaee1abf9a391383fb0a99e#a6e9a7e6c596982f3aaee1abf9a391383fb0a99e"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=9eb02be84f21898e247daeb2af5827c9fe85a3a0#9eb02be84f21898e247daeb2af5827c9fe85a3a0"
|
||||
dependencies = [
|
||||
"fearless_simd",
|
||||
"hayro-ccitt",
|
||||
@@ -3389,7 +3389,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=e7873217287876f76a0455
|
||||
[[package]]
|
||||
name = "hayro-syntax"
|
||||
version = "0.7.2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=a6e9a7e6c596982f3aaee1abf9a391383fb0a99e#a6e9a7e6c596982f3aaee1abf9a391383fb0a99e"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=9eb02be84f21898e247daeb2af5827c9fe85a3a0#9eb02be84f21898e247daeb2af5827c9fe85a3a0"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hayro-ccitt",
|
||||
|
||||
+6
-6
@@ -35,7 +35,7 @@ craft-zip = { git = "https://github.com/storytold/craft-libs", version = "0.1.0"
|
||||
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" }
|
||||
# craft-update: app-specific pretend versions apply to startup and manual checks.
|
||||
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "e2dc681a3", features = ["egui"] }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "a6e9a7e6c596982f3aaee1abf9a391383fb0a99e", features = ["cos", "crypt", "filters", "fonts"] }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "9eb02be84f21898e247daeb2af5827c9fe85a3a0", features = ["cos", "crypt", "filters", "fonts"] }
|
||||
# The writers the Word and RTF exports map onto (storytold/craft-libs#793). craft-rtf, craft-wordmodel and
|
||||
# craft-docx move together: craft_rtf::doc::export takes its own revision's Document.
|
||||
craft-rtf = { git = "https://github.com/storytold/craft-libs", version = "0.1.0", rev = "b8eaa8e2f3561f9fa27fcf3b7f67ce915e93caa3" }
|
||||
@@ -166,12 +166,12 @@ codegen-units = 1
|
||||
|
||||
# Vendored, patched third-party crates (see vendor/README.md). Each patch is meant to go upstream.
|
||||
[patch.crates-io]
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a6e9a7e6c596982f3aaee1abf9a391383fb0a99e" }
|
||||
hayro = { git = "https://github.com/storytold/craft-libs", rev = "a6e9a7e6c596982f3aaee1abf9a391383fb0a99e" }
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a6e9a7e6c596982f3aaee1abf9a391383fb0a99e" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a6e9a7e6c596982f3aaee1abf9a391383fb0a99e" }
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "9eb02be84f21898e247daeb2af5827c9fe85a3a0" }
|
||||
hayro = { git = "https://github.com/storytold/craft-libs", rev = "9eb02be84f21898e247daeb2af5827c9fe85a3a0" }
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "9eb02be84f21898e247daeb2af5827c9fe85a3a0" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "9eb02be84f21898e247daeb2af5827c9fe85a3a0" }
|
||||
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "e7873217287876f76a045550369c90a541693c33" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a6e9a7e6c596982f3aaee1abf9a391383fb0a99e" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "9eb02be84f21898e247daeb2af5827c9fe85a3a0" }
|
||||
lopdf = { path = "vendor/lopdf" }
|
||||
vello_common = { path = "vendor/vello_common" }
|
||||
vello_cpu = { path = "vendor/vello_cpu" }
|
||||
|
||||
@@ -440,7 +440,14 @@ fn render_page<'a>(
|
||||
Some(t) => {
|
||||
let scale = req.scale.clamp(0.01, 400.0);
|
||||
let (tw, th) = (t.w.clamp(1, 4096), t.h.clamp(1, 4096));
|
||||
RasterOptions { scale: [scale, scale], size: Some([tw, th]), offset: [t.x as f32, t.y as f32], background, color_replacement }
|
||||
RasterOptions {
|
||||
scale: [scale, scale],
|
||||
size: Some([tw, th]),
|
||||
offset: [t.x as f32, t.y as f32],
|
||||
background,
|
||||
color_replacement,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
None => {
|
||||
let scale = effective_scale(w, h, req.scale);
|
||||
@@ -457,7 +464,14 @@ fn render_page<'a>(
|
||||
// hayro floors the size when none is given, losing the partial edge pixels. The
|
||||
// scale keeps each side within MAX_SIDE (give or take float noise), so it fits u32.
|
||||
let side = |pt: f32| device_pixels(pt, scale).min(MAX_SIDE as u32);
|
||||
RasterOptions { scale: [scale, scale], size: Some([side(w), side(h)]), offset: [0.0, 0.0], background, color_replacement }
|
||||
RasterOptions {
|
||||
scale: [scale, scale],
|
||||
size: Some([side(w), side(h)]),
|
||||
offset: [0.0, 0.0],
|
||||
background,
|
||||
color_replacement,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
};
|
||||
// Rendered straight into a buffer of whole pixels, which the GUI takes over as is.
|
||||
|
||||
@@ -70,7 +70,6 @@ fn render_kept_to(pdf: Vec<u8>, max_coverage: Option<usize>) -> (Vec<u8>, bool)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "craft-libs uses unvendored vello_cpu 0.0.8 where RenderSettings::max_coverage is a no-op"]
|
||||
fn a_page_past_its_coverage_leaves_the_rest_out_and_says_so() {
|
||||
// 2^10 circles, each storing its edge tiles' coverage.
|
||||
let pdf = doubling_forms(10);
|
||||
@@ -107,7 +106,6 @@ fn leaves_out_past_the_limit(leaf: &str, marker: &str) {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "craft-libs uses unvendored vello_cpu 0.0.8 where RenderSettings::max_coverage is a no-op"]
|
||||
fn strokes_past_the_coverage_are_left_out() {
|
||||
// A stroked circle and a stroked curve: neither is a rectangle, so both go through
|
||||
// `stroke_path`, and the page's only coverage is strokes.
|
||||
@@ -118,7 +116,6 @@ fn strokes_past_the_coverage_are_left_out() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "craft-libs uses unvendored vello_cpu 0.0.8 where RenderSettings::max_coverage is a no-op"]
|
||||
fn fast_rectangles_past_the_coverage_are_left_out() {
|
||||
// Axis-aligned rectangles fill through `fill_rect_fast`, and are the page's only coverage.
|
||||
leaves_out_past_the_limit("0 0 1 rg 40.5 40.5 119 119 re f", "1 0 0 rg 170.5 10.5 20 20 re f");
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::process::Command;
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
const SHARED_REV: &str = "a6e9a7e6c596982f3aaee1abf9a391383fb0a99e";
|
||||
const SHARED_REV: &str = "9eb02be84f21898e247daeb2af5827c9fe85a3a0";
|
||||
const PACKAGES: &[(&str, &str)] = &[
|
||||
("craft-pdf", "0.1.0"),
|
||||
("hayro", "0.7.1"),
|
||||
|
||||
Reference in New Issue
Block a user