diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp index 0dd412e9782..346b8d6a713 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp @@ -24,18 +24,19 @@ CommandExecutorCPU::CommandExecutorCPU(Gfx::Bitmap& bitmap) .scaling_mode = {} }); } -CommandResult CommandExecutorCPU::draw_glyph_run(Vector const& glyph_run, Color const& color, Gfx::FloatPoint translation, double scale) +CommandResult CommandExecutorCPU::draw_glyph_run(DrawGlyphRun const& command) { auto& painter = this->painter(); - for (auto& glyph_or_emoji : glyph_run) { + auto const& glyphs = command.glyph_run->glyphs(); + for (auto& glyph_or_emoji : glyphs) { auto transformed_glyph = glyph_or_emoji; transformed_glyph.visit([&](auto& glyph) { - glyph.position = glyph.position.scaled(scale).translated(translation); - glyph.font = glyph.font->with_size(glyph.font->point_size() * static_cast(scale)); + glyph.position = glyph.position.scaled(command.scale).translated(command.translation); + glyph.font = glyph.font->with_size(glyph.font->point_size() * static_cast(command.scale)); }); if (glyph_or_emoji.has()) { auto& glyph = transformed_glyph.get(); - painter.draw_glyph(glyph.position, glyph.code_point, *glyph.font, color); + painter.draw_glyph(glyph.position, glyph.code_point, *glyph.font, command.color); } else { auto& emoji = transformed_glyph.get(); painter.draw_emoji(emoji.position.to_type(), *emoji.emoji, *emoji.font); @@ -44,13 +45,13 @@ CommandResult CommandExecutorCPU::draw_glyph_run(Vector c return CommandResult::Continue; } -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> const& font) +CommandResult CommandExecutorCPU::draw_text(DrawText const& command) { auto& painter = this->painter(); - if (font.has_value()) { - painter.draw_text(rect, raw_text, *font, alignment, color, elision, wrapping); + if (command.font.has_value()) { + painter.draw_text(command.rect, command.raw_text, *command.font, command.alignment, command.color, command.elision, command.wrapping); } else { - painter.draw_text(rect, raw_text, alignment, color, elision, wrapping); + painter.draw_text(command.rect, command.raw_text, command.alignment, command.color, command.elision, command.wrapping); } return CommandResult::Continue; } @@ -77,85 +78,83 @@ void apply_clip_paths_to_painter(Gfx::IntRect const& rect, Callback callback, Ve } } -CommandResult CommandExecutorCPU::fill_rect(Gfx::IntRect const& rect, Color const& color, Vector const& clip_paths) +CommandResult CommandExecutorCPU::fill_rect(FillRect const& command) { auto paint_op = [&](Gfx::Painter& painter) { - painter.fill_rect(rect, color); + painter.fill_rect(command.rect, command.color); }; - if (clip_paths.is_empty()) { + if (command.clip_paths.is_empty()) { paint_op(painter()); } else { - apply_clip_paths_to_painter(rect, paint_op, clip_paths, painter()); + apply_clip_paths_to_painter(command.rect, paint_op, command.clip_paths, painter()); } return CommandResult::Continue; } -CommandResult CommandExecutorCPU::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(DrawScaledBitmap const& command) { auto& painter = this->painter(); - painter.draw_scaled_bitmap(dst_rect, bitmap, src_rect, 1, scaling_mode); + painter.draw_scaled_bitmap(command.dst_rect, command.bitmap, command.src_rect, 1, command.scaling_mode); return CommandResult::Continue; } -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, Vector const& clip_paths) +CommandResult CommandExecutorCPU::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command) { auto paint_op = [&](Gfx::Painter& painter) { - painter.draw_scaled_bitmap(dst_rect, immutable_bitmap.bitmap(), src_rect, 1, scaling_mode); + painter.draw_scaled_bitmap(command.dst_rect, command.bitmap->bitmap(), command.src_rect, 1, command.scaling_mode); }; - if (clip_paths.is_empty()) { + if (command.clip_paths.is_empty()) { paint_op(painter()); } else { - apply_clip_paths_to_painter(dst_rect, paint_op, clip_paths, painter()); + apply_clip_paths_to_painter(command.dst_rect, paint_op, command.clip_paths, painter()); } return CommandResult::Continue; } -CommandResult CommandExecutorCPU::set_clip_rect(Gfx::IntRect const& rect) +CommandResult CommandExecutorCPU::set_clip_rect(SetClipRect const& command) { auto& painter = this->painter(); painter.clear_clip_rect(); - painter.add_clip_rect(rect); + painter.add_clip_rect(command.rect); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::clear_clip_rect() +CommandResult CommandExecutorCPU::clear_clip_rect(ClearClipRect const&) { painter().clear_clip_rect(); return CommandResult::Continue; } -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 mask) +CommandResult CommandExecutorCPU::push_stacking_context(PushStackingContext const& command) { painter().save(); - if (is_fixed_position) + if (command.is_fixed_position) painter().translate(-painter().translation()); - if (mask.has_value()) { + if (command.mask.has_value()) { // TODO: Support masks and other stacking context features at the same time. // Note: Currently only SVG masking is implemented (which does not use CSS transforms anyway). - auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, mask->mask_bitmap->size()); + auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, command.mask->mask_bitmap->size()); if (bitmap_or_error.is_error()) return CommandResult::Continue; auto bitmap = bitmap_or_error.release_value(); stacking_contexts.append(StackingContext { .painter = AK::make(bitmap), .opacity = 1, - .destination = source_paintable_rect.translated(post_transform_translation), + .destination = command.source_paintable_rect.translated(command.post_transform_translation), .scaling_mode = Gfx::Painter::ScalingMode::None, - .mask = mask }); - painter().translate(-source_paintable_rect.location()); + .mask = command.mask }); + painter().translate(-command.source_paintable_rect.location()); return CommandResult::Continue; } // FIXME: This extracts the affine 2D part of the full transformation matrix. // Use the whole matrix when we get better transformation support in LibGfx or use LibGL for drawing the bitmap - auto affine_transform = Gfx::extract_2d_affine_transform(transform.matrix); + auto affine_transform = Gfx::extract_2d_affine_transform(command.transform.matrix); - if (opacity == 1.0f && affine_transform.is_identity_or_translation()) { + if (command.opacity == 1.0f && affine_transform.is_identity_or_translation()) { // OPTIMIZATION: This is a simple translation use previous stacking context's painter. - painter().translate(affine_transform.translation().to_rounded() + post_transform_translation); + painter().translate(affine_transform.translation().to_rounded() + command.post_transform_translation); stacking_contexts.append(StackingContext { .painter = MaybeOwned(painter()), .opacity = 1, @@ -165,8 +164,8 @@ CommandResult CommandExecutorCPU::push_stacking_context( } auto& current_painter = this->painter(); - auto source_rect = source_paintable_rect.to_type().translated(-transform.origin); - auto transformed_destination_rect = affine_transform.map(source_rect).translated(transform.origin); + auto source_rect = command.source_paintable_rect.to_type().translated(-command.transform.origin); + auto transformed_destination_rect = affine_transform.map(source_rect).translated(command.transform.origin); auto destination_rect = transformed_destination_rect.to_rounded(); // FIXME: We should find a way to scale the paintable, rather than paint into a separate bitmap, @@ -205,15 +204,15 @@ CommandResult CommandExecutorCPU::push_stacking_context( auto bitmap = bitmap_or_error.release_value(); stacking_contexts.append(StackingContext { .painter = AK::make(bitmap), - .opacity = opacity, - .destination = destination_rect.translated(post_transform_translation), - .scaling_mode = CSS::to_gfx_scaling_mode(image_rendering, destination_rect, destination_rect) }); - painter().translate(-source_paintable_rect.location() + destination_clipped_fixup.to_type()); + .opacity = command.opacity, + .destination = destination_rect.translated(command.post_transform_translation), + .scaling_mode = CSS::to_gfx_scaling_mode(command.image_rendering, destination_rect, destination_rect) }); + painter().translate(-command.source_paintable_rect.location() + destination_clipped_fixup.to_type()); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::pop_stacking_context() +CommandResult CommandExecutorCPU::pop_stacking_context(PopStackingContext const&) { ScopeGuard restore_painter = [&] { painter().restore(); @@ -234,53 +233,54 @@ CommandResult CommandExecutorCPU::pop_stacking_context() return CommandResult::Continue; } -CommandResult CommandExecutorCPU::paint_linear_gradient(Gfx::IntRect const& gradient_rect, Web::Painting::LinearGradientData const& linear_gradient_data, Vector const& clip_paths) +CommandResult CommandExecutorCPU::paint_linear_gradient(PaintLinearGradient const& command) { + auto const& linear_gradient_data = command.linear_gradient_data; auto paint_op = [&](Gfx::Painter& painter) { painter.fill_rect_with_linear_gradient( - gradient_rect, linear_gradient_data.color_stops.list, + command.gradient_rect, linear_gradient_data.color_stops.list, linear_gradient_data.gradient_angle, linear_gradient_data.color_stops.repeat_length); }; - if (clip_paths.is_empty()) { + if (command.clip_paths.is_empty()) { paint_op(painter()); } else { - apply_clip_paths_to_painter(gradient_rect, paint_op, clip_paths, painter()); + apply_clip_paths_to_painter(command.gradient_rect, paint_op, command.clip_paths, painter()); } return CommandResult::Continue; } -CommandResult CommandExecutorCPU::paint_outer_box_shadow(PaintOuterBoxShadowParams const& outer_box_shadow_params) +CommandResult CommandExecutorCPU::paint_outer_box_shadow(PaintOuterBoxShadow const& command) { auto& painter = this->painter(); - Web::Painting::paint_outer_box_shadow(painter, outer_box_shadow_params); + Web::Painting::paint_outer_box_shadow(painter, command.outer_box_shadow_params); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::paint_inner_box_shadow(PaintOuterBoxShadowParams const& outer_box_shadow_params) +CommandResult CommandExecutorCPU::paint_inner_box_shadow(PaintInnerBoxShadow const& command) { auto& painter = this->painter(); - Web::Painting::paint_inner_box_shadow(painter, outer_box_shadow_params); + Web::Painting::paint_inner_box_shadow(painter, command.outer_box_shadow_params); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span glyph_run, Color const& color, int fragment_baseline, Gfx::IntPoint const& draw_location) +CommandResult CommandExecutorCPU::paint_text_shadow(PaintTextShadow const& command) { // 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()); + auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, command.shadow_bounding_rect.size()); if (maybe_shadow_bitmap.is_error()) { - dbgln("Unable to allocate temporary bitmap {} for text-shadow rendering: {}", shadow_bounding_rect.size(), maybe_shadow_bitmap.error()); + dbgln("Unable to allocate temporary bitmap {} for text-shadow rendering: {}", command.shadow_bounding_rect.size(), maybe_shadow_bitmap.error()); return CommandResult::Continue; } auto shadow_bitmap = maybe_shadow_bitmap.release_value(); Gfx::Painter shadow_painter { *shadow_bitmap }; // FIXME: "Spread" the shadow somehow. - Gfx::IntPoint const baseline_start(text_rect.x(), text_rect.y() + fragment_baseline); + Gfx::IntPoint const baseline_start(command.text_rect.x(), command.text_rect.y() + command.fragment_baseline); shadow_painter.translate(baseline_start); - for (auto const& glyph_or_emoji : glyph_run) { + for (auto const& glyph_or_emoji : command.glyph_run) { if (glyph_or_emoji.has()) { auto const& glyph = glyph_or_emoji.get(); - shadow_painter.draw_glyph(glyph.position, glyph.code_point, *glyph.font, color); + shadow_painter.draw_glyph(glyph.position, glyph.code_point, *glyph.font, command.color); } else { auto const& emoji = glyph_or_emoji.get(); shadow_painter.draw_emoji(emoji.position.to_type(), *emoji.emoji, *emoji.font); @@ -289,96 +289,96 @@ CommandResult CommandExecutorCPU::paint_text_shadow(int blur_radius, Gfx::IntRec // Blur Gfx::StackBlurFilter filter(*shadow_bitmap); - filter.process_rgba(blur_radius, color); + filter.process_rgba(command.blur_radius, command.color); - painter().blit(draw_location, *shadow_bitmap, shadow_bounding_rect); + painter().blit(command.draw_location, *shadow_bitmap, command.shadow_bounding_rect); return CommandResult::Continue; } -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, Vector const& clip_paths) +CommandResult CommandExecutorCPU::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command) { auto paint_op = [&](Gfx::Painter& painter) { Gfx::AntiAliasingPainter aa_painter(painter); aa_painter.fill_rect_with_rounded_corners( - rect, - color, - top_left_radius, - top_right_radius, - bottom_right_radius, - bottom_left_radius); + command.rect, + command.color, + command.top_left_radius, + command.top_right_radius, + command.bottom_right_radius, + command.bottom_left_radius); }; - if (clip_paths.is_empty()) { + if (command.clip_paths.is_empty()) { paint_op(painter()); } else { - apply_clip_paths_to_painter(rect, paint_op, clip_paths, painter()); + apply_clip_paths_to_painter(command.rect, paint_op, command.clip_paths, painter()); } return CommandResult::Continue; } -CommandResult CommandExecutorCPU::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(FillPathUsingColor const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); - aa_painter.translate(aa_translation); - aa_painter.fill_path(path, color, winding_rule); + aa_painter.translate(command.aa_translation); + aa_painter.fill_path(command.path, command.color, command.winding_rule); return CommandResult::Continue; } -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) +CommandResult CommandExecutorCPU::fill_path_using_paint_style(FillPathUsingPaintStyle const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); - aa_painter.translate(aa_translation); - aa_painter.fill_path(path, paint_style, opacity, winding_rule); + aa_painter.translate(command.aa_translation); + aa_painter.fill_path(command.path, command.paint_style, command.opacity, command.winding_rule); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::stroke_path_using_color(Gfx::Path const& path, Color const& color, float thickness, Gfx::FloatPoint const& aa_translation) +CommandResult CommandExecutorCPU::stroke_path_using_color(StrokePathUsingColor const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); - aa_painter.translate(aa_translation); - aa_painter.stroke_path(path, color, thickness); + aa_painter.translate(command.aa_translation); + aa_painter.stroke_path(command.path, command.color, command.thickness); return CommandResult::Continue; } -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) +CommandResult CommandExecutorCPU::stroke_path_using_paint_style(StrokePathUsingPaintStyle const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); - aa_painter.translate(aa_translation); - aa_painter.stroke_path(path, paint_style, thickness, opacity); + aa_painter.translate(command.aa_translation); + aa_painter.stroke_path(command.path, command.paint_style, command.thickness, command.opacity); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::draw_ellipse(Gfx::IntRect const& rect, Color const& color, int thickness) +CommandResult CommandExecutorCPU::draw_ellipse(DrawEllipse const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); - aa_painter.draw_ellipse(rect, color, thickness); + aa_painter.draw_ellipse(command.rect, command.color, command.thickness); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::fill_ellipse(Gfx::IntRect const& rect, Color const& color) +CommandResult CommandExecutorCPU::fill_ellipse(FillEllipse const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); - aa_painter.fill_ellipse(rect, color); + aa_painter.fill_ellipse(command.rect, command.color); return CommandResult::Continue; } -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) +CommandResult CommandExecutorCPU::draw_line(DrawLine const& command) { - if (style == Gfx::Painter::LineStyle::Dotted) { + if (command.style == Gfx::Painter::LineStyle::Dotted) { Gfx::AntiAliasingPainter aa_painter(painter()); - aa_painter.draw_line(from, to, color, thickness, style, alternate_color); + aa_painter.draw_line(command.from, command.to, command.color, command.thickness, command.style, command.alternate_color); } else { - painter().draw_line(from, to, color, thickness, style, alternate_color); + painter().draw_line(command.from, command.to, command.color, command.thickness, command.style, command.alternate_color); } return CommandResult::Continue; } -CommandResult CommandExecutorCPU::draw_signed_distance_field(Gfx::IntRect const& rect, Color const& color, Gfx::GrayscaleBitmap const& sdf, float smoothing) +CommandResult CommandExecutorCPU::draw_signed_distance_field(DrawSignedDistanceField const& command) { - painter().draw_signed_distance_field(rect, color, sdf, smoothing); + painter().draw_signed_distance_field(command.rect, command.color, command.sdf, command.smoothing); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter) +CommandResult CommandExecutorCPU::apply_backdrop_filter(ApplyBackdropFilter const& command) { auto& painter = this->painter(); @@ -392,7 +392,7 @@ CommandResult CommandExecutorCPU::apply_backdrop_filter(Gfx::IntRect const& back // 1. Copy the Backdrop Root Image into a temporary buffer, such as a raster image. Call this buffer T’. Gfx::IntRect actual_region {}; - auto maybe_backdrop_bitmap = painter.get_region_bitmap(backdrop_region, Gfx::BitmapFormat::BGRA8888, actual_region); + auto maybe_backdrop_bitmap = painter.get_region_bitmap(command.backdrop_region, Gfx::BitmapFormat::BGRA8888, actual_region); if (actual_region.is_empty()) return CommandResult::Continue; if (maybe_backdrop_bitmap.is_error()) { @@ -402,7 +402,7 @@ CommandResult CommandExecutorCPU::apply_backdrop_filter(Gfx::IntRect const& back auto backdrop_bitmap = maybe_backdrop_bitmap.release_value(); // 2. Apply the backdrop-filter’s filter operations to the entire contents of T'. - apply_filter_list(*backdrop_bitmap, backdrop_filter.filters); + apply_filter_list(*backdrop_bitmap, command.backdrop_filter.filters); // FIXME: 3. If element B has any transforms (between B and the Backdrop Root), apply the inverse of those transforms to the contents of T’. @@ -415,41 +415,41 @@ CommandResult CommandExecutorCPU::apply_backdrop_filter(Gfx::IntRect const& back return CommandResult::Continue; } -CommandResult CommandExecutorCPU::draw_rect(Gfx::IntRect const& rect, Color const& color, bool rough) +CommandResult CommandExecutorCPU::draw_rect(DrawRect const& command) { - painter().draw_rect(rect, color, rough); + painter().draw_rect(command.rect, command.color, command.rough); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::paint_radial_gradient(Gfx::IntRect const& rect, Web::Painting::RadialGradientData const& radial_gradient_data, Gfx::IntPoint const& center, Gfx::IntSize const& size, Vector const& clip_paths) +CommandResult CommandExecutorCPU::paint_radial_gradient(PaintRadialGradient const& command) { auto paint_op = [&](Gfx::Painter& painter) { - painter.fill_rect_with_radial_gradient(rect, radial_gradient_data.color_stops.list, center, size, radial_gradient_data.color_stops.repeat_length); + painter.fill_rect_with_radial_gradient(command.rect, command.radial_gradient_data.color_stops.list, command.center, command.size, command.radial_gradient_data.color_stops.repeat_length); }; - if (clip_paths.is_empty()) { + if (command.clip_paths.is_empty()) { paint_op(painter()); } else { - apply_clip_paths_to_painter(rect, paint_op, clip_paths, painter()); + apply_clip_paths_to_painter(command.rect, paint_op, command.clip_paths, painter()); } return CommandResult::Continue; } -CommandResult CommandExecutorCPU::paint_conic_gradient(Gfx::IntRect const& rect, Web::Painting::ConicGradientData const& conic_gradient_data, Gfx::IntPoint const& position, Vector const& clip_paths) +CommandResult CommandExecutorCPU::paint_conic_gradient(PaintConicGradient const& command) { auto paint_op = [&](Gfx::Painter& painter) { - 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); + painter.fill_rect_with_conic_gradient(command.rect, command.conic_gradient_data.color_stops.list, command.position, command.conic_gradient_data.start_angle, command.conic_gradient_data.color_stops.repeat_length); }; - if (clip_paths.is_empty()) { + if (command.clip_paths.is_empty()) { paint_op(painter()); } else { - apply_clip_paths_to_painter(rect, paint_op, clip_paths, painter()); + apply_clip_paths_to_painter(command.rect, paint_op, command.clip_paths, painter()); } return CommandResult::Continue; } -CommandResult CommandExecutorCPU::draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const& color, int amplitude, int thickness) +CommandResult CommandExecutorCPU::draw_triangle_wave(DrawTriangleWave const& command) { - painter().draw_triangle_wave(p1, p2, color, amplitude, thickness); + painter().draw_triangle_wave(command.p1, command.p2, command.color, command.amplitude, command.thickness); return CommandResult::Continue; } @@ -458,24 +458,24 @@ void CommandExecutorCPU::prepare_to_execute(size_t corner_clip_max_depth) m_corner_clippers_stack.ensure_capacity(corner_clip_max_depth); } -CommandResult CommandExecutorCPU::sample_under_corners([[maybe_unused]] u32 id, CornerRadii const& corner_radii, Gfx::IntRect const& border_rect, CornerClip corner_clip) +CommandResult CommandExecutorCPU::sample_under_corners(SampleUnderCorners const& command) { - auto clipper = BorderRadiusCornerClipper::create(corner_radii, border_rect.to_type(), corner_clip).release_value(); + auto clipper = BorderRadiusCornerClipper::create(command.corner_radii, command.border_rect.to_type(), command.corner_clip).release_value(); clipper->sample_under_corners(painter()); m_corner_clippers_stack.append(clipper); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::blit_corner_clipping([[maybe_unused]] u32 id) +CommandResult CommandExecutorCPU::blit_corner_clipping(BlitCornerClipping const&) { auto clipper = m_corner_clippers_stack.take_last(); clipper->blit_corner_clipping(painter()); return CommandResult::Continue; } -CommandResult CommandExecutorCPU::paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data) +CommandResult CommandExecutorCPU::paint_borders(PaintBorders const& command) { - paint_all_borders(painter(), border_rect, corner_radii, borders_data); + paint_all_borders(painter(), command.border_rect, command.corner_radii, command.borders_data); return CommandResult::Continue; } diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h index 996a4908963..6e7fb173c47 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.h @@ -13,36 +13,36 @@ namespace Web::Painting { class CommandExecutorCPU : public CommandExecutor { public: - CommandResult draw_glyph_run(Vector const& glyph_run, Color const&, Gfx::FloatPoint translation, double scale) override; - CommandResult draw_text(Gfx::IntRect const& rect, String const& raw_text, Gfx::TextAlignment alignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional> const&) override; - CommandResult fill_rect(Gfx::IntRect const& rect, Color const&, Vector const& clip_paths) override; - CommandResult draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode) override; - CommandResult draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const&, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode, Vector const& clip_paths = {}) override; - CommandResult set_clip_rect(Gfx::IntRect const& rect) override; - CommandResult clear_clip_rect() override; - CommandResult 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 mask) override; - CommandResult pop_stacking_context() override; - CommandResult paint_linear_gradient(Gfx::IntRect const&, Web::Painting::LinearGradientData const&, Vector const& clip_paths = {}) override; - CommandResult paint_outer_box_shadow(PaintOuterBoxShadowParams const&) override; - CommandResult paint_inner_box_shadow(PaintOuterBoxShadowParams const&) override; - CommandResult paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span, Color const&, int fragment_baseline, Gfx::IntPoint const& draw_location) override; - CommandResult fill_rect_with_rounded_corners(Gfx::IntRect const&, Color const&, 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, Vector const& clip_paths) override; - CommandResult fill_path_using_color(Gfx::Path const&, Color const&, Gfx::Painter::WindingRule winding_rule, Gfx::FloatPoint const& aa_translation) override; - CommandResult fill_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const& paint_style, Gfx::Painter::WindingRule winding_rule, float opacity, Gfx::FloatPoint const& aa_translation) override; - CommandResult stroke_path_using_color(Gfx::Path const&, Color const& color, float thickness, Gfx::FloatPoint const& aa_translation) override; - CommandResult stroke_path_using_paint_style(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, float thickness, float opacity, Gfx::FloatPoint const& aa_translation) override; - CommandResult draw_ellipse(Gfx::IntRect const& rect, Color const& color, int thickness) override; - CommandResult fill_ellipse(Gfx::IntRect const& rect, Color const& color) override; - CommandResult draw_line(Color const&, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle style, Color const& alternate_color) override; - CommandResult draw_signed_distance_field(Gfx::IntRect const& rect, Color const&, Gfx::GrayscaleBitmap const& sdf, float smoothing) override; - CommandResult apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter) override; - CommandResult draw_rect(Gfx::IntRect const& rect, Color const&, bool rough) override; - CommandResult paint_radial_gradient(Gfx::IntRect const& rect, Web::Painting::RadialGradientData const& radial_gradient_data, Gfx::IntPoint const& center, Gfx::IntSize const& size, Vector const& clip_paths = {}) override; - CommandResult paint_conic_gradient(Gfx::IntRect const& rect, Web::Painting::ConicGradientData const& conic_gradient_data, Gfx::IntPoint const& position, Vector const& clip_paths = {}) override; - CommandResult draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const&, int amplitude, int thickness) override; - CommandResult sample_under_corners(u32 id, CornerRadii const&, Gfx::IntRect const&, CornerClip) override; - CommandResult blit_corner_clipping(u32 id) override; - CommandResult paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data) override; + CommandResult draw_glyph_run(DrawGlyphRun const&) override; + CommandResult draw_text(DrawText const&) override; + CommandResult fill_rect(FillRect const&) override; + CommandResult draw_scaled_bitmap(DrawScaledBitmap const&) override; + CommandResult draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const&) override; + CommandResult set_clip_rect(SetClipRect const&) override; + CommandResult clear_clip_rect(ClearClipRect const&) override; + CommandResult push_stacking_context(PushStackingContext const&) override; + CommandResult pop_stacking_context(PopStackingContext const&) override; + CommandResult paint_linear_gradient(PaintLinearGradient const&) override; + CommandResult paint_outer_box_shadow(PaintOuterBoxShadow const&) override; + CommandResult paint_inner_box_shadow(PaintInnerBoxShadow const&) override; + CommandResult paint_text_shadow(PaintTextShadow const&) override; + CommandResult fill_rect_with_rounded_corners(FillRectWithRoundedCorners const&) override; + CommandResult fill_path_using_color(FillPathUsingColor const&) override; + CommandResult fill_path_using_paint_style(FillPathUsingPaintStyle const&) override; + CommandResult stroke_path_using_color(StrokePathUsingColor const&) override; + CommandResult stroke_path_using_paint_style(StrokePathUsingPaintStyle const&) override; + CommandResult draw_ellipse(DrawEllipse const&) override; + CommandResult fill_ellipse(FillEllipse const&) override; + CommandResult draw_line(DrawLine const&) override; + CommandResult draw_signed_distance_field(DrawSignedDistanceField const&) override; + CommandResult apply_backdrop_filter(ApplyBackdropFilter const&) override; + CommandResult draw_rect(DrawRect const&) override; + CommandResult paint_radial_gradient(PaintRadialGradient const&) override; + CommandResult paint_conic_gradient(PaintConicGradient const&) override; + CommandResult draw_triangle_wave(DrawTriangleWave const&) override; + CommandResult sample_under_corners(SampleUnderCorners const&) override; + CommandResult blit_corner_clipping(BlitCornerClipping const&) override; + CommandResult paint_borders(PaintBorders const&) override; bool would_be_fully_clipped_by_painter(Gfx::IntRect) const override; diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp index ff4e11403b0..d534e479cf9 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.cpp @@ -31,32 +31,33 @@ CommandExecutorGPU::~CommandExecutorGPU() painter().flush(m_target_bitmap); } -CommandResult CommandExecutorGPU::draw_glyph_run(Vector const& glyph_run, Color const& color, Gfx::FloatPoint translation, double scale) +CommandResult CommandExecutorGPU::draw_glyph_run(DrawGlyphRun const& command) { Vector transformed_glyph_run; - transformed_glyph_run.ensure_capacity(glyph_run.size()); - for (auto& glyph : glyph_run) { + auto const& glyphs = command.glyph_run->glyphs(); + transformed_glyph_run.ensure_capacity(glyphs.size()); + for (auto& glyph : glyphs) { auto transformed_glyph = glyph; transformed_glyph.visit([&](auto& glyph) { - glyph.position = glyph.position.scaled(scale).translated(translation); - glyph.font = glyph.font->with_size(glyph.font->point_size() * static_cast(scale)); + glyph.position = glyph.position.scaled(command.scale).translated(command.translation); + glyph.font = glyph.font->with_size(glyph.font->point_size() * static_cast(command.scale)); }); transformed_glyph_run.append(transformed_glyph); } - painter().draw_glyph_run(transformed_glyph_run, color); + painter().draw_glyph_run(transformed_glyph_run, command.color); return CommandResult::Continue; } -CommandResult CommandExecutorGPU::draw_text(Gfx::IntRect const&, String const&, Gfx::TextAlignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional> const&) +CommandResult CommandExecutorGPU::draw_text(DrawText const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::fill_rect(Gfx::IntRect const& rect, Color const& color, Vector const&) +CommandResult CommandExecutorGPU::fill_rect(FillRect const& command) { // FIXME: Support clip paths - painter().fill_rect(rect, color); + painter().fill_rect(command.rect, command.color); return CommandResult::Continue; } @@ -75,82 +76,82 @@ static AccelGfx::Painter::ScalingMode to_accelgfx_scaling_mode(Gfx::Painter::Sca } } -CommandResult CommandExecutorGPU::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(DrawScaledBitmap const& command) { - painter().draw_scaled_bitmap(dst_rect, bitmap, src_rect, to_accelgfx_scaling_mode(scaling_mode)); + painter().draw_scaled_bitmap(command.dst_rect, command.bitmap, command.src_rect, to_accelgfx_scaling_mode(command.scaling_mode)); return CommandResult::Continue; } -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, Vector const&) +CommandResult CommandExecutorGPU::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command) { // TODO: Support clip paths - painter().draw_scaled_immutable_bitmap(dst_rect, immutable_bitmap, src_rect, to_accelgfx_scaling_mode(scaling_mode)); + painter().draw_scaled_immutable_bitmap(command.dst_rect, command.bitmap, command.src_rect, to_accelgfx_scaling_mode(command.scaling_mode)); return CommandResult::Continue; } -CommandResult CommandExecutorGPU::set_clip_rect(Gfx::IntRect const& rect) +CommandResult CommandExecutorGPU::set_clip_rect(SetClipRect const& command) { - painter().set_clip_rect(rect); + painter().set_clip_rect(command.rect); return CommandResult::Continue; } -CommandResult CommandExecutorGPU::clear_clip_rect() +CommandResult CommandExecutorGPU::clear_clip_rect(ClearClipRect const&) { painter().clear_clip_rect(); return CommandResult::Continue; } -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) +CommandResult CommandExecutorGPU::push_stacking_context(PushStackingContext const& command) { - if (source_paintable_rect.is_empty()) + if (command.source_paintable_rect.is_empty()) return CommandResult::SkipStackingContext; m_stacking_contexts.last().stacking_context_depth++; painter().save(); - if (is_fixed_position) { + if (command.is_fixed_position) { auto const& translation = painter().transform().translation(); painter().translate(-translation); } - auto stacking_context_transform = Gfx::extract_2d_affine_transform(transform.matrix); + auto stacking_context_transform = Gfx::extract_2d_affine_transform(command.transform.matrix); Gfx::AffineTransform inverse_origin_translation; - inverse_origin_translation.translate(-transform.origin); + inverse_origin_translation.translate(-command.transform.origin); Gfx::AffineTransform origin_translation; - origin_translation.translate(transform.origin); + origin_translation.translate(command.transform.origin); Gfx::AffineTransform final_transform = origin_translation; final_transform.multiply(stacking_context_transform); final_transform.multiply(inverse_origin_translation); - if (opacity < 1 || !stacking_context_transform.is_identity_or_translation()) { + if (command.opacity < 1 || !stacking_context_transform.is_identity_or_translation()) { // If, due to layout mistakes, we encounter an excessively large rectangle here, it must be skipped to prevent // framebuffer allocation failure. - if (source_paintable_rect.width() > 10000 || source_paintable_rect.height() > 10000) { - dbgln("FIXME: Skipping stacking context with excessively large paintable rect: {}", source_paintable_rect); + if (command.source_paintable_rect.width() > 10000 || command.source_paintable_rect.height() > 10000) { + dbgln("FIXME: Skipping stacking context with excessively large paintable rect: {}", command.source_paintable_rect); return CommandResult::SkipStackingContext; } - auto canvas = AccelGfx::Canvas::create(source_paintable_rect.size()); + auto canvas = AccelGfx::Canvas::create(command.source_paintable_rect.size()); auto painter = AccelGfx::Painter::create(m_context, canvas); - painter->translate(-source_paintable_rect.location().to_type()); + painter->translate(-command.source_paintable_rect.location().to_type()); painter->clear(Color::Transparent); m_stacking_contexts.append({ .canvas = canvas, .painter = move(painter), - .opacity = opacity, - .destination = source_paintable_rect, + .opacity = command.opacity, + .destination = command.source_paintable_rect, .transform = final_transform }); } else { - painter().translate(stacking_context_transform.translation() + post_transform_translation.to_type()); + painter().translate(stacking_context_transform.translation() + command.post_transform_translation.to_type()); m_stacking_contexts.append({ .canvas = {}, .painter = MaybeOwned(painter()), - .opacity = opacity, + .opacity = command.opacity, .destination = {}, .transform = final_transform }); } return CommandResult::Continue; } -CommandResult CommandExecutorGPU::pop_stacking_context() +CommandResult CommandExecutorGPU::pop_stacking_context(PopStackingContext const&) { auto stacking_context = m_stacking_contexts.take_last(); VERIFY(stacking_context.stacking_context_depth == 0); @@ -162,96 +163,97 @@ CommandResult CommandExecutorGPU::pop_stacking_context() return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_linear_gradient(Gfx::IntRect const& rect, Web::Painting::LinearGradientData const& data, Vector const&) +CommandResult CommandExecutorGPU::paint_linear_gradient(PaintLinearGradient const& command) { // FIXME: Support clip paths - painter().fill_rect_with_linear_gradient(rect, data.color_stops.list, data.gradient_angle, data.color_stops.repeat_length); + auto const& linear_gradient_data = command.linear_gradient_data; + painter().fill_rect_with_linear_gradient(command.gradient_rect, linear_gradient_data.color_stops.list, linear_gradient_data.gradient_angle, linear_gradient_data.color_stops.repeat_length); return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_outer_box_shadow(PaintOuterBoxShadowParams const&) +CommandResult CommandExecutorGPU::paint_outer_box_shadow(PaintOuterBoxShadow const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_inner_box_shadow(PaintOuterBoxShadowParams const&) +CommandResult CommandExecutorGPU::paint_inner_box_shadow(PaintInnerBoxShadow const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span glyph_run, Color const& color, int fragment_baseline, Gfx::IntPoint const& draw_location) +CommandResult CommandExecutorGPU::paint_text_shadow(PaintTextShadow const& command) { - auto text_shadow_canvas = AccelGfx::Canvas::create(shadow_bounding_rect.size()); + auto text_shadow_canvas = AccelGfx::Canvas::create(command.shadow_bounding_rect.size()); auto text_shadow_painter = AccelGfx::Painter::create(m_context, text_shadow_canvas); - text_shadow_painter->clear(color.with_alpha(0)); + text_shadow_painter->clear(command.color.with_alpha(0)); - Gfx::FloatRect const shadow_location { draw_location, shadow_bounding_rect.size() }; - Gfx::IntPoint const baseline_start(text_rect.x(), text_rect.y() + fragment_baseline); + Gfx::FloatRect const shadow_location { command.draw_location, command.shadow_bounding_rect.size() }; + Gfx::IntPoint const baseline_start(command.text_rect.x(), command.text_rect.y() + command.fragment_baseline); text_shadow_painter->translate(baseline_start.to_type()); - text_shadow_painter->draw_glyph_run(glyph_run, color); - if (blur_radius == 0) { + text_shadow_painter->draw_glyph_run(command.glyph_run, command.color); + if (command.blur_radius == 0) { painter().blit_canvas(shadow_location, *text_shadow_canvas); return CommandResult::Continue; } - auto horizontal_blur_canvas = AccelGfx::Canvas::create(shadow_bounding_rect.size()); + auto horizontal_blur_canvas = AccelGfx::Canvas::create(command.shadow_bounding_rect.size()); auto horizontal_blur_painter = AccelGfx::Painter::create(m_context, horizontal_blur_canvas); - horizontal_blur_painter->clear(color.with_alpha(0)); - horizontal_blur_painter->blit_blurred_canvas(shadow_bounding_rect.to_type(), *text_shadow_canvas, blur_radius, AccelGfx::Painter::BlurDirection::Horizontal); - painter().blit_blurred_canvas(shadow_location, *horizontal_blur_canvas, blur_radius, AccelGfx::Painter::BlurDirection::Vertical); + horizontal_blur_painter->clear(command.color.with_alpha(0)); + horizontal_blur_painter->blit_blurred_canvas(command.shadow_bounding_rect.to_type(), *text_shadow_canvas, command.blur_radius, AccelGfx::Painter::BlurDirection::Horizontal); + painter().blit_blurred_canvas(shadow_location, *horizontal_blur_canvas, command.blur_radius, AccelGfx::Painter::BlurDirection::Vertical); return CommandResult::Continue; } -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, Vector const&) +CommandResult CommandExecutorGPU::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command) { // FIXME: Support clip paths painter().fill_rect_with_rounded_corners( - rect, color, - { static_cast(top_left_radius.horizontal_radius), static_cast(top_left_radius.vertical_radius) }, - { static_cast(top_right_radius.horizontal_radius), static_cast(top_right_radius.vertical_radius) }, - { static_cast(bottom_left_radius.horizontal_radius), static_cast(bottom_left_radius.vertical_radius) }, - { static_cast(bottom_right_radius.horizontal_radius), static_cast(bottom_right_radius.vertical_radius) }); + command.rect, command.color, + { static_cast(command.top_left_radius.horizontal_radius), static_cast(command.top_left_radius.vertical_radius) }, + { static_cast(command.top_right_radius.horizontal_radius), static_cast(command.top_right_radius.vertical_radius) }, + { static_cast(command.bottom_left_radius.horizontal_radius), static_cast(command.bottom_left_radius.vertical_radius) }, + { static_cast(command.bottom_right_radius.horizontal_radius), static_cast(command.bottom_right_radius.vertical_radius) }); return CommandResult::Continue; } -CommandResult CommandExecutorGPU::fill_path_using_color(Gfx::Path const&, Color const&, Gfx::Painter::WindingRule, Gfx::FloatPoint const&) +CommandResult CommandExecutorGPU::fill_path_using_color(FillPathUsingColor const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::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(FillPathUsingPaintStyle const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::stroke_path_using_color(Gfx::Path const&, Color const&, float, Gfx::FloatPoint const&) +CommandResult CommandExecutorGPU::stroke_path_using_color(StrokePathUsingColor const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::stroke_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const&, float, float, Gfx::FloatPoint const&) +CommandResult CommandExecutorGPU::stroke_path_using_paint_style(StrokePathUsingPaintStyle const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::draw_ellipse(Gfx::IntRect const&, Color const&, int) +CommandResult CommandExecutorGPU::draw_ellipse(DrawEllipse const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::fill_ellipse(Gfx::IntRect const& rect, Color const& color) +CommandResult CommandExecutorGPU::fill_ellipse(FillEllipse const& command) { - auto horizontal_radius = static_cast(rect.width() / 2); - auto vertical_radius = static_cast(rect.height() / 2); + auto horizontal_radius = static_cast(command.rect.width() / 2); + auto vertical_radius = static_cast(command.rect.height() / 2); painter().fill_rect_with_rounded_corners( - rect, color, + command.rect, command.color, { horizontal_radius, vertical_radius }, { horizontal_radius, vertical_radius }, { horizontal_radius, vertical_radius }, @@ -259,61 +261,61 @@ CommandResult CommandExecutorGPU::fill_ellipse(Gfx::IntRect const& rect, Color c return CommandResult::Continue; } -CommandResult CommandExecutorGPU::draw_line(Color const& color, Gfx::IntPoint const& a, Gfx::IntPoint const& b, int thickness, Gfx::Painter::LineStyle, Color const&) +CommandResult CommandExecutorGPU::draw_line(DrawLine const& command) { // FIXME: Pass line style and alternate color once AccelGfx::Painter supports it - painter().draw_line(a, b, thickness, color); + painter().draw_line(command.from, command.to, command.thickness, command.color); return CommandResult::Continue; } -CommandResult CommandExecutorGPU::draw_signed_distance_field(Gfx::IntRect const&, Color const&, Gfx::GrayscaleBitmap const&, float) +CommandResult CommandExecutorGPU::draw_signed_distance_field(DrawSignedDistanceField const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::apply_backdrop_filter(Gfx::IntRect const&, Web::CSS::ResolvedBackdropFilter const&) +CommandResult CommandExecutorGPU::apply_backdrop_filter(ApplyBackdropFilter const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::draw_rect(Gfx::IntRect const&, Color const&, bool) +CommandResult CommandExecutorGPU::draw_rect(DrawRect const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_radial_gradient(Gfx::IntRect const&, Web::Painting::RadialGradientData const&, Gfx::IntPoint const&, Gfx::IntSize const&, Vector const&) +CommandResult CommandExecutorGPU::paint_radial_gradient(PaintRadialGradient const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_conic_gradient(Gfx::IntRect const&, Web::Painting::ConicGradientData const&, Gfx::IntPoint const&, Vector const&) +CommandResult CommandExecutorGPU::paint_conic_gradient(PaintConicGradient const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::draw_triangle_wave(Gfx::IntPoint const&, Gfx::IntPoint const&, Color const&, int, int) +CommandResult CommandExecutorGPU::draw_triangle_wave(DrawTriangleWave const&) { // FIXME return CommandResult::Continue; } -CommandResult CommandExecutorGPU::sample_under_corners(u32 id, CornerRadii const& corner_radii, Gfx::IntRect const& border_rect, CornerClip) +CommandResult CommandExecutorGPU::sample_under_corners(SampleUnderCorners const& command) { - m_corner_clippers.resize(id + 1); - m_corner_clippers[id] = make(); - auto& corner_clipper = *m_corner_clippers[id]; + m_corner_clippers.resize(command.id + 1); + m_corner_clippers[command.id] = make(); + auto& corner_clipper = *m_corner_clippers[command.id]; - auto const& top_left = corner_radii.top_left; - auto const& top_right = corner_radii.top_right; - auto const& bottom_right = corner_radii.bottom_right; - auto const& bottom_left = corner_radii.bottom_left; + auto const& top_left = command.corner_radii.top_left; + auto const& top_right = command.corner_radii.top_right; + auto const& bottom_right = command.corner_radii.bottom_right; + auto const& bottom_left = command.corner_radii.bottom_left; - auto sampling_config = calculate_border_radius_sampling_config(corner_radii, border_rect); + auto sampling_config = calculate_border_radius_sampling_config(command.corner_radii, command.border_rect); auto const& page_locations = sampling_config.page_locations; auto const& bitmap_locations = sampling_config.bitmap_locations; @@ -358,9 +360,9 @@ CommandResult CommandExecutorGPU::sample_under_corners(u32 id, CornerRadii const return CommandResult::Continue; } -CommandResult CommandExecutorGPU::blit_corner_clipping(u32 id) +CommandResult CommandExecutorGPU::blit_corner_clipping(BlitCornerClipping const& command) { - auto const& corner_clipper = *m_corner_clippers[id]; + auto const& corner_clipper = *m_corner_clippers[command.id]; auto const& corner_sample_canvas = *corner_clipper.corners_sample_canvas; if (!corner_clipper.sample_canvas_top_left_rect.is_empty()) painter().blit_canvas(corner_clipper.page_top_left_rect, corner_sample_canvas, corner_clipper.sample_canvas_top_left_rect); @@ -371,15 +373,17 @@ CommandResult CommandExecutorGPU::blit_corner_clipping(u32 id) if (!corner_clipper.sample_canvas_bottom_left_rect.is_empty()) painter().blit_canvas(corner_clipper.page_bottom_left_rect, corner_sample_canvas, corner_clipper.sample_canvas_bottom_left_rect); - m_corner_clippers[id].clear(); + m_corner_clippers[command.id].clear(); return CommandResult::Continue; } -CommandResult CommandExecutorGPU::paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data) +CommandResult CommandExecutorGPU::paint_borders(PaintBorders const& command) { // FIXME: Add support for corner radiuses - (void)corner_radii; + + auto const& border_rect = command.border_rect; + auto const& borders_data = command.borders_data; Gfx::IntRect top_border_rect = { border_rect.x(), diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h index 29dc12c47be..cb51d19ee07 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorGPU.h @@ -14,36 +14,36 @@ namespace Web::Painting { class CommandExecutorGPU : public CommandExecutor { public: - CommandResult draw_glyph_run(Vector const& glyph_run, Color const&, Gfx::FloatPoint translation, double scale) override; - CommandResult draw_text(Gfx::IntRect const& rect, String const& raw_text, Gfx::TextAlignment alignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional> const&) override; - CommandResult fill_rect(Gfx::IntRect const& rect, Color const&, Vector const& clip_paths) override; - CommandResult draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode) override; - CommandResult draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const&, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode, Vector const& clip_paths = {}) override; - CommandResult set_clip_rect(Gfx::IntRect const& rect) override; - CommandResult clear_clip_rect() override; - CommandResult push_stacking_context(float opacity, bool, Gfx::IntRect const& source_paintable_rect, Gfx::IntPoint post_transform_translation, CSS::ImageRendering image_rendering, StackingContextTransform transform, Optional mask) override; - CommandResult pop_stacking_context() override; - CommandResult paint_linear_gradient(Gfx::IntRect const&, Web::Painting::LinearGradientData const&, Vector const& clip_paths = {}) override; - CommandResult paint_outer_box_shadow(PaintOuterBoxShadowParams const&) override; - CommandResult paint_inner_box_shadow(PaintOuterBoxShadowParams const&) override; - CommandResult paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span, Color const&, int fragment_baseline, Gfx::IntPoint const& draw_location) override; - CommandResult fill_rect_with_rounded_corners(Gfx::IntRect const&, Color const&, 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, Vector const& clip_paths) override; - CommandResult fill_path_using_color(Gfx::Path const&, Color const&, Gfx::Painter::WindingRule winding_rule, Gfx::FloatPoint const& aa_translation) override; - CommandResult fill_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const& paint_style, Gfx::Painter::WindingRule winding_rule, float opacity, Gfx::FloatPoint const& aa_translation) override; - CommandResult stroke_path_using_color(Gfx::Path const&, Color const& color, float thickness, Gfx::FloatPoint const& aa_translation) override; - CommandResult stroke_path_using_paint_style(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, float thickness, float opacity, Gfx::FloatPoint const& aa_translation) override; - CommandResult draw_ellipse(Gfx::IntRect const& rect, Color const& color, int thickness) override; - CommandResult fill_ellipse(Gfx::IntRect const& rect, Color const& color) override; - CommandResult draw_line(Color const&, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle style, Color const& alternate_color) override; - CommandResult draw_signed_distance_field(Gfx::IntRect const& rect, Color const&, Gfx::GrayscaleBitmap const& sdf, float smoothing) override; - CommandResult apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter) override; - CommandResult draw_rect(Gfx::IntRect const& rect, Color const&, bool rough) override; - CommandResult paint_radial_gradient(Gfx::IntRect const& rect, Web::Painting::RadialGradientData const& radial_gradient_data, Gfx::IntPoint const& center, Gfx::IntSize const& size, Vector const& clip_paths = {}) override; - CommandResult paint_conic_gradient(Gfx::IntRect const& rect, Web::Painting::ConicGradientData const& conic_gradient_data, Gfx::IntPoint const& position, Vector const& clip_paths = {}) override; - CommandResult draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const&, int amplitude, int thickness) override; - CommandResult sample_under_corners(u32 id, CornerRadii const&, Gfx::IntRect const&, CornerClip) override; - CommandResult blit_corner_clipping(u32) override; - CommandResult paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data) override; + CommandResult draw_glyph_run(DrawGlyphRun const&) override; + CommandResult draw_text(DrawText const&) override; + CommandResult fill_rect(FillRect const&) override; + CommandResult draw_scaled_bitmap(DrawScaledBitmap const&) override; + CommandResult draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const&) override; + CommandResult set_clip_rect(SetClipRect const&) override; + CommandResult clear_clip_rect(ClearClipRect const&) override; + CommandResult push_stacking_context(PushStackingContext const&) override; + CommandResult pop_stacking_context(PopStackingContext const&) override; + CommandResult paint_linear_gradient(PaintLinearGradient const&) override; + CommandResult paint_outer_box_shadow(PaintOuterBoxShadow const&) override; + CommandResult paint_inner_box_shadow(PaintInnerBoxShadow const&) override; + CommandResult paint_text_shadow(PaintTextShadow const&) override; + CommandResult fill_rect_with_rounded_corners(FillRectWithRoundedCorners const&) override; + CommandResult fill_path_using_color(FillPathUsingColor const&) override; + CommandResult fill_path_using_paint_style(FillPathUsingPaintStyle const&) override; + CommandResult stroke_path_using_color(StrokePathUsingColor const&) override; + CommandResult stroke_path_using_paint_style(StrokePathUsingPaintStyle const&) override; + CommandResult draw_ellipse(DrawEllipse const&) override; + CommandResult fill_ellipse(FillEllipse const&) override; + CommandResult draw_line(DrawLine const&) override; + CommandResult draw_signed_distance_field(DrawSignedDistanceField const&) override; + CommandResult apply_backdrop_filter(ApplyBackdropFilter const&) override; + CommandResult draw_rect(DrawRect const&) override; + CommandResult paint_radial_gradient(PaintRadialGradient const&) override; + CommandResult paint_conic_gradient(PaintConicGradient const&) override; + CommandResult draw_triangle_wave(DrawTriangleWave const&) override; + CommandResult sample_under_corners(SampleUnderCorners const&) override; + CommandResult blit_corner_clipping(BlitCornerClipping const&) override; + CommandResult paint_borders(PaintBorders const&) override; bool would_be_fully_clipped_by_painter(Gfx::IntRect) const override; diff --git a/Userland/Libraries/LibWeb/Painting/CommandList.cpp b/Userland/Libraries/LibWeb/Painting/CommandList.cpp index 345b76d8d8b..e77eef8a0b2 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandList.cpp +++ b/Userland/Libraries/LibWeb/Painting/CommandList.cpp @@ -130,113 +130,88 @@ void CommandList::execute(CommandExecutor& executor) auto result = command.visit( [&](DrawGlyphRun const& command) { - return executor.draw_glyph_run(command.glyph_run->glyphs(), command.color, command.translation, command.scale); + return executor.draw_glyph_run(command); }, [&](DrawText const& command) { - return executor.draw_text(command.rect, command.raw_text, command.alignment, command.color, - command.elision, command.wrapping, command.font); + return executor.draw_text(command); }, [&](FillRect const& command) { - return executor.fill_rect(command.rect, command.color, command.clip_paths); + return executor.fill_rect(command); }, [&](DrawScaledBitmap const& command) { - return executor.draw_scaled_bitmap(command.dst_rect, command.bitmap, command.src_rect, - command.scaling_mode); + return executor.draw_scaled_bitmap(command); }, [&](DrawScaledImmutableBitmap const& command) { - return executor.draw_scaled_immutable_bitmap(command.dst_rect, command.bitmap, command.src_rect, - command.scaling_mode, command.clip_paths); + return executor.draw_scaled_immutable_bitmap(command); }, [&](SetClipRect const& command) { - return executor.set_clip_rect(command.rect); + return executor.set_clip_rect(command); }, - [&](ClearClipRect const&) { - return executor.clear_clip_rect(); + [&](ClearClipRect const& command) { + return executor.clear_clip_rect(command); }, [&](PushStackingContext const& command) { - return executor.push_stacking_context(command.opacity, command.is_fixed_position, - command.source_paintable_rect, - command.post_transform_translation, - command.image_rendering, command.transform, command.mask); + return executor.push_stacking_context(command); }, - [&](PopStackingContext const&) { - return executor.pop_stacking_context(); + [&](PopStackingContext const& command) { + return executor.pop_stacking_context(command); }, [&](PaintLinearGradient const& command) { - return executor.paint_linear_gradient(command.gradient_rect, command.linear_gradient_data, command.clip_paths); + return executor.paint_linear_gradient(command); }, [&](PaintRadialGradient const& command) { - return executor.paint_radial_gradient(command.rect, command.radial_gradient_data, - command.center, command.size, command.clip_paths); + return executor.paint_radial_gradient(command); }, [&](PaintConicGradient const& command) { - return executor.paint_conic_gradient(command.rect, command.conic_gradient_data, - command.position, command.clip_paths); + return executor.paint_conic_gradient(command); }, [&](PaintOuterBoxShadow const& command) { - return executor.paint_outer_box_shadow(command.outer_box_shadow_params); + return executor.paint_outer_box_shadow(command); }, [&](PaintInnerBoxShadow const& command) { - return executor.paint_inner_box_shadow(command.outer_box_shadow_params); + return executor.paint_inner_box_shadow(command); }, [&](PaintTextShadow const& command) { - return executor.paint_text_shadow(command.blur_radius, command.shadow_bounding_rect, - command.text_rect, command.glyph_run, command.color, - command.fragment_baseline, command.draw_location); + return executor.paint_text_shadow(command); }, [&](FillRectWithRoundedCorners const& command) { - return executor.fill_rect_with_rounded_corners(command.rect, command.color, - command.top_left_radius, - command.top_right_radius, - command.bottom_left_radius, - command.bottom_right_radius, - command.clip_paths); + return executor.fill_rect_with_rounded_corners(command); }, [&](FillPathUsingColor const& command) { - return executor.fill_path_using_color(command.path, command.color, command.winding_rule, - command.aa_translation); + return executor.fill_path_using_color(command); }, [&](FillPathUsingPaintStyle const& command) { - return executor.fill_path_using_paint_style(command.path, command.paint_style, - command.winding_rule, command.opacity, - command.aa_translation); + return executor.fill_path_using_paint_style(command); }, [&](StrokePathUsingColor const& command) { - return executor.stroke_path_using_color(command.path, command.color, command.thickness, - command.aa_translation); + return executor.stroke_path_using_color(command); }, [&](StrokePathUsingPaintStyle const& command) { - return executor.stroke_path_using_paint_style(command.path, command.paint_style, - command.thickness, command.opacity, - command.aa_translation); + return executor.stroke_path_using_paint_style(command); }, [&](DrawEllipse const& command) { - return executor.draw_ellipse(command.rect, command.color, command.thickness); + return executor.draw_ellipse(command); }, [&](FillEllipse const& command) { - return executor.fill_ellipse(command.rect, command.color); + return executor.fill_ellipse(command); }, [&](DrawLine const& command) { - return executor.draw_line(command.color, command.from, command.to, command.thickness, - command.style, command.alternate_color); + return executor.draw_line(command); }, [&](DrawSignedDistanceField const& command) { - return executor.draw_signed_distance_field(command.rect, command.color, command.sdf, - command.smoothing); + return executor.draw_signed_distance_field(command); }, [&](ApplyBackdropFilter const& command) { - return executor.apply_backdrop_filter(command.backdrop_region, command.backdrop_filter); + return executor.apply_backdrop_filter(command); }, [&](DrawRect const& command) { - return executor.draw_rect(command.rect, command.color, command.rough); + return executor.draw_rect(command); }, [&](DrawTriangleWave const& command) { - return executor.draw_triangle_wave(command.p1, command.p2, command.color, command.amplitude, - command.thickness); + return executor.draw_triangle_wave(command); }, [&](SampleUnderCorners const& command) { - return executor.sample_under_corners(command.id, command.corner_radii, command.border_rect, - command.corner_clip); + return executor.sample_under_corners(command); }, [&](BlitCornerClipping const& command) { if (skipped_sample_corner_commands.contains(command.id)) { @@ -247,10 +222,10 @@ void CommandList::execute(CommandExecutor& executor) dbgln("Skipping blit_corner_clipping command because the sample_under_corners command was skipped."); return CommandResult::Continue; } - return executor.blit_corner_clipping(command.id); + return executor.blit_corner_clipping(command); }, [&](PaintBorders const& command) { - return executor.paint_borders(command.border_rect, command.corner_radii, command.borders_data); + return executor.paint_borders(command); }); if (result == CommandResult::SkipStackingContext) { diff --git a/Userland/Libraries/LibWeb/Painting/CommandList.h b/Userland/Libraries/LibWeb/Painting/CommandList.h index efa970a0a24..16d70ce79d8 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandList.h +++ b/Userland/Libraries/LibWeb/Painting/CommandList.h @@ -47,42 +47,36 @@ class CommandExecutor { public: virtual ~CommandExecutor() = default; - virtual CommandResult draw_glyph_run(Vector const& glyph_run, Color const&, Gfx::FloatPoint translation, double scale) = 0; - virtual CommandResult draw_text(Gfx::IntRect const&, String const&, Gfx::TextAlignment alignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional> const&) = 0; - virtual CommandResult fill_rect(Gfx::IntRect const&, Color const&, Vector const& clip_paths) = 0; - virtual CommandResult draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode) = 0; - virtual CommandResult draw_scaled_immutable_bitmap(Gfx::IntRect const& dst_rect, Gfx::ImmutableBitmap const&, Gfx::IntRect const& src_rect, Gfx::Painter::ScalingMode scaling_mode, Vector const& clip_paths = {}) = 0; - virtual CommandResult set_clip_rect(Gfx::IntRect const& rect) = 0; - virtual CommandResult clear_clip_rect() = 0; - virtual CommandResult 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 mask) = 0; - virtual CommandResult pop_stacking_context() = 0; - virtual CommandResult paint_linear_gradient(Gfx::IntRect const&, LinearGradientData const&, Vector const& clip_paths = {}) = 0; - virtual CommandResult paint_radial_gradient(Gfx::IntRect const& rect, RadialGradientData const&, Gfx::IntPoint const& center, Gfx::IntSize const& size, Vector const& clip_paths = {}) = 0; - virtual CommandResult paint_conic_gradient(Gfx::IntRect const& rect, ConicGradientData const&, Gfx::IntPoint const& position, Vector const& clip_paths = {}) = 0; - virtual CommandResult paint_outer_box_shadow(PaintOuterBoxShadowParams const&) = 0; - virtual CommandResult paint_inner_box_shadow(PaintOuterBoxShadowParams const&) = 0; - virtual CommandResult paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span, Color const&, int fragment_baseline, Gfx::IntPoint const& draw_location) = 0; - virtual CommandResult 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, - Vector const& clip_paths = {}) - = 0; - virtual CommandResult fill_path_using_color(Gfx::Path const&, Color const& color, Gfx::Painter::WindingRule, Gfx::FloatPoint const& aa_translation) = 0; - virtual CommandResult fill_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const& paint_style, Gfx::Painter::WindingRule winding_rule, float opacity, Gfx::FloatPoint const& aa_translation) = 0; - virtual CommandResult stroke_path_using_color(Gfx::Path const&, Color const& color, float thickness, Gfx::FloatPoint const& aa_translation) = 0; - virtual CommandResult stroke_path_using_paint_style(Gfx::Path const&, Gfx::PaintStyle const& paint_style, float thickness, float opacity, Gfx::FloatPoint const& aa_translation) = 0; - virtual CommandResult draw_ellipse(Gfx::IntRect const&, Color const&, int thickness) = 0; - virtual CommandResult fill_ellipse(Gfx::IntRect const&, Color const&) = 0; - virtual CommandResult draw_line(Color const& color, Gfx::IntPoint const& from, Gfx::IntPoint const& to, int thickness, Gfx::Painter::LineStyle, Color const& alternate_color) = 0; - virtual CommandResult draw_signed_distance_field(Gfx::IntRect const& rect, Color const&, Gfx::GrayscaleBitmap const&, float smoothing) = 0; - virtual CommandResult apply_backdrop_filter(Gfx::IntRect const& backdrop_region, Web::CSS::ResolvedBackdropFilter const& backdrop_filter) = 0; - virtual CommandResult draw_rect(Gfx::IntRect const& rect, Color const&, bool rough) = 0; - virtual CommandResult draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const& color, int amplitude, int thickness) = 0; - virtual CommandResult sample_under_corners(u32 id, CornerRadii const&, Gfx::IntRect const&, CornerClip) = 0; - virtual CommandResult blit_corner_clipping(u32 id) = 0; - virtual CommandResult paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data) = 0; + virtual CommandResult draw_glyph_run(DrawGlyphRun const&) = 0; + virtual CommandResult draw_text(DrawText const&) = 0; + virtual CommandResult fill_rect(FillRect const&) = 0; + virtual CommandResult draw_scaled_bitmap(DrawScaledBitmap const&) = 0; + virtual CommandResult draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const&) = 0; + virtual CommandResult set_clip_rect(SetClipRect const&) = 0; + virtual CommandResult clear_clip_rect(ClearClipRect const&) = 0; + virtual CommandResult push_stacking_context(PushStackingContext const&) = 0; + virtual CommandResult pop_stacking_context(PopStackingContext const&) = 0; + virtual CommandResult paint_linear_gradient(PaintLinearGradient const&) = 0; + virtual CommandResult paint_radial_gradient(PaintRadialGradient const&) = 0; + virtual CommandResult paint_conic_gradient(PaintConicGradient const&) = 0; + virtual CommandResult paint_outer_box_shadow(PaintOuterBoxShadow const&) = 0; + virtual CommandResult paint_inner_box_shadow(PaintInnerBoxShadow const&) = 0; + virtual CommandResult paint_text_shadow(PaintTextShadow const&) = 0; + virtual CommandResult fill_rect_with_rounded_corners(FillRectWithRoundedCorners const&) = 0; + virtual CommandResult fill_path_using_color(FillPathUsingColor const&) = 0; + virtual CommandResult fill_path_using_paint_style(FillPathUsingPaintStyle const&) = 0; + virtual CommandResult stroke_path_using_color(StrokePathUsingColor const&) = 0; + virtual CommandResult stroke_path_using_paint_style(StrokePathUsingPaintStyle const&) = 0; + virtual CommandResult draw_ellipse(DrawEllipse const&) = 0; + virtual CommandResult fill_ellipse(FillEllipse const&) = 0; + virtual CommandResult draw_line(DrawLine const&) = 0; + virtual CommandResult draw_signed_distance_field(DrawSignedDistanceField const&) = 0; + virtual CommandResult apply_backdrop_filter(ApplyBackdropFilter const&) = 0; + virtual CommandResult draw_rect(DrawRect const&) = 0; + virtual CommandResult draw_triangle_wave(DrawTriangleWave const&) = 0; + virtual CommandResult sample_under_corners(SampleUnderCorners const&) = 0; + virtual CommandResult blit_corner_clipping(BlitCornerClipping const&) = 0; + virtual CommandResult paint_borders(PaintBorders const&) = 0; virtual bool would_be_fully_clipped_by_painter(Gfx::IntRect) const = 0; virtual bool needs_prepare_glyphs_texture() const { return false; } virtual void prepare_glyph_texture(HashMap> const& unique_glyphs) = 0;