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

Container::rounded takes KeyOrValue<f64> instead of f64 #1054

Merged
merged 4 commits into from
Jun 25, 2020

Conversation

binomial0
Copy link
Contributor

Fixes #1052.
This is my first PR, and I'm not completely sure how things are done. However, the change is really small, so I don't think there's much that can go wrong.
I checked that all the tests pass, and I also tried this out in an unpublished application that I had lying around.

I think this change should be semver-safe, but I'm not sure. Some downstream crate's type inference might break, because the rounded function becomes more general. However, in the most common case you simply pass a float literal, and that case doesn't break. Still, I don't have any experience in Rust API design to completely rule out this problem.

Performance is probably irrelevant. At the moment, paint() unconditionally loads the border radius, even if it doesn't need it. I could improve that with some way-too-clever caching code that would be annoying to write and, more importantly, horrible to read, so I decided not to do that.

@binomial0 binomial0 changed the title Container rounded key Container::rounded takes KeyOrValue<f64> instead of f64 Jun 23, 2020
@ForLoveOfCats ForLoveOfCats added S-needs-review waits for review widget concerns a particular widget labels Jun 23, 2020
Copy link
Collaborator

@jneem jneem left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! Just a couple tiny comments.

CHANGELOG.md Outdated Show resolved Hide resolved
druid/src/widget/container.rs Outdated Show resolved Hide resolved
@jneem jneem merged commit 6742a46 into linebender:master Jun 25, 2020
@jneem
Copy link
Collaborator

jneem commented Jun 25, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-needs-review waits for review widget concerns a particular widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Container::rounded takes f64 directly
3 participants