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

[Impeller] Color matrix color filter implementation.#35284

Merged
auto-submit[bot] merged 12 commits intoflutter:mainfrom
betrevisan:impeller-color-matrix-filter
Aug 10, 2022
Merged

[Impeller] Color matrix color filter implementation.#35284
auto-submit[bot] merged 12 commits intoflutter:mainfrom
betrevisan:impeller-color-matrix-filter

Conversation

@betrevisan
Copy link
Contributor

@betrevisan betrevisan commented Aug 9, 2022

The changes proposed in this PR implement the color matrix color filter in Impeller alongside accompanying tests. One of the added tests allows developers to play around with the behavior of the color filter as they change the values of the matrix.

The PR also fixes flutter/flutter#107358.

This PR was developed on top of the changes proposed earlier in #34483.

Below is a Demo of what the playground looks like for this filter.
Screen Shot 2022-08-10 at 9 02 46 AM

Screen Shot 2022-08-10 at 9 03 00 AM

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 Hixie said 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.

@betrevisan betrevisan requested review from bdero and iskakaushik August 9, 2022 22:22
@betrevisan betrevisan changed the title Impeller color matrix filter Impeller color matrix color filter Aug 9, 2022

// Define the ImGui
ImGui::Begin("Color Matrix");
char label[4] = "##1";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use std::string label = "##1"; label.c_str(); // next line, makes it easier to change in the future.

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

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

LGTM

@betrevisan betrevisan marked this pull request as ready for review August 9, 2022 22:25
@iskakaushik iskakaushik added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 9, 2022

color = frag_info.color_m * color + frag_info.color_v;

// color = clamp(color);
Copy link
Contributor

Choose a reason for hiding this comment

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

drive by nit: commented out code

Copy link
Contributor

Choose a reason for hiding this comment

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

@betrevisan could you please fix this :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, just updated it. Thanks for catching that :)

@iskakaushik iskakaushik removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 9, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 9, 2022

  • This commit has no checks. Please check that ci.yaml validation has started and there are multiple checks. If not, try uploading an empty commit.

Copy link
Contributor

@bdero bdero left a comment

Choose a reason for hiding this comment

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

LGTM.

I haven't actually tried the playground -- a screenshot or video of the test would be nice to see (but by no means required). :)


// Set the color matrix filter.
FilterContents::ColorMatrix matrix = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
Copy link
Contributor

@bdero bdero Aug 10, 2022

Choose a reason for hiding this comment

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

Nit: For these and all of the other matrices, maybe lay these out in a 5x4 grid for easy reading? Often we use comments to coerce the formatter in situations like this. For example

FilterContents::ColorMatrix matrix = {
    1, 1, 1, 1, 1, //
    1, 1, 1, 1, 1, //
    1, 1, 1, 1, 1, //
    1, 1, 1, 1, 1, //
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice! I edited the matrices now.

@chinmaygarde chinmaygarde changed the title Impeller color matrix color filter [Impeller] Color matrix color filter implementation. Aug 10, 2022
@betrevisan betrevisan closed this Aug 10, 2022
@betrevisan betrevisan reopened this Aug 10, 2022
@betrevisan betrevisan closed this Aug 10, 2022
@betrevisan betrevisan reopened this Aug 10, 2022
@iskakaushik
Copy link
Contributor

@betrevisan could you please fix the formatting errors?

@betrevisan betrevisan closed this Aug 10, 2022
@betrevisan betrevisan reopened this Aug 10, 2022
@iskakaushik iskakaushik added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 10, 2022
@auto-submit auto-submit bot merged commit a705c0c into flutter:main Aug 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 10, 2022
emilyabest pushed a commit to emilyabest/engine that referenced this pull request Aug 12, 2022
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 e: impeller

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

[Impeller] Implement the color matrix filter.

4 participants