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

[ui] fix missing color conversion in drawAtlas. #54750

Merged
merged 5 commits into from
Aug 26, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Aug 23, 2024

Ensure that int32 ui colors are correctly converted to Dl Colors (convert instead of reinterpret cast).

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@jonahwilliams
Copy link
Member Author

@flar / @gaaclarke for ideas?

@jonahwilliams
Copy link
Member Author

Maybe dart:ui golden is the best route

@gaaclarke
Copy link
Member

gaaclarke commented Aug 23, 2024

It will get an integration test when I migrate it to support wide gamut colors. I'm just adding some to the gradient path right now.

@gaaclarke
Copy link
Member

However, wide gamut support for this could get deprioritized depending on how everything else goes so it might be a while.

@gaaclarke
Copy link
Member

Here's a pr for such a test for gradients: flutter/flutter#153976

If we wanted we could add the test that asserts it gets an srgb color. Then when wide gamut is supported, switch it to wide gamut.

@jonahwilliams
Copy link
Member Author

I'm not adding wide gamut support as a feature - this code does not correctly convert the int32 color into the 4 float color so drawAtlas is broken right now. Test added, hopefully this passes.

@jonahwilliams
Copy link
Member Author

Test added

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

lgtm

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2024
@auto-submit auto-submit bot merged commit 8ef3af3 into flutter:main Aug 26, 2024
32 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 26, 2024
@@ -596,12 +596,17 @@ Dart_Handle Canvas::drawAtlas(Dart_Handle paint_objects,
tonic::Int32List colors(colors_handle);
tonic::Float32List cull_rect(cull_rect_handle);

std::vector<DlColor> dl_color(colors.num_elements());
Copy link
Contributor

@flar flar Aug 26, 2024

Choose a reason for hiding this comment

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

I tend to use:

  std::vector<Foo> things;
  things.reserve(N);
  for (all the things) {
    things.emplace_back(next thing constructor arguments);
    // or things.push_back(next thing) if it's a simple thing
    // or we've already constructed the things
  }

It avoids double initialization of the memory. Reserve just allocates and doesn't initialize. Since the loop will be replacing all of the default-initialized values, it's a waste of time.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that is a better way to do it. I think I'll let this sit for now as my expectation is that we can rip it out once the wide gamut conversions are finished.

Copy link
Member

Choose a reason for hiding this comment

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

I think there is even a lint for this that we don't have turned on.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 26, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 26, 2024
…sions) (#154137)

Manual roll requested by [email protected]

flutter/engine@365b0c7...f645ca5

2024-08-26 [email protected] Revert dart to b81b344a194f (flutter/engine#54782)
2024-08-26 [email protected] [web] set the "dialog" ARIA role unconditionally (flutter/engine#54761)
2024-08-26 [email protected] Revert "Test running the macOS engine has no stray logging" (flutter/engine#54778)
2024-08-26 [email protected] clangd_check: write .clangd as part of test (flutter/engine#54766)
2024-08-26 [email protected] Roll Dart SDK from c7eb3230248a to 94c21ec02e28 (2 revisions) (flutter/engine#54776)
2024-08-26 [email protected] [Android] Drops semantics query when app is not attached (flutter/engine#52040)
2024-08-26 [email protected] [ui] fix missing color conversion in drawAtlas. (flutter/engine#54750)
2024-08-26 [email protected] Roll Skia from ce0656c1d79c to a05dbd2a60f0 (3 revisions) (flutter/engine#54774)
2024-08-26 [email protected] Roll Fuchsia Linux SDK from CVnRW3RAZuTq0lVaw... to QqRZlA9wVbeg4WoPz... (flutter/engine#54770)
2024-08-26 [email protected] [Impeller] delete impeller image class. (flutter/engine#54767)
2024-08-25 [email protected] [Impeller] more test migration. (flutter/engine#54763)
2024-08-25 [email protected] [macOS] Add TODOs to remove AppKit bug workaround (flutter/engine#54764)
2024-08-25 [email protected] Roll Fuchsia Linux SDK from 5uR6WvDV5FX-aZgKQ... to CVnRW3RAZuTq0lVaw... (flutter/engine#54765)
2024-08-24 [email protected] Roll Skia from d59df6f6f4f3 to ce0656c1d79c (2 revisions) (flutter/engine#54760)
2024-08-24 [email protected] Roll Skia from 741972846fa2 to d59df6f6f4f3 (1 revision) (flutter/engine#54758)
2024-08-24 [email protected] Roll Fuchsia Linux SDK from 0d2McFgsNwG-5r1Rb... to 5uR6WvDV5FX-aZgKQ... (flutter/engine#54757)
2024-08-24 [email protected] Roll Dart SDK from 586ba94c96a4 to c7eb3230248a (2 revisions) (flutter/engine#54755)
2024-08-24 [email protected] Roll Skia from 0086a17e0d4c to 741972846fa2 (3 revisions) (flutter/engine#54753)
2024-08-24 [email protected] Roll Dart SDK from b81b344a194f to 586ba94c96a4 (1 revision) (flutter/engine#54752)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from 0d2McFgsNwG- to QqRZlA9wVbeg

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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…sions) (flutter#154137)

Manual roll requested by [email protected]

flutter/engine@365b0c7...f645ca5

2024-08-26 [email protected] Revert dart to b81b344a194f (flutter/engine#54782)
2024-08-26 [email protected] [web] set the "dialog" ARIA role unconditionally (flutter/engine#54761)
2024-08-26 [email protected] Revert "Test running the macOS engine has no stray logging" (flutter/engine#54778)
2024-08-26 [email protected] clangd_check: write .clangd as part of test (flutter/engine#54766)
2024-08-26 [email protected] Roll Dart SDK from c7eb3230248a to 94c21ec02e28 (2 revisions) (flutter/engine#54776)
2024-08-26 [email protected] [Android] Drops semantics query when app is not attached (flutter/engine#52040)
2024-08-26 [email protected] [ui] fix missing color conversion in drawAtlas. (flutter/engine#54750)
2024-08-26 [email protected] Roll Skia from ce0656c1d79c to a05dbd2a60f0 (3 revisions) (flutter/engine#54774)
2024-08-26 [email protected] Roll Fuchsia Linux SDK from CVnRW3RAZuTq0lVaw... to QqRZlA9wVbeg4WoPz... (flutter/engine#54770)
2024-08-26 [email protected] [Impeller] delete impeller image class. (flutter/engine#54767)
2024-08-25 [email protected] [Impeller] more test migration. (flutter/engine#54763)
2024-08-25 [email protected] [macOS] Add TODOs to remove AppKit bug workaround (flutter/engine#54764)
2024-08-25 [email protected] Roll Fuchsia Linux SDK from 5uR6WvDV5FX-aZgKQ... to CVnRW3RAZuTq0lVaw... (flutter/engine#54765)
2024-08-24 [email protected] Roll Skia from d59df6f6f4f3 to ce0656c1d79c (2 revisions) (flutter/engine#54760)
2024-08-24 [email protected] Roll Skia from 741972846fa2 to d59df6f6f4f3 (1 revision) (flutter/engine#54758)
2024-08-24 [email protected] Roll Fuchsia Linux SDK from 0d2McFgsNwG-5r1Rb... to 5uR6WvDV5FX-aZgKQ... (flutter/engine#54757)
2024-08-24 [email protected] Roll Dart SDK from 586ba94c96a4 to c7eb3230248a (2 revisions) (flutter/engine#54755)
2024-08-24 [email protected] Roll Skia from 0086a17e0d4c to 741972846fa2 (3 revisions) (flutter/engine#54753)
2024-08-24 [email protected] Roll Dart SDK from b81b344a194f to 586ba94c96a4 (1 revision) (flutter/engine#54752)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from 0d2McFgsNwG- to QqRZlA9wVbeg

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants