Skip to content

Commit

Permalink
Impl From<Encoding> for Scene. (#538)
Browse files Browse the repository at this point in the history
* Impl `From<Encoding>` for `Scene`.

This allows creating a `Scene` with a pre-existing `Encoding`.

Fixes #530.

* Link to #541

---------

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
  • Loading branch information
waywardmonkeys and DJMcNab authored Apr 23, 2024
1 parent 17585c3 commit 45c872a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ impl Scene {
}
}

impl From<Encoding> for Scene {
fn from(encoding: Encoding) -> Self {
// It's fine to create a default estimator here, and that field will be
// removed at some point - see https://github.com/linebender/vello/issues/541
Self {
encoding,
#[cfg(feature = "bump_estimate")]
estimator: vello_encoding::BumpEstimator::default(),
}
}
}

/// Builder for encoding a glyph run.
pub struct DrawGlyphs<'a> {
encoding: &'a mut Encoding,
Expand Down

0 comments on commit 45c872a

Please sign in to comment.