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

Conversation

@flar
Copy link
Contributor

@flar flar commented May 6, 2021

Includes a new golden test.

The only thing that doesn't work is using an ImageFilter.matrix in a BackdropFilter on the HTML renderer. I don't know of a way to apply a transform to the background.

What does work:

  • ImageFiltered with matrix on both CanvasKit and HTML
  • BackdropFilter with matrix on CanvasKit
  • BackdropFilter does nothing with a matrix filter on HTML

Previously all of those would throw an exception.

Fixes flutter/flutter#45213

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label May 6, 2021
@google-cla google-cla bot added the cla: yes label May 6, 2021
@flar flar requested review from ferhatb and yjbanov May 6, 2021 19:10
@flar flar force-pushed the web-imagefilter-matrix-support branch from b720007 to b0242d3 Compare May 10, 2021 20:56
@ferhatb
Copy link
Contributor

ferhatb commented May 10, 2021

Thanks @flar , will review shortly.

@flar
Copy link
Contributor Author

flar commented May 10, 2021

Thanks @ferhatb , builds have been problematic for a while so I was just recently able to rebase this and get it past the build issues (hopefully, knocking on wood).

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

_CkMatrixImageFilter({ required this.matrix, required this.filterQuality }) : super._();

Float64List matrix;
ui.FilterQuality filterQuality;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these be final?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, probably very minor performance wins, but if this object is opaque the values can be converted using toSkMatrixFromFloat64 and toSkFilterQuality in the constructor initializer, so when the image filter is reused we don't need to re-convert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At first I was worried that this would change the toString() representation, but then I realized I could convert back for stringifying, so I went with this method.

Also, I wasn't copying the matrix so that was a problem waiting to happen. By converting the matrix to an Sk form, we have a defensive copy implicitly (although the stringify precision will suffer slightly, but that is arguably being honest about the precision that web maintains for these values...).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the end I made them final, but didn't store them as converted values in case that disrupts the processing of the == operator which is key to consistency of tree changes as values change.

@flar flar force-pushed the web-imagefilter-matrix-support branch from b0242d3 to 025a3e3 Compare May 17, 2021 20:57
@flar
Copy link
Contributor Author

flar commented May 17, 2021

I implemented suggestions from @yjbanov and rebased. I had to make some adjustments for the recent changes by @hterkelsen for the way the libraries are packaged. Hopefully I complied with the new design directions.

@flar flar added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label May 17, 2021
@fluttergithubbot fluttergithubbot merged commit 156c2be into flutter:master May 17, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2021
zanderso pushed a commit to flutter/flutter that referenced this pull request May 19, 2021
* 98068f1 fuchsia: Only send different ViewProperties (flutter/engine#26170)

* 5e487ba Roll Skia from c1f641104531 to 469531234936 (4 revisions) (flutter/engine#26197)

* 4cab492 Add image generator registry (flutter/engine#25987)

* c753c24 Roll Fuchsia Linux SDK from l6XmTSLnt... to AUWVgDkx6... (flutter/engine#26201)

* 75a7812 Reland outputs a json version of the package manifest. (flutter/engine#26163)

* b5dc598 Roll Skia from 469531234936 to 5b38536d76ae (7 revisions) (flutter/engine#26202)

* fb91366 [icu] Upgrade ICU to 69.1, the same commit used by Chromimum latest (flutter/engine#26200)

* 62e0951 Prepare to move --delete-tostring-package-uri option to Dart SDK (flutter/engine#26196)

* 156c2be Web ImageFilter.matrix support (flutter/engine#25982)

* c30de25 Roll Skia from 5b38536d76ae to 2fed9f62d29a (7 revisions) (flutter/engine#26206)

* 7ef42f1 Roll Fuchsia Mac SDK from KmSY84b_E... to 7WNQRHsHN... (flutter/engine#26207)

* 8bba964 Add more diagrams for deferred components docs, fix alignment of existing one (flutter/engine#26209)

* 391e22d Roll Dart SDK from 67be110b5ba8 to 510f26486328 (3 revisions) (flutter/engine#26212)

* fa62ce0 Roll Skia from 2fed9f62d29a to e8cd0a54041e (2 revisions) (flutter/engine#26213)

* 2029cba Roll Skia from e8cd0a54041e to 3d854bade6de (4 revisions) (flutter/engine#26216)

* 9cd3c64 Roll Fuchsia Linux SDK from AUWVgDkx6... to boele8geO... (flutter/engine#26217)

* 6ceab15 Roll Dart SDK from 510f26486328 to 13e329e614f2 (1 revision) (flutter/engine#26218)

* f90698a Roll Fuchsia Mac SDK from 7WNQRHsHN... to F5TX4MaEg... (flutter/engine#26220)

* b9d03fe Roll Skia from 3d854bade6de to 66125eac158d (1 revision) (flutter/engine#26221)

* 849ce7e Roll Dart SDK from 13e329e614f2 to 2eea032403e2 (1 revision) (flutter/engine#26222)

* ca89d69 Roll Skia from 66125eac158d to 5696bcd0f7f8 (1 revision) (flutter/engine#26223)

* db7a3dc fuchsia: Fix occlusion_hint handling (flutter/engine#26208)

* b875d99 Roll Skia from 5696bcd0f7f8 to bdfd77616177 (5 revisions) (flutter/engine#26224)

* b67caca Roll Skia from bdfd77616177 to fb8d20befa8f (1 revision) (flutter/engine#26225)

* 2398dea Revert Dart SDK to 67be110b5ba8fc84af5e7136389e52a13ccbc9d5 (flutter/engine#26232)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes platform-web Code specifically for the web engine waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter/engine/web_ui does not implement ImageFilter.matrix

4 participants