mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
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:
parent
ab1cf8f89b
commit
ecdb53cca6
Notes:
github-actions[bot]
2024-11-23 19:22:01 +00:00
Author: https://github.com/gotlougit Commit: https://github.com/LadybirdBrowser/ladybird/commit/ecdb53cca6f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2248 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/kalenikaliaksandr Reviewed-by: https://github.com/konradekk
6 changed files with 5 additions and 16 deletions
|
@ -409,7 +409,6 @@ struct ApplyOpacity {
|
|||
};
|
||||
|
||||
struct ApplyFilters {
|
||||
float opacity;
|
||||
CSS::ResolvedFilter filter;
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -407,9 +407,9 @@ void DisplayListRecorder::apply_opacity(float opacity)
|
|||
append(ApplyOpacity { .opacity = opacity });
|
||||
}
|
||||
|
||||
void DisplayListRecorder::apply_filters(float opacity, CSS::ResolvedFilter filter)
|
||||
void DisplayListRecorder::apply_filters(CSS::ResolvedFilter filter)
|
||||
{
|
||||
append(ApplyFilters { .opacity = opacity, .filter = filter });
|
||||
append(ApplyFilters { .filter = filter });
|
||||
}
|
||||
|
||||
void DisplayListRecorder::apply_transform(Gfx::FloatPoint origin, Gfx::FloatMatrix4x4 matrix)
|
||||
|
|
|
@ -149,7 +149,7 @@ public:
|
|||
void paint_scrollbar(int scroll_frame_id, Gfx::IntRect, CSSPixelFraction scroll_size, bool vertical);
|
||||
|
||||
void apply_opacity(float opacity);
|
||||
void apply_filters(float opacity, CSS::ResolvedFilter filter);
|
||||
void apply_filters(CSS::ResolvedFilter filter);
|
||||
void apply_transform(Gfx::FloatPoint origin, Gfx::FloatMatrix4x4);
|
||||
void apply_mask_bitmap(Gfx::IntPoint origin, Gfx::ImmutableBitmap const&, Gfx::Bitmap::MaskKind);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void SVGSVGPaintable::paint_descendants(PaintContext& context, PaintableBox cons
|
|||
context.display_list_recorder().apply_opacity(computed_values.opacity());
|
||||
}
|
||||
|
||||
context.display_list_recorder().apply_filters(paintable.computed_values().opacity(), paintable.computed_values().filter());
|
||||
context.display_list_recorder().apply_filters(paintable.computed_values().filter());
|
||||
|
||||
if (svg_box.has_css_transform()) {
|
||||
auto transform_matrix = svg_box.transform();
|
||||
|
|
|
@ -327,7 +327,7 @@ void StackingContext::paint(PaintContext& context) const
|
|||
context.display_list_recorder().push_scroll_frame_id(*paintable_box().scroll_frame_id());
|
||||
}
|
||||
context.display_list_recorder().push_stacking_context(push_stacking_context_params);
|
||||
context.display_list_recorder().apply_filters(opacity, paintable_box().computed_values().filter());
|
||||
context.display_list_recorder().apply_filters(paintable_box().computed_values().filter());
|
||||
|
||||
if (auto mask_image = computed_values.mask_image()) {
|
||||
auto mask_display_list = DisplayList::create();
|
||||
|
|
Loading…
Add table
Reference in a new issue