Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Framework wide color #54415

Merged
merged 51 commits into from
Aug 22, 2024
Merged

Framework wide color #54415

merged 51 commits into from
Aug 22, 2024

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Aug 7, 2024

issue: flutter/flutter#127855
integration test: #54415

This does the preliminary work for implementing wide gamut colors in the Flutter framework. Here are the following changes:

  1. colors now specify a colorspace with which they are to be interpreted
  2. colors now store their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that is a temporary solution to support a smooth transition. Here is the plan for landing this:

  1. Land this PR
  2. Wait for it to roll into the Framework
  3. Land Switched CupertinoDynamicColor to implements Color flutter#153938 which will make CupertinoDynamicColor implement Color
  4. Land another engine PR that rips out the int storage: Removes the int storage from Color #54714

Here are follow up PRs:

  1. Changes DlColor to support wide gamut colors #54473 - changes DlColor so the wide gamut colors are rendered
  2. Hooks up framework wide gamut to engine wide gamut #54567 - Hooks up these changes to take advantage of wide DlColor
  3. Adds wide gamut framework test flutter#153319 - the integration test for the framework repo

There are some things that have been left as follow up PRs since they are technically breaking:

  1. The math on lerp hasn't been updated to take advantage of the higher bit depth
  2. operator== hasn't been updated to take advantage of the higher bit depth
  3. hashCode hasn't been updated to take advantage of the higher bit depth
  4. alphaBlend hasn't been updated to take advantage of the higher bit depth
  5. toString hasn't been updated to take advantage of the higher bit depth

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

static_cast<uint8_t>(red * 255.f) << 16 | //
static_cast<uint8_t>(green * 255.f) << 8 | //
static_cast<uint8_t>(blue * 255.f) << 0;
// TODO(gaaclarke): Pass down color info to DlColor.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #54473

@gaaclarke gaaclarke force-pushed the framework-wide-color branch from 53d9b42 to 95cd85b Compare August 12, 2024 23:34
@gaaclarke
Copy link
Member Author

There is a slight change in the results of alpha blending which is tripping up pixel exact golden tests. For example in EmbedderTest.CanRenderSceneWithoutCustomCompositorMetal the blend of the red and green triangle was (r:85, g:170, b:0), but is now showing up as (r:86, g:169: b:0).

@gaaclarke gaaclarke marked this pull request as ready for review August 14, 2024 18:32
@gaaclarke
Copy link
Member Author

@johnmccutchan I chose you to review since you have been involved in discussions about this feature and have a wholistic view of engine/framework. @jonahwilliams I chose you to represent the interests of the engine team. Let me know if you'd like to hear from someone else.

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I used a p3 color value after this change lands? Does it get clamped or re-interpreted as sRGB?

@override
int get hashCode => value.hashCode;
int get hashCode => Object.hash(_floatToInt8(a), _floatToInt8(r),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should change the hash code computation in this PR and not as a follow up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Responded to this in #54415 (comment)

@@ -323,13 +423,21 @@ class Color {
if (other.runtimeType != runtimeType) {
return false;
}
return other is Color
&& other.value == value;
// TODO(gaaclarke): Make equality more fine grain than 1/256.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should change the == implementation in this PR and not in a follow up. You'll want some sort of fudge factor for the comparisons.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this some more, we want ensure the hashCode is equal if the color is equal, so normaliziing to some bit depth (not 256) is probably required here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so I had this all implemented and decided to pull it out and wait for new PR. The reason why is that I want to separate the PRs for landing support for rendering wide gamut colors and support for wider bit depth for Color components. The reason is that the wider bit depth in color is the thing that is most likely going to cause a regression in tests. Rendering wide gamut colors is 3 commits across 2 repos and will be a pain to revert. I really think these should be landed separately.

My plan is to basically do the same math but use a number like 2^12 to match the bit depth for HDMI 2.0. On iOS we currently can only render 2^10.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could switch the storage back to an int in the meantime if it makes landing this PR easier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact maybe it makes sense to switch the storage to always be fixed point. I could refactor the old code to work from a fixed point where the divisor is 255. Then we can crank it up to 6000. The transmission to the lower levels can remain floats. The benefit is that the change at dart:ui is much simpler. Having 6000 be the fixed-point divisor would allow us to accurately represent 1/2, 1/4, 1/8, 1/10, 1/16. It's close to the 2^12 bit rate.

@gaaclarke
Copy link
Member Author

What happens if I used a p3 color value after this change lands? Does it get clamped or re-interpreted as sRGB?

It will get clamped. After #54473 they will be rendered correctly.

@jonahwilliams
Copy link
Member

Clamping seems reasonable. What about gradient colors? The constructors don't take Int32Lists, so we can change the implementation to pass float data now without breaking them. Obvs, atlas and vertices are more complicated.

@gaaclarke
Copy link
Member Author

Clamping seems reasonable. What about gradient colors? The constructors don't take Int32Lists, so we can change the implementation to pass float data now without breaking them. Obvs, atlas and vertices are more complicated.

Yea, those are going to be changed after this lands in different PRs. This is just what is required to make the integration test work.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Aug 14, 2024
@gaaclarke
Copy link
Member Author

The failure in the framework tests can be reproduced with

flutter --local-engine=host_debug_unopt_arm64 \
  --local-engine-host=host_debug_unopt_arm64 \
  --local-engine-src-path=/Users/aaclarke/dev/engine/src/ test \
  --name="Cupertino.*focusable\sand" \
  test/material/switch_test.dart 

I've traced the failure and it has to do with Paint.color setter and getter which is reading and writing to ByteData when going through the trace canvas test matcher.

@gaaclarke
Copy link
Member Author

Looks like we have a test too that makes sure the color components are based off of the .value result:

  test('subclass of Color can override value', () {
    const DynamicColorClass color = DynamicColorClass(0xF0E0D0C0);
    expect(color.value, 0xF0E0D0C0);
    // Call base class member, make sure it uses overridden value.
    expect(color.red, 0xE0);
  });

https://github.com/gaaclarke/engine/blob/4771d838406fb5dea21a385bf693c384918d9f29/lib/web_ui/test/ui/color_test.dart#L143-L148

@gaaclarke
Copy link
Member Author

I was able to eliminate some of the framework test failures by making sure things like .red are based on .value. The remaining bugs still seem to be related to Cupertino so possibly another weird subclassing Color behavior. We should really make that class final.

auto-submit bot pushed a commit that referenced this pull request Aug 19, 2024
issue: flutter/flutter#127855
integration test: #54415

This is the engine side changes required for wide gamut framework support.  It changes the internal representation of DlColor to be floats.  It will be married with #54415 when it lands in #54567.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@gaaclarke
Copy link
Member Author

I found the existing error with Cupertino's dynamic color Color subclass. It was relying on withAlpha() which was rewritten to use the float values, but the subclass was using the .value override to make that work. As a result I've deprecated withOpacity() and kept it the same definition.

auto-submit bot added a commit that referenced this pull request Aug 20, 2024
Reverts: #54473
Initiated by: jonahwilliams
Reason for reverting: golden diffs like https://flutter-engine-gold.skia.org/detail?grouping=name%3Dimpeller_Play_AiksTest_BlendModeSrcAlphaLuminosity_OpenGLES%26source_type%3Dflutter-engine&digest=107ccd2cd1170746b1ffc4d31184e789 look incorrect, potentially an alpha issue
Original PR Author: gaaclarke

Reviewed By: {flar}

This change reverts the following previous change:
issue: flutter/flutter#127855
integration test: #54415

This is the engine side changes required for wide gamut framework support.  It changes the internal representation of DlColor to be floats.  It will be married with #54415 when it lands in #54567.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Aug 20, 2024
issue: flutter/flutter#127855
integration test: flutter#54415

This is the engine side changes required for wide gamut framework support.  It changes the internal representation of DlColor to be floats.  It will be married with flutter#54415 when it lands in flutter#54567.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
@gaaclarke gaaclarke force-pushed the framework-wide-color branch from 4227d3e to 501f4a4 Compare August 20, 2024 18:01
auto-submit bot pushed a commit that referenced this pull request Aug 20, 2024
relands #54473
issue: flutter/flutter#127855
integration test: #54415

This is the engine side changes required for wide gamut framework support.  It changes the internal representation of DlColor to be floats.  It will be married with #54415 when it lands in #54567.

## Difference from last attempt

1) The default color is now opaque black, not transparent black (not the issue for revert)
1) Updated a test to send in valid numbers when constructing a color and added asserts to avoid those problems in the future.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2024
flar added a commit that referenced this pull request Aug 23, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 23, 2024
…153994)

flutter/engine@67a7fe1...e4fac78

2024-08-23 [email protected] Revert "Framework wide color" (flutter/engine#54728)
2024-08-23 [email protected] Roll Skia from 7ac776072577 to 7d96b8516e8d (3 revisions) (flutter/engine#54731)
2024-08-23 [email protected] Roll Skia from 789f5cb0b9c2 to 7ac776072577 (1 revision) (flutter/engine#54729)
2024-08-23 [email protected] Roll Skia from b25553b2fb9f to 789f5cb0b9c2 (1 revision) (flutter/engine#54726)
2024-08-23 [email protected] Roll Dart SDK from ca009736fb3e to f9e6abb21ac7 (1 revision) (flutter/engine#54725)
2024-08-23 [email protected] [Impeller] Reland 3: Implement draw order optimization. (flutter/engine#54673)
2024-08-23 [email protected] Roll Fuchsia Test Scripts from 2fOjXGNxdSoRSGCL7... to 2TaLkdJNlAIbDYccn... (flutter/engine#54721)
2024-08-23 [email protected] Roll Fuchsia GN SDK from sbh76PYVTMxav4ACT... to OKGFjciA5Vd0TQks4... (flutter/engine#54722)
2024-08-22 [email protected] Test running the macOS engine has no stray logging (flutter/engine#54716)
2024-08-22 [email protected] Roll Dart SDK from 937389f7bc48 to ca009736fb3e (1 revision) (flutter/engine#54719)
2024-08-22 [email protected] More diagnostic clean ups (flutter/engine#54265)
2024-08-22 [email protected] Framework wide color (flutter/engine#54415)
2024-08-22 [email protected] Roll Skia from 10e9072dcea0 to b25553b2fb9f (2 revisions) (flutter/engine#54717)
2024-08-22 [email protected] Roll Dart SDK from ce160bf13347 to 937389f7bc48 (1 revision) (flutter/engine#54715)
2024-08-22 [email protected] [web:semantics] fix double click due to long-press (flutter/engine#54697)
2024-08-22 [email protected] Roll Skia from 04ce2e2bfc35 to 10e9072dcea0 (1 revision) (flutter/engine#54713)
2024-08-22 [email protected] Pin mac host and iOS builds to arm64 builders (flutter/engine#54711)
2024-08-22 [email protected] macOS: Bundle dSYM packages in FlutterMacOS.xcframework (flutter/engine#54696)
2024-08-22 [email protected] Roll Skia from 7611984dc27b to 04ce2e2bfc35 (2 revisions) (flutter/engine#54712)
2024-08-22 [email protected] vulkan_glfw validation layer logging (flutter/engine#54607)
2024-08-22 [email protected] Roll Skia from 4c66b7e42027 to 7611984dc27b (1 revision) (flutter/engine#54710)
2024-08-22 [email protected] Roll Dart SDK from 025bf8d376d3 to ce160bf13347 (1 revision) (flutter/engine#54709)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Aug 23, 2024
issue: flutter/flutter#127855
integration test: flutter#54415

This does the preliminary work for implementing wide gamut colors in the
Flutter framework. Here are the following changes:
1) colors now specify a colorspace with which they are to be interpreted
1) colors now store their components as floats to accommodate bit depths
more than 8

The storage of this Color class is weird with float/int storage but that
is a temporary solution to support a smooth transition. Here is the plan
for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land flutter/flutter#153938 which will make
CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage:
flutter#54714

Here are follow up PRs:
1) flutter#54473 - changes DlColor so the
wide gamut colors are rendered
1) flutter#54567 - Hooks up these changes
to take advantage of wide DlColor
1) flutter/flutter#153319 - the integration test
for the framework repo

There are some things that have been left as follow up PRs since they
are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the
higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit
depth
1) `hashCode` hasn't been updated to take advantage of the higher bit
depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit
depth
1) `toString` hasn't been updated to take advantage of the higher bit
depth

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Aug 29, 2024
issue: flutter/flutter#127855
integration test: flutter#54415

This does the preliminary work for implementing wide gamut colors in the
Flutter framework. Here are the following changes:
1) colors now specify a colorspace with which they are to be interpreted
1) colors now store their components as floats to accommodate bit depths
more than 8

The storage of this Color class is weird with float/int storage but that
is a temporary solution to support a smooth transition. Here is the plan
for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land flutter/flutter#153938 which will make
CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage:
flutter#54714

Here are follow up PRs:
1) flutter#54473 - changes DlColor so the
wide gamut colors are rendered
1) flutter#54567 - Hooks up these changes
to take advantage of wide DlColor
1) flutter/flutter#153319 - the integration test
for the framework repo

There are some things that have been left as follow up PRs since they
are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the
higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit
depth
1) `hashCode` hasn't been updated to take advantage of the higher bit
depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit
depth
1) `toString` hasn't been updated to take advantage of the higher bit
depth

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
auto-submit bot pushed a commit that referenced this pull request Aug 29, 2024
[This PR](#54415) was reverted because it requires a manual roll into the framework.

issue: flutter/flutter#127855
integration test: #54415

This does the preliminary work for implementing wide gamut colors in the Flutter framework. Here are the following changes: 1) colors now specify a colorspace with which they are to be interpreted 1) colors now store their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that is a temporary solution to support a smooth transition. Here is the plan for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land flutter/flutter#153938 which will make CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage: #54714

Here are follow up PRs:
1) #54473 - changes DlColor so the wide gamut colors are rendered
1) #54567 - Hooks up these changes to take advantage of wide DlColor
1) flutter/flutter#153319 - the integration test for the framework repo

There are some things that have been left as follow up PRs since they are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit depth
1) `hashCode` hasn't been updated to take advantage of the higher bit depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit depth
1) `toString` hasn't been updated to take advantage of the higher bit depth
auto-submit bot added a commit that referenced this pull request Aug 30, 2024
…#54884)

Reverts: #54567
Initiated by: chingjun
Reason for reverting: Breaking internal tests. See b/363125155
Original PR Author: gaaclarke

Reviewed By: {jonahwilliams, chinmaygarde}

This change reverts the following previous change:
issue: flutter/flutter#127855
integration test: #54415

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
auto-submit bot pushed a commit that referenced this pull request Aug 30, 2024
auto-submit bot added a commit that referenced this pull request Aug 30, 2024
Reverts: #54737
Initiated by: chingjun
Reason for reverting: Breaking internal tests. See b/363125155
Original PR Author: gaaclarke

Reviewed By: {matanlurey, jonahwilliams}

This change reverts the following previous change:
[This PR](#54415) was reverted because it requires a manual roll into the framework.

issue: flutter/flutter#127855
integration test: #54415

This does the preliminary work for implementing wide gamut colors in the Flutter framework. Here are the following changes: 1) colors now specify a colorspace with which they are to be interpreted 1) colors now store their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that is a temporary solution to support a smooth transition. Here is the plan for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land flutter/flutter#153938 which will make CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage: #54714

Here are follow up PRs:
1) #54473 - changes DlColor so the wide gamut colors are rendered
1) #54567 - Hooks up these changes to take advantage of wide DlColor
1) flutter/flutter#153319 - the integration test for the framework repo

There are some things that have been left as follow up PRs since they are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit depth
1) `hashCode` hasn't been updated to take advantage of the higher bit depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit depth
1) `toString` hasn't been updated to take advantage of the higher bit depth
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Aug 30, 2024
[This PR](flutter#54415) was reverted because it requires a manual roll into the framework.

issue: flutter/flutter#127855
integration test: flutter#54415

This does the preliminary work for implementing wide gamut colors in the Flutter framework. Here are the following changes: 1) colors now specify a colorspace with which they are to be interpreted 1) colors now store their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that is a temporary solution to support a smooth transition. Here is the plan for landing this:
1) Land this PR
1) Wait for it to roll into the Framework
1) Land flutter/flutter#153938 which will make CupertinoDynamicColor implement Color
1) Land another engine PR that rips out the int storage: flutter#54714

Here are follow up PRs:
1) flutter#54473 - changes DlColor so the wide gamut colors are rendered
1) flutter#54567 - Hooks up these changes to take advantage of wide DlColor
1) flutter/flutter#153319 - the integration test for the framework repo

There are some things that have been left as follow up PRs since they are technically breaking:
1) The math on `lerp` hasn't been updated to take advantage of the higher bit depth
1) `operator==` hasn't been updated to take advantage of the higher bit depth
1) `hashCode` hasn't been updated to take advantage of the higher bit depth
1) `alphaBlend` hasn't been updated to take advantage of the higher bit depth
1) `toString` hasn't been updated to take advantage of the higher bit depth
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Aug 30, 2024
gaaclarke added a commit that referenced this pull request Aug 30, 2024
[This PR](#54415) was reverted
because it required customer testing updates.

issue: flutter/flutter#127855
integration test: #54415

This does the preliminary work for implementing wide gamut colors in the
Flutter framework. Here are the following changes: 1) colors now specify
a colorspace with which they are to be interpreted 1) colors now store
their components as floats to accommodate bit depths more than 8

The storage of this Color class is weird with float/int storage but that
is a temporary solution to support a smooth transition. Here is the plan
for landing this: 1) Land this PR
1) Wait for it to roll into the Framework
1) Land flutter/flutter#153938 which will make
CupertinoDynamicColor implement Color 1) Land another engine PR that
rips out the int storage: #54714

Here are follow up PRs:
1) #54473 - changes DlColor so the
wide gamut colors are rendered 1)
#54567 - Hooks up these changes to
take advantage of wide DlColor 1)
flutter/flutter#153319 - the integration test
for the framework repo

There are some things that have been left as follow up PRs since they
are technically breaking: 1) The math on `lerp` hasn't been updated to
take advantage of the higher bit depth 1) `operator==` hasn't been
updated to take advantage of the higher bit depth 1) `hashCode` hasn't
been updated to take advantage of the higher bit depth 1) `alphaBlend`
hasn't been updated to take advantage of the higher bit depth 1)
`toString` hasn't been updated to take advantage of the higher bit depth

## Reland 2 notes

This was reverted because it changes the math on `_lerpDouble`. While
those changes were mathematcially equivalent, they had different
behaviors when working with non-numbers which created unexpected
changes. The change has been reverted and a test added.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Aug 30, 2024
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…lutter#153994)

flutter/engine@67a7fe1...e4fac78

2024-08-23 [email protected] Revert "Framework wide color" (flutter/engine#54728)
2024-08-23 [email protected] Roll Skia from 7ac776072577 to 7d96b8516e8d (3 revisions) (flutter/engine#54731)
2024-08-23 [email protected] Roll Skia from 789f5cb0b9c2 to 7ac776072577 (1 revision) (flutter/engine#54729)
2024-08-23 [email protected] Roll Skia from b25553b2fb9f to 789f5cb0b9c2 (1 revision) (flutter/engine#54726)
2024-08-23 [email protected] Roll Dart SDK from ca009736fb3e to f9e6abb21ac7 (1 revision) (flutter/engine#54725)
2024-08-23 [email protected] [Impeller] Reland 3: Implement draw order optimization. (flutter/engine#54673)
2024-08-23 [email protected] Roll Fuchsia Test Scripts from 2fOjXGNxdSoRSGCL7... to 2TaLkdJNlAIbDYccn... (flutter/engine#54721)
2024-08-23 [email protected] Roll Fuchsia GN SDK from sbh76PYVTMxav4ACT... to OKGFjciA5Vd0TQks4... (flutter/engine#54722)
2024-08-22 [email protected] Test running the macOS engine has no stray logging (flutter/engine#54716)
2024-08-22 [email protected] Roll Dart SDK from 937389f7bc48 to ca009736fb3e (1 revision) (flutter/engine#54719)
2024-08-22 [email protected] More diagnostic clean ups (flutter/engine#54265)
2024-08-22 [email protected] Framework wide color (flutter/engine#54415)
2024-08-22 [email protected] Roll Skia from 10e9072dcea0 to b25553b2fb9f (2 revisions) (flutter/engine#54717)
2024-08-22 [email protected] Roll Dart SDK from ce160bf13347 to 937389f7bc48 (1 revision) (flutter/engine#54715)
2024-08-22 [email protected] [web:semantics] fix double click due to long-press (flutter/engine#54697)
2024-08-22 [email protected] Roll Skia from 04ce2e2bfc35 to 10e9072dcea0 (1 revision) (flutter/engine#54713)
2024-08-22 [email protected] Pin mac host and iOS builds to arm64 builders (flutter/engine#54711)
2024-08-22 [email protected] macOS: Bundle dSYM packages in FlutterMacOS.xcframework (flutter/engine#54696)
2024-08-22 [email protected] Roll Skia from 7611984dc27b to 04ce2e2bfc35 (2 revisions) (flutter/engine#54712)
2024-08-22 [email protected] vulkan_glfw validation layer logging (flutter/engine#54607)
2024-08-22 [email protected] Roll Skia from 4c66b7e42027 to 7611984dc27b (1 revision) (flutter/engine#54710)
2024-08-22 [email protected] Roll Dart SDK from 025bf8d376d3 to ce160bf13347 (1 revision) (flutter/engine#54709)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 3, 2024
issue: #127855
This was an impediment to [changing the Color class](flutter/engine#54415).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants