-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix anti-aliasing when painting borders with solid colors. #122317
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
Conversation
5c974c4 to
0933a9b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c9402fd to
1517d4f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c88563b to
82d5630
Compare
This comment was marked as outdated.
This comment was marked as outdated.
9a594d2 to
7d69b22
Compare
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.
They are flipped because of this #122034 (comment)
I don't know which name would fit better. borderVerticalLines? Or I just flip them and vertical: borderHorizontal?
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.
They don't appear flipped to me, and make sense as-is. They're referring to the border size on the vertical and horizontal sides of the rect, right?
f80f915 to
cb6bc78
Compare
This comment was marked as outdated.
This comment was marked as outdated.
cb6bc78 to
650fac1
Compare
e7ed131 to
90fda14
Compare
90fda14 to
2e68863
Compare
|
Thanks. I'll debug that here. |
|
They're pretty trivial, so as long as we can say that they are more correct now than they were, I'm OK with approving them. |
|
I'll see if I can debug today (at max, until weekend) and tell you the verdict. I think the code I just pushed should help. Please check here again in a few hours when Google Testing has ran again to see if it changed.. lol |
|
Meanwhile, if you want to play with borders, I have two other border-related-PRs waiting for your feedback 😛. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
I approved the goldens. Looks like they are fine. |
| // rounding error leaking the background color around the clipped | ||
| // shape. | ||
| // https://github.com/flutter/flutter/issues/13675 | ||
| final Rect ajustedRect = _adjustRectOnOutlinedBorder(rect, textDirection); |
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.
nit: adjusted
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.
Thanks! I'm traveling to SF, I'll fix this (and my other PRs) next week.
| // When border is filled, the rect is reduced to avoid anti-aliasing | ||
| // rounding error leaking the background color around the clipped | ||
| // shape. | ||
| // https://github.com/flutter/flutter/issues/13675 |
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.
nit: no need to link to the issue, just put whatever is relevant in the comment. (The code will probably outlive the bug database.)
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Status: I went on vacation, I came back, I already fixed a few pending PRs, this is coming pretty soon. |
|
@bernaferrari any update on this? |
|
Not yet, I got ready a few things that were pending already, but this is tricky because of the Google Testing, so it is trial and error and I need to ask someone from Google every trial and error if there was a progress. |
|
Without being able to test on google testing, I think I'll give up on this for now :( |
Trying to reland #122317 in 2024. Let's see if we can. <img width="666" alt="image" src="https://user-images.githubusercontent.com/351125/182002867-03d55bbb-163d-48b9-ba3c-ed32dbef2680.png"> Side effect: shapes with border will be rounder:  Close #13675.
…53365) Trying to reland flutter#122317 in 2024. Let's see if we can. <img width="666" alt="image" src="https://user-images.githubusercontent.com/351125/182002867-03d55bbb-163d-48b9-ba3c-ed32dbef2680.png"> Side effect: shapes with border will be rounder:  Close flutter#13675.
…53365) Trying to reland flutter#122317 in 2024. Let's see if we can. <img width="666" alt="image" src="https://user-images.githubusercontent.com/351125/182002867-03d55bbb-163d-48b9-ba3c-ed32dbef2680.png"> Side effect: shapes with border will be rounder:  Close flutter#13675.


Fix #13675 by reducing paint area by the width of the border, when border has opacity of 1.
There are many many ways to face this challenge. I opted into the "slightly-weirder but cleaner" solution, since I need to cast OutlinedBorder in ShapeDecoration. The other option would be adding
isShadow = falsetopaintInterior(or maybe even an enum likePaintInteriorKind) so we can differ between shadows and not shadows (we want shadows to be painted over the same area). This would add the calculation everywhere (RoundedRectangleBorder, CircleBorder, StadiumBorder, etc), so I thought it was simpler to just put in ShapeDecoration (simpler + easier to maintain!).