-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Fix rendering of gradients in html mode #40345
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). 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. |
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
Golden file changes are available for triage from new commit, Click here to view. |
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. |
@xtyxtyx This looks like a great contribution, sorry we have been slacking on reviewing it. Let me see if I can find a reviewer. |
@xtyxtyx If you don't get a review for this in the next few days, please join our Discord (the link is in the contributing guide, link to which is below) and ping me (Hixie) in the #hackers-web channel. |
CC @yjbanov ? |
@@ -86,7 +86,7 @@ Future<void> testMain() async { | |||
} | |||
expect(rc.renderStrategy.hasArbitraryPaint, isTrue); | |||
await canvasScreenshot(rc, 'linear_gradient_oval_matrix'); | |||
}); | |||
}, skip: isFirefox); |
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.
Did this suddenly start failing on Firefox? Thoughts @yjbanov ?
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'm surprised this wasn't failing before. We don't have infra to golden-test Firefox. @eyebrowsoffire reorged our tests recently and might know more.
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 don't think these tests will fail on Firefox, but they will not take screenshots or send them to skia gold. However, it may be of at least some utility to just run the tests on Firefox anyway just to make sure you can actually do the drawing commands and not crash or throw an exception. I'll leave it up to you though, it might not be worthwhile to run them.
LGTM but I'd like @eyebrowsoffire, who looked into this code before and also recently mentioned something to me about it, to take a second look. |
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.
LGTM! Thanks for fixing this.
@@ -86,7 +86,7 @@ Future<void> testMain() async { | |||
} | |||
expect(rc.renderStrategy.hasArbitraryPaint, isTrue); | |||
await canvasScreenshot(rc, 'linear_gradient_oval_matrix'); | |||
}); | |||
}, skip: isFirefox); |
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 don't think these tests will fail on Firefox, but they will not take screenshots or send them to skia gold. However, it may be of at least some utility to just run the tests on Firefox anyway just to make sure you can actually do the drawing commands and not crash or throw an exception. I'll leave it up to you though, it might not be worthwhile to run them.
Golden file changes are available for triage from new commit, Click here to view. |
@xtyxtyx This has been sitting for a while, and I noticed there are some untriaged goldens sitting here. I went to triage them, but some of the new ones don't look correct to me. For example https://flutter-engine-gold.skia.org/detail?grouping=name%3Dradial_gradient_clamp_transformed%26source_type%3Dflutter-engine&digest=fb78cbd08ab084418a97c2bfe060a503&changelist_id=40345&crs=github Which just shows a gray oval. I have to assume that's supposed to be rendering some kind of gradient there? Not sure if it's an issue with the test, an issue with the rendering code, or whether it's actually expected to just draw a gray oval. |
Golden file changes are available for triage from new commit, Click here to view. |
Golden file changes are available for triage from new commit, Click here to view. |
@eyebrowsoffire Thanks for your help! After some investigation I found these gray ovals were painted because the center of the gradient was too far away. I've fixed the test and the new these golden files look correct now. |
Great! I approved the new goldens, they look sane to me now. |
Thanks so much for your contribution @xtyxtyx !! |
…132284) flutter/engine@b5b41ff...9117ff2 2023-08-10 zanderso@users.noreply.github.com Revert "Android a11y bridge sets importantness" (flutter/engine#44569) 2023-08-10 skia-flutter-autoroll@skia.org Roll Skia from 491f67637e6e to 7c5f6b17a998 (2 revisions) (flutter/engine#44568) 2023-08-10 matanlurey@users.noreply.github.com [Impeller] Replace Vulkan rotation checks with polling (flutter/engine#44361) 2023-08-10 31859944+LongCatIsLooong@users.noreply.github.com Disable text rounding hack by default (flutter/engine#44544) 2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 3d5a6138b7e5 to 491f67637e6e (4 revisions) (flutter/engine#44563) 2023-08-09 skia-flutter-autoroll@skia.org Manual roll Dart SDK from f664f4b9c50d to d89e4ead966d (11 revisions) (flutter/engine#44560) 2023-08-09 58529443+srujzs@users.noreply.github.com Make toJS'd function use JS types (flutter/engine#44469) 2023-08-09 xty50337@hotmail.com [web] Fix rendering of gradients in html mode (flutter/engine#40345) 2023-08-09 55360120+Matt2D@users.noreply.github.com Flutter iOS Interactive Keyboard: Fixing Animation Issue (flutter/engine#44514) 2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 8c9a8d3e073c to 3d5a6138b7e5 (4 revisions) (flutter/engine#44557) 2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from d210bab77137 to 8c9a8d3e073c (1 revision) (flutter/engine#44555) 2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 25aedb939915 to d210bab77137 (2 revisions) (flutter/engine#44550) 2023-08-09 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from e7bMhkfY-RPMrSMhB... to zoCGnScKZWbm5s9Hy... (flutter/engine#44548) 2023-08-09 skia-flutter-autoroll@skia.org Roll Skia from 17ba2122707b to 25aedb939915 (3 revisions) (flutter/engine#44547) 2023-08-09 47866232+chunhtai@users.noreply.github.com Android a11y bridge sets importantness (flutter/engine#44452) 2023-08-09 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from tO6r8iQqnmsYkLcvZ... to ZCP8LDbKF4LTBFz_W... (flutter/engine#44545) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from tO6r8iQqnmsY to ZCP8LDbKF4LT fuchsia/sdk/core/mac-amd64 from e7bMhkfY-RPM to zoCGnScKZWbm 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 chinmaygarde@google.com,rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
 <details> <summary> Code Example</summary> ```dart import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class DemoGradientTransform implements GradientTransform { @OverRide Matrix4? transform(Rect bounds, {TextDirection? textDirection}) { return Matrix4.identity() ..scale(1.2, 1.7) ..rotateZ(0.25); } } class MyApp extends StatelessWidget { const MyApp({super.key}); @OverRide Widget build(BuildContext context) { var colors = <Color>[ Colors.red, Colors.green, Colors.blue, Colors.yellow, ]; const stops = <double>[0.0, 0.25, 0.5, 1.0]; return MaterialApp( debugShowCheckedModeBanner: false, home: GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: TileMode.values.length, ), children: <Widget>[ for (final mode in TileMode.values) DecoratedBox( decoration: BoxDecoration( gradient: LinearGradient( colors: colors, stops: stops, tileMode: mode, transform: DemoGradientTransform(), ), ), ), for (final mode in TileMode.values) DecoratedBox( decoration: BoxDecoration( gradient: RadialGradient( center: Alignment.topLeft, radius: 0.5, colors: colors, stops: stops, tileMode: mode, transform: DemoGradientTransform(), ), ), ), for (final mode in TileMode.values) DecoratedBox( decoration: BoxDecoration( gradient: SweepGradient( center: Alignment.topLeft, startAngle: 0.0, endAngle: 3.14, colors: colors, stops: stops, tileMode: mode, transform: DemoGradientTransform(), ), ), ), ], ), ); } } ``` </details> Fixes: flutter/flutter#84245
Code Example
Fixes: flutter/flutter#84245