LibWeb+WebContent: Remove "Painting" prefix from command executor names

Painting command executors are defined within the "Painting" namespace,
allowing us to remove this prefix from their names.

This commit performs the following renamings:

- Painting::PaintingCommandExecutor to Painting::CommandExecutor
- Painting::PaintingCommandExecutorCPU to Painting::CommandExecutorCPU
- Painting::PaintingCommandExecutorGPU to Painting::CommandExecutorGPU
This commit is contained in:
Aliaksandr Kalenik 2024-02-15 15:00:43 +01:00 committed by Andreas Kling
parent 11d746a67f
commit cb97eef2cf
Notes: sideshowbarker 2024-07-17 03:03:44 +09:00
10 changed files with 91 additions and 91 deletions

View file

@ -493,6 +493,7 @@ set(SOURCES
Painting/ButtonPaintable.cpp
Painting/CanvasPaintable.cpp
Painting/Command.cpp
Painting/CommandExecutorCPU.cpp
Painting/CommandList.cpp
Painting/CheckBoxPaintable.cpp
Painting/GradientPainting.cpp
@ -507,7 +508,6 @@ set(SOURCES
Painting/Paintable.cpp
Painting/PaintableBox.cpp
Painting/PaintableFragment.cpp
Painting/PaintingCommandExecutorCPU.cpp
Painting/RadioButtonPaintable.cpp
Painting/RecordingPainter.cpp
Painting/SVGPathPaintable.cpp
@ -692,7 +692,7 @@ link_with_locale_data(LibWeb)
if (HAS_ACCELERATED_GRAPHICS)
target_link_libraries(LibWeb PRIVATE ${ACCEL_GFX_LIBS})
target_sources(LibWeb PRIVATE Painting/PaintingCommandExecutorGPU.cpp)
target_sources(LibWeb PRIVATE Painting/CommandExecutorGPU.cpp)
target_link_libraries(LibWeb PRIVATE LibAccelGfx)
target_compile_definitions(LibWeb PRIVATE HAS_ACCELERATED_GRAPHICS)
endif()

View file

@ -8,14 +8,14 @@
#include <LibGfx/StylePainter.h>
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
#include <LibWeb/Painting/CommandExecutorCPU.h>
#include <LibWeb/Painting/FilterPainting.h>
#include <LibWeb/Painting/PaintingCommandExecutorCPU.h>
#include <LibWeb/Painting/RecordingPainter.h>
#include <LibWeb/Painting/ShadowPainting.h>
namespace Web::Painting {
PaintingCommandExecutorCPU::PaintingCommandExecutorCPU(Gfx::Bitmap& bitmap)
CommandExecutorCPU::CommandExecutorCPU(Gfx::Bitmap& bitmap)
: m_target_bitmap(bitmap)
{
stacking_contexts.append({ .painter = AK::make<Gfx::Painter>(bitmap),
@ -24,7 +24,7 @@ PaintingCommandExecutorCPU::PaintingCommandExecutorCPU(Gfx::Bitmap& bitmap)
.scaling_mode = {} });
}
CommandResult PaintingCommandExecutorCPU::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const& color)
CommandResult CommandExecutorCPU::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const& color)
{
auto& painter = this->painter();
for (auto& glyph_or_emoji : glyph_run) {
@ -39,7 +39,7 @@ CommandResult PaintingCommandExecutorCPU::draw_glyph_run(Vector<Gfx::DrawGlyphOr
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_text(Gfx::IntRect const& rect, String const& raw_text, Gfx::TextAlignment alignment, Color const& color, Gfx::TextElision elision, Gfx::TextWrapping wrapping, Optional<NonnullRefPtr<Gfx::Font>> const& font)
CommandResult CommandExecutorCPU::draw_text(Gfx::IntRect const& rect, String const& raw_text, Gfx::TextAlignment alignment, Color const& color, Gfx::TextElision elision, Gfx::TextWrapping wrapping, Optional<NonnullRefPtr<Gfx::Font>> const& font)
{
auto& painter = this->painter();
if (font.has_value()) {
@ -50,28 +50,28 @@ CommandResult PaintingCommandExecutorCPU::draw_text(Gfx::IntRect const& rect, St
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::fill_rect(Gfx::IntRect const& rect, Color const& color)
CommandResult CommandExecutorCPU::fill_rect(Gfx::IntRect const& rect, Color const& color)
{
auto& painter = this->painter();
painter.fill_rect(rect, color);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
CommandResult CommandExecutorCPU::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
{
auto& painter = this->painter();
painter.draw_scaled_bitmap(dst_rect, bitmap, src_rect, 1, scaling_mode);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const& immutable_bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
CommandResult CommandExecutorCPU::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const& immutable_bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
{
auto& painter = this->painter();
painter.draw_scaled_bitmap(dst_rect, immutable_bitmap.bitmap(), src_rect, 1, scaling_mode);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::set_clip_rect(Gfx::IntRect const& rect)
CommandResult CommandExecutorCPU::set_clip_rect(Gfx::IntRect const& rect)
{
auto& painter = this->painter();
painter.clear_clip_rect();
@ -79,13 +79,13 @@ CommandResult PaintingCommandExecutorCPU::set_clip_rect(Gfx::IntRect const& rect
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::clear_clip_rect()
CommandResult CommandExecutorCPU::clear_clip_rect()
{
painter().clear_clip_rect();
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::push_stacking_context(
CommandResult CommandExecutorCPU::push_stacking_context(
float opacity, bool is_fixed_position, Gfx::IntRect const& source_paintable_rect, Gfx::IntPoint post_transform_translation,
CSS::ImageRendering image_rendering, StackingContextTransform transform, Optional<StackingContextMask> mask)
{
@ -174,7 +174,7 @@ CommandResult PaintingCommandExecutorCPU::push_stacking_context(
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::pop_stacking_context()
CommandResult CommandExecutorCPU::pop_stacking_context()
{
ScopeGuard restore_painter = [&] {
painter().restore();
@ -195,7 +195,7 @@ CommandResult PaintingCommandExecutorCPU::pop_stacking_context()
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_linear_gradient(Gfx::IntRect const& gradient_rect, Web::Painting::LinearGradientData const& linear_gradient_data)
CommandResult CommandExecutorCPU::paint_linear_gradient(Gfx::IntRect const& gradient_rect, Web::Painting::LinearGradientData const& linear_gradient_data)
{
auto const& data = linear_gradient_data;
painter().fill_rect_with_linear_gradient(
@ -204,21 +204,21 @@ CommandResult PaintingCommandExecutorCPU::paint_linear_gradient(Gfx::IntRect con
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_outer_box_shadow(PaintOuterBoxShadowParams const& outer_box_shadow_params)
CommandResult CommandExecutorCPU::paint_outer_box_shadow(PaintOuterBoxShadowParams const& outer_box_shadow_params)
{
auto& painter = this->painter();
Web::Painting::paint_outer_box_shadow(painter, outer_box_shadow_params);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_inner_box_shadow(PaintOuterBoxShadowParams const& outer_box_shadow_params)
CommandResult CommandExecutorCPU::paint_inner_box_shadow(PaintOuterBoxShadowParams const& outer_box_shadow_params)
{
auto& painter = this->painter();
Web::Painting::paint_inner_box_shadow(painter, outer_box_shadow_params);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color const& color, int fragment_baseline, Gfx::IntPoint const& draw_location)
CommandResult CommandExecutorCPU::paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color const& color, int fragment_baseline, Gfx::IntPoint const& draw_location)
{
// FIXME: Figure out the maximum bitmap size for all shadows and then allocate it once and reuse it?
auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, shadow_bounding_rect.size());
@ -250,7 +250,7 @@ CommandResult PaintingCommandExecutorCPU::paint_text_shadow(int blur_radius, Gfx
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::CornerRadius const& top_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& top_right_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_right_radius)
CommandResult CommandExecutorCPU::fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::CornerRadius const& top_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& top_right_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_right_radius)
{
Gfx::AntiAliasingPainter aa_painter(painter());
aa_painter.fill_rect_with_rounded_corners(
@ -263,7 +263,7 @@ CommandResult PaintingCommandExecutorCPU::fill_rect_with_rounded_corners(Gfx::In
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::fill_path_using_color(Gfx::Path const& path, Color const& color, Gfx::Painter::WindingRule winding_rule, Gfx::FloatPoint const& aa_translation)
CommandResult CommandExecutorCPU::fill_path_using_color(Gfx::Path const& path, Color const& color, Gfx::Painter::WindingRule winding_rule, Gfx::FloatPoint const& aa_translation)
{
Gfx::AntiAliasingPainter aa_painter(painter());
aa_painter.translate(aa_translation);
@ -271,7 +271,7 @@ CommandResult PaintingCommandExecutorCPU::fill_path_using_color(Gfx::Path const&
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::fill_path_using_paint_style(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, Gfx::Painter::WindingRule winding_rule, float opacity, Gfx::FloatPoint const& aa_translation)
CommandResult CommandExecutorCPU::fill_path_using_paint_style(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, Gfx::Painter::WindingRule winding_rule, float opacity, Gfx::FloatPoint const& aa_translation)
{
Gfx::AntiAliasingPainter aa_painter(painter());
aa_painter.translate(aa_translation);
@ -279,7 +279,7 @@ CommandResult PaintingCommandExecutorCPU::fill_path_using_paint_style(Gfx::Path
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::stroke_path_using_color(Gfx::Path const& path, Color const& color, float thickness, Gfx::FloatPoint const& aa_translation)
CommandResult CommandExecutorCPU::stroke_path_using_color(Gfx::Path const& path, Color const& color, float thickness, Gfx::FloatPoint const& aa_translation)
{
Gfx::AntiAliasingPainter aa_painter(painter());
aa_painter.translate(aa_translation);
@ -287,7 +287,7 @@ CommandResult PaintingCommandExecutorCPU::stroke_path_using_color(Gfx::Path cons
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::stroke_path_using_paint_style(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, float thickness, float opacity, Gfx::FloatPoint const& aa_translation)
CommandResult CommandExecutorCPU::stroke_path_using_paint_style(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, float thickness, float opacity, Gfx::FloatPoint const& aa_translation)
{
Gfx::AntiAliasingPainter aa_painter(painter());
aa_painter.translate(aa_translation);
@ -295,21 +295,21 @@ CommandResult PaintingCommandExecutorCPU::stroke_path_using_paint_style(Gfx::Pat
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_ellipse(Gfx::IntRect const& rect, Color const& color, int thickness)
CommandResult CommandExecutorCPU::draw_ellipse(Gfx::IntRect const& rect, Color const& color, int thickness)
{
Gfx::AntiAliasingPainter aa_painter(painter());
aa_painter.draw_ellipse(rect, color, thickness);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::fill_ellipse(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::BlendMode blend_mode)
CommandResult CommandExecutorCPU::fill_ellipse(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::BlendMode blend_mode)
{
Gfx::AntiAliasingPainter aa_painter(painter());
aa_painter.fill_ellipse(rect, color, blend_mode);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_line(Color const& color, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle style, Color const& alternate_color)
CommandResult CommandExecutorCPU::draw_line(Color const& color, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle style, Color const& alternate_color)
{
if (style == Gfx::Painter::LineStyle::Dotted) {
Gfx::AntiAliasingPainter aa_painter(painter());
@ -320,19 +320,19 @@ CommandResult PaintingCommandExecutorCPU::draw_line(Color const& color, Gfx::Int
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_signed_distance_field(Gfx::IntRect const& rect, Color const& color, Gfx::GrayscaleBitmap const& sdf, float smoothing)
CommandResult CommandExecutorCPU::draw_signed_distance_field(Gfx::IntRect const& rect, Color const& color, Gfx::GrayscaleBitmap const& sdf, float smoothing)
{
painter().draw_signed_distance_field(rect, color, sdf, smoothing);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_frame(Gfx::IntRect const& rect, Palette const& palette, Gfx::FrameStyle style)
CommandResult CommandExecutorCPU::paint_frame(Gfx::IntRect const& rect, Palette const& palette, Gfx::FrameStyle style)
{
Gfx::StylePainter::paint_frame(painter(), rect, palette, style);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter)
CommandResult CommandExecutorCPU::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter)
{
auto& painter = this->painter();
@ -369,31 +369,31 @@ CommandResult PaintingCommandExecutorCPU::apply_backdrop_filter(Gfx::IntRect con
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_rect(Gfx::IntRect const& rect, Color const& color, bool rough)
CommandResult CommandExecutorCPU::draw_rect(Gfx::IntRect const& rect, Color const& color, bool rough)
{
painter().draw_rect(rect, color, rough);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_radial_gradient(Gfx::IntRect const& rect, Web::Painting::RadialGradientData const& radial_gradient_data, Gfx::IntPoint const& center, Gfx::IntSize const& size)
CommandResult CommandExecutorCPU::paint_radial_gradient(Gfx::IntRect const& rect, Web::Painting::RadialGradientData const& radial_gradient_data, Gfx::IntPoint const& center, Gfx::IntSize const& size)
{
painter().fill_rect_with_radial_gradient(rect, radial_gradient_data.color_stops.list, center, size, radial_gradient_data.color_stops.repeat_length);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_conic_gradient(Gfx::IntRect const& rect, Web::Painting::ConicGradientData const& conic_gradient_data, Gfx::IntPoint const& position)
CommandResult CommandExecutorCPU::paint_conic_gradient(Gfx::IntRect const& rect, Web::Painting::ConicGradientData const& conic_gradient_data, Gfx::IntPoint const& position)
{
painter().fill_rect_with_conic_gradient(rect, conic_gradient_data.color_stops.list, position, conic_gradient_data.start_angle, conic_gradient_data.color_stops.repeat_length);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const& color, int amplitude, int thickness)
CommandResult CommandExecutorCPU::draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const& color, int amplitude, int thickness)
{
painter().draw_triangle_wave(p1, p2, color, amplitude, thickness);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::sample_under_corners(u32 id, CornerRadii const& corner_radii, Gfx::IntRect const& border_rect, CornerClip corner_clip)
CommandResult CommandExecutorCPU::sample_under_corners(u32 id, CornerRadii const& corner_radii, Gfx::IntRect const& border_rect, CornerClip corner_clip)
{
m_corner_clippers.resize(id + 1);
auto clipper = BorderRadiusCornerClipper::create(corner_radii, border_rect.to_type<DevicePixels>(), corner_clip);
@ -402,20 +402,20 @@ CommandResult PaintingCommandExecutorCPU::sample_under_corners(u32 id, CornerRad
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::blit_corner_clipping(u32 id)
CommandResult CommandExecutorCPU::blit_corner_clipping(u32 id)
{
m_corner_clippers[id]->blit_corner_clipping(painter());
m_corner_clippers[id] = nullptr;
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorCPU::paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data)
CommandResult CommandExecutorCPU::paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data)
{
paint_all_borders(painter(), border_rect, corner_radii, borders_data);
return CommandResult::Continue;
}
bool PaintingCommandExecutorCPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
bool CommandExecutorCPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
{
return !painter().clip_rect().intersects(rect.translated(painter().translation()));
}

View file

@ -11,7 +11,7 @@
namespace Web::Painting {
class PaintingCommandExecutorCPU : public PaintingCommandExecutor {
class CommandExecutorCPU : public CommandExecutor {
public:
CommandResult draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const&) override;
CommandResult draw_text(Gfx::IntRect const& rect, String const& raw_text, Gfx::TextAlignment alignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional<NonnullRefPtr<Gfx::Font>> const&) override;
@ -53,7 +53,7 @@ public:
bool needs_update_immutable_bitmap_texture_cache() const override { return false; }
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override {};
PaintingCommandExecutorCPU(Gfx::Bitmap& bitmap);
CommandExecutorCPU(Gfx::Bitmap& bitmap);
private:
Gfx::Bitmap& m_target_bitmap;

View file

@ -6,11 +6,11 @@
#include <LibAccelGfx/GlyphAtlas.h>
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
#include <LibWeb/Painting/PaintingCommandExecutorGPU.h>
#include <LibWeb/Painting/CommandExecutorGPU.h>
namespace Web::Painting {
PaintingCommandExecutorGPU::PaintingCommandExecutorGPU(AccelGfx::Context& context, Gfx::Bitmap& bitmap)
CommandExecutorGPU::CommandExecutorGPU(AccelGfx::Context& context, Gfx::Bitmap& bitmap)
: m_target_bitmap(bitmap)
, m_context(context)
{
@ -24,26 +24,26 @@ PaintingCommandExecutorGPU::PaintingCommandExecutorGPU(AccelGfx::Context& contex
.transform = {} });
}
PaintingCommandExecutorGPU::~PaintingCommandExecutorGPU()
CommandExecutorGPU::~CommandExecutorGPU()
{
m_context.activate();
VERIFY(m_stacking_contexts.size() == 1);
painter().flush(m_target_bitmap);
}
CommandResult PaintingCommandExecutorGPU::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const& color)
CommandResult CommandExecutorGPU::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const& color)
{
painter().draw_glyph_run(glyph_run, color);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::draw_text(Gfx::IntRect const&, String const&, Gfx::TextAlignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional<NonnullRefPtr<Gfx::Font>> const&)
CommandResult CommandExecutorGPU::draw_text(Gfx::IntRect const&, String const&, Gfx::TextAlignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional<NonnullRefPtr<Gfx::Font>> const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::fill_rect(Gfx::IntRect const& rect, Color const& color)
CommandResult CommandExecutorGPU::fill_rect(Gfx::IntRect const& rect, Color const& color)
{
painter().fill_rect(rect, color);
return CommandResult::Continue;
@ -64,31 +64,31 @@ static AccelGfx::Painter::ScalingMode to_accelgfx_scaling_mode(Gfx::Painter::Sca
}
}
CommandResult PaintingCommandExecutorGPU::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
CommandResult CommandExecutorGPU::draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
{
painter().draw_scaled_bitmap(dst_rect, bitmap, src_rect, to_accelgfx_scaling_mode(scaling_mode));
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const& immutable_bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
CommandResult CommandExecutorGPU::draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const& immutable_bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode)
{
painter().draw_scaled_immutable_bitmap(dst_rect, immutable_bitmap, src_rect, to_accelgfx_scaling_mode(scaling_mode));
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::set_clip_rect(Gfx::IntRect const& rect)
CommandResult CommandExecutorGPU::set_clip_rect(Gfx::IntRect const& rect)
{
painter().set_clip_rect(rect);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::clear_clip_rect()
CommandResult CommandExecutorGPU::clear_clip_rect()
{
painter().clear_clip_rect();
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::push_stacking_context(float opacity, bool is_fixed_position, Gfx::IntRect const& source_paintable_rect, Gfx::IntPoint post_transform_translation, CSS::ImageRendering, StackingContextTransform transform, Optional<StackingContextMask>)
CommandResult CommandExecutorGPU::push_stacking_context(float opacity, bool is_fixed_position, Gfx::IntRect const& source_paintable_rect, Gfx::IntPoint post_transform_translation, CSS::ImageRendering, StackingContextTransform transform, Optional<StackingContextMask>)
{
if (source_paintable_rect.is_empty())
return CommandResult::SkipStackingContext;
@ -131,7 +131,7 @@ CommandResult PaintingCommandExecutorGPU::push_stacking_context(float opacity, b
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::pop_stacking_context()
CommandResult CommandExecutorGPU::pop_stacking_context()
{
auto stacking_context = m_stacking_contexts.take_last();
VERIFY(stacking_context.stacking_context_depth == 0);
@ -143,25 +143,25 @@ CommandResult PaintingCommandExecutorGPU::pop_stacking_context()
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_linear_gradient(Gfx::IntRect const& rect, Web::Painting::LinearGradientData const& data)
CommandResult CommandExecutorGPU::paint_linear_gradient(Gfx::IntRect const& rect, Web::Painting::LinearGradientData const& data)
{
painter().fill_rect_with_linear_gradient(rect, data.color_stops.list, data.gradient_angle, data.color_stops.repeat_length);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_outer_box_shadow(PaintOuterBoxShadowParams const&)
CommandResult CommandExecutorGPU::paint_outer_box_shadow(PaintOuterBoxShadowParams const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_inner_box_shadow(PaintOuterBoxShadowParams const&)
CommandResult CommandExecutorGPU::paint_inner_box_shadow(PaintOuterBoxShadowParams const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color const& color, int fragment_baseline, Gfx::IntPoint const& draw_location)
CommandResult CommandExecutorGPU::paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color const& color, int fragment_baseline, Gfx::IntPoint const& draw_location)
{
auto text_shadow_canvas = AccelGfx::Canvas::create(shadow_bounding_rect.size());
auto text_shadow_painter = AccelGfx::Painter::create(m_context, text_shadow_canvas);
@ -184,7 +184,7 @@ CommandResult PaintingCommandExecutorGPU::paint_text_shadow(int blur_radius, Gfx
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::CornerRadius const& top_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& top_right_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_right_radius)
CommandResult CommandExecutorGPU::fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::CornerRadius const& top_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& top_right_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_left_radius, Gfx::AntiAliasingPainter::CornerRadius const& bottom_right_radius)
{
painter().fill_rect_with_rounded_corners(
rect, color,
@ -195,37 +195,37 @@ CommandResult PaintingCommandExecutorGPU::fill_rect_with_rounded_corners(Gfx::In
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::fill_path_using_color(Gfx::Path const&, Color const&, Gfx::Painter::WindingRule, Gfx::FloatPoint const&)
CommandResult CommandExecutorGPU::fill_path_using_color(Gfx::Path const&, Color const&, Gfx::Painter::WindingRule, Gfx::FloatPoint const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::fill_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const&, Gfx::Painter::WindingRule, float, Gfx::FloatPoint const&)
CommandResult CommandExecutorGPU::fill_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const&, Gfx::Painter::WindingRule, float, Gfx::FloatPoint const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::stroke_path_using_color(Gfx::Path const&, Color const&, float, Gfx::FloatPoint const&)
CommandResult CommandExecutorGPU::stroke_path_using_color(Gfx::Path const&, Color const&, float, Gfx::FloatPoint const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::stroke_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const&, float, float, Gfx::FloatPoint const&)
CommandResult CommandExecutorGPU::stroke_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const&, float, float, Gfx::FloatPoint const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::draw_ellipse(Gfx::IntRect const&, Color const&, int)
CommandResult CommandExecutorGPU::draw_ellipse(Gfx::IntRect const&, Color const&, int)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::fill_ellipse(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::BlendMode)
CommandResult CommandExecutorGPU::fill_ellipse(Gfx::IntRect const& rect, Color const& color, Gfx::AntiAliasingPainter::BlendMode)
{
auto horizontal_radius = static_cast<float>(rect.width() / 2);
auto vertical_radius = static_cast<float>(rect.height() / 2);
@ -238,56 +238,56 @@ CommandResult PaintingCommandExecutorGPU::fill_ellipse(Gfx::IntRect const& rect,
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::draw_line(Color const& color, Gfx::IntPoint const& a, Gfx::IntPoint const& b, int thickness, Gfx::Painter::LineStyle, Color const&)
CommandResult CommandExecutorGPU::draw_line(Color const& color, Gfx::IntPoint const& a, Gfx::IntPoint const& b, int thickness, Gfx::Painter::LineStyle, Color const&)
{
// FIXME: Pass line style and alternate color once AccelGfx::Painter supports it
painter().draw_line(a, b, thickness, color);
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::draw_signed_distance_field(Gfx::IntRect const&, Color const&, Gfx::GrayscaleBitmap const&, float)
CommandResult CommandExecutorGPU::draw_signed_distance_field(Gfx::IntRect const&, Color const&, Gfx::GrayscaleBitmap const&, float)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_frame(Gfx::IntRect const&, Palette const&, Gfx::FrameStyle)
CommandResult CommandExecutorGPU::paint_frame(Gfx::IntRect const&, Palette const&, Gfx::FrameStyle)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::apply_backdrop_filter(Gfx::IntRect const&, Web::CSS::ResolvedBackdropFilter const&)
CommandResult CommandExecutorGPU::apply_backdrop_filter(Gfx::IntRect const&, Web::CSS::ResolvedBackdropFilter const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::draw_rect(Gfx::IntRect const&, Color const&, bool)
CommandResult CommandExecutorGPU::draw_rect(Gfx::IntRect const&, Color const&, bool)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_radial_gradient(Gfx::IntRect const&, Web::Painting::RadialGradientData const&, Gfx::IntPoint const&, Gfx::IntSize const&)
CommandResult CommandExecutorGPU::paint_radial_gradient(Gfx::IntRect const&, Web::Painting::RadialGradientData const&, Gfx::IntPoint const&, Gfx::IntSize const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_conic_gradient(Gfx::IntRect const&, Web::Painting::ConicGradientData const&, Gfx::IntPoint const&)
CommandResult CommandExecutorGPU::paint_conic_gradient(Gfx::IntRect const&, Web::Painting::ConicGradientData const&, Gfx::IntPoint const&)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::draw_triangle_wave(Gfx::IntPoint const&, Gfx::IntPoint const&, Color const&, int, int)
CommandResult CommandExecutorGPU::draw_triangle_wave(Gfx::IntPoint const&, Gfx::IntPoint const&, Color const&, int, int)
{
// FIXME
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::sample_under_corners(u32 id, CornerRadii const& corner_radii, Gfx::IntRect const& border_rect, CornerClip)
CommandResult CommandExecutorGPU::sample_under_corners(u32 id, CornerRadii const& corner_radii, Gfx::IntRect const& border_rect, CornerClip)
{
m_corner_clippers.resize(id + 1);
m_corner_clippers[id] = make<BorderRadiusCornerClipper>();
@ -343,7 +343,7 @@ CommandResult PaintingCommandExecutorGPU::sample_under_corners(u32 id, CornerRad
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::blit_corner_clipping(u32 id)
CommandResult CommandExecutorGPU::blit_corner_clipping(u32 id)
{
auto const& corner_clipper = *m_corner_clippers[id];
auto const& corner_sample_canvas = *corner_clipper.corners_sample_canvas;
@ -361,7 +361,7 @@ CommandResult PaintingCommandExecutorGPU::blit_corner_clipping(u32 id)
return CommandResult::Continue;
}
CommandResult PaintingCommandExecutorGPU::paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data)
CommandResult CommandExecutorGPU::paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data)
{
// FIXME: Add support for corner radiuses
(void)corner_radii;
@ -403,23 +403,23 @@ CommandResult PaintingCommandExecutorGPU::paint_borders(DevicePixelRect const& b
return CommandResult::Continue;
}
bool PaintingCommandExecutorGPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
bool CommandExecutorGPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
{
auto translation = painter().transform().translation().to_type<int>();
return !painter().clip_rect().intersects(rect.translated(translation));
}
void PaintingCommandExecutorGPU::prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_glyphs)
void CommandExecutorGPU::prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_glyphs)
{
AccelGfx::GlyphAtlas::the().update(unique_glyphs);
}
void PaintingCommandExecutorGPU::prepare_to_execute()
void CommandExecutorGPU::prepare_to_execute()
{
m_context.activate();
}
void PaintingCommandExecutorGPU::update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>& immutable_bitmaps)
void CommandExecutorGPU::update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>& immutable_bitmaps)
{
painter().update_immutable_bitmap_texture_cache(immutable_bitmaps);
}

View file

@ -12,7 +12,7 @@
namespace Web::Painting {
class PaintingCommandExecutorGPU : public PaintingCommandExecutor {
class CommandExecutorGPU : public CommandExecutor {
public:
CommandResult draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const&) override;
CommandResult draw_text(Gfx::IntRect const& rect, String const& raw_text, Gfx::TextAlignment alignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional<NonnullRefPtr<Gfx::Font>> const&) override;
@ -56,8 +56,8 @@ public:
bool needs_update_immutable_bitmap_texture_cache() const override { return true; }
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override;
PaintingCommandExecutorGPU(AccelGfx::Context&, Gfx::Bitmap& bitmap);
~PaintingCommandExecutorGPU() override;
CommandExecutorGPU(AccelGfx::Context&, Gfx::Bitmap& bitmap);
~CommandExecutorGPU() override;
private:
Gfx::Bitmap& m_target_bitmap;

View file

@ -39,7 +39,7 @@ void CommandList::apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_f
}
}
void CommandList::execute(PaintingCommandExecutor& executor)
void CommandList::execute(CommandExecutor& executor)
{
executor.prepare_to_execute();

View file

@ -43,9 +43,9 @@ enum class CommandResult {
SkipStackingContext,
};
class PaintingCommandExecutor {
class CommandExecutor {
public:
virtual ~PaintingCommandExecutor() = default;
virtual ~CommandExecutor() = default;
virtual CommandResult draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const&) = 0;
virtual CommandResult draw_text(Gfx::IntRect const&, String const&, Gfx::TextAlignment alignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional<NonnullRefPtr<Gfx::Font>> const&) = 0;
@ -96,7 +96,7 @@ public:
void append(Command&& command, Optional<i32> scroll_frame_id);
void apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_frame_id);
void execute(PaintingCommandExecutor&);
void execute(CommandExecutor&);
private:
struct CommandWithScrollFrame {

View file

@ -5,7 +5,7 @@
*/
#include <LibWeb/Layout/ImageBox.h>
#include <LibWeb/Painting/PaintingCommandExecutorCPU.h>
#include <LibWeb/Painting/CommandExecutorCPU.h>
#include <LibWeb/Painting/SVGGraphicsPaintable.h>
#include <LibWeb/Painting/StackingContext.h>
#include <LibWeb/SVG/SVGMaskElement.h>
@ -98,7 +98,7 @@ RefPtr<Gfx::Bitmap> SVGGraphicsPaintable::calculate_mask(PaintContext& context,
auto paint_context = context.clone(recording_painter);
paint_context.set_svg_transform(graphics_element.get_transform());
StackingContext::paint_node_as_stacking_context(mask_paintable, paint_context);
PaintingCommandExecutorCPU executor { *mask_bitmap };
CommandExecutorCPU executor { *mask_bitmap };
painting_commands.execute(executor);
}
}

View file

@ -15,8 +15,8 @@
#include <LibWeb/HTML/TraversableNavigable.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/Painting/CommandExecutorCPU.h>
#include <LibWeb/Painting/PaintContext.h>
#include <LibWeb/Painting/PaintingCommandExecutorCPU.h>
#include <LibWeb/Painting/ViewportPaintable.h>
#include <LibWeb/SVG/SVGDecodedImageData.h>
#include <LibWeb/SVG/SVGSVGElement.h>
@ -135,7 +135,7 @@ RefPtr<Gfx::Bitmap> SVGDecodedImageData::render(Gfx::IntSize size) const
m_document->paintable()->paint_all_phases(context);
Painting::PaintingCommandExecutorCPU executor { *bitmap };
Painting::CommandExecutorCPU executor { *bitmap };
painting_commands.execute(executor);
return bitmap;

View file

@ -19,8 +19,8 @@
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/TraversableNavigable.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/CommandExecutorCPU.h>
#include <LibWeb/Painting/PaintableBox.h>
#include <LibWeb/Painting/PaintingCommandExecutorCPU.h>
#include <LibWeb/Painting/ViewportPaintable.h>
#include <LibWeb/Platform/Timer.h>
#include <LibWebView/Attribute.h>
@ -32,7 +32,7 @@
#include <WebContent/WebDriverConnection.h>
#ifdef HAS_ACCELERATED_GRAPHICS
# include <LibWeb/Painting/PaintingCommandExecutorGPU.h>
# include <LibWeb/Painting/CommandExecutorGPU.h>
#endif
namespace WebContent {
@ -203,7 +203,7 @@ void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& ta
if (s_use_gpu_painter) {
#ifdef HAS_ACCELERATED_GRAPHICS
Web::Painting::PaintingCommandExecutorGPU painting_command_executor(*m_accelerated_graphics_context, target);
Web::Painting::CommandExecutorGPU painting_command_executor(*m_accelerated_graphics_context, target);
painting_commands.execute(painting_command_executor);
#else
static bool has_warned_about_configuration = false;
@ -214,7 +214,7 @@ void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& ta
}
#endif
} else {
Web::Painting::PaintingCommandExecutorCPU painting_command_executor(target);
Web::Painting::CommandExecutorCPU painting_command_executor(target);
painting_commands.execute(painting_command_executor);
}
}