Integration: #3020 number its hayro-interpret patch 48 (40 is #2987's)

This commit is contained in:
aiongg
2026-10-22 01:51:55 +00:00
parent e2d3f30c63
commit ec6a8166bb
5 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -7159,7 +7159,7 @@ endstream endobj
assert_eq!(decodes("B"), 5, "a JPX soft mask decodes for the size it is drawn at");
}
// ICC profiles whose stream dictionaries are the same (vendored hayro-interpret patch 40).
// ICC profiles whose stream dictionaries are the same (vendored hayro-interpret patch 48).
mod icc_profile_cache;
/// Render `pdf`'s first page at 72 dpi with no time limit beyond the test's own.
@@ -1,5 +1,5 @@
//! Two `/ICCBased` profiles whose stream dictionaries are byte for byte the same (`/N 3` and one
//! `/Length`) each draw through their own profile (vendored hayro-interpret patch 40). hayro
//! `/Length`) each draw through their own profile (vendored hayro-interpret patch 48). hayro
//! cached the colour space it read from a profile stream by the dictionary's bytes alone, so
//! the second profile drew through whichever was read first.
//!
+3 -3
View File
@@ -8,7 +8,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
type CacheMap = HashMap<u128, Option<Box<dyn Any + Send + Sync>>>;
/// The objects read from a document, by key. PdfCraft patch (40): the second field counts the
/// The objects read from a document, by key. PdfCraft patch (48): the second field counts the
/// ICC profiles read through it ([`Cache::icc_profile_reads`]).
#[derive(Clone)]
pub(crate) struct Cache(Arc<Mutex<CacheMap>>, Arc<AtomicUsize>);
@@ -23,13 +23,13 @@ impl Cache {
Self(Arc::new(Mutex::new(HashMap::new())), Arc::default())
}
/// PdfCraft patch (40): count one ICC profile read, the colour space of an `/ICCBased`
/// PdfCraft patch (48): count one ICC profile read, the colour space of an `/ICCBased`
/// profile no entry held yet being built from it.
pub(crate) fn count_icc_profile_read(&self) {
self.1.fetch_add(1, Ordering::Relaxed);
}
/// PdfCraft patch (40): how many ICC profiles were read through this cache.
/// PdfCraft patch (48): how many ICC profiles were read through this cache.
pub(crate) fn icc_profile_reads(&self) -> usize {
self.1.load(Ordering::Relaxed)
}
+3 -3
View File
@@ -122,7 +122,7 @@ pub(crate) enum ColorSpaceType {
DeviceN(DeviceN),
}
/// PdfCraft patch (40): what the colour space read from an `/ICCBased` profile stream is cached
/// PdfCraft patch (48): what the colour space read from an `/ICCBased` profile stream is cached
/// by. hayro keyed it by the stream dictionary's bytes alone, so two different profiles with the
/// same `/N` and `/Length` shared whichever was read first, and colours in the second were
/// drawn through the first.
@@ -138,7 +138,7 @@ enum IccProfileKey<'a> {
Content { dict: u128, data: &'a [u8] },
}
/// PdfCraft patch (40): the object of the `/ICCBased` profile `stream` that `array` names, or
/// PdfCraft patch (48): the object of the `/ICCBased` profile `stream` that `array` names, or
/// `None` for a stream written directly in the array (its dictionary lies within the array's
/// bytes). Such a stream has no object of its own: its dictionary reports the object that
/// holds the array, which every other stream written there reports too.
@@ -168,7 +168,7 @@ impl ColorSpaceType {
let dict = icc_stream.dict();
let num_components = dict.get::<usize>(N)?;
// PdfCraft patch (40): cached by what the profile is read from (see
// PdfCraft patch (48): cached by what the profile is read from (see
// `IccProfileKey`), not by the stream dictionary's bytes alone.
let read = || {
let data = icc_stream.raw_data();
+1 -1
View File
@@ -147,7 +147,7 @@ impl<'a> InterpreterCache<'a> {
self.decoded_cache.decodes()
}
/// PdfCraft patch (40): how many `/ICCBased` profiles were read through this cache, for
/// PdfCraft patch (48): how many `/ICCBased` profiles were read through this cache, for
/// diagnostics and tests. A profile used again, by the same stream object or by a copy with
/// the same dictionary and bytes, is read once.
pub fn icc_profile_reads(&self) -> usize {