-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Improve shadow rendering on Android, fix shadow clipping on iOS #26789
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
2a51aee
to
2a218db
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
2f0b86f
to
eccf37e
Compare
I'm late to the party but an attempt to improve shadow's performance was made before here #10523. Moving the code to the Java side might help but I think what would benefit the most is a shadow cache. All views that have the same size and the same shadow properties (very common scenario in CollectionView items for example) should use the same bitmap. This will eliminate a huge number of calls including C# to Java ones. There is an implementation of the shadow cache in the PR. |
@AmrAlSayed0 thanks for sharing, I'll check it out. |
d40a883
to
5cb0404
Compare
This PR depends on #27531 to fix MacCatalyst screenshot taking. |
/rebase |
0f77951
to
1ba8b37
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Failing tests look unrelated. |
[InlineData("#FF0000")] | ||
[InlineData("#00FF00")] | ||
[InlineData("#0000FF")] | ||
public void SolidPaintTest(string hexColor) |
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.
Added some Device Tests to validate the IsSolid
extension method.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Rebased and updated macOS snapshots after merge #27531 |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Android Shadow Rendering
Description of Change
Glide
'sLruBitmapPool
to reduce the memory pressure on JavaPaint
only when shadow changesCanvas
API to speedup the shadow rendering performance by a lotsaveLayer
call from platform interop: it's a very expensive operation done for no reasons hereBenchmark
Here I've executed the testing host app with
return new ShadowBenchmark();
as main page and scrolling the CV once.Before
After (with transparency)
You can see this is a bit faster, and for sure it is creating less GC/allocation work due to the bitmap pool.
Still timings are not good enough.
After (with solid background)
This time no need to create bitmaps and render descendants, we can simply draw the shadow.
And this is exactly the speed we want.
Notes
To collect those speedscopes I've temporary re-added:
iOS Shadow Rendering
Layer
considering it's the parent of the clipped content.Issues Fixed
Fixes #27156
Fixes #23630
Fixes #20518
Fixes #18202
Fixes #17886
Fixes #13981
Fixes #9539
Fixes #4106
Relates to #17881
Relates to #17257
Relates to #10401