Reuse verified native suffixes after settled output routines

This commit is contained in:
gloamxun committed 2026-11-29 07:51:37 +08:00
1 parent f387b1db61
commit 0117449023
30 files changed
+791 -77

No files matched your search

@@ -10,7 +10,7 @@ use crate::{
const MAX_CMAP_DEPTH: usize = 16;
const MAX_CMAP_BYTES: usize = 16 * 1024 * 1024;
#[derive(Debug)]
#[derive(Debug, PartialEq, Eq)]
pub(crate) struct CMap {
codespaces: [Vec<[u32; 2]>; 4],
mappings: [BTreeMap<u32, Mapping>; 4],
@@ -24,19 +24,19 @@ pub(crate) struct CMap {
pub(crate) resources: Vec<ResourceVersion>,
}
#[derive(Debug)]
#[derive(Debug, PartialEq, Eq)]
struct Mapping {
last: u32,
destination: Destination,
}
#[derive(Debug)]
#[derive(Debug, PartialEq, Eq)]
struct CidRange {
last: u32,
cid: u16,
}
#[derive(Debug)]
#[derive(Debug, PartialEq, Eq)]
enum Destination {
Sequential(Vec<u8>),
Explicit(Vec<Vec<u8>>),
@@ -308,7 +308,7 @@ impl ShippedColor {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
struct Stack {
mode: PdfLiteralMode,
replay_on_page: bool,
@@ -325,7 +325,7 @@ impl Stack {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct PdfColorStacks(Vec<Stack>);
impl Default for PdfColorStacks {
@@ -87,6 +87,13 @@ pub(crate) struct AnnotationState {
enabled: bool,
}
impl AnnotationState {
pub(crate) fn same_idle_state(&self, other: &Self) -> bool {
self.enabled == other.enabled && self.bounds.is_none() && other.bounds.is_none()
&& self.active.is_none() && other.active.is_none()
}
}
impl Default for AnnotationState {
fn default() -> Self {
Self {
@@ -104,7 +104,7 @@ fn program(literal: String, resources: Vec<XdvColorResource>) -> Arc<PdfColorPro
})
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct ColorState {
base: Colors,
saved: Vec<Colors>,
@@ -44,6 +44,13 @@ pub(crate) struct TextEncoding {
}
impl TextEncoding {
pub(crate) fn same_state(&self, other: &Self) -> bool {
self.tainted_literals == other.tainted_literals
&& self.extra_keys == other.extra_keys
&& self.map.as_deref() == other.map.as_deref()
}
pub(crate) fn apply(
&mut self, operands: &[u8], from: &str, files: &mut impl SourceProvider,
) -> Vec<String> {