-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Add mask blur style support to the RRect blur fast path. #51250
Conversation
The SDF implementation suggested here might lend itself to an even more direct implementation if we could teach it to implement unequal corner radii. Since it computes the distance to the interior and knows if it is inside or outside, a lot of variants could be developed from it just by doing some clamping based on the sign of the SDF computation. |
07325f1
to
e21a452
Compare
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! The only thing we should do is make the test results easier to talk about and evaluate. There is like 30 images all on one image. These should be separate tests or labeled in the output. People should be able to easily talk about the results and correlate the output with the code, this makes that too difficult.
impeller/aiks/canvas.cc
Outdated
rrect_paint.color = | ||
rrect_paint.GetColorFilter()->GetCPUColorFilterProc()(paint.color); | ||
rrect_paint.color_filter = nullptr; | ||
rrect_paint.invert_colors = false; |
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.
nit: This seems tricky, having to clear out invert_colors. I could see someone missing this easily, it might be worth making a function AbsorbColorFilter
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 should be turned around. Rather than clone and eliminate properties, create a default paint and only copy in the attributes you want.
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 fixed this up to try and make the paint construction less confusing. Please TAL.
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!
impeller/aiks/aiks_unittests.cc
Outdated
BlendMode blend_mode = BlendMode::kSourceOver; | ||
}; | ||
|
||
static Picture MaskBlurVariantTest(const AiksTest& test_context, |
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.
Oh wait, can you put these in aiks_blur_unittests, please? I wish I had a better way to force the sorting of this.
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.
Done.
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. |
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!
…144817) flutter/engine@bbb1ed0...bc4abcd 2024-03-08 [email protected] [Impeller] Add mask blur style support to the RRect blur fast path. (flutter/engine#51250) 2024-03-08 [email protected] [Impeller] moved tests to aiks_blur_unittests, added warning (flutter/engine#51274) 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 [email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This improves performance by avoiding the 2-pass Gaussian blur in more shadow drawing situations.
The new golden also serves as a good reference for how mask blurs are supposed to work alongside various other paint properties such as color filters, color opacity, image filters, and blending.
The top 5 shapes are various RRect cases and are rendering correctly via the new blur style implementation in this patch.
The two bottom rows (the triangles and arcs) are non-rrect paths, so they're falling back to rendering using the 2-pass Gaussian blur. Rendering errors are circled in red below:
BlurStyle::kSolid
. After the first clipped overlay has been drawn, subsequent clipped overlays aren't drawing.BlendMode::kExclusion
.BlurStyle::kInner
andBlurStyle::kOuter
respectfully, but with a blur ImageFilter also set on the paint state. The ImageFilter needs to be applied to the rasterized mask blurred content.