Rename `PathObject` to `DrawPath` to differentiate it from a clip path

This commit is contained in:
Patrick Walton 2020-02-15 12:39:15 -08:00
parent 6e28552a44
commit fefa3c3cd3
6 changed files with 18 additions and 18 deletions

View File

@ -22,7 +22,7 @@ use pathfinder_geometry::vector::Vector2F;
use pathfinder_geometry::rect::RectF;
use pathfinder_geometry::transform2d::Transform2F;
use pathfinder_renderer::paint::{Paint, PaintId};
use pathfinder_renderer::scene::{PathObject, Scene};
use pathfinder_renderer::scene::{DrawPath, Scene};
use std::borrow::Cow;
use std::default::Default;
use std::f32::consts::PI;
@ -206,10 +206,10 @@ impl CanvasRenderingContext2D {
let mut outline = outline.clone();
outline.transform(&Transform2F::from_translation(self.current_state.shadow_offset));
self.scene.push_path(PathObject::new(outline, paint_id, String::new()))
self.scene.push_path(DrawPath::new(outline, paint_id, String::new()))
}
self.scene.push_path(PathObject::new(outline, paint_id, String::new()))
self.scene.push_path(DrawPath::new(outline, paint_id, String::new()))
}
// Transformations

View File

@ -23,7 +23,7 @@ use pathfinder_content::outline::Outline;
#[derive(Clone)]
pub struct Scene {
pub(crate) paths: Vec<PathObject>,
pub(crate) paths: Vec<DrawPath>,
palette: Palette,
bounds: RectF,
view_box: RectF,
@ -40,7 +40,7 @@ impl Scene {
}
}
pub fn push_path(&mut self, path: PathObject) {
pub fn push_path(&mut self, path: DrawPath) {
self.bounds = self.bounds.union_rect(path.outline.bounds());
self.paths.push(path);
}
@ -201,16 +201,16 @@ impl<'a> Iterator for PathIter<'a> {
}
#[derive(Clone, Debug)]
pub struct PathObject {
pub struct DrawPath {
outline: Outline,
paint: PaintId,
name: String,
}
impl PathObject {
impl DrawPath {
#[inline]
pub fn new(outline: Outline, paint: PaintId, name: String) -> PathObject {
PathObject { outline, paint, name }
pub fn new(outline: Outline, paint: PaintId, name: String) -> DrawPath {
DrawPath { outline, paint, name }
}
#[inline]

View File

@ -12,7 +12,7 @@
use crate::gpu_data::SolidTileVertex;
use crate::paint::PaintMetadata;
use crate::scene::PathObject;
use crate::scene::DrawPath;
use crate::tile_map::DenseTileMap;
use crate::tiles;
use pathfinder_geometry::rect::RectF;
@ -57,7 +57,7 @@ impl ZBuffer {
}
pub fn build_solid_tiles(&self,
paths: &[PathObject],
paths: &[DrawPath],
paint_metadata: &[PaintMetadata],
object_range: Range<u32>)
-> Vec<SolidTileVertex> {

View File

@ -23,7 +23,7 @@ use pathfinder_geometry::rect::RectF;
use pathfinder_geometry::transform2d::Transform2F;
use pathfinder_geometry::vector::Vector2F;
use pathfinder_renderer::paint::Paint;
use pathfinder_renderer::scene::{PathObject, Scene};
use pathfinder_renderer::scene::{DrawPath, Scene};
use std::fmt::{Display, Formatter, Result as FormatResult};
use std::mem;
use usvg::{Color as SvgColor, LineCap as UsvgLineCap, LineJoin as UsvgLineJoin, Node, NodeExt};
@ -123,7 +123,7 @@ impl BuiltSVG {
let outline = Outline::from_segments(path);
let name = format!("Fill({})", node.id());
self.scene.push_path(PathObject::new(outline, style, name));
self.scene.push_path(DrawPath::new(outline, style, name));
}
if let Some(ref stroke) = path.stroke {
@ -149,7 +149,7 @@ impl BuiltSVG {
outline.transform(&transform);
let name = format!("Stroke({})", node.id());
self.scene.push_path(PathObject::new(outline, style, name));
self.scene.push_path(DrawPath::new(outline, style, name));
}
}
NodeKind::Path(..) => {}

View File

@ -13,7 +13,7 @@ use pathfinder_color::{ColorF, ColorU};
use pathfinder_content::outline::{Outline, Contour};
use pathfinder_content::stroke::{OutlineStrokeToFill, StrokeStyle};
use pathfinder_geometry::vector::Vector2F;
use pathfinder_renderer::scene::{PathObject, Scene};
use pathfinder_renderer::scene::{DrawPath, Scene};
use swf_types::tags::SetBackgroundColor;
use swf_types::{Tag, SRgb8, Movie};
@ -194,7 +194,7 @@ pub fn draw_paths_into_scene(library: &SymbolLibrary, scene: &mut Scene) {
path = stroke_to_fill.into_outline();
}
scene.push_path(PathObject::new(
scene.push_path(DrawPath::new(
path,
paint_id,
String::new()

View File

@ -19,7 +19,7 @@ use pathfinder_content::stroke::{OutlineStrokeToFill, StrokeStyle};
use pathfinder_geometry::transform2d::Transform2F;
use pathfinder_geometry::vector::Vector2F;
use pathfinder_renderer::paint::PaintId;
use pathfinder_renderer::scene::{PathObject, Scene};
use pathfinder_renderer::scene::{DrawPath, Scene};
use skribo::{FontCollection, Layout, TextStyle};
use std::mem;
@ -76,7 +76,7 @@ impl SceneExt for Scene {
outline = stroke_to_fill.into_outline();
}
self.push_path(PathObject::new(outline, paint_id, String::new()));
self.push_path(DrawPath::new(outline, paint_id, String::new()));
Ok(())
}