From d30750e8a74a0f88c20081bed2347bcd2c606b07 Mon Sep 17 00:00:00 2001 From: Chad Brokaw Date: Thu, 19 May 2022 18:07:07 -0400 Subject: [PATCH] Remove poorly named functions Moves the more descriptive comments to the free functions. --- piet-scene/src/scene/builder.rs | 9 +++++---- piet-scene/src/scene/mod.rs | 13 ------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/piet-scene/src/scene/builder.rs b/piet-scene/src/scene/builder.rs index 39abc93..8aa1bf5 100644 --- a/piet-scene/src/scene/builder.rs +++ b/piet-scene/src/scene/builder.rs @@ -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) { - let transform = transform.into(); + pub fn push_transform(&mut self, transform: Affine) { self.transform(transform); self.transforms.push(transform); } diff --git a/piet-scene/src/scene/mod.rs b/piet-scene/src/scene/mod.rs index abbc6d9..577f81e 100644 --- a/piet-scene/src/scene/mod.rs +++ b/piet-scene/src/scene/mod.rs @@ -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)]