-
Notifications
You must be signed in to change notification settings - Fork 743
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
perf: Avoid re-creating Android Paint instances #13259
Conversation
src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.Android.cs
Outdated
Show resolved
Hide resolved
f3ac8f0
to
d8f8c3e
Compare
src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.Android.cs
Outdated
Show resolved
Hide resolved
8046a18
to
fb7be39
Compare
@MartinZikmund just a few breaking changes to mark are left. |
Pull request was converted to draft
fb7be39
to
371ec88
Compare
@jeromelaban made the method private protected as a breaking change, will adjust diffignore when the CI fails, otherwise should be good to approve |
849dc1d
to
b40ea7d
Compare
e0efcd1
to
9e168b4
Compare
The build 94131 found UI Test snapshots differences: Details
|
GitHub Issue (If applicable): closes #13258, closes #11685
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Brush
always creates newPaint
instances.What is the new behavior?
BorderLayerRenderer
andShape
both keep two static instances ofPaint
alive throughout the application lifetime, reusing them whenever needed. Because rendering happens on UI thread, this is not a problem - the approach is similar to the reuse of corner radius arrays.Copilot Summary
🤖 Generated by Copilot at 59d9ca7
This pull request improves the performance and memory usage of various
Brush
classes and theBorder
control on Android by reusing and modifyingPaint
instances instead of creating new ones. It also refactors some code to follow the project's style guidelines and adds error handling and validation where needed. It updates theBrush
abstract methods and the corresponding tests to reflect the new API. It affects the filesBorderLayerRenderer.Android.cs
,AcrylicBrush.Android.cs
,Brush.Android.cs
,SolidColorBrush.Android.cs
,Shape.Android.cs
,Given_RevealBrush.cs
,RadialGradientBrush.Android.cs
,RevealBrush.Android.cs
,GradientBrush.Android.cs
,ImageBrush.Android.cs
, andXamlCompositionBrushBase.Android.cs
.PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Run
results.Other information
Internal Issue (If applicable):