LibWeb: Rename RecordingPainter to DisplayListRecorder

Use more widely recognized name among browser engine developers.
This commit is contained in:
Aliaksandr Kalenik 2024-06-23 18:40:10 +02:00 committed by Alexander Kalenik
parent 5570e6b648
commit 854b269338
Notes: sideshowbarker 2024-07-17 14:33:07 +09:00
43 changed files with 204 additions and 204 deletions

View File

@ -17,6 +17,7 @@ source_set("Painting") {
"Command.cpp",
"CommandExecutorCPU.cpp",
"DisplayList.cpp",
"DisplayListRecorder.cpp",
"FilterPainting.cpp",
"GradientPainting.cpp",
"ImagePaintable.cpp",
@ -30,7 +31,6 @@ source_set("Painting") {
"PaintableBox.cpp",
"PaintableFragment.cpp",
"RadioButtonPaintable.cpp",
"RecordingPainter.cpp",
"SVGClipPaintable.cpp",
"SVGForeignObjectPaintable.cpp",
"SVGGraphicsPaintable.cpp",

View File

@ -544,6 +544,7 @@ set(SOURCES
Painting/CheckBoxPaintable.cpp
Painting/ClippableAndScrollable.cpp
Painting/DisplayList.cpp
Painting/DisplayListRecorder.cpp
Painting/GradientPainting.cpp
Painting/FilterPainting.cpp
Painting/ImagePaintable.cpp
@ -558,7 +559,6 @@ set(SOURCES
Painting/PaintableBox.cpp
Painting/PaintableFragment.cpp
Painting/RadioButtonPaintable.cpp
Painting/RecordingPainter.cpp
Painting/SVGForeignObjectPaintable.cpp
Painting/SVGPathPaintable.cpp
Painting/SVGGraphicsPaintable.cpp

View File

@ -47,7 +47,7 @@ void ConicGradientStyleValue::paint(PaintContext& context, DevicePixelRect const
VERIFY(m_resolved.has_value());
auto destination_rect = dest_rect.to_type<int>();
auto position = context.rounded_device_point(m_resolved->position).to_type<int>();
context.recording_painter().fill_rect_with_conic_gradient(destination_rect, m_resolved->data, position, clip_paths);
context.display_list_recorder().fill_rect_with_conic_gradient(destination_rect, m_resolved->data, position, clip_paths);
}
bool ConicGradientStyleValue::equals(StyleValue const& other) const

View File

@ -14,8 +14,8 @@
#include <LibWeb/HTML/DecodedImageData.h>
#include <LibWeb/HTML/ImageRequest.h>
#include <LibWeb/HTML/PotentialCORSRequest.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
#include <LibWeb/Painting/PaintContext.h>
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Platform/Timer.h>
namespace Web::CSS {
@ -137,7 +137,7 @@ void ImageStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_r
{
if (auto const* b = bitmap(m_current_frame_index, dest_rect.size().to_type<int>()); b != nullptr) {
auto scaling_mode = to_gfx_scaling_mode(image_rendering, b->rect(), dest_rect.to_type<int>());
context.recording_painter().draw_scaled_immutable_bitmap(dest_rect.to_type<int>(), *b, b->rect(), scaling_mode, clip_paths);
context.display_list_recorder().draw_scaled_immutable_bitmap(dest_rect.to_type<int>(), *b, b->rect(), scaling_mode, clip_paths);
}
}

View File

@ -112,7 +112,7 @@ void LinearGradientStyleValue::resolve_for_size(Layout::NodeWithStyleAndBoxModel
void LinearGradientStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering, Vector<Gfx::Path> const& clip_paths) const
{
VERIFY(m_resolved.has_value());
context.recording_painter().fill_rect_with_linear_gradient(dest_rect.to_type<int>(), m_resolved->data, clip_paths);
context.display_list_recorder().fill_rect_with_linear_gradient(dest_rect.to_type<int>(), m_resolved->data, clip_paths);
}
}

View File

@ -212,7 +212,7 @@ void RadialGradientStyleValue::paint(PaintContext& context, DevicePixelRect cons
VERIFY(m_resolved.has_value());
auto center = context.rounded_device_point(m_resolved->center).to_type<int>();
auto size = context.rounded_device_size(m_resolved->gradient_size).to_type<int>();
context.recording_painter().fill_rect_with_radial_gradient(dest_rect.to_type<int>(), m_resolved->data, center, size, clip_paths);
context.display_list_recorder().fill_rect_with_radial_gradient(dest_rect.to_type<int>(), m_resolved->data, center, size, clip_paths);
}
}

View File

@ -24,7 +24,7 @@ class XMLDocumentBuilder;
}
namespace Web::Painting {
class RecordingPainter;
class DisplayListRecorder;
class SVGGradientPaintStyle;
using PaintStyle = RefPtr<SVGGradientPaintStyle>;
}

View File

@ -2092,7 +2092,7 @@ void Navigable::inform_the_navigation_api_about_aborting_navigation()
}));
}
void Navigable::record_display_list(Painting::RecordingPainter& recording_painter, PaintConfig config)
void Navigable::record_display_list(Painting::DisplayListRecorder& display_list_recorder, PaintConfig config)
{
auto document = active_document();
if (!document)
@ -2104,12 +2104,12 @@ void Navigable::record_display_list(Painting::RecordingPainter& recording_painte
auto background_color = document->background_color();
recording_painter.fill_rect(bitmap_rect, background_color);
display_list_recorder.fill_rect(bitmap_rect, background_color);
if (!document->paintable()) {
VERIFY_NOT_REACHED();
}
Web::PaintContext context(recording_painter, page.palette(), page.client().device_pixels_per_css_pixel());
Web::PaintContext context(display_list_recorder, page.palette(), page.client().device_pixels_per_css_pixel());
context.set_device_viewport_rect(viewport_rect);
context.set_should_show_line_box_borders(config.should_show_line_box_borders);
context.set_should_paint_overlay(config.paint_overlay);
@ -2136,8 +2136,8 @@ void Navigable::record_display_list(Painting::RecordingPainter& recording_painte
auto scroll_offset = context.rounded_device_point(scrollable_frame->offset).to_type<int>();
scroll_offsets_by_frame_id[scrollable_frame->id] = scroll_offset;
}
recording_painter.display_list().apply_scroll_offsets(scroll_offsets_by_frame_id);
recording_painter.display_list().mark_unnecessary_commands();
display_list_recorder.display_list().apply_scroll_offsets(scroll_offsets_by_frame_id);
display_list_recorder.display_list().mark_unnecessary_commands();
}
m_needs_repaint = false;

View File

@ -183,7 +183,7 @@ public:
bool should_show_line_box_borders { false };
bool has_focus { false };
};
void record_display_list(Painting::RecordingPainter& recording_painter, PaintConfig);
void record_display_list(Painting::DisplayListRecorder& display_list_recorder, PaintConfig);
Page& page() { return m_page; }
Page const& page() const { return m_page; }

View File

@ -1177,16 +1177,16 @@ JS::GCPtr<DOM::Node> TraversableNavigable::currently_focused_area()
void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& target, Web::PaintOptions paint_options)
{
Painting::DisplayList display_list;
Painting::RecordingPainter recording_painter(display_list);
Painting::DisplayListRecorder display_list_recorder(display_list);
Gfx::IntRect bitmap_rect { {}, content_rect.size().to_type<int>() };
recording_painter.fill_rect(bitmap_rect, Web::CSS::SystemColor::canvas());
display_list_recorder.fill_rect(bitmap_rect, Web::CSS::SystemColor::canvas());
Web::HTML::Navigable::PaintConfig paint_config;
paint_config.paint_overlay = paint_options.paint_overlay == Web::PaintOptions::PaintOverlay::Yes;
paint_config.should_show_line_box_borders = paint_options.should_show_line_box_borders;
paint_config.has_focus = paint_options.has_focus;
record_display_list(recording_painter, paint_config);
record_display_list(display_list_recorder, paint_config);
auto painting_command_executor_type = page().client().painting_command_executor_type();
if (painting_command_executor_type == PaintingCommandExecutorType::GPU) {

View File

@ -49,10 +49,10 @@ void AudioPaintable::paint(PaintContext& context, PaintPhase phase) const
if (phase != PaintPhase::Foreground)
return;
RecordingPainterStateSaver saver { context.recording_painter() };
DisplayListRecorderStateSaver saver { context.display_list_recorder() };
auto audio_rect = context.rounded_device_rect(absolute_rect());
context.recording_painter().add_clip_rect(audio_rect.to_type<int>());
context.display_list_recorder().add_clip_rect(audio_rect.to_type<int>());
ScopedCornerRadiusClip corner_clip { context, audio_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };

View File

@ -126,7 +126,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
clip_paths = compute_text_clip_paths(context, *layout_node.paintable());
}
auto& painter = context.recording_painter();
auto& display_list_recorder = context.display_list_recorder();
struct BackgroundBox {
CSSPixelRect rect;
@ -181,7 +181,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
}
}
painter.fill_rect_with_rounded_corners(
display_list_recorder.fill_rect_with_rounded_corners(
context.rounded_device_rect(color_box.rect).to_type<int>(),
background_color,
color_box.radii.top_left.as_corner(context),
@ -217,14 +217,14 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
for (auto& layer : background_layers->in_reverse()) {
if (!layer_is_paintable(layer))
continue;
RecordingPainterStateSaver state { painter };
DisplayListRecorderStateSaver state { display_list_recorder };
// Clip
auto clip_box = get_box(layer.clip);
CSSPixelRect const& css_clip_rect = clip_box.rect;
auto clip_rect = context.rounded_device_rect(css_clip_rect);
painter.add_clip_rect(clip_rect.to_type<int>());
display_list_recorder.add_clip_rect(clip_rect.to_type<int>());
ScopedCornerRadiusClip corner_clip { context, clip_rect, clip_box.radii };
if (layer.clip == CSS::BackgroundBox::BorderBox) {
@ -452,7 +452,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
fill_rect = fill_rect->united(image_device_rect);
}
});
painter.fill_rect(fill_rect->to_type<int>(), color.value(), clip_paths);
display_list_recorder.fill_rect(fill_rect->to_type<int>(), color.value(), clip_paths);
} else {
for_each_image_device_rect([&](auto const& image_device_rect) {
image.paint(context, image_device_rect, image_rendering, clip_paths);

View File

@ -61,7 +61,7 @@ Gfx::Color border_color(BorderEdge edge, BordersDataDevicePixels const& borders_
return border_data.color;
}
void paint_border(RecordingPainter& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::Path& path, bool last)
void paint_border(DisplayListRecorder& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::Path& path, bool last)
{
auto const& border_data = [&] {
switch (edge) {
@ -491,7 +491,7 @@ void paint_border(RecordingPainter& painter, BorderEdge edge, DevicePixelRect co
}
}
void paint_all_borders(RecordingPainter& painter, DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data)
void paint_all_borders(DisplayListRecorder& painter, DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data)
{
if (borders_data.top.width <= 0 && borders_data.right.width <= 0 && borders_data.left.width <= 0 && borders_data.bottom.width <= 0)
return;

View File

@ -26,8 +26,8 @@ enum class BorderEdge {
// Returns OptionalNone if there is no outline to paint.
Optional<BordersData> borders_data_for_outline(Layout::Node const&, Color outline_color, CSS::OutlineStyle outline_style, CSSPixels outline_width);
void paint_border(RecordingPainter& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::Path& path, bool last);
void paint_all_borders(RecordingPainter& painter, DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const&);
void paint_border(DisplayListRecorder& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::Path& path, bool last);
void paint_all_borders(DisplayListRecorder& painter, DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const&);
Gfx::Color border_color(BorderEdge edge, BordersDataDevicePixels const& borders_data);

View File

@ -128,14 +128,14 @@ ScopedCornerRadiusClip::ScopedCornerRadiusClip(PaintContext& context, DevicePixe
m_has_radius = corner_radii.has_any_radius();
if (!m_has_radius)
return;
m_context.recording_painter().sample_under_corners(m_id, corner_radii, border_rect.to_type<int>(), corner_clip);
m_context.display_list_recorder().sample_under_corners(m_id, corner_radii, border_rect.to_type<int>(), corner_clip);
}
ScopedCornerRadiusClip::~ScopedCornerRadiusClip()
{
if (!m_has_radius)
return;
m_context.recording_painter().blit_corner_clipping(m_id);
m_context.display_list_recorder().blit_corner_clipping(m_id);
}
}

View File

@ -40,7 +40,7 @@ void CanvasPaintable::paint(PaintContext& context, PaintPhase phase) const
// FIXME: Remove this const_cast.
const_cast<HTML::HTMLCanvasElement&>(layout_box().dom_node()).present();
auto scaling_mode = to_gfx_scaling_mode(computed_values().image_rendering(), layout_box().dom_node().bitmap()->rect(), canvas_rect.to_type<int>());
context.recording_painter().draw_scaled_bitmap(canvas_rect.to_type<int>(), *layout_box().dom_node().bitmap(), layout_box().dom_node().bitmap()->rect(), scaling_mode);
context.display_list_recorder().draw_scaled_bitmap(canvas_rect.to_type<int>(), *layout_box().dom_node().bitmap(), layout_box().dom_node().bitmap()->rect(), scaling_mode);
}
}
}

View File

@ -99,11 +99,11 @@ void CheckBoxPaintable::paint(PaintContext& context, PaintPhase phase) const
// Little heuristic that smaller things look better with more smoothness.
if (checkbox.checked() && !checkbox.indeterminate()) {
auto background_color = enabled ? input_colors.accent : input_colors.mid_gray;
context.recording_painter().fill_rect_with_rounded_corners(checkbox_rect, modify_color(background_color), checkbox_radius);
context.display_list_recorder().fill_rect_with_rounded_corners(checkbox_rect, modify_color(background_color), checkbox_radius);
auto tick_color = increase_contrast(input_colors.base, background_color);
if (!enabled)
tick_color = shade(tick_color, 0.5f);
context.recording_painter().fill_path({
context.display_list_recorder().fill_path({
.path = check_mark_path(checkbox_rect),
.color = tick_color,
.translation = checkbox_rect.location().to_type<float>(),
@ -111,14 +111,14 @@ void CheckBoxPaintable::paint(PaintContext& context, PaintPhase phase) const
} else {
auto background_color = input_colors.background_color(enabled);
auto border_thickness = max(1, checkbox_rect.width() / 10);
context.recording_painter().fill_rect_with_rounded_corners(checkbox_rect, modify_color(input_colors.border_color(enabled)), checkbox_radius);
context.recording_painter().fill_rect_with_rounded_corners(checkbox_rect.shrunken(border_thickness, border_thickness, border_thickness, border_thickness),
context.display_list_recorder().fill_rect_with_rounded_corners(checkbox_rect, modify_color(input_colors.border_color(enabled)), checkbox_radius);
context.display_list_recorder().fill_rect_with_rounded_corners(checkbox_rect.shrunken(border_thickness, border_thickness, border_thickness, border_thickness),
background_color, max(0, checkbox_radius - border_thickness));
if (checkbox.indeterminate()) {
int radius = 0.05 * checkbox_rect.width();
auto dash_color = increase_contrast(input_colors.dark_gray, background_color);
auto dash_rect = checkbox_rect.inflated(-0.4 * checkbox_rect.width(), -0.8 * checkbox_rect.height());
context.recording_painter().fill_rect_with_rounded_corners(dash_rect, dash_color, radius, radius, radius, radius);
context.display_list_recorder().fill_rect_with_rounded_corners(dash_rect, dash_color, radius, radius, radius, radius);
}
}
}

View File

@ -9,8 +9,8 @@
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
#include <LibWeb/Painting/CommandExecutorCPU.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
#include <LibWeb/Painting/FilterPainting.h>
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Painting/ShadowPainting.h>
namespace Web::Painting {

View File

@ -8,7 +8,7 @@
#include <AK/MaybeOwned.h>
#include <LibGfx/ScalingMode.h>
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
namespace Web::Painting {

View File

@ -8,7 +8,7 @@
#include <AK/MaybeOwned.h>
#include <LibAccelGfx/Painter.h>
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
namespace Web::Painting {

View File

@ -7,7 +7,7 @@
#pragma once
#include <LibGfx/Bitmap.h>
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
namespace Web::Painting {

View File

@ -4,28 +4,28 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
#include <LibWeb/Painting/ShadowPainting.h>
namespace Web::Painting {
RecordingPainter::RecordingPainter(DisplayList& command_list)
DisplayListRecorder::DisplayListRecorder(DisplayList& command_list)
: m_command_list(command_list)
{
m_state_stack.append(State());
}
RecordingPainter::~RecordingPainter()
DisplayListRecorder::~DisplayListRecorder()
{
VERIFY(m_corner_clip_state_stack.is_empty());
}
void RecordingPainter::append(Command&& command)
void DisplayListRecorder::append(Command&& command)
{
m_command_list.append(move(command), state().scroll_frame_id);
}
void RecordingPainter::sample_under_corners(u32 id, CornerRadii corner_radii, Gfx::IntRect border_rect, CornerClip corner_clip)
void DisplayListRecorder::sample_under_corners(u32 id, CornerRadii corner_radii, Gfx::IntRect border_rect, CornerClip corner_clip)
{
m_corner_clip_state_stack.append({ id, border_rect });
if (m_corner_clip_state_stack.size() > display_list().corner_clip_max_depth())
@ -37,14 +37,14 @@ void RecordingPainter::sample_under_corners(u32 id, CornerRadii corner_radii, Gf
corner_clip });
}
void RecordingPainter::blit_corner_clipping(u32 id)
void DisplayListRecorder::blit_corner_clipping(u32 id)
{
auto clip_state = m_corner_clip_state_stack.take_last();
VERIFY(clip_state.id == id);
append(BlitCornerClipping { id, state().translation.map(clip_state.rect) });
}
void RecordingPainter::fill_rect(Gfx::IntRect const& rect, Color color, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::fill_rect(Gfx::IntRect const& rect, Color color, Vector<Gfx::Path> const& clip_paths)
{
if (rect.is_empty())
return;
@ -55,7 +55,7 @@ void RecordingPainter::fill_rect(Gfx::IntRect const& rect, Color color, Vector<G
});
}
void RecordingPainter::fill_path(FillPathUsingColorParams params)
void DisplayListRecorder::fill_path(FillPathUsingColorParams params)
{
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type<int>();
@ -70,7 +70,7 @@ void RecordingPainter::fill_path(FillPathUsingColorParams params)
});
}
void RecordingPainter::fill_path(FillPathUsingPaintStyleParams params)
void DisplayListRecorder::fill_path(FillPathUsingPaintStyleParams params)
{
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type<int>();
@ -86,7 +86,7 @@ void RecordingPainter::fill_path(FillPathUsingPaintStyleParams params)
});
}
void RecordingPainter::stroke_path(StrokePathUsingColorParams params)
void DisplayListRecorder::stroke_path(StrokePathUsingColorParams params)
{
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type<int>();
@ -103,7 +103,7 @@ void RecordingPainter::stroke_path(StrokePathUsingColorParams params)
});
}
void RecordingPainter::stroke_path(StrokePathUsingPaintStyleParams params)
void DisplayListRecorder::stroke_path(StrokePathUsingPaintStyleParams params)
{
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type<int>();
@ -121,7 +121,7 @@ void RecordingPainter::stroke_path(StrokePathUsingPaintStyleParams params)
});
}
void RecordingPainter::draw_ellipse(Gfx::IntRect const& a_rect, Color color, int thickness)
void DisplayListRecorder::draw_ellipse(Gfx::IntRect const& a_rect, Color color, int thickness)
{
if (a_rect.is_empty())
return;
@ -132,7 +132,7 @@ void RecordingPainter::draw_ellipse(Gfx::IntRect const& a_rect, Color color, int
});
}
void RecordingPainter::fill_ellipse(Gfx::IntRect const& a_rect, Color color)
void DisplayListRecorder::fill_ellipse(Gfx::IntRect const& a_rect, Color color)
{
if (a_rect.is_empty())
return;
@ -142,7 +142,7 @@ void RecordingPainter::fill_ellipse(Gfx::IntRect const& a_rect, Color color)
});
}
void RecordingPainter::fill_rect_with_linear_gradient(Gfx::IntRect const& gradient_rect, LinearGradientData const& data, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::fill_rect_with_linear_gradient(Gfx::IntRect const& gradient_rect, LinearGradientData const& data, Vector<Gfx::Path> const& clip_paths)
{
if (gradient_rect.is_empty())
return;
@ -152,7 +152,7 @@ void RecordingPainter::fill_rect_with_linear_gradient(Gfx::IntRect const& gradie
.clip_paths = clip_paths });
}
void RecordingPainter::fill_rect_with_conic_gradient(Gfx::IntRect const& rect, ConicGradientData const& data, Gfx::IntPoint const& position, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::fill_rect_with_conic_gradient(Gfx::IntRect const& rect, ConicGradientData const& data, Gfx::IntPoint const& position, Vector<Gfx::Path> const& clip_paths)
{
if (rect.is_empty())
return;
@ -163,7 +163,7 @@ void RecordingPainter::fill_rect_with_conic_gradient(Gfx::IntRect const& rect, C
.clip_paths = clip_paths });
}
void RecordingPainter::fill_rect_with_radial_gradient(Gfx::IntRect const& rect, RadialGradientData const& data, Gfx::IntPoint center, Gfx::IntSize size, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::fill_rect_with_radial_gradient(Gfx::IntRect const& rect, RadialGradientData const& data, Gfx::IntPoint center, Gfx::IntSize size, Vector<Gfx::Path> const& clip_paths)
{
if (rect.is_empty())
return;
@ -175,7 +175,7 @@ void RecordingPainter::fill_rect_with_radial_gradient(Gfx::IntRect const& rect,
.clip_paths = clip_paths });
}
void RecordingPainter::draw_rect(Gfx::IntRect const& rect, Color color, bool rough)
void DisplayListRecorder::draw_rect(Gfx::IntRect const& rect, Color color, bool rough)
{
if (rect.is_empty())
return;
@ -185,7 +185,7 @@ void RecordingPainter::draw_rect(Gfx::IntRect const& rect, Color color, bool rou
.rough = rough });
}
void RecordingPainter::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode)
void DisplayListRecorder::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode)
{
if (dst_rect.is_empty())
return;
@ -197,7 +197,7 @@ void RecordingPainter::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bit
});
}
void RecordingPainter::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode scaling_mode, Vector<Gfx::Path> const& clip_paths)
{
if (dst_rect.is_empty())
return;
@ -210,7 +210,7 @@ void RecordingPainter::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect
});
}
void RecordingPainter::draw_line(Gfx::IntPoint from, Gfx::IntPoint to, Color color, int thickness, Gfx::LineStyle style, Color alternate_color)
void DisplayListRecorder::draw_line(Gfx::IntPoint from, Gfx::IntPoint to, Color color, int thickness, Gfx::LineStyle style, Color alternate_color)
{
append(DrawLine {
.color = color,
@ -222,7 +222,7 @@ void RecordingPainter::draw_line(Gfx::IntPoint from, Gfx::IntPoint to, Color col
});
}
void RecordingPainter::draw_text(Gfx::IntRect const& rect, String raw_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Color color)
void DisplayListRecorder::draw_text(Gfx::IntRect const& rect, String raw_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Color color)
{
if (rect.is_empty())
return;
@ -254,7 +254,7 @@ void RecordingPainter::draw_text(Gfx::IntRect const& rect, String raw_text, Gfx:
draw_text_run(Gfx::IntPoint(roundf(baseline_x), roundf(baseline_y)), *glyph_run, color, rect, 1.0);
}
void RecordingPainter::draw_text_run(Gfx::IntPoint baseline_start, Gfx::GlyphRun const& glyph_run, Color color, Gfx::IntRect const& rect, double scale)
void DisplayListRecorder::draw_text_run(Gfx::IntPoint baseline_start, Gfx::GlyphRun const& glyph_run, Color color, Gfx::IntRect const& rect, double scale)
{
if (rect.is_empty())
return;
@ -268,28 +268,28 @@ void RecordingPainter::draw_text_run(Gfx::IntPoint baseline_start, Gfx::GlyphRun
});
}
void RecordingPainter::add_clip_rect(Gfx::IntRect const& rect)
void DisplayListRecorder::add_clip_rect(Gfx::IntRect const& rect)
{
append(AddClipRect { .rect = state().translation.map(rect) });
}
void RecordingPainter::translate(int dx, int dy)
void DisplayListRecorder::translate(int dx, int dy)
{
m_state_stack.last().translation.translate(dx, dy);
}
void RecordingPainter::translate(Gfx::IntPoint delta)
void DisplayListRecorder::translate(Gfx::IntPoint delta)
{
m_state_stack.last().translation.translate(delta.to_type<float>());
}
void RecordingPainter::save()
void DisplayListRecorder::save()
{
append(Save {});
m_state_stack.append(m_state_stack.last());
}
void RecordingPainter::restore()
void DisplayListRecorder::restore()
{
append(Restore {});
@ -297,7 +297,7 @@ void RecordingPainter::restore()
m_state_stack.take_last();
}
void RecordingPainter::push_stacking_context(PushStackingContextParams params)
void DisplayListRecorder::push_stacking_context(PushStackingContextParams params)
{
append(PushStackingContext {
.opacity = params.opacity,
@ -316,13 +316,13 @@ void RecordingPainter::push_stacking_context(PushStackingContextParams params)
m_state_stack.append(State());
}
void RecordingPainter::pop_stacking_context()
void DisplayListRecorder::pop_stacking_context()
{
m_state_stack.take_last();
append(PopStackingContext {});
}
void RecordingPainter::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter)
void DisplayListRecorder::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter)
{
if (backdrop_region.is_empty())
return;
@ -333,18 +333,18 @@ void RecordingPainter::apply_backdrop_filter(Gfx::IntRect const& backdrop_region
});
}
void RecordingPainter::paint_outer_box_shadow_params(PaintBoxShadowParams params)
void DisplayListRecorder::paint_outer_box_shadow_params(PaintBoxShadowParams params)
{
params.device_content_rect = state().translation.map(params.device_content_rect);
append(PaintOuterBoxShadow { .box_shadow_params = params });
}
void RecordingPainter::paint_inner_box_shadow_params(PaintBoxShadowParams params)
void DisplayListRecorder::paint_inner_box_shadow_params(PaintBoxShadowParams params)
{
append(PaintInnerBoxShadow { .box_shadow_params = params });
}
void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color color, int fragment_baseline, Gfx::IntPoint draw_location)
void DisplayListRecorder::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color color, int fragment_baseline, Gfx::IntPoint draw_location)
{
append(PaintTextShadow {
.blur_radius = blur_radius,
@ -356,7 +356,7 @@ void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_
.draw_location = state().translation.map(draw_location) });
}
void RecordingPainter::fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color color, Gfx::AntiAliasingPainter::CornerRadius top_left_radius, Gfx::AntiAliasingPainter::CornerRadius top_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_left_radius, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color color, Gfx::AntiAliasingPainter::CornerRadius top_left_radius, Gfx::AntiAliasingPainter::CornerRadius top_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_left_radius, Vector<Gfx::Path> const& clip_paths)
{
if (rect.is_empty())
return;
@ -377,14 +377,14 @@ void RecordingPainter::fill_rect_with_rounded_corners(Gfx::IntRect const& rect,
});
}
void RecordingPainter::fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect, Color color, int radius, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect, Color color, int radius, Vector<Gfx::Path> const& clip_paths)
{
if (a_rect.is_empty())
return;
fill_rect_with_rounded_corners(a_rect, color, radius, radius, radius, radius, clip_paths);
}
void RecordingPainter::fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect, Color color, int top_left_radius, int top_right_radius, int bottom_right_radius, int bottom_left_radius, Vector<Gfx::Path> const& clip_paths)
void DisplayListRecorder::fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect, Color color, int top_left_radius, int top_right_radius, int bottom_right_radius, int bottom_left_radius, Vector<Gfx::Path> const& clip_paths)
{
if (a_rect.is_empty())
return;
@ -396,7 +396,7 @@ void RecordingPainter::fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect
clip_paths);
}
void RecordingPainter::draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a_p2, Color color, int amplitude, int thickness = 1)
void DisplayListRecorder::draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a_p2, Color color, int amplitude, int thickness = 1)
{
append(DrawTriangleWave {
.p1 = state().translation.map(a_p1),

View File

@ -35,9 +35,9 @@
namespace Web::Painting {
class RecordingPainter {
AK_MAKE_NONCOPYABLE(RecordingPainter);
AK_MAKE_NONMOVABLE(RecordingPainter);
class DisplayListRecorder {
AK_MAKE_NONCOPYABLE(DisplayListRecorder);
AK_MAKE_NONMOVABLE(DisplayListRecorder);
public:
void fill_rect(Gfx::IntRect const& rect, Color color, Vector<Gfx::Path> const& clip_paths = {});
@ -135,8 +135,8 @@ public:
void draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a_p2, Color color, int amplitude, int thickness);
RecordingPainter(DisplayList&);
~RecordingPainter();
DisplayListRecorder(DisplayList&);
~DisplayListRecorder();
DisplayList& display_list() { return m_command_list; }
@ -161,21 +161,21 @@ private:
DisplayList& m_command_list;
};
class RecordingPainterStateSaver {
class DisplayListRecorderStateSaver {
public:
explicit RecordingPainterStateSaver(RecordingPainter& painter)
explicit DisplayListRecorderStateSaver(DisplayListRecorder& painter)
: m_painter(painter)
{
m_painter.save();
}
~RecordingPainterStateSaver()
~DisplayListRecorderStateSaver()
{
m_painter.restore();
}
private:
RecordingPainter& m_painter;
DisplayListRecorder& m_painter;
};
}

View File

@ -103,7 +103,7 @@ void apply_backdrop_filter(PaintContext& context, CSSPixelRect const& backdrop_r
auto backdrop_region = context.rounded_device_rect(backdrop_rect);
ScopedCornerRadiusClip corner_clipper { context, backdrop_region, border_radii_data };
context.recording_painter().apply_backdrop_filter(backdrop_region.to_type<int>(), border_radii_data, backdrop_filter);
context.display_list_recorder().apply_backdrop_filter(backdrop_region.to_type<int>(), border_radii_data, backdrop_filter);
}
}

View File

@ -65,8 +65,8 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const
auto image_rect = context.rounded_device_rect(absolute_rect());
if (m_renders_as_alt_text) {
auto enclosing_rect = context.enclosing_device_rect(absolute_rect()).to_type<int>();
context.recording_painter().draw_rect(enclosing_rect, Gfx::Color::Black);
context.recording_painter().draw_text(enclosing_rect, m_alt_text, Platform::FontPlugin::the().default_font(), Gfx::TextAlignment::Center, computed_values().color());
context.display_list_recorder().draw_rect(enclosing_rect, Gfx::Color::Black);
context.display_list_recorder().draw_text(enclosing_rect, m_alt_text, Platform::FontPlugin::the().default_font(), Gfx::TextAlignment::Center, computed_values().color());
} else if (auto bitmap = m_image_provider.current_image_bitmap(image_rect.size().to_type<int>())) {
ScopedCornerRadiusClip corner_clip { context, image_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
auto image_int_rect = image_rect.to_type<int>();
@ -150,7 +150,7 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const
(int)scaled_bitmap_height
};
context.recording_painter().draw_scaled_immutable_bitmap(draw_rect.intersected(image_int_rect), *bitmap, bitmap_rect.intersected(bitmap_intersect), scaling_mode);
context.display_list_recorder().draw_scaled_immutable_bitmap(draw_rect.intersected(image_int_rect), *bitmap, bitmap_rect.intersected(bitmap_intersect), scaling_mode);
}
}
}

View File

@ -33,26 +33,26 @@ Layout::InlineNode const& InlinePaintable::layout_node() const
void InlinePaintable::before_paint(PaintContext& context, PaintPhase) const
{
if (scroll_frame_id().has_value()) {
context.recording_painter().save();
context.recording_painter().set_scroll_frame_id(scroll_frame_id().value());
context.display_list_recorder().save();
context.display_list_recorder().set_scroll_frame_id(scroll_frame_id().value());
}
if (clip_rect().has_value()) {
context.recording_painter().save();
context.recording_painter().add_clip_rect(context.enclosing_device_rect(*clip_rect()).to_type<int>());
context.display_list_recorder().save();
context.display_list_recorder().add_clip_rect(context.enclosing_device_rect(*clip_rect()).to_type<int>());
}
}
void InlinePaintable::after_paint(PaintContext& context, PaintPhase) const
{
if (clip_rect().has_value())
context.recording_painter().restore();
context.display_list_recorder().restore();
if (scroll_frame_id().has_value())
context.recording_painter().restore();
context.display_list_recorder().restore();
}
void InlinePaintable::paint(PaintContext& context, PaintPhase phase) const
{
auto& painter = context.recording_painter();
auto& display_list_recorder = context.display_list_recorder();
if (phase == PaintPhase::Background) {
auto containing_block_position_in_absolute_coordinates = containing_block()->absolute_position();
@ -141,9 +141,9 @@ void InlinePaintable::paint(PaintContext& context, PaintPhase phase) const
border_radii_data.inflate(outline_data->top.width + outline_offset_y, outline_data->right.width + outline_offset_x, outline_data->bottom.width + outline_offset_y, outline_data->left.width + outline_offset_x);
borders_rect.inflate(outline_data->top.width + outline_offset_y, outline_data->right.width + outline_offset_x, outline_data->bottom.width + outline_offset_y, outline_data->left.width + outline_offset_x);
paint_all_borders(context.recording_painter(), context.rounded_device_rect(borders_rect), border_radii_data.as_corners(context), outline_data->to_device_pixels(context));
paint_all_borders(context.display_list_recorder(), context.rounded_device_rect(borders_rect), border_radii_data.as_corners(context), outline_data->to_device_pixels(context));
} else {
paint_all_borders(context.recording_painter(), context.rounded_device_rect(borders_rect), border_radii_data.as_corners(context), borders_data.to_device_pixels(context));
paint_all_borders(context.display_list_recorder(), context.rounded_device_rect(borders_rect), border_radii_data.as_corners(context), borders_data.to_device_pixels(context));
}
return IterationDecision::Continue;
@ -172,7 +172,7 @@ void InlinePaintable::paint(PaintContext& context, PaintPhase phase) const
// would be none. Once we implement non-rectangular outlines for the `outline` CSS
// property, we can use that here instead.
for_each_fragment([&](auto const& fragment, bool, bool) {
painter.draw_rect(context.enclosing_device_rect(fragment.absolute_rect()).template to_type<int>(), Color::Magenta);
display_list_recorder.draw_rect(context.enclosing_device_rect(fragment.absolute_rect()).template to_type<int>(), Color::Magenta);
return IterationDecision::Continue;
});
}

View File

@ -69,13 +69,13 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
switch (layout_box().list_style_type()) {
case CSS::ListStyleType::Square:
context.recording_painter().fill_rect(device_marker_rect.to_type<int>(), color);
context.display_list_recorder().fill_rect(device_marker_rect.to_type<int>(), color);
break;
case CSS::ListStyleType::Circle:
context.recording_painter().draw_ellipse(device_marker_rect.to_type<int>(), color, 1);
context.display_list_recorder().draw_ellipse(device_marker_rect.to_type<int>(), color, 1);
break;
case CSS::ListStyleType::Disc:
context.recording_painter().fill_ellipse(device_marker_rect.to_type<int>(), color);
context.display_list_recorder().fill_ellipse(device_marker_rect.to_type<int>(), color);
break;
case CSS::ListStyleType::DisclosureClosed: {
// https://drafts.csswg.org/css-counter-styles-3/#disclosure-closed
@ -88,7 +88,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
path.line_to({ left + sin_60_deg * (right - left), (top + bottom) / 2 });
path.line_to({ left, bottom });
path.close();
context.recording_painter().fill_path({ .path = path, .color = color, .winding_rule = Gfx::WindingRule::EvenOdd });
context.display_list_recorder().fill_path({ .path = path, .color = color, .winding_rule = Gfx::WindingRule::EvenOdd });
break;
}
case CSS::ListStyleType::DisclosureOpen: {
@ -102,7 +102,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
path.line_to({ right, top });
path.line_to({ (left + right) / 2, top + sin_60_deg * (bottom - top) });
path.close();
context.recording_painter().fill_path({ .path = path, .color = color, .winding_rule = Gfx::WindingRule::EvenOdd });
context.display_list_recorder().fill_path({ .path = path, .color = color, .winding_rule = Gfx::WindingRule::EvenOdd });
break;
}
case CSS::ListStyleType::Decimal:
@ -118,7 +118,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
break;
// FIXME: This should use proper text layout logic!
// This does not line up with the text in the <li> element which looks very sad :(
context.recording_painter().draw_text(device_enclosing.to_type<int>(), MUST(String::from_byte_string(*text)), layout_box().scaled_font(context), Gfx::TextAlignment::Center, color);
context.display_list_recorder().draw_text(device_enclosing.to_type<int>(), MUST(String::from_byte_string(*text)), layout_box().scaled_font(context), Gfx::TextAlignment::Center, color);
break;
}
case CSS::ListStyleType::None:

View File

@ -44,7 +44,7 @@ Optional<DevicePixelPoint> MediaPaintable::mouse_position(PaintContext& context,
return {};
}
void MediaPaintable::fill_triangle(RecordingPainter& painter, Gfx::IntPoint location, Array<Gfx::IntPoint, 3> coordinates, Color color)
void MediaPaintable::fill_triangle(DisplayListRecorder& painter, Gfx::IntPoint location, Array<Gfx::IntPoint, 3> coordinates, Color color)
{
Gfx::Path path;
path.move_to((coordinates[0] + location).to_type<float>());
@ -61,7 +61,7 @@ void MediaPaintable::fill_triangle(RecordingPainter& painter, Gfx::IntPoint loca
void MediaPaintable::paint_media_controls(PaintContext& context, HTML::HTMLMediaElement const& media_element, DevicePixelRect media_rect, Optional<DevicePixelPoint> const& mouse_position) const
{
auto components = compute_control_bar_components(context, media_element, media_rect);
context.recording_painter().fill_rect(components.control_box_rect.to_type<int>(), control_box_color.with_alpha(0xd0));
context.display_list_recorder().fill_rect(components.control_box_rect.to_type<int>(), control_box_color.with_alpha(0xd0));
paint_control_bar_playback_button(context, media_element, components, mouse_position);
paint_control_bar_timeline(context, media_element, components);
@ -155,7 +155,7 @@ void MediaPaintable::paint_control_bar_playback_button(PaintContext& context, HT
{ 0, static_cast<int>(playback_button_size) },
} };
fill_triangle(context.recording_painter(), playback_button_location.to_type<int>(), play_button_coordinates, playback_button_color);
fill_triangle(context.display_list_recorder(), playback_button_location.to_type<int>(), play_button_coordinates, playback_button_color);
} else {
DevicePixelRect pause_button_left_rect {
playback_button_location,
@ -166,8 +166,8 @@ void MediaPaintable::paint_control_bar_playback_button(PaintContext& context, HT
{ playback_button_size / 3, playback_button_size }
};
context.recording_painter().fill_rect(pause_button_left_rect.to_type<int>(), playback_button_color);
context.recording_painter().fill_rect(pause_button_right_rect.to_type<int>(), playback_button_color);
context.display_list_recorder().fill_rect(pause_button_left_rect.to_type<int>(), playback_button_color);
context.display_list_recorder().fill_rect(pause_button_right_rect.to_type<int>(), playback_button_color);
}
}
@ -182,11 +182,11 @@ void MediaPaintable::paint_control_bar_timeline(PaintContext& context, HTML::HTM
auto timeline_past_rect = components.timeline_rect;
timeline_past_rect.set_width(timeline_button_offset_x);
context.recording_painter().fill_rect(timeline_past_rect.to_type<int>(), control_highlight_color.lightened());
context.display_list_recorder().fill_rect(timeline_past_rect.to_type<int>(), control_highlight_color.lightened());
auto timeline_future_rect = components.timeline_rect;
timeline_future_rect.take_from_left(timeline_button_offset_x);
context.recording_painter().fill_rect(timeline_future_rect.to_type<int>(), Color::Black);
context.display_list_recorder().fill_rect(timeline_future_rect.to_type<int>(), Color::Black);
}
void MediaPaintable::paint_control_bar_timestamp(PaintContext& context, Components const& components)
@ -194,7 +194,7 @@ void MediaPaintable::paint_control_bar_timestamp(PaintContext& context, Componen
if (components.timestamp_rect.is_empty())
return;
context.recording_painter().draw_text(components.timestamp_rect.to_type<int>(), components.timestamp, *components.timestamp_font, Gfx::TextAlignment::CenterLeft, Color::White);
context.display_list_recorder().draw_text(components.timestamp_rect.to_type<int>(), components.timestamp, *components.timestamp_font, Gfx::TextAlignment::CenterLeft, Color::White);
}
void MediaPaintable::paint_control_bar_speaker(PaintContext& context, HTML::HTMLMediaElement const& media_element, Components const& components, Optional<DevicePixelPoint> const& mouse_position)
@ -227,18 +227,18 @@ void MediaPaintable::paint_control_bar_speaker(PaintContext& context, HTML::HTML
path.line_to(device_point(0, 11));
path.line_to(device_point(0, 4));
path.close();
context.recording_painter().fill_path({ .path = path, .color = speaker_button_color, .winding_rule = Gfx::WindingRule::EvenOdd });
context.display_list_recorder().fill_path({ .path = path, .color = speaker_button_color, .winding_rule = Gfx::WindingRule::EvenOdd });
path.clear();
path.move_to(device_point(13, 3));
path.quadratic_bezier_curve_to(device_point(16, 7.5), device_point(13, 12));
path.move_to(device_point(14, 0));
path.quadratic_bezier_curve_to(device_point(20, 7.5), device_point(14, 15));
context.recording_painter().stroke_path({ .path = path, .color = speaker_button_color, .thickness = 1 });
context.display_list_recorder().stroke_path({ .path = path, .color = speaker_button_color, .thickness = 1 });
if (media_element.muted()) {
context.recording_painter().draw_line(device_point(0, 0).to_type<int>(), device_point(20, 15).to_type<int>(), Color::Red, 2);
context.recording_painter().draw_line(device_point(0, 15).to_type<int>(), device_point(20, 0).to_type<int>(), Color::Red, 2);
context.display_list_recorder().draw_line(device_point(0, 0).to_type<int>(), device_point(20, 15).to_type<int>(), Color::Red, 2);
context.display_list_recorder().draw_line(device_point(0, 15).to_type<int>(), device_point(20, 0).to_type<int>(), Color::Red, 2);
}
}
@ -252,11 +252,11 @@ void MediaPaintable::paint_control_bar_volume(PaintContext& context, HTML::HTMLM
auto volume_lower_rect = components.volume_scrub_rect;
volume_lower_rect.set_width(volume_button_offset_x);
context.recording_painter().fill_rect_with_rounded_corners(volume_lower_rect.to_type<int>(), control_highlight_color.lightened(), 4);
context.display_list_recorder().fill_rect_with_rounded_corners(volume_lower_rect.to_type<int>(), control_highlight_color.lightened(), 4);
auto volume_higher_rect = components.volume_scrub_rect;
volume_higher_rect.take_from_left(volume_button_offset_x);
context.recording_painter().fill_rect_with_rounded_corners(volume_higher_rect.to_type<int>(), Color::Black, 4);
context.display_list_recorder().fill_rect_with_rounded_corners(volume_higher_rect.to_type<int>(), Color::Black, 4);
auto volume_button_rect = components.volume_scrub_rect;
volume_button_rect.shrink(components.volume_scrub_rect.width() - components.volume_button_size, components.volume_scrub_rect.height() - components.volume_button_size);
@ -264,7 +264,7 @@ void MediaPaintable::paint_control_bar_volume(PaintContext& context, HTML::HTMLM
auto volume_is_hovered = rect_is_hovered(media_element, components.volume_rect, mouse_position, HTML::HTMLMediaElement::MouseTrackingComponent::Volume);
auto volume_color = control_button_color(volume_is_hovered);
context.recording_painter().fill_ellipse(volume_button_rect.to_type<int>(), volume_color);
context.display_list_recorder().fill_ellipse(volume_button_rect.to_type<int>(), volume_color);
}
MediaPaintable::DispatchEventOfSameName MediaPaintable::handle_mousedown(Badge<EventHandler>, CSSPixelPoint position, unsigned button, unsigned)

View File

@ -20,7 +20,7 @@ protected:
explicit MediaPaintable(Layout::ReplacedBox const&);
static Optional<DevicePixelPoint> mouse_position(PaintContext&, HTML::HTMLMediaElement const&);
static void fill_triangle(RecordingPainter& painter, Gfx::IntPoint location, Array<Gfx::IntPoint, 3> coordinates, Color color);
static void fill_triangle(DisplayListRecorder& painter, Gfx::IntPoint location, Array<Gfx::IntPoint, 3> coordinates, Color color);
void paint_media_controls(PaintContext&, HTML::HTMLMediaElement const&, DevicePixelRect media_rect, Optional<DevicePixelPoint> const& mouse_position) const;

View File

@ -50,23 +50,23 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
if (!hosted_paint_tree)
return;
context.recording_painter().save();
context.display_list_recorder().save();
context.recording_painter().add_clip_rect(clip_rect.to_type<int>());
context.display_list_recorder().add_clip_rect(clip_rect.to_type<int>());
auto absolute_device_rect = context.enclosing_device_rect(absolute_rect);
context.recording_painter().translate(absolute_device_rect.x().value(), absolute_device_rect.y().value());
context.display_list_recorder().translate(absolute_device_rect.x().value(), absolute_device_rect.y().value());
HTML::Navigable::PaintConfig paint_config;
paint_config.paint_overlay = context.should_paint_overlay();
paint_config.should_show_line_box_borders = context.should_show_line_box_borders();
paint_config.has_focus = context.has_focus();
const_cast<DOM::Document*>(hosted_document)->navigable()->record_display_list(context.recording_painter(), paint_config);
const_cast<DOM::Document*>(hosted_document)->navigable()->record_display_list(context.display_list_recorder(), paint_config);
context.recording_painter().restore();
context.display_list_recorder().restore();
if constexpr (HIGHLIGHT_FOCUSED_FRAME_DEBUG) {
if (layout_box().dom_node().content_navigable()->is_focused()) {
context.recording_painter().draw_rect(clip_rect.to_type<int>(), Color::Cyan);
context.display_list_recorder().draw_rect(clip_rect.to_type<int>(), Color::Cyan);
}
}
}

View File

@ -11,8 +11,8 @@ namespace Web {
static u64 s_next_paint_generation_id = 0;
PaintContext::PaintContext(Painting::RecordingPainter& recording_painter, Palette const& palette, double device_pixels_per_css_pixel)
: m_recording_painter(recording_painter)
PaintContext::PaintContext(Painting::DisplayListRecorder& display_list_recorder, Palette const& palette, double device_pixels_per_css_pixel)
: m_display_list_recorder(display_list_recorder)
, m_palette(palette)
, m_device_pixels_per_css_pixel(device_pixels_per_css_pixel)
, m_paint_generation_id(s_next_paint_generation_id++)

View File

@ -11,16 +11,16 @@
#include <LibGfx/Forward.h>
#include <LibGfx/Palette.h>
#include <LibGfx/Rect.h>
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Painting/DisplayListRecorder.h>
#include <LibWeb/PixelUnits.h>
namespace Web {
class PaintContext {
public:
PaintContext(Painting::RecordingPainter& painter, Palette const& palette, double device_pixels_per_css_pixel);
PaintContext(Painting::DisplayListRecorder& painter, Palette const& palette, double device_pixels_per_css_pixel);
Painting::RecordingPainter& recording_painter() const { return m_recording_painter; }
Painting::DisplayListRecorder& display_list_recorder() const { return m_display_list_recorder; }
Palette const& palette() const { return m_palette; }
bool should_show_line_box_borders() const { return m_should_show_line_box_borders; }
@ -70,7 +70,7 @@ public:
CSSPixelSize scale_to_css_size(DevicePixelSize) const;
CSSPixelRect scale_to_css_rect(DevicePixelRect) const;
PaintContext clone(Painting::RecordingPainter& painter) const
PaintContext clone(Painting::DisplayListRecorder& painter) const
{
auto clone = PaintContext(painter, m_palette, m_device_pixels_per_css_pixel);
clone.m_device_viewport_rect = m_device_viewport_rect;
@ -87,7 +87,7 @@ public:
u64 paint_generation_id() const { return m_paint_generation_id; }
private:
Painting::RecordingPainter& m_recording_painter;
Painting::DisplayListRecorder& m_display_list_recorder;
Palette m_palette;
double m_device_pixels_per_css_pixel { 0 };
DevicePixelRect m_device_viewport_rect;

View File

@ -333,7 +333,7 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
border_radius_data.inflate(outline_data->top.width + outline_offset_y, outline_data->right.width + outline_offset_x, outline_data->bottom.width + outline_offset_y, outline_data->left.width + outline_offset_x);
borders_rect.inflate(outline_data->top.width + outline_offset_y, outline_data->right.width + outline_offset_x, outline_data->bottom.width + outline_offset_y, outline_data->left.width + outline_offset_x);
paint_all_borders(context.recording_painter(), context.rounded_device_rect(borders_rect), border_radius_data.as_corners(context), outline_data->to_device_pixels(context));
paint_all_borders(context.display_list_recorder(), context.rounded_device_rect(borders_rect), border_radius_data.as_corners(context), outline_data->to_device_pixels(context));
}
}
@ -343,11 +343,11 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
int thumb_corner_radius = static_cast<int>(context.rounded_device_pixels(scrollbar_thumb_thickness / 2));
if (auto thumb_rect = scroll_thumb_rect(ScrollDirection::Horizontal); thumb_rect.has_value()) {
auto thumb_device_rect = context.enclosing_device_rect(thumb_rect.value());
context.recording_painter().fill_rect_with_rounded_corners(thumb_device_rect.to_type<int>(), color, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius);
context.display_list_recorder().fill_rect_with_rounded_corners(thumb_device_rect.to_type<int>(), color, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius);
}
if (auto thumb_rect = scroll_thumb_rect(ScrollDirection::Vertical); thumb_rect.has_value()) {
auto thumb_device_rect = context.enclosing_device_rect(thumb_rect.value());
context.recording_painter().fill_rect_with_rounded_corners(thumb_device_rect.to_type<int>(), color, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius);
context.display_list_recorder().fill_rect_with_rounded_corners(thumb_device_rect.to_type<int>(), color, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius, thumb_corner_radius);
}
}
@ -366,8 +366,8 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
auto paint_inspector_rect = [&](CSSPixelRect const& rect, Color color) {
auto device_rect = context.enclosing_device_rect(rect).to_type<int>();
context.recording_painter().fill_rect(device_rect, Color(color).with_alpha(100));
context.recording_painter().draw_rect(device_rect, Color(color));
context.display_list_recorder().fill_rect(device_rect, Color(color).with_alpha(100));
context.display_list_recorder().draw_rect(device_rect, Color(color));
};
paint_inspector_rect(margin_rect, Color::Yellow);
@ -390,9 +390,9 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
size_text_rect.set_width(CSSPixels::nearest_value_for(font.width(size_text)) + 4);
size_text_rect.set_height(CSSPixels::nearest_value_for(font.pixel_size()) + 4);
auto size_text_device_rect = context.enclosing_device_rect(size_text_rect).to_type<int>();
context.recording_painter().fill_rect(size_text_device_rect, context.palette().color(Gfx::ColorRole::Tooltip));
context.recording_painter().draw_rect(size_text_device_rect, context.palette().threed_shadow1());
context.recording_painter().draw_text(size_text_device_rect, size_text, font, Gfx::TextAlignment::Center, context.palette().color(Gfx::ColorRole::TooltipText));
context.display_list_recorder().fill_rect(size_text_device_rect, context.palette().color(Gfx::ColorRole::Tooltip));
context.display_list_recorder().draw_rect(size_text_device_rect, context.palette().threed_shadow1());
context.display_list_recorder().draw_text(size_text_device_rect, size_text, font, Gfx::TextAlignment::Center, context.palette().color(Gfx::ColorRole::TooltipText));
}
}
@ -414,7 +414,7 @@ void PaintableBox::paint_border(PaintContext& context) const
.bottom = box_model().border.bottom == 0 ? CSS::BorderData() : computed_values().border_bottom(),
.left = box_model().border.left == 0 ? CSS::BorderData() : computed_values().border_left(),
};
paint_all_borders(context.recording_painter(), context.rounded_device_rect(absolute_border_box_rect()), normalized_border_radii_data().as_corners(context), borders_data.to_device_pixels(context));
paint_all_borders(context.display_list_recorder(), context.rounded_device_rect(absolute_border_box_rect()), normalized_border_radii_data().as_corners(context), borders_data.to_device_pixels(context));
}
void PaintableBox::paint_backdrop_filter(PaintContext& context) const
@ -482,15 +482,15 @@ BorderRadiiData PaintableBox::normalized_border_radii_data(ShrinkRadiiForBorders
void PaintableBox::apply_scroll_offset(PaintContext& context, PaintPhase) const
{
if (scroll_frame_id().has_value()) {
context.recording_painter().save();
context.recording_painter().set_scroll_frame_id(scroll_frame_id().value());
context.display_list_recorder().save();
context.display_list_recorder().set_scroll_frame_id(scroll_frame_id().value());
}
}
void PaintableBox::reset_scroll_offset(PaintContext& context, PaintPhase) const
{
if (scroll_frame_id().has_value())
context.recording_painter().restore();
context.display_list_recorder().restore();
}
void PaintableBox::apply_clip_overflow_rect(PaintContext& context, PaintPhase phase) const
@ -501,8 +501,8 @@ void PaintableBox::apply_clip_overflow_rect(PaintContext& context, PaintPhase ph
if (clip_rect().has_value()) {
auto overflow_clip_rect = clip_rect().value();
m_clipping_overflow = true;
context.recording_painter().save();
context.recording_painter().add_clip_rect(context.enclosing_device_rect(overflow_clip_rect).to_type<int>());
context.display_list_recorder().save();
context.display_list_recorder().add_clip_rect(context.enclosing_device_rect(overflow_clip_rect).to_type<int>());
auto const& border_radii_clips = this->border_radii_clips();
m_corner_clipper_ids.resize(border_radii_clips.size());
auto const& combined_transform = combined_css_transform();
@ -514,7 +514,7 @@ void PaintableBox::apply_clip_overflow_rect(PaintContext& context, PaintPhase ph
auto corner_clipper_id = context.allocate_corner_clipper_id();
m_corner_clipper_ids[corner_clip_index] = corner_clipper_id;
auto rect = corner_clip.rect.translated(-combined_transform.translation().to_type<CSSPixels>());
context.recording_painter().sample_under_corners(corner_clipper_id, corner_clip.radii.as_corners(context), context.rounded_device_rect(rect).to_type<int>(), CornerClip::Outside);
context.display_list_recorder().sample_under_corners(corner_clipper_id, corner_clip.radii.as_corners(context), context.rounded_device_rect(rect).to_type<int>(), CornerClip::Outside);
}
}
}
@ -534,9 +534,9 @@ void PaintableBox::clear_clip_overflow_rect(PaintContext& context, PaintPhase ph
continue;
auto corner_clipper_id = m_corner_clipper_ids[corner_clip_index];
m_corner_clipper_ids[corner_clip_index] = corner_clipper_id;
context.recording_painter().blit_corner_clipping(corner_clipper_id);
context.display_list_recorder().blit_corner_clipping(corner_clipper_id);
}
context.recording_painter().restore();
context.display_list_recorder().restore();
}
}
@ -572,12 +572,12 @@ void paint_cursor_if_needed(PaintContext& context, TextPaintable const& paintabl
auto cursor_device_rect = context.rounded_device_rect(cursor_rect).to_type<int>();
context.recording_painter().draw_rect(cursor_device_rect, paintable.computed_values().color());
context.display_list_recorder().draw_rect(cursor_device_rect, paintable.computed_values().color());
}
void paint_text_decoration(PaintContext& context, TextPaintable const& paintable, PaintableFragment const& fragment)
{
auto& painter = context.recording_painter();
auto& painter = context.display_list_recorder();
auto& font = fragment.layout_node().first_available_font();
auto fragment_box = fragment.absolute_rect();
CSSPixels glyph_height = CSSPixels::nearest_value_for(font.pixel_size());
@ -652,14 +652,14 @@ void paint_text_decoration(PaintContext& context, TextPaintable const& paintable
void paint_text_fragment(PaintContext& context, TextPaintable const& paintable, PaintableFragment const& fragment, PaintPhase phase)
{
auto& painter = context.recording_painter();
auto& painter = context.display_list_recorder();
if (phase == PaintPhase::Foreground) {
auto fragment_absolute_rect = fragment.absolute_rect();
auto fragment_absolute_device_rect = context.enclosing_device_rect(fragment_absolute_rect);
if (paintable.document().inspected_layout_node() == &paintable.layout_node())
context.recording_painter().draw_rect(fragment_absolute_device_rect.to_type<int>(), Color::Magenta);
context.display_list_recorder().draw_rect(fragment_absolute_device_rect.to_type<int>(), Color::Magenta);
auto text = paintable.text_for_rendering();
@ -670,7 +670,7 @@ void paint_text_fragment(PaintContext& context, TextPaintable const& paintable,
auto selection_rect = context.enclosing_device_rect(fragment.selection_rect(paintable.layout_node().first_available_font())).to_type<int>();
if (!selection_rect.is_empty()) {
painter.fill_rect(selection_rect, CSS::SystemColor::highlight());
RecordingPainterStateSaver saver(painter);
DisplayListRecorderStateSaver saver(painter);
painter.add_clip_rect(selection_rect);
painter.draw_text_run(baseline_start.to_type<int>(), fragment.glyph_run(), CSS::SystemColor::highlight_text(), fragment_absolute_device_rect.to_type<int>(), scale);
}
@ -699,12 +699,12 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const
should_clip_overflow = true;
}
if (should_clip_overflow) {
context.recording_painter().save();
context.display_list_recorder().save();
// FIXME: Handle overflow-x and overflow-y being different values.
auto clip_box_with_enclosing_scroll_frame_offset = clip_box;
if (enclosing_scroll_frame_offset().has_value())
clip_box_with_enclosing_scroll_frame_offset.translate_by(enclosing_scroll_frame_offset().value());
context.recording_painter().add_clip_rect(context.rounded_device_rect(clip_box_with_enclosing_scroll_frame_offset).to_type<int>());
context.display_list_recorder().add_clip_rect(context.rounded_device_rect(clip_box_with_enclosing_scroll_frame_offset).to_type<int>());
auto border_radii = normalized_border_radii_data(ShrinkRadiiForBorders::Yes);
CornerRadii corner_radii {
@ -715,12 +715,12 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const
};
if (corner_radii.has_any_radius()) {
corner_clip_id = context.allocate_corner_clipper_id();
context.recording_painter().sample_under_corners(*corner_clip_id, corner_radii, context.rounded_device_rect(clip_box).to_type<int>(), CornerClip::Outside);
context.display_list_recorder().sample_under_corners(*corner_clip_id, corner_radii, context.rounded_device_rect(clip_box).to_type<int>(), CornerClip::Outside);
}
context.recording_painter().save();
context.display_list_recorder().save();
auto scroll_offset = context.rounded_device_point(this->scroll_offset());
context.recording_painter().translate(-scroll_offset.to_type<int>());
context.display_list_recorder().translate(-scroll_offset.to_type<int>());
}
// Text shadows
@ -737,8 +737,8 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const
auto fragment_absolute_rect = fragment.absolute_rect();
auto fragment_absolute_device_rect = context.enclosing_device_rect(fragment_absolute_rect);
if (context.should_show_line_box_borders()) {
context.recording_painter().draw_rect(fragment_absolute_device_rect.to_type<int>(), Color::Green);
context.recording_painter().draw_line(
context.display_list_recorder().draw_rect(fragment_absolute_device_rect.to_type<int>(), Color::Green);
context.display_list_recorder().draw_line(
context.rounded_device_point(fragment_absolute_rect.top_left().translated(0, fragment.baseline())).to_type<int>(),
context.rounded_device_point(fragment_absolute_rect.top_right().translated(-1, fragment.baseline())).to_type<int>(), Color::Red);
}
@ -747,12 +747,12 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const
}
if (should_clip_overflow) {
context.recording_painter().restore();
context.display_list_recorder().restore();
if (corner_clip_id.has_value()) {
context.recording_painter().blit_corner_clipping(*corner_clip_id);
context.display_list_recorder().blit_corner_clipping(*corner_clip_id);
corner_clip_id = {};
}
context.recording_painter().restore();
context.display_list_recorder().restore();
}
}

View File

@ -40,7 +40,7 @@ void RadioButtonPaintable::paint(PaintContext& context, PaintPhase phase) const
auto draw_circle = [&](auto const& rect, Color color) {
// Note: Doing this is a bit more forgiving than draw_circle() which will round to the nearset even radius.
// This will fudge it (which works better here).
context.recording_painter().fill_rect_with_rounded_corners(rect, color, rect.width() / 2);
context.display_list_recorder().fill_rect_with_rounded_corners(rect, color, rect.width() / 2);
};
auto shrink_all = [&](auto const& rect, int amount) {

View File

@ -82,9 +82,9 @@ RefPtr<Gfx::Bitmap> SVGMaskable::calculate_mask_of_svg(PaintContext& context, CS
return {};
mask_bitmap = mask_bitmap_or_error.release_value();
DisplayList display_list;
RecordingPainter recording_painter(display_list);
recording_painter.translate(-mask_rect.location().to_type<int>());
auto paint_context = context.clone(recording_painter);
DisplayListRecorder display_list_recorder(display_list);
display_list_recorder.translate(-mask_rect.location().to_type<int>());
auto paint_context = context.clone(display_list_recorder);
paint_context.set_svg_transform(graphics_element.get_transform());
paint_context.set_draw_svg_geometry_for_clip_path(is<SVGClipPaintable>(paintable));
StackingContext::paint_node_as_stacking_context(paintable, paint_context);

View File

@ -66,7 +66,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
auto svg_element_rect = svg_node->paintable_box()->absolute_rect();
// FIXME: This should not be trucated to an int.
RecordingPainterStateSaver save_painter { context.recording_painter() };
DisplayListRecorderStateSaver save_painter { context.display_list_recorder() };
auto offset = context.floored_device_point(svg_element_rect.location()).to_type<int>().to_type<float>();
auto maybe_view_box = svg_node->dom_node().view_box();
@ -98,7 +98,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
// The raw geometry of each child element exclusive of rendering properties such as fill, stroke, stroke-width
// within a clipPath conceptually defines a 1-bit mask (with the possible exception of anti-aliasing along
// the edge of the geometry) which represents the silhouette of the graphics associated with that element.
context.recording_painter().fill_path({
context.display_list_recorder().fill_path({
.path = closed_path(),
.color = Color::Black,
.winding_rule = to_gfx_winding_rule(graphics_element.clip_rule().value_or(SVG::ClipRule::Nonzero)),
@ -116,7 +116,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
auto fill_opacity = graphics_element.fill_opacity().value_or(1);
auto winding_rule = to_gfx_winding_rule(graphics_element.fill_rule().value_or(SVG::FillRule::Nonzero));
if (auto paint_style = graphics_element.fill_paint_style(paint_context); paint_style.has_value()) {
context.recording_painter().fill_path({
context.display_list_recorder().fill_path({
.path = closed_path(),
.paint_style = *paint_style,
.winding_rule = winding_rule,
@ -124,7 +124,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
.translation = offset,
});
} else if (auto fill_color = graphics_element.fill_color(); fill_color.has_value()) {
context.recording_painter().fill_path({
context.display_list_recorder().fill_path({
.path = closed_path(),
.color = fill_color->with_opacity(fill_opacity),
.winding_rule = winding_rule,
@ -138,7 +138,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
float stroke_thickness = graphics_element.stroke_width().value_or(1) * viewbox_scale;
if (auto paint_style = graphics_element.stroke_paint_style(paint_context); paint_style.has_value()) {
context.recording_painter().stroke_path({
context.display_list_recorder().stroke_path({
.path = path,
.paint_style = *paint_style,
.thickness = stroke_thickness,
@ -146,7 +146,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
.translation = offset,
});
} else if (auto stroke_color = graphics_element.stroke_color(); stroke_color.has_value()) {
context.recording_painter().stroke_path({
context.display_list_recorder().stroke_path({
.path = path,
.color = stroke_color->with_opacity(stroke_opacity),
.thickness = stroke_thickness,

View File

@ -31,10 +31,10 @@ void SVGSVGPaintable::before_children_paint(PaintContext& context, PaintPhase ph
PaintableBox::before_children_paint(context, phase);
if (phase != PaintPhase::Foreground)
return;
context.recording_painter().save();
context.display_list_recorder().save();
auto clip_rect = absolute_rect();
clip_rect.translate_by(enclosing_scroll_frame_offset().value_or({}));
context.recording_painter().add_clip_rect(context.enclosing_device_rect(clip_rect).to_type<int>());
context.display_list_recorder().add_clip_rect(context.enclosing_device_rect(clip_rect).to_type<int>());
}
void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase phase) const
@ -42,7 +42,7 @@ void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase pha
PaintableBox::after_children_paint(context, phase);
if (phase != PaintPhase::Foreground)
return;
context.recording_painter().restore();
context.display_list_recorder().restore();
}
}

View File

@ -569,10 +569,10 @@ void paint_box_shadow(PaintContext& context,
auto shrinked_border_radii = border_radii;
shrinked_border_radii.shrink(borders_data.top.width, borders_data.right.width, borders_data.bottom.width, borders_data.left.width);
ScopedCornerRadiusClip corner_clipper { context, device_content_rect, shrinked_border_radii, CornerClip::Outside };
context.recording_painter().paint_inner_box_shadow_params(params);
context.display_list_recorder().paint_inner_box_shadow_params(params);
} else {
ScopedCornerRadiusClip corner_clipper { context, device_content_rect, border_radii, CornerClip::Inside };
context.recording_painter().paint_outer_box_shadow_params(params);
context.display_list_recorder().paint_outer_box_shadow_params(params);
}
}
}
@ -620,7 +620,7 @@ void paint_text_shadow(PaintContext& context, PaintableFragment const& fragment,
draw_rect.y() + offset_y - margin
};
context.recording_painter().paint_text_shadow(blur_radius, bounding_rect, text_rect, scaled_glyph_run, layer.color, fragment_baseline, draw_location);
context.display_list_recorder().paint_text_shadow(blur_radius, bounding_rect, text_rect, scaled_glyph_run, layer.color, fragment_baseline, draw_location);
}
}

View File

@ -276,7 +276,7 @@ void StackingContext::paint(PaintContext& context) const
if (opacity == 0.0f)
return;
RecordingPainterStateSaver saver(context.recording_painter());
DisplayListRecorderStateSaver saver(context.display_list_recorder());
auto to_device_pixels_scale = float(context.device_pixels_per_css_pixel());
Gfx::IntRect source_paintable_rect;
@ -295,7 +295,7 @@ void StackingContext::paint(PaintContext& context) const
transform_origin = paintable_box().transform_origin().to_type<float>();
}
RecordingPainter::PushStackingContextParams push_stacking_context_params {
DisplayListRecorder::PushStackingContextParams push_stacking_context_params {
.opacity = opacity,
.is_fixed_position = paintable().is_fixed_position(),
.source_paintable_rect = source_paintable_rect,
@ -322,13 +322,13 @@ void StackingContext::paint(PaintContext& context) const
}
}
context.recording_painter().save();
context.display_list_recorder().save();
if (paintable().is_paintable_box() && paintable_box().scroll_frame_id().has_value())
context.recording_painter().set_scroll_frame_id(*paintable_box().scroll_frame_id());
context.recording_painter().push_stacking_context(push_stacking_context_params);
context.display_list_recorder().set_scroll_frame_id(*paintable_box().scroll_frame_id());
context.display_list_recorder().push_stacking_context(push_stacking_context_params);
paint_internal(context);
context.recording_painter().pop_stacking_context();
context.recording_painter().restore();
context.display_list_recorder().pop_stacking_context();
context.display_list_recorder().restore();
}
TraversalDecision StackingContext::hit_test(CSSPixelPoint position, HitTestType type, Function<TraversalDecision(HitTestResult)> const& callback) const

View File

@ -284,12 +284,12 @@ static void paint_collected_edges(PaintContext& context, Vector<BorderEdgePainti
: border_edge_painting_info.rect.bottom_left();
if (border_style == CSS::LineStyle::Dotted) {
context.recording_painter().draw_line(p1.to_type<int>(), p2.to_type<int>(), color, width.value(), Gfx::LineStyle::Dotted);
context.display_list_recorder().draw_line(p1.to_type<int>(), p2.to_type<int>(), color, width.value(), Gfx::LineStyle::Dotted);
} else if (border_style == CSS::LineStyle::Dashed) {
context.recording_painter().draw_line(p1.to_type<int>(), p2.to_type<int>(), color, width.value(), Gfx::LineStyle::Dashed);
context.display_list_recorder().draw_line(p1.to_type<int>(), p2.to_type<int>(), color, width.value(), Gfx::LineStyle::Dashed);
} else {
// FIXME: Support the remaining line styles instead of rendering them as solid.
context.recording_painter().fill_rect(Gfx::IntRect(border_edge_painting_info.rect.location(), border_edge_painting_info.rect.size()), color);
context.display_list_recorder().fill_rect(Gfx::IntRect(border_edge_painting_info.rect.location(), border_edge_painting_info.rect.size()), color);
}
}
}
@ -351,7 +351,7 @@ static void paint_separate_cell_borders(PaintableBox const& cell_box, HashMap<Ce
.left = cell_box.box_model().border.left == 0 ? CSS::BorderData() : cell_box.computed_values().border_left(),
};
auto cell_rect = cell_coordinates_to_device_rect.get({ cell_box.table_cell_coordinates()->row_index, cell_box.table_cell_coordinates()->column_index }).value();
paint_all_borders(context.recording_painter(), cell_rect, cell_box.normalized_border_radii_data().as_corners(context), borders_data.to_device_pixels(context));
paint_all_borders(context.display_list_recorder(), cell_rect, cell_box.normalized_border_radii_data().as_corners(context), borders_data.to_device_pixels(context));
}
void paint_table_borders(PaintContext& context, PaintableBox const& table_paintable)
@ -436,7 +436,7 @@ void paint_table_borders(PaintContext& context, PaintableBox const& table_painta
.bottom = cell_box.box_model().border.bottom == 0 ? CSS::BorderData() : cell_box.computed_values().border_bottom(),
.left = cell_box.box_model().border.left == 0 ? CSS::BorderData() : cell_box.computed_values().border_left(),
};
paint_all_borders(context.recording_painter(), context.rounded_device_rect(cell_box.absolute_border_box_rect()), cell_box.normalized_border_radii_data().as_corners(context), borders_data.to_device_pixels(context));
paint_all_borders(context.display_list_recorder(), context.rounded_device_rect(cell_box.absolute_border_box_rect()), cell_box.normalized_border_radii_data().as_corners(context), borders_data.to_device_pixels(context));
}
}
}

View File

@ -58,10 +58,10 @@ void VideoPaintable::paint(PaintContext& context, PaintPhase phase) const
if (phase != PaintPhase::Foreground)
return;
RecordingPainterStateSaver saver { context.recording_painter() };
DisplayListRecorderStateSaver saver { context.display_list_recorder() };
auto video_rect = context.rounded_device_rect(absolute_rect());
context.recording_painter().add_clip_rect(video_rect.to_type<int>());
context.display_list_recorder().add_clip_rect(video_rect.to_type<int>());
ScopedCornerRadiusClip corner_clip { context, video_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
@ -130,12 +130,12 @@ void VideoPaintable::paint(PaintContext& context, PaintPhase phase) const
auto paint_frame = [&](auto const& frame) {
auto scaling_mode = to_gfx_scaling_mode(computed_values().image_rendering(), frame->rect(), video_rect.to_type<int>());
context.recording_painter().draw_scaled_bitmap(video_rect.to_type<int>(), *frame, frame->rect(), scaling_mode);
context.display_list_recorder().draw_scaled_bitmap(video_rect.to_type<int>(), *frame, frame->rect(), scaling_mode);
};
auto paint_transparent_black = [&]() {
static constexpr auto transparent_black = Gfx::Color::from_argb(0x00'00'00'00);
context.recording_painter().fill_rect(video_rect.to_type<int>(), transparent_black);
context.display_list_recorder().fill_rect(video_rect.to_type<int>(), transparent_black);
};
auto paint_loaded_video_controls = [&]() {
@ -211,8 +211,8 @@ void VideoPaintable::paint_placeholder_video_controls(PaintContext& context, Dev
auto playback_button_is_hovered = mouse_position.has_value() && control_box_rect.contains(*mouse_position);
auto playback_button_color = control_button_color(playback_button_is_hovered);
context.recording_painter().fill_ellipse(control_box_rect.to_type<int>(), control_box_color);
fill_triangle(context.recording_painter(), playback_button_location.to_type<int>(), play_button_coordinates, playback_button_color);
context.display_list_recorder().fill_ellipse(control_box_rect.to_type<int>(), control_box_color);
fill_triangle(context.display_list_recorder(), playback_button_location.to_type<int>(), play_button_coordinates, playback_button_color);
}
}

View File

@ -63,7 +63,7 @@ void ViewportPaintable::build_stacking_context_tree()
void ViewportPaintable::paint_all_phases(PaintContext& context)
{
build_stacking_context_tree_if_needed();
context.recording_painter().translate(-context.device_viewport_rect().location().to_type<int>());
context.display_list_recorder().translate(-context.device_viewport_rect().location().to_type<int>());
stacking_context()->paint(context);
}

View File

@ -94,9 +94,9 @@ RefPtr<Gfx::Bitmap> SVGDecodedImageData::render(Gfx::IntSize size) const
m_document->update_layout();
Painting::DisplayList display_list;
Painting::RecordingPainter recording_painter(display_list);
Painting::DisplayListRecorder display_list_recorder(display_list);
m_document->navigable()->record_display_list(recording_painter, {});
m_document->navigable()->record_display_list(display_list_recorder, {});
auto painting_command_executor_type = m_page_client->painting_command_executor_type();
switch (painting_command_executor_type) {