summaryrefslogtreecommitdiff
path: root/crates/typst-layout/src/image.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2025-07-08 10:52:43 +0200
committerGitHub <noreply@github.com>2025-07-08 08:52:43 +0000
commit0a3c6939dd274f40672484695d909c2cc0d0d755 (patch)
tree465c10338230b895fdd06c8b3491f1734e8a2932 /crates/typst-layout/src/image.rs
parent36ecbb2c8dccc1a31c43fee1466f1425844d8607 (diff)
Rewrite foundations of native elements (#6547)
Diffstat (limited to 'crates/typst-layout/src/image.rs')
-rw-r--r--crates/typst-layout/src/image.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/typst-layout/src/image.rs b/crates/typst-layout/src/image.rs
index a8f4a0c8..261a58fa 100644
--- a/crates/typst-layout/src/image.rs
+++ b/crates/typst-layout/src/image.rs
@@ -28,7 +28,7 @@ pub fn layout_image(
// Take the format that was explicitly defined, or parse the extension,
// or try to detect the format.
let Derived { source, derived: loaded } = &elem.source;
- let format = match elem.format(styles) {
+ let format = match elem.format.get(styles) {
Smart::Custom(v) => v,
Smart::Auto => determine_format(source, &loaded.data).at(span)?,
};
@@ -55,7 +55,7 @@ pub fn layout_image(
RasterImage::new(
loaded.data.clone(),
format,
- elem.icc(styles).as_ref().map(|icc| icc.derived.clone()),
+ elem.icc.get_ref(styles).as_ref().map(|icc| icc.derived.clone()),
)
.at(span)?,
),
@@ -69,7 +69,7 @@ pub fn layout_image(
),
};
- let image = Image::new(kind, elem.alt(styles), elem.scaling(styles));
+ let image = Image::new(kind, elem.alt.get_cloned(styles), elem.scaling.get(styles));
// Determine the image's pixel aspect ratio.
let pxw = image.width();
@@ -106,7 +106,7 @@ pub fn layout_image(
};
// Compute the actual size of the fitted image.
- let fit = elem.fit(styles);
+ let fit = elem.fit.get(styles);
let fitted = match fit {
ImageFit::Cover | ImageFit::Contain => {
if wide == (fit == ImageFit::Contain) {