summaryrefslogtreecommitdiff
path: root/src/export/pdf/image.rs
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-04-23 14:33:56 +0200
committerGitHub <noreply@github.com>2023-04-23 14:33:56 +0200
commit561ff979d574f496415c0499345d41da2e1f6e1e (patch)
tree037479ac000bd87a1cb2149e5389b28f08d24051 /src/export/pdf/image.rs
parent2fbb14f712708188649181525813b3ac5a02e0fb (diff)
Add instrumentation (Part 1) (#761)
Diffstat (limited to 'src/export/pdf/image.rs')
-rw-r--r--src/export/pdf/image.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/export/pdf/image.rs b/src/export/pdf/image.rs
index e6eaa9c9..04d4dcc3 100644
--- a/src/export/pdf/image.rs
+++ b/src/export/pdf/image.rs
@@ -7,6 +7,7 @@ use super::{deflate, PdfContext, RefExt};
use crate::image::{DecodedImage, RasterFormat};
/// Embed all used images into the PDF.
+#[tracing::instrument(skip_all)]
pub fn write_images(ctx: &mut PdfContext) {
for image in ctx.image_map.items() {
let image_ref = ctx.alloc.bump();
@@ -67,6 +68,7 @@ pub fn write_images(ctx: &mut PdfContext) {
/// whether the image has color.
///
/// Skips the alpha channel as that's encoded separately.
+#[tracing::instrument(skip_all)]
fn encode_image(
format: RasterFormat,
dynamic: &DynamicImage,
@@ -111,6 +113,7 @@ fn encode_image(
}
/// Encode an image's alpha channel if present.
+#[tracing::instrument(skip_all)]
fn encode_alpha(dynamic: &DynamicImage) -> (Vec<u8>, Filter) {
let pixels: Vec<_> = dynamic.pixels().map(|(_, _, Rgba([_, _, _, a]))| a).collect();
(deflate(&pixels), Filter::FlateDecode)