Rename `PathObject` to `DrawPath` to differentiate it from a clip path
This commit is contained in:
parent
6e28552a44
commit
fefa3c3cd3
|
@ -22,7 +22,7 @@ use pathfinder_geometry::vector::Vector2F;
|
||||||
use pathfinder_geometry::rect::RectF;
|
use pathfinder_geometry::rect::RectF;
|
||||||
use pathfinder_geometry::transform2d::Transform2F;
|
use pathfinder_geometry::transform2d::Transform2F;
|
||||||
use pathfinder_renderer::paint::{Paint, PaintId};
|
use pathfinder_renderer::paint::{Paint, PaintId};
|
||||||
use pathfinder_renderer::scene::{PathObject, Scene};
|
use pathfinder_renderer::scene::{DrawPath, Scene};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
@ -206,10 +206,10 @@ impl CanvasRenderingContext2D {
|
||||||
|
|
||||||
let mut outline = outline.clone();
|
let mut outline = outline.clone();
|
||||||
outline.transform(&Transform2F::from_translation(self.current_state.shadow_offset));
|
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
|
// Transformations
|
||||||
|
|
|
@ -23,7 +23,7 @@ use pathfinder_content::outline::Outline;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Scene {
|
pub struct Scene {
|
||||||
pub(crate) paths: Vec<PathObject>,
|
pub(crate) paths: Vec<DrawPath>,
|
||||||
palette: Palette,
|
palette: Palette,
|
||||||
bounds: RectF,
|
bounds: RectF,
|
||||||
view_box: 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.bounds = self.bounds.union_rect(path.outline.bounds());
|
||||||
self.paths.push(path);
|
self.paths.push(path);
|
||||||
}
|
}
|
||||||
|
@ -201,16 +201,16 @@ impl<'a> Iterator for PathIter<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct PathObject {
|
pub struct DrawPath {
|
||||||
outline: Outline,
|
outline: Outline,
|
||||||
paint: PaintId,
|
paint: PaintId,
|
||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PathObject {
|
impl DrawPath {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(outline: Outline, paint: PaintId, name: String) -> PathObject {
|
pub fn new(outline: Outline, paint: PaintId, name: String) -> DrawPath {
|
||||||
PathObject { outline, paint, name }
|
DrawPath { outline, paint, name }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
use crate::gpu_data::SolidTileVertex;
|
use crate::gpu_data::SolidTileVertex;
|
||||||
use crate::paint::PaintMetadata;
|
use crate::paint::PaintMetadata;
|
||||||
use crate::scene::PathObject;
|
use crate::scene::DrawPath;
|
||||||
use crate::tile_map::DenseTileMap;
|
use crate::tile_map::DenseTileMap;
|
||||||
use crate::tiles;
|
use crate::tiles;
|
||||||
use pathfinder_geometry::rect::RectF;
|
use pathfinder_geometry::rect::RectF;
|
||||||
|
@ -57,7 +57,7 @@ impl ZBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_solid_tiles(&self,
|
pub fn build_solid_tiles(&self,
|
||||||
paths: &[PathObject],
|
paths: &[DrawPath],
|
||||||
paint_metadata: &[PaintMetadata],
|
paint_metadata: &[PaintMetadata],
|
||||||
object_range: Range<u32>)
|
object_range: Range<u32>)
|
||||||
-> Vec<SolidTileVertex> {
|
-> Vec<SolidTileVertex> {
|
||||||
|
|
|
@ -23,7 +23,7 @@ use pathfinder_geometry::rect::RectF;
|
||||||
use pathfinder_geometry::transform2d::Transform2F;
|
use pathfinder_geometry::transform2d::Transform2F;
|
||||||
use pathfinder_geometry::vector::Vector2F;
|
use pathfinder_geometry::vector::Vector2F;
|
||||||
use pathfinder_renderer::paint::Paint;
|
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::fmt::{Display, Formatter, Result as FormatResult};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use usvg::{Color as SvgColor, LineCap as UsvgLineCap, LineJoin as UsvgLineJoin, Node, NodeExt};
|
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 outline = Outline::from_segments(path);
|
||||||
|
|
||||||
let name = format!("Fill({})", node.id());
|
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 {
|
if let Some(ref stroke) = path.stroke {
|
||||||
|
@ -149,7 +149,7 @@ impl BuiltSVG {
|
||||||
outline.transform(&transform);
|
outline.transform(&transform);
|
||||||
|
|
||||||
let name = format!("Stroke({})", node.id());
|
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(..) => {}
|
NodeKind::Path(..) => {}
|
||||||
|
|
|
@ -13,7 +13,7 @@ use pathfinder_color::{ColorF, ColorU};
|
||||||
use pathfinder_content::outline::{Outline, Contour};
|
use pathfinder_content::outline::{Outline, Contour};
|
||||||
use pathfinder_content::stroke::{OutlineStrokeToFill, StrokeStyle};
|
use pathfinder_content::stroke::{OutlineStrokeToFill, StrokeStyle};
|
||||||
use pathfinder_geometry::vector::Vector2F;
|
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::tags::SetBackgroundColor;
|
||||||
use swf_types::{Tag, SRgb8, Movie};
|
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();
|
path = stroke_to_fill.into_outline();
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.push_path(PathObject::new(
|
scene.push_path(DrawPath::new(
|
||||||
path,
|
path,
|
||||||
paint_id,
|
paint_id,
|
||||||
String::new()
|
String::new()
|
||||||
|
|
|
@ -19,7 +19,7 @@ use pathfinder_content::stroke::{OutlineStrokeToFill, StrokeStyle};
|
||||||
use pathfinder_geometry::transform2d::Transform2F;
|
use pathfinder_geometry::transform2d::Transform2F;
|
||||||
use pathfinder_geometry::vector::Vector2F;
|
use pathfinder_geometry::vector::Vector2F;
|
||||||
use pathfinder_renderer::paint::PaintId;
|
use pathfinder_renderer::paint::PaintId;
|
||||||
use pathfinder_renderer::scene::{PathObject, Scene};
|
use pathfinder_renderer::scene::{DrawPath, Scene};
|
||||||
use skribo::{FontCollection, Layout, TextStyle};
|
use skribo::{FontCollection, Layout, TextStyle};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ impl SceneExt for Scene {
|
||||||
outline = stroke_to_fill.into_outline();
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue