@@ -934,6 +934,7 @@ class ContextStateHandle {
934934 }
935935
936936 ui.MaskFilter ? _currentFilter;
937+ String ? _currentFilterCss;
937938 SurfacePaintData ? _lastUsedPaint;
938939
939940 /// Currently active shader bounds.
@@ -1003,19 +1004,20 @@ class ContextStateHandle {
10031004 }
10041005
10051006 final ui.MaskFilter ? maskFilter = paint.maskFilter;
1006- if (! _renderMaskFilterForWebkit) {
1007- if (_currentFilter != maskFilter) {
1008- _currentFilter = maskFilter;
1009- context.filter = maskFilterToCanvasFilter (maskFilter);
1010- }
1011- } else {
1012- // WebKit does not support the `filter` property. Instead we apply a
1013- // shadow to the shape of the same color as the paint and the same blur
1014- // as the mask filter.
1015- //
1016- // Note that on WebKit the cached value of _currentFilter is not useful.
1017- // Instead we destructure it into the shadow properties and cache those.
1018- if (maskFilter != null ) {
1007+ if (maskFilter != null ) {
1008+ if (! _renderMaskFilterForWebkit) {
1009+ if (_currentFilter != maskFilter) {
1010+ _currentFilter = maskFilter;
1011+ _currentFilterCss = maskFilterToCanvasFilter (maskFilter);
1012+ }
1013+ context.filter = _currentFilterCss;
1014+ } else {
1015+ // WebKit does not support the `filter` property. Instead we apply a
1016+ // shadow to the shape of the same color as the paint and the same blur
1017+ // as the mask filter.
1018+ //
1019+ // Note that on WebKit the cached value of _currentFilter is not useful.
1020+ // Instead we destructure it into the shadow properties and cache those.
10191021 context.save ();
10201022 context.shadowBlur = convertSigmaToRadius (maskFilter.webOnlySigma);
10211023 // Shadow color must be fully opaque.
0 commit comments