Update various front-end libraries
This commit is contained in:
parent
13b2c91dde
commit
769dae4a9c
|
@ -165,7 +165,7 @@ impl CanvasRenderingContext2D {
|
||||||
|
|
||||||
let mut path = DrawPath::new(outline, paint_id);
|
let mut path = DrawPath::new(outline, paint_id);
|
||||||
path.set_blend_mode(BlendMode::Clear);
|
path.set_blend_mode(BlendMode::Clear);
|
||||||
self.canvas.scene.push_path(path);
|
self.canvas.scene.push_draw_path(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line styles
|
// Line styles
|
||||||
|
@ -345,7 +345,7 @@ impl CanvasRenderingContext2D {
|
||||||
}
|
}
|
||||||
path.set_fill_rule(fill_rule);
|
path.set_fill_rule(fill_rule);
|
||||||
path.set_blend_mode(blend_mode);
|
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,
|
composite_shadow_blur_render_targets_if_needed(&mut self.canvas.scene,
|
||||||
shadow_blur_info,
|
shadow_blur_info,
|
||||||
|
@ -356,7 +356,7 @@ impl CanvasRenderingContext2D {
|
||||||
path.set_clip_path(clip_path);
|
path.set_clip_path(clip_path);
|
||||||
path.set_fill_rule(fill_rule);
|
path.set_fill_rule(fill_rule);
|
||||||
path.set_blend_mode(blend_mode);
|
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,
|
fn push_shadow_blur_render_targets_if_needed(scene: &mut Scene,
|
||||||
current_state: &State,
|
current_state: &State,
|
||||||
|
@ -410,9 +410,9 @@ impl CanvasRenderingContext2D {
|
||||||
path_y.set_clip_path(clip_path);
|
path_y.set_clip_path(clip_path);
|
||||||
|
|
||||||
scene.pop_render_target();
|
scene.pop_render_target();
|
||||||
scene.push_path(path_x);
|
scene.push_draw_path(path_x);
|
||||||
scene.pop_render_target();
|
scene.pop_render_target();
|
||||||
scene.push_path(path_y);
|
scene.push_draw_path(path_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
use pathfinder_content::outline::ContourIterFlags;
|
use pathfinder_content::outline::ContourIterFlags;
|
||||||
use pathfinder_content::segment::SegmentKind;
|
use pathfinder_content::segment::SegmentKind;
|
||||||
use pathfinder_renderer::scene::Scene;
|
|
||||||
use pathfinder_geometry::vector::{Vector2F, vec2f};
|
use pathfinder_geometry::vector::{Vector2F, vec2f};
|
||||||
|
use pathfinder_renderer::scene::{DrawPath, Scene};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
|
@ -53,7 +53,8 @@ fn export_svg<W: Write>(scene: &Scene, writer: &mut W) -> io::Result<()> {
|
||||||
view_box.size().x(),
|
view_box.size().x(),
|
||||||
view_box.size().y()
|
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, " <path")?;
|
write!(writer, " <path")?;
|
||||||
if !name.is_empty() {
|
if !name.is_empty() {
|
||||||
write!(writer, " id=\"{}\"", name)?;
|
write!(writer, " id=\"{}\"", name)?;
|
||||||
|
@ -75,8 +76,9 @@ fn export_pdf<W: Write>(scene: &Scene, writer: &mut W) -> io::Result<()> {
|
||||||
vec2f(r.x(), height - r.y())
|
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.
|
// TODO(pcwalton): Gradients and patterns.
|
||||||
|
let paint = scene.palette().paints.get(paint_id.0 as usize).unwrap();
|
||||||
if paint.is_color() {
|
if paint.is_color() {
|
||||||
pdf.set_fill_color(paint.base_color());
|
pdf.set_fill_color(paint.base_color());
|
||||||
}
|
}
|
||||||
|
@ -138,7 +140,7 @@ fn export_ps<W: Write>(scene: &Scene, writer: &mut W) -> io::Result<()> {
|
||||||
writeln!(writer, "0 {} translate", view_box.size().y())?;
|
writeln!(writer, "0 {} translate", view_box.size().y())?;
|
||||||
writeln!(writer, "1 -1 scale")?;
|
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() {
|
if !name.is_empty() {
|
||||||
writeln!(writer, "newpath % {}", name)?;
|
writeln!(writer, "newpath % {}", name)?;
|
||||||
} else {
|
} else {
|
||||||
|
@ -180,6 +182,7 @@ fn export_ps<W: Write>(scene: &Scene, writer: &mut W) -> io::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(pcwalton): Gradients and patterns.
|
// TODO(pcwalton): Gradients and patterns.
|
||||||
|
let paint = scene.palette().paints.get(paint_id.0 as usize).unwrap();
|
||||||
if paint.is_color() {
|
if paint.is_color() {
|
||||||
let color = paint.base_color();
|
let color = paint.base_color();
|
||||||
writeln!(writer, "{} {} {} setrgbcolor", color.r, color.g, color.b)?;
|
writeln!(writer, "{} {} {} setrgbcolor", color.r, color.g, color.b)?;
|
||||||
|
|
|
@ -280,7 +280,7 @@ impl BuiltSVG {
|
||||||
path.set_clip_path(state.clip_path);
|
path.set_clip_path(state.clip_path);
|
||||||
path.set_fill_rule(fill_rule);
|
path.set_fill_rule(fill_rule);
|
||||||
path.set_name(name);
|
path.set_name(name);
|
||||||
self.scene.push_path(path);
|
self.scene.push_draw_path(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ pub fn draw_paths_into_scene(library: &SymbolLibrary, scene: &mut Scene) {
|
||||||
|
|
||||||
let mut path = DrawPath::new(path, paint_id);
|
let mut path = DrawPath::new(path, paint_id);
|
||||||
path.set_fill_rule(FillRule::EvenOdd);
|
path.set_fill_rule(FillRule::EvenOdd);
|
||||||
scene.push_path(path);
|
scene.push_draw_path(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ impl<F> FontContext<F> where F: Loader {
|
||||||
path.set_clip_path(render_options.clip_path);
|
path.set_clip_path(render_options.clip_path);
|
||||||
path.set_blend_mode(render_options.blend_mode);
|
path.set_blend_mode(render_options.blend_mode);
|
||||||
|
|
||||||
scene.push_path(path);
|
scene.push_draw_path(path);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue