Allocate native PNG transparency and palette objects

This commit is contained in:
gloamxun committed 2026-11-27 21:30:31 +08:00
1 parent 51451813dc
commit 342bedf9b4
9 files changed
+215 -29

No files matched your search

@@ -452,6 +452,7 @@ impl Executor {
let mut has_space_nodes = false;
let mut has_explicit_space = false;
let mut pdf_objects = Vec::new();
let mut pdf_images = Vec::new();
let mut pdf_forms = Vec::new();
let mut xdv_annotations = std::collections::BTreeMap::new();
let mut reopened_images = false;
@@ -496,6 +497,17 @@ impl Executor {
self.current = output.span;
self.tick()?;
pdf_forms.push((form.number, output.span));
} else if let OutputOperation::PdfImage { image, .. } = &output.operation
&& !unicode_pages && device.pdf.is_some()
{
self.current = output.span;
self.tick()?;
if let Some(page) = &mut shipout.pdf_objects
&& page.png_group.is_none()
{
page.png_group = image.png_group;
}
pdf_images.push((image.id, output.span));
} else if let OutputOperation::PdfColor { stack, action } = &output.operation {
if device.pdf.is_none() {
return self.fail("cannot ship a PDF color operation to DVI");
@@ -705,6 +717,10 @@ impl Executor {
.finish_page(self.shipped_pages as u32 + 1, limit)
.map_err(|message| self.error(message, current))?;
}
for (image, span) in pdf_images {
self.current = span;
self.declare_pdf_image(image, files)?;
}
if reopened_images {
self.rebind_shipped_format_images(&mut shipout.box_node)?;
}