[Android] Sort gradient stops by offset#31318
Merged
jfversluis merged 3 commits intodotnet:inflight/currentfrom Sep 9, 2025
Merged
[Android] Sort gradient stops by offset#31318jfversluis merged 3 commits intodotnet:inflight/currentfrom
jfversluis merged 3 commits intodotnet:inflight/currentfrom
Conversation
Updated the gradient stop processing to order stops by their offset before populating color and offset arrays. This ensures gradients are rendered correctly according to stop positions.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes Android gradient rendering by ensuring gradient stops are processed in the correct order. The issue was that gradient stops were being rendered in their declaration order rather than sorted by their offset position, causing incorrect gradient appearance.
- Sorts gradient stops by their offset value before processing colors and positions
- Ensures gradients render correctly according to stop positions rather than declaration order
Member
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jsuarezruiz
suggested changes
Aug 26, 2025
|
|
||
| int count = 0; | ||
| foreach (var orderStop in orderStops) | ||
| foreach (var orderStop in orderStops.OrderBy(s => s.Offset)) |
Contributor
There was a problem hiding this comment.
Can sort manually? Can use Sortthat modifies the list in place avoiding the overhead of creating a new collection.
Contributor
Author
There was a problem hiding this comment.
But: If some code elsewhere is depending on the original ordering (e.g., holding onto indices or iterating concurrently), we may break that assumption.
jfversluis
approved these changes
Sep 9, 2025
PureWeen
pushed a commit
that referenced
this pull request
Sep 18, 2025
* [Android] Sort gradient stops by offset Updated the gradient stop processing to order stops by their offset before populating color and offset arrays. This ensures gradients are rendered correctly according to stop positions. * Added a UITest * Add snapshots --------- Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
PureWeen
pushed a commit
that referenced
this pull request
Sep 18, 2025
* [Android] Sort gradient stops by offset Updated the gradient stop processing to order stops by their offset before populating color and offset arrays. This ensures gradients are rendered correctly according to stop positions. * Added a UITest * Add snapshots --------- Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
github-actions bot
pushed a commit
that referenced
this pull request
Sep 18, 2025
* [Android] Sort gradient stops by offset Updated the gradient stop processing to order stops by their offset before populating color and offset arrays. This ensures gradients are rendered correctly according to stop positions. * Added a UITest * Add snapshots --------- Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
github-actions bot
pushed a commit
that referenced
this pull request
Sep 23, 2025
* [Android] Sort gradient stops by offset Updated the gradient stop processing to order stops by their offset before populating color and offset arrays. This ensures gradients are rendered correctly according to stop positions. * Added a UITest * Add snapshots --------- Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
github-actions bot
pushed a commit
that referenced
this pull request
Sep 23, 2025
* [Android] Sort gradient stops by offset Updated the gradient stop processing to order stops by their offset before populating color and offset arrays. This ensures gradients are rendered correctly according to stop positions. * Added a UITest * Add snapshots --------- Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Updated the gradient stop processing to order stops by their offset before populating color and offset arrays. This ensures gradients are rendered correctly according to stop positions.
Applied the same approach as in here: https://github.dev/kubaflo/maui/blob/be7d14bd4c4c1c31f3dad7bc9e836374aa38c7b1/src/Core/src/Graphics/PaintExtensions.Android.cs#L105
Issues Fixed
Fixes #31314