Skip to content

Commit

Permalink
Impl From<Encoding> for Scene.
Browse files Browse the repository at this point in the history
This allows creating a `Scene` with a pre-existing `Encoding`.

Fixes linebender#530.
  • Loading branch information
waywardmonkeys committed Apr 2, 2024
1 parent 45bc031 commit 24fdd3f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@ impl Scene {
}
}

impl From<Encoding> for Scene {
fn from(encoding: Encoding) -> Self {
// TODO: Properly update the estimator for the encoding.
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 24fdd3f

Please sign in to comment.