New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ImageFilter
/ColorFilter
/MaskFilter
in Skwasm
#42088
Conversation
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. |
} | ||
|
||
abstract class ScenePicture implements ui.Picture { | ||
ui.Rect get cullRect; |
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.
Should this be called bounds
? I'm not sure how a picture could be "culling" anything 🤔
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.
This terminology comes from skia itself, see SkPicture::cullRect
. I think the idea is that if that rectangle can be culled by another operation (like a clip operation or something), it can cull the picture and skip all of its drawing commands.
final MaskFilterHandle handle; | ||
bool _isDisposed = false; | ||
|
||
void dispose() { |
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 believe the pattern we use is to assert(!_isDisposed)
in all dispose methods because double-dispose likely points to some app-side bug.
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.
Well, I don't actually have the finalization registry wired up yet, but the idea is for this to be safe to call more than once, since it might be called manually by the user and it might be called by the finalization registry. I think it makes sense for this to be idempotent, at least for how I envision this being used with the UniqueRef
stuff.
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.
Yeah, as long as the object reference does not leak to the framework then it should be fine. The trouble starts when the framework references the object. Then you have a chicken and egg problem, the framework drops the reference and the object is GC'd, but then FinalizationRegistry
doesn't have an object to call dispose()
on. In CanvasKit each Skia object is represented using a pair of Dart objects, a Ck*
object (e.g. CkPaint
) and a UniqueRef
. Then we do FinalizationRegistry.register(ckObject, uniqueRef)
and hand the ckObject
reference to the framework. When ckObject
is GC'd, we call uniqueRef.dispose()
. UniqueRef
is the only place that could potentially be disposed more than once, once manually and once via FinalizationRegistry
. However, CkObject
should only be disposed once, which is where we put assert(!isDisposed)
.
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 guessing in Skwasm we don't need UniqueRef
at all. I think Pointer
can play the same role without an extra wrapper.
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.
Yeah I see what you're saying. I know FinalizationRegistry
basically needs an extra layer of indirection, but I haven't quite figured out how this is all going to work with the Skwasm objects. If you don't mind, I'm just going to kick the can on this issue and revisit it when I hook up the finalization registry stuff.
-1.0, 0, 0, 1.0, 0, // row | ||
0, -1.0, 0, 1.0, 0, // row | ||
0, 0, -1.0, 1.0, 0, // row | ||
1.0, 1.0, 1.0, 1.0, 0 |
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.
Add // the boat
to the last line 😛
…127292) flutter/engine@aac0919...f0f3fe7 2023-05-21 skia-flutter-autoroll@skia.org Roll Skia from 7c7dff949a27 to 5b2005e47bf3 (1 revision) (flutter/engine#42199) 2023-05-21 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from gQ989rlKAuTJHQR-C... to 88pzkUAkSKsJrNG38... (flutter/engine#42198) 2023-05-21 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from 868_67npyO8nD_JCx... to JU-dKW3CQIUzhbqWE... (flutter/engine#42197) 2023-05-21 skia-flutter-autoroll@skia.org Roll Skia from a60bfcb01af9 to 7c7dff949a27 (1 revision) (flutter/engine#42195) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from c_fRDyBVZX-MwW5fS... to gQ989rlKAuTJHQR-C... (flutter/engine#42194) 2023-05-20 skia-flutter-autoroll@skia.org Roll Skia from f3e9cb7d37fd to a60bfcb01af9 (1 revision) (flutter/engine#42193) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from sfLkc5VBFU6UkljF6... to 868_67npyO8nD_JCx... (flutter/engine#42191) 2023-05-20 kjlubick@users.noreply.github.com Move SkSurface::MakeNull to SkSurfaces::Null (flutter/engine#42158) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from TWjmvLCOnYAUgAzvT... to c_fRDyBVZX-MwW5fS... (flutter/engine#42189) 2023-05-20 skia-flutter-autoroll@skia.org Roll Skia from b4a4782cf89d to f3e9cb7d37fd (1 revision) (flutter/engine#42188) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from pwdDQgM88sqLmZczj... to sfLkc5VBFU6UkljF6... (flutter/engine#42187) 2023-05-20 skia-flutter-autoroll@skia.org Roll Skia from 7202b405f061 to b4a4782cf89d (19 revisions) (flutter/engine#42185) 2023-05-20 dnfield@google.com [Impeller] avoid creating multiple concurrent message loops for Andorid Vulkan (flutter/engine#42146) 2023-05-20 jacksongardner@google.com Implement `ImageFilter`/`ColorFilter`/`MaskFilter` in Skwasm (flutter/engine#42088) 2023-05-20 30870216+gaaclarke@users.noreply.github.com [Impeller] Made other vulkan objects cleanup properly. (flutter/engine#42113) 2023-05-19 coldpalelight@gmail.com [Impeller] Fix the issue that 'coverage_coords' is incorrectly calculated in 'FillPathGeometry::GetPositionUVBuffer' (flutter/engine#42155) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from TWjmvLCOnYAU to 88pzkUAkSKsJ fuchsia/sdk/core/mac-amd64 from pwdDQgM88sqL to JU-dKW3CQIUz 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 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
…lutter#127292) flutter/engine@aac0919...f0f3fe7 2023-05-21 skia-flutter-autoroll@skia.org Roll Skia from 7c7dff949a27 to 5b2005e47bf3 (1 revision) (flutter/engine#42199) 2023-05-21 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from gQ989rlKAuTJHQR-C... to 88pzkUAkSKsJrNG38... (flutter/engine#42198) 2023-05-21 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from 868_67npyO8nD_JCx... to JU-dKW3CQIUzhbqWE... (flutter/engine#42197) 2023-05-21 skia-flutter-autoroll@skia.org Roll Skia from a60bfcb01af9 to 7c7dff949a27 (1 revision) (flutter/engine#42195) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from c_fRDyBVZX-MwW5fS... to gQ989rlKAuTJHQR-C... (flutter/engine#42194) 2023-05-20 skia-flutter-autoroll@skia.org Roll Skia from f3e9cb7d37fd to a60bfcb01af9 (1 revision) (flutter/engine#42193) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from sfLkc5VBFU6UkljF6... to 868_67npyO8nD_JCx... (flutter/engine#42191) 2023-05-20 kjlubick@users.noreply.github.com Move SkSurface::MakeNull to SkSurfaces::Null (flutter/engine#42158) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from TWjmvLCOnYAUgAzvT... to c_fRDyBVZX-MwW5fS... (flutter/engine#42189) 2023-05-20 skia-flutter-autoroll@skia.org Roll Skia from b4a4782cf89d to f3e9cb7d37fd (1 revision) (flutter/engine#42188) 2023-05-20 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from pwdDQgM88sqLmZczj... to sfLkc5VBFU6UkljF6... (flutter/engine#42187) 2023-05-20 skia-flutter-autoroll@skia.org Roll Skia from 7202b405f061 to b4a4782cf89d (19 revisions) (flutter/engine#42185) 2023-05-20 dnfield@google.com [Impeller] avoid creating multiple concurrent message loops for Andorid Vulkan (flutter/engine#42146) 2023-05-20 jacksongardner@google.com Implement `ImageFilter`/`ColorFilter`/`MaskFilter` in Skwasm (flutter/engine#42088) 2023-05-20 30870216+gaaclarke@users.noreply.github.com [Impeller] Made other vulkan objects cleanup properly. (flutter/engine#42113) 2023-05-19 coldpalelight@gmail.com [Impeller] Fix the issue that 'coverage_coords' is incorrectly calculated in 'FillPathGeometry::GetPositionUVBuffer' (flutter/engine#42155) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from TWjmvLCOnYAU to 88pzkUAkSKsJ fuchsia/sdk/core/mac-amd64 from pwdDQgM88sqL to JU-dKW3CQIUz 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 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
This implements flutter/flutter#126342
This implements
ImageFilter
,ColorFilter
andMaskFilter
in Skwasm. This includes support on thePaint
object, as well as theSceneBuilder
layers that use these types.