Merge pull request #73 from ishitatsuyuki/close-path

Always close fill paths, fix #68

Close #68
Close #74
This commit is contained in:
Tatsuyuki Ishi 2021-03-17 01:24:09 +09:00 committed by GitHub
commit 3557df24c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -303,6 +303,21 @@ impl PietGpuRenderContext {
}
fn encode_path(&mut self, path: impl Iterator<Item = PathEl>, is_fill: bool) {
if is_fill {
self.encode_path_inner(path.flat_map(|el| {
match el {
PathEl::MoveTo(..) => {
Some(PathEl::ClosePath)
}
_ => None
}.into_iter().chain(Some(el))
}).chain(Some(PathEl::ClosePath)), is_fill)
} else {
self.encode_path_inner(path, is_fill)
}
}
fn encode_path_inner(&mut self, path: impl Iterator<Item = PathEl>, is_fill: bool) {
let flatten = false;
if flatten {
let mut start_pt = None;