summaryrefslogtreecommitdiff
path: root/library/src/graphics
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-24 17:39:08 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-24 17:41:41 +0100
commit8d3c68a1deb28dce2b80ed61f85141180ce6a951 (patch)
treede007203d448d6b6a2df7838e802f85d23ccd1a6 /library/src/graphics
parent5ae81971f299688b05d77af208d7bb44ffce5e2d (diff)
Protect Vm
Diffstat (limited to 'library/src/graphics')
-rw-r--r--library/src/graphics/hide.rs2
-rw-r--r--library/src/graphics/image.rs4
-rw-r--r--library/src/graphics/line.rs2
-rw-r--r--library/src/graphics/shape.rs2
4 files changed, 5 insertions, 5 deletions
diff --git a/library/src/graphics/hide.rs b/library/src/graphics/hide.rs
index 0fdb8638..f79b31ae 100644
--- a/library/src/graphics/hide.rs
+++ b/library/src/graphics/hide.rs
@@ -6,7 +6,7 @@ pub struct HideNode(pub Content);
#[node(LayoutInline)]
impl HideNode {
- fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> {
+ fn construct(_: &Vm, args: &mut Args) -> SourceResult<Content> {
Ok(Self(args.expect("body")?).pack())
}
}
diff --git a/library/src/graphics/image.rs b/library/src/graphics/image.rs
index 12121257..202abebe 100644
--- a/library/src/graphics/image.rs
+++ b/library/src/graphics/image.rs
@@ -14,12 +14,12 @@ impl ImageNode {
/// How the image should adjust itself to a given area.
pub const FIT: ImageFit = ImageFit::Cover;
- fn construct(vm: &mut Vm, args: &mut Args) -> SourceResult<Content> {
+ fn construct(vm: &Vm, args: &mut Args) -> SourceResult<Content> {
let Spanned { v: path, span } =
args.expect::<Spanned<EcoString>>("path to image file")?;
let full = vm.locate(&path).at(span)?;
- let buffer = vm.world.file(&full).at(span)?;
+ let buffer = vm.world().file(&full).at(span)?;
let ext = full.extension().and_then(OsStr::to_str).unwrap_or_default();
let format = match ext.to_lowercase().as_str() {
"png" => ImageFormat::Raster(RasterFormat::Png),
diff --git a/library/src/graphics/line.rs b/library/src/graphics/line.rs
index 112274d2..e7c347b2 100644
--- a/library/src/graphics/line.rs
+++ b/library/src/graphics/line.rs
@@ -15,7 +15,7 @@ impl LineNode {
#[property(resolve, fold)]
pub const STROKE: PartialStroke = PartialStroke::default();
- fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> {
+ fn construct(_: &Vm, args: &mut Args) -> SourceResult<Content> {
let origin = args.named("origin")?.unwrap_or_default();
let delta = match args.named::<Axes<Rel<Length>>>("to")? {
diff --git a/library/src/graphics/shape.rs b/library/src/graphics/shape.rs
index d484b993..ebdc1717 100644
--- a/library/src/graphics/shape.rs
+++ b/library/src/graphics/shape.rs
@@ -38,7 +38,7 @@ impl<const S: ShapeKind> ShapeNode<S> {
#[property(skip, resolve, fold)]
pub const RADIUS: Corners<Option<Rel<Length>>> = Corners::splat(Rel::zero());
- fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> {
+ fn construct(_: &Vm, args: &mut Args) -> SourceResult<Content> {
let size = match S {
SQUARE => args.named::<Length>("size")?.map(Rel::from),
CIRCLE => args.named::<Length>("radius")?.map(|r| 2.0 * Rel::from(r)),