From 769dae4a9c1f004f5998edf3b555088df89bbe14 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 23 Jun 2020 13:07:33 -0700 Subject: [PATCH] Update various front-end libraries --- canvas/src/lib.rs | 10 +++++----- export/src/lib.rs | 11 +++++++---- svg/src/lib.rs | 2 +- swf/src/lib.rs | 2 +- text/src/lib.rs | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/canvas/src/lib.rs b/canvas/src/lib.rs index 4de6a028..3dc0a8bc 100644 --- a/canvas/src/lib.rs +++ b/canvas/src/lib.rs @@ -165,7 +165,7 @@ impl CanvasRenderingContext2D { let mut path = DrawPath::new(outline, paint_id); path.set_blend_mode(BlendMode::Clear); - self.canvas.scene.push_path(path); + self.canvas.scene.push_draw_path(path); } // Line styles @@ -345,7 +345,7 @@ impl CanvasRenderingContext2D { } path.set_fill_rule(fill_rule); path.set_blend_mode(blend_mode); - self.canvas.scene.push_path(path); + self.canvas.scene.push_draw_path(path); composite_shadow_blur_render_targets_if_needed(&mut self.canvas.scene, shadow_blur_info, @@ -356,7 +356,7 @@ impl CanvasRenderingContext2D { path.set_clip_path(clip_path); path.set_fill_rule(fill_rule); path.set_blend_mode(blend_mode); - self.canvas.scene.push_path(path); + self.canvas.scene.push_draw_path(path); fn push_shadow_blur_render_targets_if_needed(scene: &mut Scene, current_state: &State, @@ -410,9 +410,9 @@ impl CanvasRenderingContext2D { path_y.set_clip_path(clip_path); scene.pop_render_target(); - scene.push_path(path_x); + scene.push_draw_path(path_x); scene.pop_render_target(); - scene.push_path(path_y); + scene.push_draw_path(path_y); } } diff --git a/export/src/lib.rs b/export/src/lib.rs index 4a4ab5b5..6db4161c 100644 --- a/export/src/lib.rs +++ b/export/src/lib.rs @@ -10,8 +10,8 @@ use pathfinder_content::outline::ContourIterFlags; use pathfinder_content::segment::SegmentKind; -use pathfinder_renderer::scene::Scene; use pathfinder_geometry::vector::{Vector2F, vec2f}; +use pathfinder_renderer::scene::{DrawPath, Scene}; use std::fmt; use std::io::{self, Write}; @@ -53,7 +53,8 @@ fn export_svg(scene: &Scene, writer: &mut W) -> io::Result<()> { view_box.size().x(), view_box.size().y() )?; - for (paint, outline, name) in scene.paths() { + for &DrawPath { paint: paint_id, ref outline, ref name, .. } in scene.draw_paths() { + let paint = scene.palette().paints.get(paint_id.0 as usize).unwrap(); write!(writer, " (scene: &Scene, writer: &mut W) -> io::Result<()> { vec2f(r.x(), height - r.y()) }; - for (paint, outline, _) in scene.paths() { + for &DrawPath { paint: paint_id, ref outline, .. } in scene.draw_paths() { // TODO(pcwalton): Gradients and patterns. + let paint = scene.palette().paints.get(paint_id.0 as usize).unwrap(); if paint.is_color() { pdf.set_fill_color(paint.base_color()); } @@ -138,7 +140,7 @@ fn export_ps(scene: &Scene, writer: &mut W) -> io::Result<()> { writeln!(writer, "0 {} translate", view_box.size().y())?; writeln!(writer, "1 -1 scale")?; - for (paint, outline, name) in scene.paths() { + for &DrawPath { paint: paint_id, ref outline, ref name, .. } in scene.draw_paths() { if !name.is_empty() { writeln!(writer, "newpath % {}", name)?; } else { @@ -180,6 +182,7 @@ fn export_ps(scene: &Scene, writer: &mut W) -> io::Result<()> { } // TODO(pcwalton): Gradients and patterns. + let paint = scene.palette().paints.get(paint_id.0 as usize).unwrap(); if paint.is_color() { let color = paint.base_color(); writeln!(writer, "{} {} {} setrgbcolor", color.r, color.g, color.b)?; diff --git a/svg/src/lib.rs b/svg/src/lib.rs index 7f7de163..1abbd470 100644 --- a/svg/src/lib.rs +++ b/svg/src/lib.rs @@ -280,7 +280,7 @@ impl BuiltSVG { path.set_clip_path(state.clip_path); path.set_fill_rule(fill_rule); path.set_name(name); - self.scene.push_path(path); + self.scene.push_draw_path(path); } } diff --git a/swf/src/lib.rs b/swf/src/lib.rs index 911181fc..39c5593a 100644 --- a/swf/src/lib.rs +++ b/swf/src/lib.rs @@ -194,7 +194,7 @@ pub fn draw_paths_into_scene(library: &SymbolLibrary, scene: &mut Scene) { let mut path = DrawPath::new(path, paint_id); path.set_fill_rule(FillRule::EvenOdd); - scene.push_path(path); + scene.push_draw_path(path); } } } diff --git a/text/src/lib.rs b/text/src/lib.rs index 575e7f4c..c4300987 100644 --- a/text/src/lib.rs +++ b/text/src/lib.rs @@ -137,7 +137,7 @@ impl FontContext where F: Loader { path.set_clip_path(render_options.clip_path); path.set_blend_mode(render_options.blend_mode); - scene.push_path(path); + scene.push_draw_path(path); Ok(()) }