This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] use point/line primitve for hairlines. #55230
Closed
Closed
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
813d4bd
[Impeller] use point/line primitve for hairlines.
1c362df
Merge branch 'main' of github.com:flutter/engine into primitive_geom
beee6ae
single contour.
e3cc898
add chck
2d8f1eb
++
032cb2f
Merge branch 'main' into primitive_geom
a968e8a
Merge branch 'main' into primitive_geom
ce71dab
Merge branch 'main' of github.com:flutter/engine into primitive_geom
544cb56
add back prevent overdraw and fix typos.
2f3c2a6
Merge branch 'primitive_geom' of github.com:jonahwilliams/engine into…
eb7f841
Merge branch 'main' into primitive_geom
07017d1
++
6ff4f7f
Merge branch 'primitive_geom' of github.com:jonahwilliams/engine into…
e4340b5
add jim test.
32779af
skip round and square caps.
4c75e18
Merge branch 'main' into primitive_geom
201b54b
++
0c6c969
++
7f98866
Merge branch 'main' of github.com:flutter/engine into primitive_geom
185291f
fix rrect descriptors.
4385efc
Merge branch 'main' of github.com:flutter/engine into primitive_geom
2eeee37
Merge branch 'main' of github.com:flutter/engine into primitive_geom
897ff2f
++
a91974b
use radius.
126f665
typo
b7152ee
++
1fd08d6
Merge branch 'main' into primitive_geom
9975825
++
d76a6cc
refactor circle position logic.
322ede8
Merge branch 'primitive_geom' of github.com:jonahwilliams/engine into…
44f5082
++
011e724
testing.
1b4da9f
++
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,13 +133,11 @@ bool Geometry::CanApplyMaskFilter() const { | |
| Scalar Geometry::ComputeStrokeAlphaCoverage(const Matrix& transform, | ||
| Scalar stroke_width) { | ||
| Scalar scaled_stroke_width = transform.GetMaxBasisLengthXY() * stroke_width; | ||
| // If the stroke width is 0 or greater than kMinStrokeSizeMSAA, don't apply | ||
| // any additional alpha. This is intended to match Skia behavior. | ||
| if (scaled_stroke_width == 0.0 || scaled_stroke_width >= kMinStrokeSizeMSAA) { | ||
| if (scaled_stroke_width == 0.0 || scaled_stroke_width >= kMinStrokeSize) { | ||
flar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return 1.0; | ||
| } | ||
| // This scalling is eyeballed from Skia. | ||
| return std::clamp(scaled_stroke_width * 2.0f, 0.f, 1.f); | ||
| return std::clamp(scaled_stroke_width, 0.1f, 1.f); | ||
flar marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still confused on this code. So, 0.0 means 1.0. That would create a visual break when reducing the width down to 0, would it not?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes there will be a visual break, but this is the behavior of skia. 0 means explicitly 1 pixel, whereas smaller widths are simulated by modulating alpha. |
||
| } | ||
|
|
||
| } // namespace impeller | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I was wondering why we pass along the 0.0 here and just noticed a bug.
The StrokedCircle generator below says it will convert to a filled circle if the inner radius is <= 0, but if you look at the implementation it converts if the half_width is < 0... which I don't think happens ever? So, there's a bug there.
But, fixing that bug or not, it calls into question why we pass along a 0 in the first place. Why isn't <=0 clamped at the minimum pixel width?
We can file a bug against the StrokedCircle generator for fixing separately, but I think the passing along of a 0 here results in a thin circle turning into a filled circle (whereas passing in the min_width would not), so this calculation is suspect.
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.
And if we don't pass it along to the stroke generator, does it generate an empty shape when tessellating?
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.
Is the comment just wrong? a quick read through and I think this code is doing reasonable things? half_width is always 0 for fills though its confusing that we go through the stroke code to get there...
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.
I think I see now, this is totally confusing. So the local field
stroke_width_is set to -1 to indicate a filled circle. The?:code used to convert this to 0 and the half_width would always be >0 for the other case (stroked). So, yes, for the truly filled case we are calling a method calledStrokedCirclewhich is odd and confusing, but the comment indicates that the called method will also do a filled circle for the case where the inner radius disappears - and it does no such thing.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 code would make a lot more sense if there was a more explicit indicator of filled and it simply said:
Fixing StrokedCircle to detect the degenerate case would be a separate fix, but until then, the comment below is just a red herring, maybe if it said "should simplify" instead of "will simplify"...
Uh oh!
There was an error while loading. Please reload this page.
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.
Or, it would be OK if that pseudo-code used "stroke_width_ < 0" as the test, as long as it doesn't try to fold the cases together via strange values in
half_width...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.
I re-arranged this code.