-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes to fine rasterization #241
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@@ -138,7 +138,7 @@ fn fill_path(tile: Tile, xy: vec2<f32>) -> array<f32, PIXELS_PER_THREAD> { | |||
} | |||
// nonzero winding rule | |||
for (var i = 0u; i < PIXELS_PER_THREAD; i += 1u) { | |||
area[i] = abs(area[i]); | |||
area[i] = min(abs(area[i]), 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without comments in the vicinity, I can't easily work out the reason for this change.
I will note that this is a significant change if the value is highly negative; whether that makes sense is a different question.
This does at least agree with the nonzero
comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures consistent coverage between overlapping and non-overlapping regions in self-intersecting paths. When alpha < 1
this results in increased brightness in overlapping pixels. Note that this clamp was in the original GLSL code so it’s not technically a change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's basically the definition of the nonzero fill rule: 0 maps to 0, any other value maps to 1, and this particular formulation gets fractional values for antialiasing basically correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, my mistake. I didn't see that abs
wasn't removed
* remove area clamp in fine (now in #241) * make DrawTag::info_size() const fn * document DrawColor rgba field * change Monoid type parameter to an associated type and describe the additional Default constraint * consistent parens in PathTag::is_subpath_end * add comments for 32-bit path segment types in PathTag * also adds low level encoding functions for the three currently supported brushes
The area bug was found and fixed by @dfrg, and is adapted from #239. I wanted to move it to a separate PR so that one would be more focused on API.
The other bug is currently silent because the two quantities swapped are both 4, but it is triggered when experimenting with tuning for performance.