Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion canvas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["pathfinder", "canvas", "vector", "graphics", "gpu"]
crate-type = ["rlib", "staticlib"]

[dependencies]
font-kit = { version = "0.6", optional = true }
font-kit = { version = "0.10", optional = true }

[dependencies.pathfinder_color]
path = "../color"
Expand Down
9 changes: 9 additions & 0 deletions canvas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ impl CanvasRenderingContext2D {
}

// Extensions
pub fn reset(&mut self) {
self.saved_states = vec![];
self.current_state.reset();
self.clear();
}

/// Clears the current canvas.
pub fn clear(&mut self) {
Expand Down Expand Up @@ -679,6 +684,10 @@ impl State {
}
}

fn reset(&mut self) {
*self = State::default(self.font_collection.clone());
}

fn resolve_paint<'a>(&self, paint: &'a Paint) -> Cow<'a, Paint> {
let mut must_copy = !self.transform.is_identity() || self.global_alpha < 1.0;
if !must_copy {
Expand Down
2 changes: 1 addition & 1 deletion examples/canvas_text/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Patrick Walton <pcwalton@mimiga.net>"]
edition = "2018"

[dependencies]
font-kit = "0.6"
font-kit = "0.10"
gl = "0.14"
sdl2 = "0.33"
sdl2-sys = "0.33"
Expand Down
2 changes: 1 addition & 1 deletion text/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository = "https://github.com/servo/pathfinder"
homepage = "https://github.com/servo/pathfinder"

[dependencies]
font-kit = "0.6"
font-kit = "0.10"

[dependencies.pathfinder_content]
path = "../content"
Expand Down