mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Scale blur filter's radius by device pixel scale
The blur filter's effect was reduced on higher DPI displays.
This commit is contained in:
parent
e064fa19d2
commit
7544066c0c
Notes:
github-actions[bot]
2025-11-12 15:00:29 +00:00
Author: https://github.com/gmta
Commit: 7544066c0c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6792
Reviewed-by: https://github.com/kalenikaliaksandr ✅
4 changed files with 6 additions and 6 deletions
|
|
@ -588,7 +588,7 @@ void PaintableBox::paint_backdrop_filter(DisplayListRecordingContext& context) c
|
|||
auto backdrop_region = context.rounded_device_rect(absolute_border_box_rect());
|
||||
auto border_radii_data = normalized_border_radii_data();
|
||||
ScopedCornerRadiusClip corner_clipper { context, backdrop_region, border_radii_data };
|
||||
if (auto resolved_backdrop_filter = resolve_filter(backdrop_filter); resolved_backdrop_filter.has_value())
|
||||
if (auto resolved_backdrop_filter = resolve_filter(context, backdrop_filter); resolved_backdrop_filter.has_value())
|
||||
context.display_list_recorder().apply_backdrop_filter(backdrop_region.to_type<int>(), border_radii_data, *resolved_backdrop_filter);
|
||||
}
|
||||
|
||||
|
|
@ -1699,13 +1699,13 @@ PaintableBox const* PaintableBox::nearest_scrollable_ancestor() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Optional<Gfx::Filter> PaintableBox::resolve_filter(CSS::Filter const& computed_filter) const
|
||||
Optional<Gfx::Filter> PaintableBox::resolve_filter(DisplayListRecordingContext& context, CSS::Filter const& computed_filter) const
|
||||
{
|
||||
Optional<Gfx::Filter> resolved_filter;
|
||||
for (auto const& filter : computed_filter.filters()) {
|
||||
filter.visit(
|
||||
[&](CSS::FilterOperation::Blur const& blur) {
|
||||
auto resolved_radius = blur.resolved_radius(layout_node_with_style_and_box_metrics());
|
||||
auto resolved_radius = blur.resolved_radius(layout_node_with_style_and_box_metrics()) * context.device_pixels_per_css_pixel();
|
||||
auto new_filter = Gfx::Filter::blur(resolved_radius, resolved_radius);
|
||||
|
||||
resolved_filter = resolved_filter.has_value()
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ public:
|
|||
[[nodiscard]] RefPtr<ClipFrame const> enclosing_clip_frame() const { return m_enclosing_clip_frame; }
|
||||
[[nodiscard]] RefPtr<ClipFrame const> own_clip_frame() const { return m_own_clip_frame; }
|
||||
|
||||
Optional<Gfx::Filter> resolve_filter(CSS::Filter const& computed_filter) const;
|
||||
Optional<Gfx::Filter> resolve_filter(DisplayListRecordingContext&, CSS::Filter const& computed_filter) const;
|
||||
|
||||
protected:
|
||||
explicit PaintableBox(Layout::Box const&);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void SVGSVGPaintable::paint_svg_box(DisplayListRecordingContext& context, Painta
|
|||
|
||||
auto filter_applied = false;
|
||||
if (filter.has_filters()) {
|
||||
if (auto resolved_filter = svg_box.resolve_filter(filter); resolved_filter.has_value()) {
|
||||
if (auto resolved_filter = svg_box.resolve_filter(context, filter); resolved_filter.has_value()) {
|
||||
context.display_list_recorder().apply_filter(*resolved_filter);
|
||||
filter_applied = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ void StackingContext::paint(DisplayListRecordingContext& context) const
|
|||
auto mask_image = computed_values.mask_image();
|
||||
Optional<Gfx::Filter> resolved_filter;
|
||||
if (computed_values.filter().has_filters())
|
||||
resolved_filter = paintable_box().resolve_filter(computed_values.filter());
|
||||
resolved_filter = paintable_box().resolve_filter(context, computed_values.filter());
|
||||
|
||||
bool needs_to_save_state = mask_image || paintable_box().get_masking_area().has_value();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue