LibWeb: Deduplicate opacity code in ApplyFilters

The opacity is still being set separately by using
ApplyOpacity for both CSS and SVG
This commit is contained in:
Saksham Mittal 2024-11-23 23:08:51 +05:30 committed by Alexander Kalenik
commit ecdb53cca6
Notes: github-actions[bot] 2024-11-23 19:22:01 +00:00
6 changed files with 5 additions and 16 deletions

View file

@ -1097,16 +1097,6 @@ void DisplayListPlayerSkia::apply_filters(ApplyFilters const& command)
append_filter(to_skia_image_filter(filter));
}
// We apply opacity as a color filter here so we only need to save and restore a single layer.
if (command.opacity < 1) {
append_filter(to_skia_image_filter(CSS::ResolvedFilter::FilterFunction {
CSS::ResolvedFilter::Color {
CSS::FilterOperation::Color::Type::Opacity,
command.opacity,
},
}));
}
SkPaint paint;
paint.setImageFilter(image_filter);
auto& canvas = surface().canvas();