Skip to content

Commit

Permalink
don't emit spans if their coverage would round to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
glowcoil committed May 18, 2020
1 parent 67501be commit b3d1962
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/path.rs
Expand Up @@ -245,10 +245,10 @@ impl Path {
let mut accum: f32 = 0.0;
for increment in sorted_increments {
if increment.x != x || increment.y != y {
if coverage != 0.0 {
if (coverage.abs() * 255.0) as u8 != 0 {
spans.push(Span { x, y, len: 1, coverage: coverage.abs().min(1.0) });
}
if increment.y == y && increment.x > x + 1 && accum != 0.0 {
if increment.y == y && increment.x > x + 1 && (accum.abs() * 255.0) as u8 != 0 {
spans.push(Span {
x: x + 1,
y: y,
Expand All @@ -266,7 +266,7 @@ impl Path {
coverage += increment.area;
accum += increment.height;
}
if coverage != 0.0 {
if (coverage.abs() * 255.0) as u8 != 0 {
spans.push(Span { x, y, len: 1, coverage: coverage.abs().min(1.0) });
}
}
Expand Down

0 comments on commit b3d1962

Please sign in to comment.