LibWeb: Remove filter from PushStackingContext

This commit is contained in:
Saksham Mittal 2024-11-21 19:59:52 +05:30
parent 260017133f
commit 34c64c64db
No known key found for this signature in database
5 changed files with 1 additions and 31 deletions

View file

@ -119,7 +119,6 @@ struct StackingContextTransform {
struct PushStackingContext { struct PushStackingContext {
float opacity; float opacity;
CSS::ResolvedFilter filter;
// The bounding box of the source paintable (pre-transform). // The bounding box of the source paintable (pre-transform).
Gfx::IntRect source_paintable_rect; Gfx::IntRect source_paintable_rect;
// A translation to be applied after the stacking context has been transformed. // A translation to be applied after the stacking context has been transformed.

View file

@ -396,33 +396,7 @@ void DisplayListPlayerSkia::push_stacking_context(PushStackingContext const& com
.translate(-command.transform.origin); .translate(-command.transform.origin);
auto matrix = to_skia_matrix(new_transform); auto matrix = to_skia_matrix(new_transform);
if (!command.filter.is_none()) {
sk_sp<SkImageFilter> image_filter;
auto append_filter = [&image_filter](auto new_filter) {
if (image_filter)
image_filter = SkImageFilters::Compose(new_filter, image_filter);
else
image_filter = new_filter;
};
// Apply filters in order
for (auto const& filter_function : command.filter.filters)
append_filter(to_skia_image_filter(filter_function));
// We apply opacity as a color filter here so we only need to save and restore a single layer.
if (command.opacity < 1) { 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);
canvas.saveLayer(nullptr, &paint);
} else if (command.opacity < 1) {
auto source_paintable_rect = to_skia_rect(command.source_paintable_rect); auto source_paintable_rect = to_skia_rect(command.source_paintable_rect);
SkRect dest; SkRect dest;
matrix.mapRect(&dest, source_paintable_rect); matrix.mapRect(&dest, source_paintable_rect);

View file

@ -285,7 +285,6 @@ void DisplayListRecorder::push_stacking_context(PushStackingContextParams params
{ {
append(PushStackingContext { append(PushStackingContext {
.opacity = params.opacity, .opacity = params.opacity,
.filter = params.filter,
.source_paintable_rect = params.source_paintable_rect, .source_paintable_rect = params.source_paintable_rect,
.transform = { .transform = {
.origin = params.transform.origin, .origin = params.transform.origin,

View file

@ -111,7 +111,6 @@ public:
struct PushStackingContextParams { struct PushStackingContextParams {
float opacity; float opacity;
CSS::ResolvedFilter filter;
bool is_fixed_position; bool is_fixed_position;
Gfx::IntRect source_paintable_rect; Gfx::IntRect source_paintable_rect;
StackingContextTransform transform; StackingContextTransform transform;

View file

@ -301,7 +301,6 @@ void StackingContext::paint(PaintContext& context) const
DisplayListRecorder::PushStackingContextParams push_stacking_context_params { DisplayListRecorder::PushStackingContextParams push_stacking_context_params {
.opacity = opacity, .opacity = opacity,
.filter = paintable_box().computed_values().filter(),
.is_fixed_position = paintable_box().is_fixed_position(), .is_fixed_position = paintable_box().is_fixed_position(),
.source_paintable_rect = source_paintable_rect, .source_paintable_rect = source_paintable_rect,
.transform = { .transform = {