summaryrefslogtreecommitdiff
path: root/crates/typst-pdf/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-06-10 15:28:40 +0200
committerGitHub <noreply@github.com>2024-06-10 13:28:40 +0000
commit7fa86eed0eca9b529d71d4006f389a753467e54a (patch)
treeeeb4a0cd5a82e30b1852312f3eec1c6269a893b8 /crates/typst-pdf/src
parenta68a241570eca6d46f916e3ee103664a4eb79333 (diff)
Basic multi-threading (#4366)
Diffstat (limited to 'crates/typst-pdf/src')
-rw-r--r--crates/typst-pdf/src/image.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/typst-pdf/src/image.rs b/crates/typst-pdf/src/image.rs
index 9951dac5..1d43a43b 100644
--- a/crates/typst-pdf/src/image.rs
+++ b/crates/typst-pdf/src/image.rs
@@ -145,6 +145,7 @@ pub fn deferred_image(image: Image) -> (Deferred<EncodedImage>, Option<ColorSpac
/// whether the image has color.
///
/// Skips the alpha channel as that's encoded separately.
+#[typst_macros::time(name = "encode raster image")]
fn encode_raster_image(image: &RasterImage) -> (Vec<u8>, Filter, bool) {
let dynamic = image.dynamic();
let channel_count = dynamic.color().channel_count();
@@ -169,6 +170,7 @@ fn encode_raster_image(image: &RasterImage) -> (Vec<u8>, Filter, bool) {
}
/// Encode an image's alpha channel if present.
+#[typst_macros::time(name = "encode alpha")]
fn encode_alpha(raster: &RasterImage) -> (Vec<u8>, Filter) {
let pixels: Vec<_> = raster
.dynamic()
@@ -179,6 +181,7 @@ fn encode_alpha(raster: &RasterImage) -> (Vec<u8>, Filter) {
}
/// Encode an SVG into a chunk of PDF objects.
+#[typst_macros::time(name = "encode svg")]
fn encode_svg(svg: &SvgImage) -> (Chunk, Ref) {
svg2pdf::to_chunk(svg.tree(), svg2pdf::ConversionOptions::default())
}