Skip to content
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

Merged
merged 1 commit into from
Jan 8, 2023
Merged

Fixes to fine rasterization #241

merged 1 commit into from
Jan 8, 2023

Conversation

raphlinus
Copy link
Contributor

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.

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.
@raphlinus raphlinus mentioned this pull request Jan 8, 2023
Copy link
Collaborator

@dfrg dfrg left a 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);
Copy link
Member

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

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Member

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

@raphlinus raphlinus merged commit 080277b into main Jan 8, 2023
@raphlinus raphlinus deleted the fine_fixes branch January 8, 2023 21:50
dfrg added a commit that referenced this pull request Jan 8, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants