Skip to content

Commit 6f8a482

Browse files
committed
Vendor kurbo SVG path parser (+revert to stable kurbo)
Signed-off-by: Nico Burns <nico@nicoburns.com>
1 parent 293f8b7 commit 6f8a482

5 files changed

Lines changed: 367 additions & 13 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ pollster = "0.4"
7878
# Dev-dependencies
7979
winit = { version = "0.30.2", features = ["rwh_06"] }
8080

81-
[patch.crates-io]
82-
kurbo = { git = "https://github.com/linebender/kurbo", rev = "868cd631beee6f787d63113a9eb72e8c005fa33c" }
81+
# [patch.crates-io]
8382
# vello = { path = "../vello/vello" }
8483
# vello_cpu = { path = "../vello/sparse_strips/vello_cpu" }
8584
# vello_hybrid = { path = "../vello/sparse_strips/vello_hybrid" }

crates/anyrender/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
//! - [anyrender_vello](https://docs.rs/anyrender_vello)
2828
//! - [anyrender_vello_cpu](https://docs.rs/anyrender_vello_cpu)
2929
30+
#![allow(clippy::collapsible_if)]
31+
3032
use kurbo::{Affine, Rect, Shape, Stroke};
3133
use peniko::{BlendMode, Brush, Color, Fill, FontData, ImageBrushRef, StyleRef};
3234
use recording::RenderCommand;
@@ -41,6 +43,9 @@ pub use null_backend::*;
4143
pub mod recording;
4244
pub use recording::Scene;
4345

46+
#[cfg(feature = "serde")]
47+
mod svg_path_parser;
48+
4449
/// Abstraction for rendering a scene to a window
4550
pub trait WindowRenderer {
4651
type ScenePainter<'a>: PaintScene

crates/anyrender/src/recording.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ mod svg_path {
299299
use kurbo::BezPath;
300300
use serde::{self, Deserialize, Deserializer, Serializer};
301301

302+
use crate::svg_path_parser;
303+
302304
pub fn serialize<S>(path: &BezPath, serializer: S) -> Result<S::Ok, S::Error>
303305
where
304306
S: Serializer,
@@ -311,6 +313,6 @@ mod svg_path {
311313
D: Deserializer<'de>,
312314
{
313315
let s = String::deserialize(deserializer)?;
314-
BezPath::from_svg(&s).map_err(serde::de::Error::custom)
316+
svg_path_parser::parse_svg_path(&s).map_err(serde::de::Error::custom)
315317
}
316318
}

0 commit comments

Comments
 (0)