Always close fill paths, fix #68

This commit is contained in:
Ishi Tatsuyuki 2021-03-17 00:51:13 +09:00
parent 22e410c13e
commit 8a499bc50e

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;