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

gpui: Enable MSAA to Path render for Anti-Aliasing #22812

Merged
merged 19 commits into from
Jan 29, 2025

Conversation

huacnlee
Copy link
Contributor

@huacnlee huacnlee commented Jan 8, 2025

Closes #20762

Release Notes:

  • N/A

Enable MSAA for Anti-Aliasing to Path (cx.paint_path) for drawing a better vector graphics.

cargo run -p gpui --example gradient --features macos-blade
cargo run -p gpui --example gradient

cargo run -p gpui --example painting --features macos-blade
cargo run -p gpui --example painting

Before

image

After

image

TODO

Ref kvark/blade#213

Ask @kvark to review.

I am not sure if there is anything I missed. I modified it according to the particle example of Blade project. But the difference is that after the first MSAA render, I did not do it a second time, I tested it and found it was not necessary.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 8, 2025
crates/gpui/Cargo.toml Outdated Show resolved Hide resolved
@huacnlee huacnlee changed the title gpui: Enable blade MSAA for Anti-Aliasing gpui: Enable MSAA for Anti-Aliasing Jan 8, 2025
@huacnlee

This comment was marked as resolved.

@huacnlee huacnlee changed the title gpui: Enable MSAA for Anti-Aliasing gpui: Enable MSAA to Path render for Anti-Aliasing Jan 8, 2025
@huacnlee

This comment was marked as resolved.

@huacnlee

This comment was marked as resolved.

kvark pushed a commit to kvark/blade that referenced this pull request Jan 10, 2025
There need a method to check if the system supports a specific sample
count.

Ref zed-industries/zed#22812 need this feature
to setup sample_count.
Copy link
Contributor

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

crates/gpui/src/platform/blade/blade_renderer.rs Outdated Show resolved Hide resolved
crates/gpui/src/platform/blade/blade_renderer.rs Outdated Show resolved Hide resolved
crates/gpui/src/platform/blade/blade_atlas.rs Outdated Show resolved Hide resolved
crates/gpui/src/platform/blade/blade_renderer.rs Outdated Show resolved Hide resolved
@huacnlee huacnlee marked this pull request as ready for review January 15, 2025 08:33
@huacnlee
Copy link
Contributor Author

Wait #22808 to merge, then the painting example will be ok:

image

Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everyone seems fine with the changes in their current form, it seems?

I will serve as a tie-breaker (again) and merge this after next Wednesday's release.

@SomeoneToIgnore SomeoneToIgnore self-assigned this Jan 28, 2025
@SomeoneToIgnore
Copy link
Contributor

@huacnlee can we merge/rebase on fresh main please?

@huacnlee
Copy link
Contributor Author

😂 I don't have a computer right now, I'm on holiday for the Chinese New Year.

@SomeoneToIgnore
Copy link
Contributor

No rush, we can get back to that later, and sorry for the pings.

Happy holidays!

SomeoneToIgnore pushed a commit that referenced this pull request Jan 29, 2025
Release Notes:

- N/A

---

Continue #20499

We to draw more complex Path. Before this change, we only have
`line_to`, but it is not enough.

Add a new `PathBuilder` to use [lyon](https://github.com/nical/lyon) to
build more complex path.

And then with PR #22812 to enable anti-aliasing, all thing will be
perfect.
## Show case

```bash
cargo run -p gpui --example painting
```

Before:

<img width="1136" alt="image"
src="https://github.com/user-attachments/assets/0c15833a-ec95-404c-a469-24cf172cfd86"
/>

After:

<img width="1136" alt="image"
src="https://github.com/user-attachments/assets/42cfa35e-7e8f-4ef3-bb2d-b98defc62ad6"
/>
@SomeoneToIgnore SomeoneToIgnore merged commit b9e0aae into zed-industries:main Jan 29, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gpui: Improve paint_path draw straight line to anti-aliasing
3 participants