Remove poorly named functions

Moves the more descriptive comments to the free functions.
This commit is contained in:
Chad Brokaw 2022-05-19 18:07:07 -04:00
parent 39b773c611
commit d30750e8a7
2 changed files with 5 additions and 17 deletions

View file

@ -23,12 +23,14 @@ use core::borrow::Borrow;
const MAX_BLEND_STACK: usize = 256;
/// Creates a new builder for constructing a scene.
/// Creates a new builder for filling a scene. Any current content in the scene
/// will be cleared.
pub fn build_scene<'a>(scene: &'a mut Scene, rcx: &'a mut ResourceContext) -> Builder<'a> {
Builder::new(&mut scene.data, ResourceData::Scene(rcx))
}
/// Creates a new builder for construction a scene fragment.
/// Creates a new builder for filling a scene fragment. Any current content in
/// the fragment will be cleared.
pub fn build_fragment<'a>(fragment: &'a mut Fragment) -> Builder<'a> {
Builder::new(
&mut fragment.data,
@ -62,8 +64,7 @@ impl<'a> Builder<'a> {
}
/// Pushes a transform matrix onto the stack.
pub fn push_transform(&mut self, transform: impl Into<Affine>) {
let transform = transform.into();
pub fn push_transform(&mut self, transform: Affine) {
self.transform(transform);
self.transforms.push(transform);
}

View file

@ -25,7 +25,6 @@ pub use style::*;
use super::brush::*;
use super::geometry::{Affine, Point};
use super::path::Element;
use super::resource::ResourceContext;
use core::ops::Range;
@ -85,12 +84,6 @@ pub struct Scene {
}
impl Scene {
/// Creates a new builder for filling the scene. Any current content in
/// the scene is cleared.
pub fn build<'a>(&'a mut self, rcx: &'a mut ResourceContext) -> Builder<'a> {
build_scene(self, rcx)
}
/// Returns the raw encoded scene data streams.
pub fn data(&self) -> &SceneData {
&self.data
@ -110,12 +103,6 @@ impl Fragment {
pub fn points(&self) -> &[Point] {
bytemuck::cast_slice(&self.data.pathseg_stream)
}
/// Creates a new builder for filling the fragment. Any current content in
/// the fragment is cleared.
pub fn build<'a>(&'a mut self) -> Builder<'a> {
build_fragment(self)
}
}
#[derive(Default)]