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
Changes DlColor to support wide gamut colors (#54473) #54648
Merged
auto-submit
merged 5 commits into
flutter-team-archive:main
from
gaaclarke:wide-gamut-framework-dlcolor2
Aug 20, 2024
+446
−147
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
107a9a2
Changes DlColor to support wide gamut colors (#54473)
gaaclarke 055303c
Made sure dlcolor is opaque black by default
gaaclarke 65d4573
fixed typo in test and added assert to avoid it
gaaclarke bbe7dd8
asserted colorspace
gaaclarke db4f334
removed asserts
gaaclarke 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
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.
Should we dcheck or clamp? This is currently, in this PR, helping to catch a problem in a test conversion that we crossed paths with, but that bug-in-a-test would have normally been caught by the test creator. If we dcheck then we might annoy someone who calculated the alpha and ended up with a barely-out-of-range value. They could just have easily have provided 255 for one of the color values and we'd take it as a potential non-normalized Color Space float...?
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.
Rather than dcheck I think we should clamp right? Certain blend modes (plus) can lead to alpha greater than one without a clamp
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.
My concern with that is that it will mask problems like we had where someone is sending in 255 to create a color. The assert forces people creating colors to have a clamp if they are doing arithmetic that will get it out of bounds. I didn't have to change any code as a result of all our tests, so that's a good sign. I think this leaves us in a better position considering we control all the locations where DlColors are created. A public API would be a different story.
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.
You should clamp.
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 removed the asserts to duplicate the behavior of
impeller::Color. There may be transitory colors that are not valid, clamping or the asserts could mess with that. I don't think we blend with DlColor today, it's more of a transmission format, but I think we plan to use it more broadly in the future.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.
We will be CPU blending once we merge DlColor and impeller::Color. This will happen sooner than you'd think