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

Commit d77c4e5

Browse files
authored
adjust blur radius for HTML to match CanvasKit (#20840)
* adjust blur radius for HTML to match CanvasKit * switch to new goldens for new blur radius logic
1 parent b4e0896 commit d77c4e5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/web_ui/dev/goldens_lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
repository: https://github.com/flutter/goldens.git
2-
revision: 57327a39aba333794a092d4e72777bb37102f8ba
2+
revision: f1e5b87249f54998e23a34788e19ec864358e50b

lib/web_ui/lib/src/engine/html/scene_builder.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,9 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
563563
}
564564
}
565565

566-
// TODO(yjbanov): in HTML the blur looks too aggressive. The current
567-
// implementation was copied from the existing backdrop-filter
568-
// but probably needs a revision.
566+
// HTML only supports a single radius, but Flutter ImageFilter supports separate
567+
// horizontal and vertical radii. The best approximation we can provide is to
568+
// average the two radii together for a single compromise value.
569569
String _imageFilterToCss(EngineImageFilter filter) {
570-
return 'blur(${math.max(filter.sigmaX, filter.sigmaY) * 2}px)';
570+
return 'blur(${(filter.sigmaX + filter.sigmaY) / 2}px)';
571571
}

0 commit comments

Comments
 (0)