mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-11 13:02:25 +00:00
PDF: compile the CCITT row helper only with images
This commit is contained in:
1 parent
6865897f14
commit
6e909558c1
3 files changed
+6
-2
No files matched your search
Vendored
+3
@@ -321,6 +321,9 @@ products match its vertices (moving the points alone skewed barycentric coordina
|
||||
`restore_state` doesn't when the saved-state bound skipped the save; and a resolved JP2
|
||||
palette decodes to 8 bits whatever `/BitsPerComponent` the dictionary gives.
|
||||
|
||||
`hayro-syntax` compiles `filter::ccitt_max_rows` and its unit tests only with the
|
||||
`images` feature, matching `filter::ccitt`.
|
||||
|
||||
This remains the patched 0.7 backend. It retains the existing Bradford Lab conversion,
|
||||
floating component precision and codec versions, rather than claiming full 0.8
|
||||
equivalence. The independent color oracles, backend tests and facade contracts cover
|
||||
|
||||
Vendored
+1
-1
@@ -176,7 +176,7 @@
|
||||
"path": "src/filter/mod.rs",
|
||||
"source_sha256": "0af7145ab16b15b7a60c4b57efecb9bd5fd0cfdc9bb5f9388abb695386e63e49",
|
||||
"source_git_blob": "06bda29487d62c25dc39c1ee109091cb17e3867f",
|
||||
"sha256": "727fd21fe968d0ce9de54ea0c50658af43658289f9b38b27fbc74596e48d0d4b"
|
||||
"sha256": "a3bf1dbe731aca35808ec7f22f1d58bb5f0f4e3ce9087260d1e38800baf33bd8"
|
||||
},
|
||||
{
|
||||
"path": "src/filter/run_length.rs",
|
||||
|
||||
+2
-1
@@ -176,13 +176,14 @@ const MAX_CCITT_PIXELS: u64 = 1 << 28;
|
||||
|
||||
/// PdfCraft patch: the most rows of `columns` pixels, `row_bytes` bytes each once decoded, that fit
|
||||
/// both `limit` bytes and the pixel cap; at least one when one row fits.
|
||||
#[cfg(feature = "images")]
|
||||
pub(crate) fn ccitt_max_rows(columns: u32, row_bytes: u32, limit: usize) -> u32 {
|
||||
let by_pixels = MAX_CCITT_PIXELS / u64::from(columns.max(1));
|
||||
let by_bytes = u64::try_from(limit).unwrap_or(u64::MAX) / u64::from(row_bytes.max(1));
|
||||
u32::try_from(by_pixels.min(by_bytes)).unwrap_or(u32::MAX)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, feature = "images"))]
|
||||
mod ccitt_tests {
|
||||
use super::ccitt_max_rows;
|
||||
|
||||
|
||||
Reference in new issue
Block a user