LibWeb: Inline apply_backdrop_filter function into paint_backdrop_filter

No need to have a separate file for this small function.
This commit is contained in:
Aliaksandr Kalenik 2024-07-29 16:51:15 +03:00 committed by Alexander Kalenik
parent 8164be7ac8
commit 0bfcf73524
Notes: github-actions[bot] 2024-07-29 15:49:47 +00:00
5 changed files with 9 additions and 44 deletions

View file

@ -17,7 +17,6 @@ source_set("Painting") {
"Command.cpp",
"DisplayList.cpp",
"DisplayListRecorder.cpp",
"FilterPainting.cpp",
"GradientPainting.cpp",
"ImagePaintable.cpp",
"InlinePaintable.cpp",

View file

@ -558,7 +558,6 @@ set(SOURCES
Painting/DisplayListPlayerSkia.cpp
Painting/DisplayListRecorder.cpp
Painting/GradientPainting.cpp
Painting/FilterPainting.cpp
Painting/ImagePaintable.cpp
Painting/InlinePaintable.cpp
Painting/LabelablePaintable.cpp

View file

@ -1,21 +0,0 @@
/*
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
#include <LibWeb/Painting/FilterPainting.h>
namespace Web::Painting {
void apply_backdrop_filter(PaintContext& context, CSSPixelRect const& backdrop_rect, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter)
{
auto backdrop_region = context.rounded_device_rect(backdrop_rect);
ScopedCornerRadiusClip corner_clipper { context, backdrop_region, border_radii_data };
context.display_list_recorder().apply_backdrop_filter(backdrop_region.to_type<int>(), border_radii_data, backdrop_filter);
}
}

View file

@ -1,17 +0,0 @@
/*
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Forward.h>
#include <LibWeb/CSS/BackdropFilter.h>
#include <LibWeb/Forward.h>
namespace Web::Painting {
void apply_backdrop_filter(PaintContext&, CSSPixelRect const&, BorderRadiiData const&, CSS::ResolvedBackdropFilter const&);
}

View file

@ -16,7 +16,6 @@
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/BackgroundPainting.h>
#include <LibWeb/Painting/FilterPainting.h>
#include <LibWeb/Painting/PaintableBox.h>
#include <LibWeb/Painting/SVGPaintable.h>
#include <LibWeb/Painting/SVGSVGPaintable.h>
@ -438,9 +437,15 @@ void PaintableBox::paint_border(PaintContext& context) const
void PaintableBox::paint_backdrop_filter(PaintContext& context) const
{
auto& backdrop_filter = computed_values().backdrop_filter();
if (!backdrop_filter.is_none())
apply_backdrop_filter(context, absolute_border_box_rect(), normalized_border_radii_data(), backdrop_filter);
auto const& backdrop_filter = computed_values().backdrop_filter();
if (backdrop_filter.is_none()) {
return;
}
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 };
context.display_list_recorder().apply_backdrop_filter(backdrop_region.to_type<int>(), border_radii_data, backdrop_filter);
}
void PaintableBox::paint_background(PaintContext& context) const