This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Let pushColorFilter accept all types of ColorFilters #9641
Merged
dnfield
merged 19 commits into
flutter-team-archive:master
from
dnfield:push_color_filter
Jul 10, 2019
Merged
Changes from 5 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5af08d0
Let pushColorFilter accept all types of ColorFilters
dnfield 059bf04
release typed data, check matrix len
dnfield b7b4aa8
20 entries, not 25
dnfield a1e9319
20 entries, not 25
dnfield ed6fa6d
move const to right spot
dnfield a3b9075
tests
dnfield ff4ed6b
Refactor ColorFilter to have a native wrapper
dnfield 4b820ed
comment
dnfield 8935830
tests
dnfield 1bfc97c
typo
dnfield 919f2d3
merge
dnfield 529803d
Merge remote-tracking branch 'upstream/master' into push_color_filter
dnfield f10ecfd
merge
dnfield c8a8c35
Merge remote-tracking branch 'upstream/master' into native_color_filter
dnfield 884f0e3
Use right accessor
dnfield c6f3421
Merge branch 'native_color_filter' into push_color_filter
dnfield 9f132cf
merge
dnfield b6a06a9
merge!
dnfield 75a88a5
remove dead code
dnfield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -274,7 +274,13 @@ void main() { | |
| return builder.pushOpacity(100, oldLayer: oldLayer); | ||
| }); | ||
| testNoSharing((SceneBuilder builder, EngineLayer oldLayer) { | ||
| return builder.pushColorFilter(const Color.fromARGB(0, 0, 0, 0), BlendMode.color, oldLayer: oldLayer); | ||
| return builder.pushColorFilter( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add test coverage for all 4 types of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do |
||
| const ColorFilter.mode( | ||
| Color.fromARGB(0, 0, 0, 0), | ||
| BlendMode.color, | ||
| ), | ||
| oldLayer: oldLayer, | ||
| ); | ||
| }); | ||
| testNoSharing((SceneBuilder builder, EngineLayer oldLayer) { | ||
| return builder.pushBackdropFilter(ImageFilter.blur(), oldLayer: oldLayer); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Instead of implementing 4 pushColorFilter variants, maybe it's cleaner to define a single
pushColorFilterthat takes ask_sp<SkColorFilter>, and exposeExtractColorFilterfrompaint.ccto generate theSkColorFilter.Uh oh!
There was an error while loading. Please reload this page.
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.
My concern with that is the Paint version is a bit hacky and was mainly done to maintain backwards compatibility.
Paint can afford to do this because it already encodes/serializes this data to the engine side. Doing that is not free. I'd rather use this approach because it avoids allocating unnecessary typed data (which is demonstrably slow), and avoids sending data over to thenative side that we don't need.
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.
Thanks for pointing that out! I didn't realize that
ColorFilterdoesn't have a corresponding nativeSkColorFilterobject. Is it possible to create such a native object during the construction ofColorFilter, soPaintcan just store it inside_objects(like howShaderis stored), andpushColorFiltercan also directly use it without triggering additional Dart to native conversion costs?I guess that I'm Ok with having 4
pushColorFilter***inscene_builder.ccbut it just feels a little weird as every previouspush***inscene_builder.cchas a one-to-one relationship with theSceneBuilder.push***incompositing.dart. I'll consult @chinmaygarde and @yjbanov to see how they feel about 4pushColorFilter***variants inscene_builder.cc.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.
That may be a better way to go - just make ColorFilter a
NativeFieldWrapper2class. Do you want that to be part of this pull request or should we split it out?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.
Let's have it here if it's not complicating this PR too much :) (I was hoping that it could even simplify this PR a little bit.)
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 split that effort out into #9668 which has landed and been merged into this PR. PTAL.