mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-18 01:40:26 +03:00
LibWeb: Rename CommandExecutor to DisplayListPlayer
Use more widely recognized name among browser engine developers.
This commit is contained in:
parent
854b269338
commit
760dfdcc1a
Notes:
sideshowbarker
2024-07-18 00:41:35 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/760dfdcc1a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/260
@ -15,8 +15,8 @@ source_set("Painting") {
|
|||||||
"CheckBoxPaintable.cpp",
|
"CheckBoxPaintable.cpp",
|
||||||
"ClippableAndScrollable.cpp",
|
"ClippableAndScrollable.cpp",
|
||||||
"Command.cpp",
|
"Command.cpp",
|
||||||
"CommandExecutorCPU.cpp",
|
|
||||||
"DisplayList.cpp",
|
"DisplayList.cpp",
|
||||||
|
"DisplayListPlayerCPU.cpp",
|
||||||
"DisplayListRecorder.cpp",
|
"DisplayListRecorder.cpp",
|
||||||
"FilterPainting.cpp",
|
"FilterPainting.cpp",
|
||||||
"GradientPainting.cpp",
|
"GradientPainting.cpp",
|
||||||
@ -48,7 +48,7 @@ source_set("Painting") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if (current_os == "linux" || current_os == "mac") {
|
if (current_os == "linux" || current_os == "mac") {
|
||||||
sources += [ "CommandExecutorGPU.cpp" ]
|
sources += [ "DisplayListPlayerGPU.cpp" ]
|
||||||
public_deps = [ "//Userland/Libraries/LibAccelGfx" ]
|
public_deps = [ "//Userland/Libraries/LibAccelGfx" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,11 +539,11 @@ set(SOURCES
|
|||||||
Painting/BordersData.cpp
|
Painting/BordersData.cpp
|
||||||
Painting/CanvasPaintable.cpp
|
Painting/CanvasPaintable.cpp
|
||||||
Painting/Command.cpp
|
Painting/Command.cpp
|
||||||
Painting/CommandExecutorCPU.cpp
|
|
||||||
Painting/CommandExecutorSkia.cpp
|
|
||||||
Painting/CheckBoxPaintable.cpp
|
Painting/CheckBoxPaintable.cpp
|
||||||
Painting/ClippableAndScrollable.cpp
|
Painting/ClippableAndScrollable.cpp
|
||||||
Painting/DisplayList.cpp
|
Painting/DisplayList.cpp
|
||||||
|
Painting/DisplayListPlayerCPU.cpp
|
||||||
|
Painting/DisplayListPlayerSkia.cpp
|
||||||
Painting/DisplayListRecorder.cpp
|
Painting/DisplayListRecorder.cpp
|
||||||
Painting/GradientPainting.cpp
|
Painting/GradientPainting.cpp
|
||||||
Painting/FilterPainting.cpp
|
Painting/FilterPainting.cpp
|
||||||
@ -760,7 +760,7 @@ target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibHTTP LibGfx LibI
|
|||||||
|
|
||||||
if (HAS_ACCELERATED_GRAPHICS)
|
if (HAS_ACCELERATED_GRAPHICS)
|
||||||
target_link_libraries(LibWeb PRIVATE ${ACCEL_GFX_LIBS})
|
target_link_libraries(LibWeb PRIVATE ${ACCEL_GFX_LIBS})
|
||||||
target_sources(LibWeb PRIVATE Painting/CommandExecutorGPU.cpp)
|
target_sources(LibWeb PRIVATE Painting/DisplayListPlayerGPU.cpp)
|
||||||
target_link_libraries(LibWeb PRIVATE LibAccelGfx)
|
target_link_libraries(LibWeb PRIVATE LibAccelGfx)
|
||||||
target_compile_definitions(LibWeb PRIVATE HAS_ACCELERATED_GRAPHICS)
|
target_compile_definitions(LibWeb PRIVATE HAS_ACCELERATED_GRAPHICS)
|
||||||
endif()
|
endif()
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||||
#include <LibWeb/HTML/Window.h>
|
#include <LibWeb/HTML/Window.h>
|
||||||
#include <LibWeb/Page/Page.h>
|
#include <LibWeb/Page/Page.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorCPU.h>
|
#include <LibWeb/Painting/DisplayListPlayerCPU.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorSkia.h>
|
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
||||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||||
|
|
||||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||||
# include <LibWeb/Painting/CommandExecutorGPU.h>
|
# include <LibWeb/Painting/DisplayListPlayerGPU.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
@ -1188,11 +1188,11 @@ void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::
|
|||||||
paint_config.has_focus = paint_options.has_focus;
|
paint_config.has_focus = paint_options.has_focus;
|
||||||
record_display_list(display_list_recorder, paint_config);
|
record_display_list(display_list_recorder, paint_config);
|
||||||
|
|
||||||
auto painting_command_executor_type = page().client().painting_command_executor_type();
|
auto display_list_player_type = page().client().display_list_player_type();
|
||||||
if (painting_command_executor_type == PaintingCommandExecutorType::GPU) {
|
if (display_list_player_type == DisplayListPlayerType::GPU) {
|
||||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||||
Web::Painting::CommandExecutorGPU painting_command_executor(*paint_options.accelerated_graphics_context, target);
|
Web::Painting::DisplayListPlayerGPU player(*paint_options.accelerated_graphics_context, target);
|
||||||
display_list.execute(painting_command_executor);
|
display_list.execute(player);
|
||||||
#else
|
#else
|
||||||
static bool has_warned_about_configuration = false;
|
static bool has_warned_about_configuration = false;
|
||||||
|
|
||||||
@ -1201,12 +1201,12 @@ void TraversableNavigable::paint(Web::DevicePixelRect const& content_rect, Gfx::
|
|||||||
has_warned_about_configuration = true;
|
has_warned_about_configuration = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (painting_command_executor_type == PaintingCommandExecutorType::Skia) {
|
} else if (display_list_player_type == DisplayListPlayerType::Skia) {
|
||||||
Painting::CommandExecutorSkia painting_command_executor(target);
|
Painting::DisplayListPlayerSkia player(target);
|
||||||
display_list.execute(painting_command_executor);
|
display_list.execute(player);
|
||||||
} else {
|
} else {
|
||||||
Web::Painting::CommandExecutorCPU painting_command_executor(target);
|
Web::Painting::DisplayListPlayerCPU player(target);
|
||||||
display_list.execute(painting_command_executor);
|
display_list.execute(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ struct PaintOptions {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PaintingCommandExecutorType {
|
enum class DisplayListPlayerType {
|
||||||
CPU,
|
CPU,
|
||||||
GPU,
|
GPU,
|
||||||
Skia
|
Skia
|
||||||
@ -378,7 +378,7 @@ public:
|
|||||||
virtual void schedule_repaint() = 0;
|
virtual void schedule_repaint() = 0;
|
||||||
virtual bool is_ready_to_paint() const = 0;
|
virtual bool is_ready_to_paint() const = 0;
|
||||||
|
|
||||||
virtual PaintingCommandExecutorType painting_command_executor_type() const = 0;
|
virtual DisplayListPlayerType display_list_player_type() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~PageClient() = default;
|
virtual ~PageClient() = default;
|
||||||
|
@ -76,7 +76,7 @@ void DisplayList::mark_unnecessary_commands()
|
|||||||
VERIFY(sample_blit_ranges.is_empty());
|
VERIFY(sample_blit_ranges.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayList::execute(CommandExecutor& executor)
|
void DisplayList::execute(DisplayListPlayer& executor)
|
||||||
{
|
{
|
||||||
executor.prepare_to_execute(m_corner_clip_max_depth);
|
executor.prepare_to_execute(m_corner_clip_max_depth);
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ enum class CommandResult {
|
|||||||
SkipStackingContext,
|
SkipStackingContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommandExecutor {
|
class DisplayListPlayer {
|
||||||
public:
|
public:
|
||||||
virtual ~CommandExecutor() = default;
|
virtual ~DisplayListPlayer() = default;
|
||||||
|
|
||||||
virtual CommandResult draw_glyph_run(DrawGlyphRun const&) = 0;
|
virtual CommandResult draw_glyph_run(DrawGlyphRun const&) = 0;
|
||||||
virtual CommandResult fill_rect(FillRect const&) = 0;
|
virtual CommandResult fill_rect(FillRect const&) = 0;
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
void apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_frame_id);
|
void apply_scroll_offsets(Vector<Gfx::IntPoint> const& offsets_by_frame_id);
|
||||||
void mark_unnecessary_commands();
|
void mark_unnecessary_commands();
|
||||||
void execute(CommandExecutor&);
|
void execute(DisplayListPlayer&);
|
||||||
|
|
||||||
size_t corner_clip_max_depth() const { return m_corner_clip_max_depth; }
|
size_t corner_clip_max_depth() const { return m_corner_clip_max_depth; }
|
||||||
void set_corner_clip_max_depth(size_t depth) { m_corner_clip_max_depth = depth; }
|
void set_corner_clip_max_depth(size_t depth) { m_corner_clip_max_depth = depth; }
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
||||||
#include <LibWeb/CSS/ComputedValues.h>
|
#include <LibWeb/CSS/ComputedValues.h>
|
||||||
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
|
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorCPU.h>
|
#include <LibWeb/Painting/DisplayListPlayerCPU.h>
|
||||||
#include <LibWeb/Painting/DisplayListRecorder.h>
|
#include <LibWeb/Painting/DisplayListRecorder.h>
|
||||||
#include <LibWeb/Painting/FilterPainting.h>
|
#include <LibWeb/Painting/FilterPainting.h>
|
||||||
#include <LibWeb/Painting/ShadowPainting.h>
|
#include <LibWeb/Painting/ShadowPainting.h>
|
||||||
|
|
||||||
namespace Web::Painting {
|
namespace Web::Painting {
|
||||||
|
|
||||||
CommandExecutorCPU::CommandExecutorCPU(Gfx::Bitmap& bitmap)
|
DisplayListPlayerCPU::DisplayListPlayerCPU(Gfx::Bitmap& bitmap)
|
||||||
: m_target_bitmap(bitmap)
|
: m_target_bitmap(bitmap)
|
||||||
{
|
{
|
||||||
stacking_contexts.append({ .painter = AK::make<Gfx::Painter>(bitmap),
|
stacking_contexts.append({ .painter = AK::make<Gfx::Painter>(bitmap),
|
||||||
@ -24,9 +24,9 @@ CommandExecutorCPU::CommandExecutorCPU(Gfx::Bitmap& bitmap)
|
|||||||
.scaling_mode = {} });
|
.scaling_mode = {} });
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandExecutorCPU::~CommandExecutorCPU() = default;
|
DisplayListPlayerCPU::~DisplayListPlayerCPU() = default;
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::draw_glyph_run(DrawGlyphRun const& command)
|
CommandResult DisplayListPlayerCPU::draw_glyph_run(DrawGlyphRun const& command)
|
||||||
{
|
{
|
||||||
auto& painter = this->painter();
|
auto& painter = this->painter();
|
||||||
auto const& glyphs = command.glyph_run->glyphs();
|
auto const& glyphs = command.glyph_run->glyphs();
|
||||||
@ -69,7 +69,7 @@ void apply_clip_paths_to_painter(Gfx::IntRect const& rect, Callback callback, Ve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::fill_rect(FillRect const& command)
|
CommandResult DisplayListPlayerCPU::fill_rect(FillRect const& command)
|
||||||
{
|
{
|
||||||
auto paint_op = [&](Gfx::Painter& painter) {
|
auto paint_op = [&](Gfx::Painter& painter) {
|
||||||
painter.fill_rect(command.rect, command.color);
|
painter.fill_rect(command.rect, command.color);
|
||||||
@ -82,14 +82,14 @@ CommandResult CommandExecutorCPU::fill_rect(FillRect const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::draw_scaled_bitmap(DrawScaledBitmap const& command)
|
CommandResult DisplayListPlayerCPU::draw_scaled_bitmap(DrawScaledBitmap const& command)
|
||||||
{
|
{
|
||||||
auto& painter = this->painter();
|
auto& painter = this->painter();
|
||||||
painter.draw_scaled_bitmap(command.dst_rect, command.bitmap, command.src_rect, 1, command.scaling_mode);
|
painter.draw_scaled_bitmap(command.dst_rect, command.bitmap, command.src_rect, 1, command.scaling_mode);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command)
|
CommandResult DisplayListPlayerCPU::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command)
|
||||||
{
|
{
|
||||||
auto paint_op = [&](Gfx::Painter& painter) {
|
auto paint_op = [&](Gfx::Painter& painter) {
|
||||||
painter.draw_scaled_bitmap(command.dst_rect, command.bitmap->bitmap(), command.src_rect, 1, command.scaling_mode);
|
painter.draw_scaled_bitmap(command.dst_rect, command.bitmap->bitmap(), command.src_rect, 1, command.scaling_mode);
|
||||||
@ -102,25 +102,25 @@ CommandResult CommandExecutorCPU::draw_scaled_immutable_bitmap(DrawScaledImmutab
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::save(Save const&)
|
CommandResult DisplayListPlayerCPU::save(Save const&)
|
||||||
{
|
{
|
||||||
painter().save();
|
painter().save();
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::restore(Restore const&)
|
CommandResult DisplayListPlayerCPU::restore(Restore const&)
|
||||||
{
|
{
|
||||||
painter().restore();
|
painter().restore();
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::add_clip_rect(AddClipRect const& command)
|
CommandResult DisplayListPlayerCPU::add_clip_rect(AddClipRect const& command)
|
||||||
{
|
{
|
||||||
painter().add_clip_rect(command.rect);
|
painter().add_clip_rect(command.rect);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::push_stacking_context(PushStackingContext const& command)
|
CommandResult DisplayListPlayerCPU::push_stacking_context(PushStackingContext const& command)
|
||||||
{
|
{
|
||||||
// FIXME: This extracts the affine 2D part of the full transformation matrix.
|
// 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
|
// Use the whole matrix when we get better transformation support in LibGfx or use LibGL for drawing the bitmap
|
||||||
@ -207,7 +207,7 @@ CommandResult CommandExecutorCPU::push_stacking_context(PushStackingContext cons
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::pop_stacking_context(PopStackingContext const&)
|
CommandResult DisplayListPlayerCPU::pop_stacking_context(PopStackingContext const&)
|
||||||
{
|
{
|
||||||
ScopeGuard restore_painter = [&] {
|
ScopeGuard restore_painter = [&] {
|
||||||
painter().restore();
|
painter().restore();
|
||||||
@ -228,7 +228,7 @@ CommandResult CommandExecutorCPU::pop_stacking_context(PopStackingContext const&
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::paint_linear_gradient(PaintLinearGradient const& command)
|
CommandResult DisplayListPlayerCPU::paint_linear_gradient(PaintLinearGradient const& command)
|
||||||
{
|
{
|
||||||
auto const& linear_gradient_data = command.linear_gradient_data;
|
auto const& linear_gradient_data = command.linear_gradient_data;
|
||||||
auto paint_op = [&](Gfx::Painter& painter) {
|
auto paint_op = [&](Gfx::Painter& painter) {
|
||||||
@ -244,21 +244,21 @@ CommandResult CommandExecutorCPU::paint_linear_gradient(PaintLinearGradient cons
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::paint_outer_box_shadow(PaintOuterBoxShadow const& command)
|
CommandResult DisplayListPlayerCPU::paint_outer_box_shadow(PaintOuterBoxShadow const& command)
|
||||||
{
|
{
|
||||||
auto& painter = this->painter();
|
auto& painter = this->painter();
|
||||||
Web::Painting::paint_outer_box_shadow(painter, command.box_shadow_params);
|
Web::Painting::paint_outer_box_shadow(painter, command.box_shadow_params);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::paint_inner_box_shadow(PaintInnerBoxShadow const& command)
|
CommandResult DisplayListPlayerCPU::paint_inner_box_shadow(PaintInnerBoxShadow const& command)
|
||||||
{
|
{
|
||||||
auto& painter = this->painter();
|
auto& painter = this->painter();
|
||||||
Web::Painting::paint_inner_box_shadow(painter, command.box_shadow_params);
|
Web::Painting::paint_inner_box_shadow(painter, command.box_shadow_params);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::paint_text_shadow(PaintTextShadow const& command)
|
CommandResult DisplayListPlayerCPU::paint_text_shadow(PaintTextShadow const& command)
|
||||||
{
|
{
|
||||||
// FIXME: Figure out the maximum bitmap size for all shadows and then allocate it once and reuse it?
|
// 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, command.shadow_bounding_rect.size());
|
auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, command.shadow_bounding_rect.size());
|
||||||
@ -290,7 +290,7 @@ CommandResult CommandExecutorCPU::paint_text_shadow(PaintTextShadow const& comma
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command)
|
CommandResult DisplayListPlayerCPU::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command)
|
||||||
{
|
{
|
||||||
auto paint_op = [&](Gfx::Painter& painter) {
|
auto paint_op = [&](Gfx::Painter& painter) {
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter);
|
Gfx::AntiAliasingPainter aa_painter(painter);
|
||||||
@ -310,7 +310,7 @@ CommandResult CommandExecutorCPU::fill_rect_with_rounded_corners(FillRectWithRou
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::fill_path_using_color(FillPathUsingColor const& command)
|
CommandResult DisplayListPlayerCPU::fill_path_using_color(FillPathUsingColor const& command)
|
||||||
{
|
{
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter());
|
Gfx::AntiAliasingPainter aa_painter(painter());
|
||||||
aa_painter.translate(command.aa_translation);
|
aa_painter.translate(command.aa_translation);
|
||||||
@ -318,7 +318,7 @@ CommandResult CommandExecutorCPU::fill_path_using_color(FillPathUsingColor const
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::fill_path_using_paint_style(FillPathUsingPaintStyle const& command)
|
CommandResult DisplayListPlayerCPU::fill_path_using_paint_style(FillPathUsingPaintStyle const& command)
|
||||||
{
|
{
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter());
|
Gfx::AntiAliasingPainter aa_painter(painter());
|
||||||
auto gfx_paint_style = command.paint_style->create_gfx_paint_style();
|
auto gfx_paint_style = command.paint_style->create_gfx_paint_style();
|
||||||
@ -327,7 +327,7 @@ CommandResult CommandExecutorCPU::fill_path_using_paint_style(FillPathUsingPaint
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::stroke_path_using_color(StrokePathUsingColor const& command)
|
CommandResult DisplayListPlayerCPU::stroke_path_using_color(StrokePathUsingColor const& command)
|
||||||
{
|
{
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter());
|
Gfx::AntiAliasingPainter aa_painter(painter());
|
||||||
aa_painter.translate(command.aa_translation);
|
aa_painter.translate(command.aa_translation);
|
||||||
@ -335,7 +335,7 @@ CommandResult CommandExecutorCPU::stroke_path_using_color(StrokePathUsingColor c
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::stroke_path_using_paint_style(StrokePathUsingPaintStyle const& command)
|
CommandResult DisplayListPlayerCPU::stroke_path_using_paint_style(StrokePathUsingPaintStyle const& command)
|
||||||
{
|
{
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter());
|
Gfx::AntiAliasingPainter aa_painter(painter());
|
||||||
auto gfx_paint_style = command.paint_style->create_gfx_paint_style();
|
auto gfx_paint_style = command.paint_style->create_gfx_paint_style();
|
||||||
@ -344,21 +344,21 @@ CommandResult CommandExecutorCPU::stroke_path_using_paint_style(StrokePathUsingP
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::draw_ellipse(DrawEllipse const& command)
|
CommandResult DisplayListPlayerCPU::draw_ellipse(DrawEllipse const& command)
|
||||||
{
|
{
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter());
|
Gfx::AntiAliasingPainter aa_painter(painter());
|
||||||
aa_painter.draw_ellipse(command.rect, command.color, command.thickness);
|
aa_painter.draw_ellipse(command.rect, command.color, command.thickness);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::fill_ellipse(FillEllipse const& command)
|
CommandResult DisplayListPlayerCPU::fill_ellipse(FillEllipse const& command)
|
||||||
{
|
{
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter());
|
Gfx::AntiAliasingPainter aa_painter(painter());
|
||||||
aa_painter.fill_ellipse(command.rect, command.color);
|
aa_painter.fill_ellipse(command.rect, command.color);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::draw_line(DrawLine const& command)
|
CommandResult DisplayListPlayerCPU::draw_line(DrawLine const& command)
|
||||||
{
|
{
|
||||||
if (command.style == Gfx::LineStyle::Dotted) {
|
if (command.style == Gfx::LineStyle::Dotted) {
|
||||||
Gfx::AntiAliasingPainter aa_painter(painter());
|
Gfx::AntiAliasingPainter aa_painter(painter());
|
||||||
@ -369,7 +369,7 @@ CommandResult CommandExecutorCPU::draw_line(DrawLine const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::apply_backdrop_filter(ApplyBackdropFilter const& command)
|
CommandResult DisplayListPlayerCPU::apply_backdrop_filter(ApplyBackdropFilter const& command)
|
||||||
{
|
{
|
||||||
auto& painter = this->painter();
|
auto& painter = this->painter();
|
||||||
|
|
||||||
@ -406,13 +406,13 @@ CommandResult CommandExecutorCPU::apply_backdrop_filter(ApplyBackdropFilter cons
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::draw_rect(DrawRect const& command)
|
CommandResult DisplayListPlayerCPU::draw_rect(DrawRect const& command)
|
||||||
{
|
{
|
||||||
painter().draw_rect(command.rect, command.color, command.rough);
|
painter().draw_rect(command.rect, command.color, command.rough);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::paint_radial_gradient(PaintRadialGradient const& command)
|
CommandResult DisplayListPlayerCPU::paint_radial_gradient(PaintRadialGradient const& command)
|
||||||
{
|
{
|
||||||
auto paint_op = [&](Gfx::Painter& painter) {
|
auto paint_op = [&](Gfx::Painter& painter) {
|
||||||
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);
|
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);
|
||||||
@ -425,7 +425,7 @@ CommandResult CommandExecutorCPU::paint_radial_gradient(PaintRadialGradient cons
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::paint_conic_gradient(PaintConicGradient const& command)
|
CommandResult DisplayListPlayerCPU::paint_conic_gradient(PaintConicGradient const& command)
|
||||||
{
|
{
|
||||||
auto paint_op = [&](Gfx::Painter& painter) {
|
auto paint_op = [&](Gfx::Painter& painter) {
|
||||||
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);
|
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);
|
||||||
@ -438,18 +438,18 @@ CommandResult CommandExecutorCPU::paint_conic_gradient(PaintConicGradient const&
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::draw_triangle_wave(DrawTriangleWave const& command)
|
CommandResult DisplayListPlayerCPU::draw_triangle_wave(DrawTriangleWave const& command)
|
||||||
{
|
{
|
||||||
painter().draw_triangle_wave(command.p1, command.p2, command.color, command.amplitude, command.thickness);
|
painter().draw_triangle_wave(command.p1, command.p2, command.color, command.amplitude, command.thickness);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandExecutorCPU::prepare_to_execute(size_t corner_clip_max_depth)
|
void DisplayListPlayerCPU::prepare_to_execute(size_t corner_clip_max_depth)
|
||||||
{
|
{
|
||||||
m_corner_clippers_stack.ensure_capacity(corner_clip_max_depth);
|
m_corner_clippers_stack.ensure_capacity(corner_clip_max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::sample_under_corners(SampleUnderCorners const& command)
|
CommandResult DisplayListPlayerCPU::sample_under_corners(SampleUnderCorners const& command)
|
||||||
{
|
{
|
||||||
auto clipper = BorderRadiusCornerClipper::create(command.corner_radii, command.border_rect.to_type<DevicePixels>(), command.corner_clip).release_value();
|
auto clipper = BorderRadiusCornerClipper::create(command.corner_radii, command.border_rect.to_type<DevicePixels>(), command.corner_clip).release_value();
|
||||||
clipper->sample_under_corners(painter());
|
clipper->sample_under_corners(painter());
|
||||||
@ -457,14 +457,14 @@ CommandResult CommandExecutorCPU::sample_under_corners(SampleUnderCorners const&
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorCPU::blit_corner_clipping(BlitCornerClipping const&)
|
CommandResult DisplayListPlayerCPU::blit_corner_clipping(BlitCornerClipping const&)
|
||||||
{
|
{
|
||||||
auto clipper = m_corner_clippers_stack.take_last();
|
auto clipper = m_corner_clippers_stack.take_last();
|
||||||
clipper->blit_corner_clipping(painter());
|
clipper->blit_corner_clipping(painter());
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandExecutorCPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
|
bool DisplayListPlayerCPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
|
||||||
{
|
{
|
||||||
return !painter().clip_rect().intersects(rect.translated(painter().translation()));
|
return !painter().clip_rect().intersects(rect.translated(painter().translation()));
|
||||||
}
|
}
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace Web::Painting {
|
namespace Web::Painting {
|
||||||
|
|
||||||
class CommandExecutorCPU : public CommandExecutor {
|
class DisplayListPlayerCPU : public DisplayListPlayer {
|
||||||
public:
|
public:
|
||||||
CommandResult draw_glyph_run(DrawGlyphRun const&) override;
|
CommandResult draw_glyph_run(DrawGlyphRun const&) override;
|
||||||
CommandResult fill_rect(FillRect const&) override;
|
CommandResult fill_rect(FillRect const&) override;
|
||||||
@ -53,8 +53,8 @@ public:
|
|||||||
bool needs_update_immutable_bitmap_texture_cache() const override { return false; }
|
bool needs_update_immutable_bitmap_texture_cache() const override { return false; }
|
||||||
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override {};
|
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override {};
|
||||||
|
|
||||||
CommandExecutorCPU(Gfx::Bitmap& bitmap);
|
DisplayListPlayerCPU(Gfx::Bitmap& bitmap);
|
||||||
~CommandExecutorCPU();
|
~DisplayListPlayerCPU();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gfx::Bitmap& m_target_bitmap;
|
Gfx::Bitmap& m_target_bitmap;
|
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
#include <LibAccelGfx/GlyphAtlas.h>
|
#include <LibAccelGfx/GlyphAtlas.h>
|
||||||
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
|
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorGPU.h>
|
#include <LibWeb/Painting/DisplayListPlayerGPU.h>
|
||||||
|
|
||||||
namespace Web::Painting {
|
namespace Web::Painting {
|
||||||
|
|
||||||
CommandExecutorGPU::CommandExecutorGPU(AccelGfx::Context& context, Gfx::Bitmap& bitmap)
|
DisplayListPlayerGPU::DisplayListPlayerGPU(AccelGfx::Context& context, Gfx::Bitmap& bitmap)
|
||||||
: m_target_bitmap(bitmap)
|
: m_target_bitmap(bitmap)
|
||||||
, m_context(context)
|
, m_context(context)
|
||||||
{
|
{
|
||||||
@ -24,14 +24,14 @@ CommandExecutorGPU::CommandExecutorGPU(AccelGfx::Context& context, Gfx::Bitmap&
|
|||||||
.transform = {} });
|
.transform = {} });
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandExecutorGPU::~CommandExecutorGPU()
|
DisplayListPlayerGPU::~DisplayListPlayerGPU()
|
||||||
{
|
{
|
||||||
m_context.activate();
|
m_context.activate();
|
||||||
VERIFY(m_stacking_contexts.size() == 1);
|
VERIFY(m_stacking_contexts.size() == 1);
|
||||||
painter().flush(m_target_bitmap);
|
painter().flush(m_target_bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::draw_glyph_run(DrawGlyphRun const& command)
|
CommandResult DisplayListPlayerGPU::draw_glyph_run(DrawGlyphRun const& command)
|
||||||
{
|
{
|
||||||
Vector<Gfx::DrawGlyphOrEmoji> transformed_glyph_run;
|
Vector<Gfx::DrawGlyphOrEmoji> transformed_glyph_run;
|
||||||
auto const& glyphs = command.glyph_run->glyphs();
|
auto const& glyphs = command.glyph_run->glyphs();
|
||||||
@ -48,7 +48,7 @@ CommandResult CommandExecutorGPU::draw_glyph_run(DrawGlyphRun const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::fill_rect(FillRect const& command)
|
CommandResult DisplayListPlayerGPU::fill_rect(FillRect const& command)
|
||||||
{
|
{
|
||||||
// FIXME: Support clip paths
|
// FIXME: Support clip paths
|
||||||
painter().fill_rect(command.rect, command.color);
|
painter().fill_rect(command.rect, command.color);
|
||||||
@ -70,38 +70,38 @@ static AccelGfx::Painter::ScalingMode to_accelgfx_scaling_mode(Gfx::ScalingMode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::draw_scaled_bitmap(DrawScaledBitmap const& command)
|
CommandResult DisplayListPlayerGPU::draw_scaled_bitmap(DrawScaledBitmap const& command)
|
||||||
{
|
{
|
||||||
painter().draw_scaled_bitmap(command.dst_rect, command.bitmap, command.src_rect, to_accelgfx_scaling_mode(command.scaling_mode));
|
painter().draw_scaled_bitmap(command.dst_rect, command.bitmap, command.src_rect, to_accelgfx_scaling_mode(command.scaling_mode));
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command)
|
CommandResult DisplayListPlayerGPU::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command)
|
||||||
{
|
{
|
||||||
// TODO: Support clip paths
|
// TODO: Support clip paths
|
||||||
painter().draw_scaled_immutable_bitmap(command.dst_rect, command.bitmap, command.src_rect, to_accelgfx_scaling_mode(command.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;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::save(Save const&)
|
CommandResult DisplayListPlayerGPU::save(Save const&)
|
||||||
{
|
{
|
||||||
painter().save();
|
painter().save();
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::restore(Restore const&)
|
CommandResult DisplayListPlayerGPU::restore(Restore const&)
|
||||||
{
|
{
|
||||||
painter().restore();
|
painter().restore();
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::add_clip_rect(AddClipRect const& command)
|
CommandResult DisplayListPlayerGPU::add_clip_rect(AddClipRect const& command)
|
||||||
{
|
{
|
||||||
painter().set_clip_rect(command.rect);
|
painter().set_clip_rect(command.rect);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::push_stacking_context(PushStackingContext const& command)
|
CommandResult DisplayListPlayerGPU::push_stacking_context(PushStackingContext const& command)
|
||||||
{
|
{
|
||||||
if (command.source_paintable_rect.is_empty())
|
if (command.source_paintable_rect.is_empty())
|
||||||
return CommandResult::SkipStackingContext;
|
return CommandResult::SkipStackingContext;
|
||||||
@ -151,7 +151,7 @@ CommandResult CommandExecutorGPU::push_stacking_context(PushStackingContext cons
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::pop_stacking_context(PopStackingContext const&)
|
CommandResult DisplayListPlayerGPU::pop_stacking_context(PopStackingContext const&)
|
||||||
{
|
{
|
||||||
auto stacking_context = m_stacking_contexts.take_last();
|
auto stacking_context = m_stacking_contexts.take_last();
|
||||||
VERIFY(stacking_context.stacking_context_depth == 0);
|
VERIFY(stacking_context.stacking_context_depth == 0);
|
||||||
@ -163,7 +163,7 @@ CommandResult CommandExecutorGPU::pop_stacking_context(PopStackingContext const&
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::paint_linear_gradient(PaintLinearGradient const& command)
|
CommandResult DisplayListPlayerGPU::paint_linear_gradient(PaintLinearGradient const& command)
|
||||||
{
|
{
|
||||||
// FIXME: Support clip paths
|
// FIXME: Support clip paths
|
||||||
auto const& linear_gradient_data = command.linear_gradient_data;
|
auto const& linear_gradient_data = command.linear_gradient_data;
|
||||||
@ -171,19 +171,19 @@ CommandResult CommandExecutorGPU::paint_linear_gradient(PaintLinearGradient cons
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::paint_outer_box_shadow(PaintOuterBoxShadow const&)
|
CommandResult DisplayListPlayerGPU::paint_outer_box_shadow(PaintOuterBoxShadow const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::paint_inner_box_shadow(PaintInnerBoxShadow const&)
|
CommandResult DisplayListPlayerGPU::paint_inner_box_shadow(PaintInnerBoxShadow const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::paint_text_shadow(PaintTextShadow const& command)
|
CommandResult DisplayListPlayerGPU::paint_text_shadow(PaintTextShadow const& command)
|
||||||
{
|
{
|
||||||
auto text_shadow_canvas = AccelGfx::Canvas::create(command.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);
|
auto text_shadow_painter = AccelGfx::Painter::create(m_context, text_shadow_canvas);
|
||||||
@ -206,7 +206,7 @@ CommandResult CommandExecutorGPU::paint_text_shadow(PaintTextShadow const& comma
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command)
|
CommandResult DisplayListPlayerGPU::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command)
|
||||||
{
|
{
|
||||||
// FIXME: Support clip paths
|
// FIXME: Support clip paths
|
||||||
painter().fill_rect_with_rounded_corners(
|
painter().fill_rect_with_rounded_corners(
|
||||||
@ -218,37 +218,37 @@ CommandResult CommandExecutorGPU::fill_rect_with_rounded_corners(FillRectWithRou
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::fill_path_using_color(FillPathUsingColor const&)
|
CommandResult DisplayListPlayerGPU::fill_path_using_color(FillPathUsingColor const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::fill_path_using_paint_style(FillPathUsingPaintStyle const&)
|
CommandResult DisplayListPlayerGPU::fill_path_using_paint_style(FillPathUsingPaintStyle const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::stroke_path_using_color(StrokePathUsingColor const&)
|
CommandResult DisplayListPlayerGPU::stroke_path_using_color(StrokePathUsingColor const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::stroke_path_using_paint_style(StrokePathUsingPaintStyle const&)
|
CommandResult DisplayListPlayerGPU::stroke_path_using_paint_style(StrokePathUsingPaintStyle const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::draw_ellipse(DrawEllipse const&)
|
CommandResult DisplayListPlayerGPU::draw_ellipse(DrawEllipse const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::fill_ellipse(FillEllipse const& command)
|
CommandResult DisplayListPlayerGPU::fill_ellipse(FillEllipse const& command)
|
||||||
{
|
{
|
||||||
auto horizontal_radius = static_cast<float>(command.rect.width() / 2);
|
auto horizontal_radius = static_cast<float>(command.rect.width() / 2);
|
||||||
auto vertical_radius = static_cast<float>(command.rect.height() / 2);
|
auto vertical_radius = static_cast<float>(command.rect.height() / 2);
|
||||||
@ -261,44 +261,44 @@ CommandResult CommandExecutorGPU::fill_ellipse(FillEllipse const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::draw_line(DrawLine const& command)
|
CommandResult DisplayListPlayerGPU::draw_line(DrawLine const& command)
|
||||||
{
|
{
|
||||||
// FIXME: Pass line style and alternate color once AccelGfx::Painter supports it
|
// FIXME: Pass line style and alternate color once AccelGfx::Painter supports it
|
||||||
painter().draw_line(command.from, command.to, command.thickness, command.color);
|
painter().draw_line(command.from, command.to, command.thickness, command.color);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::apply_backdrop_filter(ApplyBackdropFilter const&)
|
CommandResult DisplayListPlayerGPU::apply_backdrop_filter(ApplyBackdropFilter const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::draw_rect(DrawRect const&)
|
CommandResult DisplayListPlayerGPU::draw_rect(DrawRect const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::paint_radial_gradient(PaintRadialGradient const&)
|
CommandResult DisplayListPlayerGPU::paint_radial_gradient(PaintRadialGradient const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::paint_conic_gradient(PaintConicGradient const&)
|
CommandResult DisplayListPlayerGPU::paint_conic_gradient(PaintConicGradient const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::draw_triangle_wave(DrawTriangleWave const&)
|
CommandResult DisplayListPlayerGPU::draw_triangle_wave(DrawTriangleWave const&)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::sample_under_corners(SampleUnderCorners const& command)
|
CommandResult DisplayListPlayerGPU::sample_under_corners(SampleUnderCorners const& command)
|
||||||
{
|
{
|
||||||
m_corner_clippers.resize(command.id + 1);
|
m_corner_clippers.resize(command.id + 1);
|
||||||
m_corner_clippers[command.id] = make<BorderRadiusCornerClipper>();
|
m_corner_clippers[command.id] = make<BorderRadiusCornerClipper>();
|
||||||
@ -354,7 +354,7 @@ CommandResult CommandExecutorGPU::sample_under_corners(SampleUnderCorners const&
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorGPU::blit_corner_clipping(BlitCornerClipping const& command)
|
CommandResult DisplayListPlayerGPU::blit_corner_clipping(BlitCornerClipping const& command)
|
||||||
{
|
{
|
||||||
auto const& corner_clipper = *m_corner_clippers[command.id];
|
auto const& corner_clipper = *m_corner_clippers[command.id];
|
||||||
auto const& corner_sample_canvas = *corner_clipper.corners_sample_canvas;
|
auto const& corner_sample_canvas = *corner_clipper.corners_sample_canvas;
|
||||||
@ -372,23 +372,23 @@ CommandResult CommandExecutorGPU::blit_corner_clipping(BlitCornerClipping const&
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandExecutorGPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
|
bool DisplayListPlayerGPU::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
|
||||||
{
|
{
|
||||||
auto translation = painter().transform().translation().to_type<int>();
|
auto translation = painter().transform().translation().to_type<int>();
|
||||||
return !painter().clip_rect().intersects(rect.translated(translation));
|
return !painter().clip_rect().intersects(rect.translated(translation));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandExecutorGPU::prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_glyphs)
|
void DisplayListPlayerGPU::prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_glyphs)
|
||||||
{
|
{
|
||||||
AccelGfx::GlyphAtlas::the().update(unique_glyphs);
|
AccelGfx::GlyphAtlas::the().update(unique_glyphs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandExecutorGPU::prepare_to_execute([[maybe_unused]] size_t corner_clip_max_depth)
|
void DisplayListPlayerGPU::prepare_to_execute([[maybe_unused]] size_t corner_clip_max_depth)
|
||||||
{
|
{
|
||||||
m_context.activate();
|
m_context.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandExecutorGPU::update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>& immutable_bitmaps)
|
void DisplayListPlayerGPU::update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>& immutable_bitmaps)
|
||||||
{
|
{
|
||||||
painter().update_immutable_bitmap_texture_cache(immutable_bitmaps);
|
painter().update_immutable_bitmap_texture_cache(immutable_bitmaps);
|
||||||
}
|
}
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace Web::Painting {
|
namespace Web::Painting {
|
||||||
|
|
||||||
class CommandExecutorGPU : public CommandExecutor {
|
class DisplayListPlayerGPU : public DisplayListPlayer {
|
||||||
public:
|
public:
|
||||||
CommandResult draw_glyph_run(DrawGlyphRun const&) override;
|
CommandResult draw_glyph_run(DrawGlyphRun const&) override;
|
||||||
CommandResult fill_rect(FillRect const&) override;
|
CommandResult fill_rect(FillRect const&) override;
|
||||||
@ -53,8 +53,8 @@ public:
|
|||||||
bool needs_update_immutable_bitmap_texture_cache() const override { return true; }
|
bool needs_update_immutable_bitmap_texture_cache() const override { return true; }
|
||||||
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override;
|
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override;
|
||||||
|
|
||||||
CommandExecutorGPU(AccelGfx::Context&, Gfx::Bitmap& bitmap);
|
DisplayListPlayerGPU(AccelGfx::Context&, Gfx::Bitmap& bitmap);
|
||||||
~CommandExecutorGPU() override;
|
~DisplayListPlayerGPU() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gfx::Bitmap& m_target_bitmap;
|
Gfx::Bitmap& m_target_bitmap;
|
@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
#include <LibGfx/Filters/StackBlurFilter.h>
|
#include <LibGfx/Filters/StackBlurFilter.h>
|
||||||
#include <LibWeb/CSS/ComputedValues.h>
|
#include <LibWeb/CSS/ComputedValues.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorSkia.h>
|
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
||||||
#include <LibWeb/Painting/ShadowPainting.h>
|
#include <LibWeb/Painting/ShadowPainting.h>
|
||||||
|
|
||||||
namespace Web::Painting {
|
namespace Web::Painting {
|
||||||
|
|
||||||
class CommandExecutorSkia::SkiaSurface {
|
class DisplayListPlayerSkia::SkiaSurface {
|
||||||
public:
|
public:
|
||||||
SkCanvas& canvas() const { return *surface->getCanvas(); }
|
SkCanvas& canvas() const { return *surface->getCanvas(); }
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ static SkSamplingOptions to_skia_sampling_options(Gfx::ScalingMode scaling_mode)
|
|||||||
surface().canvas().clipPath(to_skia_path(path), true); \
|
surface().canvas().clipPath(to_skia_path(path), true); \
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandExecutorSkia::CommandExecutorSkia(Gfx::Bitmap& bitmap)
|
DisplayListPlayerSkia::DisplayListPlayerSkia(Gfx::Bitmap& bitmap)
|
||||||
{
|
{
|
||||||
VERIFY(bitmap.format() == Gfx::BitmapFormat::BGRA8888);
|
VERIFY(bitmap.format() == Gfx::BitmapFormat::BGRA8888);
|
||||||
auto image_info = SkImageInfo::Make(bitmap.width(), bitmap.height(), kBGRA_8888_SkColorType, kPremul_SkAlphaType);
|
auto image_info = SkImageInfo::Make(bitmap.width(), bitmap.height(), kBGRA_8888_SkColorType, kPremul_SkAlphaType);
|
||||||
@ -204,14 +204,14 @@ CommandExecutorSkia::CommandExecutorSkia(Gfx::Bitmap& bitmap)
|
|||||||
m_surface = make<SkiaSurface>(surface);
|
m_surface = make<SkiaSurface>(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandExecutorSkia::~CommandExecutorSkia() = default;
|
DisplayListPlayerSkia::~DisplayListPlayerSkia() = default;
|
||||||
|
|
||||||
CommandExecutorSkia::SkiaSurface& CommandExecutorSkia::surface() const
|
DisplayListPlayerSkia::SkiaSurface& DisplayListPlayerSkia::surface() const
|
||||||
{
|
{
|
||||||
return static_cast<SkiaSurface&>(*m_surface);
|
return static_cast<SkiaSurface&>(*m_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::draw_glyph_run(DrawGlyphRun const& command)
|
CommandResult DisplayListPlayerSkia::draw_glyph_run(DrawGlyphRun const& command)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
@ -245,7 +245,7 @@ CommandResult CommandExecutorSkia::draw_glyph_run(DrawGlyphRun const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::fill_rect(FillRect const& command)
|
CommandResult DisplayListPlayerSkia::fill_rect(FillRect const& command)
|
||||||
{
|
{
|
||||||
APPLY_PATH_CLIP_IF_NEEDED
|
APPLY_PATH_CLIP_IF_NEEDED
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ CommandResult CommandExecutorSkia::fill_rect(FillRect const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::draw_scaled_bitmap(DrawScaledBitmap const& command)
|
CommandResult DisplayListPlayerSkia::draw_scaled_bitmap(DrawScaledBitmap const& command)
|
||||||
{
|
{
|
||||||
auto src_rect = to_skia_rect(command.src_rect);
|
auto src_rect = to_skia_rect(command.src_rect);
|
||||||
auto dst_rect = to_skia_rect(command.dst_rect);
|
auto dst_rect = to_skia_rect(command.dst_rect);
|
||||||
@ -269,7 +269,7 @@ CommandResult CommandExecutorSkia::draw_scaled_bitmap(DrawScaledBitmap const& co
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command)
|
CommandResult DisplayListPlayerSkia::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command)
|
||||||
{
|
{
|
||||||
APPLY_PATH_CLIP_IF_NEEDED
|
APPLY_PATH_CLIP_IF_NEEDED
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ CommandResult CommandExecutorSkia::draw_scaled_immutable_bitmap(DrawScaledImmuta
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::add_clip_rect(AddClipRect const& command)
|
CommandResult DisplayListPlayerSkia::add_clip_rect(AddClipRect const& command)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
auto const& rect = command.rect;
|
auto const& rect = command.rect;
|
||||||
@ -291,14 +291,14 @@ CommandResult CommandExecutorSkia::add_clip_rect(AddClipRect const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::save(Save const&)
|
CommandResult DisplayListPlayerSkia::save(Save const&)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
canvas.save();
|
canvas.save();
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::restore(Restore const&)
|
CommandResult DisplayListPlayerSkia::restore(Restore const&)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
@ -324,7 +324,7 @@ static SkBitmap alpha_mask_from_bitmap(Gfx::Bitmap const& bitmap, Gfx::Bitmap::M
|
|||||||
return alpha_mask;
|
return alpha_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::push_stacking_context(PushStackingContext const& command)
|
CommandResult DisplayListPlayerSkia::push_stacking_context(PushStackingContext const& command)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
|
|
||||||
@ -363,13 +363,13 @@ CommandResult CommandExecutorSkia::push_stacking_context(PushStackingContext con
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::pop_stacking_context(PopStackingContext const&)
|
CommandResult DisplayListPlayerSkia::pop_stacking_context(PopStackingContext const&)
|
||||||
{
|
{
|
||||||
surface().canvas().restore();
|
surface().canvas().restore();
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::paint_linear_gradient(PaintLinearGradient const& command)
|
CommandResult DisplayListPlayerSkia::paint_linear_gradient(PaintLinearGradient const& command)
|
||||||
{
|
{
|
||||||
APPLY_PATH_CLIP_IF_NEEDED
|
APPLY_PATH_CLIP_IF_NEEDED
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ static void add_spread_distance_to_border_radius(int& border_radius, int spread_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::paint_outer_box_shadow(PaintOuterBoxShadow const& command)
|
CommandResult DisplayListPlayerSkia::paint_outer_box_shadow(PaintOuterBoxShadow const& command)
|
||||||
{
|
{
|
||||||
auto const& outer_box_shadow_params = command.box_shadow_params;
|
auto const& outer_box_shadow_params = command.box_shadow_params;
|
||||||
auto const& color = outer_box_shadow_params.color;
|
auto const& color = outer_box_shadow_params.color;
|
||||||
@ -469,7 +469,7 @@ CommandResult CommandExecutorSkia::paint_outer_box_shadow(PaintOuterBoxShadow co
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::paint_inner_box_shadow(PaintInnerBoxShadow const& command)
|
CommandResult DisplayListPlayerSkia::paint_inner_box_shadow(PaintInnerBoxShadow const& command)
|
||||||
{
|
{
|
||||||
auto const& outer_box_shadow_params = command.box_shadow_params;
|
auto const& outer_box_shadow_params = command.box_shadow_params;
|
||||||
auto color = outer_box_shadow_params.color;
|
auto color = outer_box_shadow_params.color;
|
||||||
@ -525,12 +525,12 @@ CommandResult CommandExecutorSkia::paint_inner_box_shadow(PaintInnerBoxShadow co
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::paint_text_shadow(PaintTextShadow const&)
|
CommandResult DisplayListPlayerSkia::paint_text_shadow(PaintTextShadow const&)
|
||||||
{
|
{
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command)
|
CommandResult DisplayListPlayerSkia::fill_rect_with_rounded_corners(FillRectWithRoundedCorners const& command)
|
||||||
{
|
{
|
||||||
APPLY_PATH_CLIP_IF_NEEDED
|
APPLY_PATH_CLIP_IF_NEEDED
|
||||||
|
|
||||||
@ -552,7 +552,7 @@ CommandResult CommandExecutorSkia::fill_rect_with_rounded_corners(FillRectWithRo
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::fill_path_using_color(FillPathUsingColor const& command)
|
CommandResult DisplayListPlayerSkia::fill_path_using_color(FillPathUsingColor const& command)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
@ -604,7 +604,7 @@ SkPaint paint_style_to_skia_paint(Painting::SVGGradientPaintStyle const& paint_s
|
|||||||
return paint;
|
return paint;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::fill_path_using_paint_style(FillPathUsingPaintStyle const& command)
|
CommandResult DisplayListPlayerSkia::fill_path_using_paint_style(FillPathUsingPaintStyle const& command)
|
||||||
{
|
{
|
||||||
auto path = to_skia_path(command.path);
|
auto path = to_skia_path(command.path);
|
||||||
path.offset(command.aa_translation.x(), command.aa_translation.y());
|
path.offset(command.aa_translation.x(), command.aa_translation.y());
|
||||||
@ -616,7 +616,7 @@ CommandResult CommandExecutorSkia::fill_path_using_paint_style(FillPathUsingPain
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::stroke_path_using_color(StrokePathUsingColor const& command)
|
CommandResult DisplayListPlayerSkia::stroke_path_using_color(StrokePathUsingColor const& command)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
@ -630,7 +630,7 @@ CommandResult CommandExecutorSkia::stroke_path_using_color(StrokePathUsingColor
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::stroke_path_using_paint_style(StrokePathUsingPaintStyle const& command)
|
CommandResult DisplayListPlayerSkia::stroke_path_using_paint_style(StrokePathUsingPaintStyle const& command)
|
||||||
{
|
{
|
||||||
auto path = to_skia_path(command.path);
|
auto path = to_skia_path(command.path);
|
||||||
path.offset(command.aa_translation.x(), command.aa_translation.y());
|
path.offset(command.aa_translation.x(), command.aa_translation.y());
|
||||||
@ -643,7 +643,7 @@ CommandResult CommandExecutorSkia::stroke_path_using_paint_style(StrokePathUsing
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::draw_ellipse(DrawEllipse const& command)
|
CommandResult DisplayListPlayerSkia::draw_ellipse(DrawEllipse const& command)
|
||||||
{
|
{
|
||||||
auto const& rect = command.rect;
|
auto const& rect = command.rect;
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
@ -656,7 +656,7 @@ CommandResult CommandExecutorSkia::draw_ellipse(DrawEllipse const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::fill_ellipse(FillEllipse const& command)
|
CommandResult DisplayListPlayerSkia::fill_ellipse(FillEllipse const& command)
|
||||||
{
|
{
|
||||||
auto const& rect = command.rect;
|
auto const& rect = command.rect;
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
@ -667,7 +667,7 @@ CommandResult CommandExecutorSkia::fill_ellipse(FillEllipse const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::draw_line(DrawLine const& command)
|
CommandResult DisplayListPlayerSkia::draw_line(DrawLine const& command)
|
||||||
{
|
{
|
||||||
auto from = SkPoint::Make(command.from.x(), command.from.y());
|
auto from = SkPoint::Make(command.from.x(), command.from.y());
|
||||||
auto to = SkPoint::Make(command.to.x(), command.to.y());
|
auto to = SkPoint::Make(command.to.x(), command.to.y());
|
||||||
@ -679,7 +679,7 @@ CommandResult CommandExecutorSkia::draw_line(DrawLine const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::apply_backdrop_filter(ApplyBackdropFilter const& command)
|
CommandResult DisplayListPlayerSkia::apply_backdrop_filter(ApplyBackdropFilter const& command)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
|
|
||||||
@ -817,7 +817,7 @@ CommandResult CommandExecutorSkia::apply_backdrop_filter(ApplyBackdropFilter con
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::draw_rect(DrawRect const& command)
|
CommandResult DisplayListPlayerSkia::draw_rect(DrawRect const& command)
|
||||||
{
|
{
|
||||||
auto const& rect = command.rect;
|
auto const& rect = command.rect;
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
@ -829,7 +829,7 @@ CommandResult CommandExecutorSkia::draw_rect(DrawRect const& command)
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::paint_radial_gradient(PaintRadialGradient const& command)
|
CommandResult DisplayListPlayerSkia::paint_radial_gradient(PaintRadialGradient const& command)
|
||||||
{
|
{
|
||||||
APPLY_PATH_CLIP_IF_NEEDED
|
APPLY_PATH_CLIP_IF_NEEDED
|
||||||
|
|
||||||
@ -859,22 +859,22 @@ CommandResult CommandExecutorSkia::paint_radial_gradient(PaintRadialGradient con
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::paint_conic_gradient(PaintConicGradient const& command)
|
CommandResult DisplayListPlayerSkia::paint_conic_gradient(PaintConicGradient const& command)
|
||||||
{
|
{
|
||||||
APPLY_PATH_CLIP_IF_NEEDED
|
APPLY_PATH_CLIP_IF_NEEDED
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::draw_triangle_wave(DrawTriangleWave const&)
|
CommandResult DisplayListPlayerSkia::draw_triangle_wave(DrawTriangleWave const&)
|
||||||
{
|
{
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandExecutorSkia::prepare_to_execute(size_t)
|
void DisplayListPlayerSkia::prepare_to_execute(size_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::sample_under_corners(SampleUnderCorners const& command)
|
CommandResult DisplayListPlayerSkia::sample_under_corners(SampleUnderCorners const& command)
|
||||||
{
|
{
|
||||||
auto rounded_rect = to_skia_rrect(command.border_rect, command.corner_radii);
|
auto rounded_rect = to_skia_rrect(command.border_rect, command.corner_radii);
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
@ -884,14 +884,14 @@ CommandResult CommandExecutorSkia::sample_under_corners(SampleUnderCorners const
|
|||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult CommandExecutorSkia::blit_corner_clipping(BlitCornerClipping const&)
|
CommandResult DisplayListPlayerSkia::blit_corner_clipping(BlitCornerClipping const&)
|
||||||
{
|
{
|
||||||
auto& canvas = surface().canvas();
|
auto& canvas = surface().canvas();
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandExecutorSkia::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
|
bool DisplayListPlayerSkia::would_be_fully_clipped_by_painter(Gfx::IntRect rect) const
|
||||||
{
|
{
|
||||||
return surface().canvas().quickReject(to_skia_rect(rect));
|
return surface().canvas().quickReject(to_skia_rect(rect));
|
||||||
}
|
}
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Web::Painting {
|
namespace Web::Painting {
|
||||||
|
|
||||||
class CommandExecutorSkia : public CommandExecutor {
|
class DisplayListPlayerSkia : public DisplayListPlayer {
|
||||||
public:
|
public:
|
||||||
CommandResult draw_glyph_run(DrawGlyphRun const&) override;
|
CommandResult draw_glyph_run(DrawGlyphRun const&) override;
|
||||||
CommandResult fill_rect(FillRect const&) override;
|
CommandResult fill_rect(FillRect const&) override;
|
||||||
@ -52,8 +52,8 @@ public:
|
|||||||
bool needs_update_immutable_bitmap_texture_cache() const override { return false; }
|
bool needs_update_immutable_bitmap_texture_cache() const override { return false; }
|
||||||
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override {};
|
void update_immutable_bitmap_texture_cache(HashMap<u32, Gfx::ImmutableBitmap const*>&) override {};
|
||||||
|
|
||||||
CommandExecutorSkia(Gfx::Bitmap& bitmap);
|
DisplayListPlayerSkia(Gfx::Bitmap& bitmap);
|
||||||
virtual ~CommandExecutorSkia() override;
|
virtual ~DisplayListPlayerSkia() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class SkiaSurface;
|
class SkiaSurface;
|
@ -7,7 +7,7 @@
|
|||||||
#include <LibWeb/Layout/ImageBox.h>
|
#include <LibWeb/Layout/ImageBox.h>
|
||||||
#include <LibWeb/Layout/SVGClipBox.h>
|
#include <LibWeb/Layout/SVGClipBox.h>
|
||||||
#include <LibWeb/Layout/SVGMaskBox.h>
|
#include <LibWeb/Layout/SVGMaskBox.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorCPU.h>
|
#include <LibWeb/Painting/DisplayListPlayerCPU.h>
|
||||||
#include <LibWeb/Painting/SVGClipPaintable.h>
|
#include <LibWeb/Painting/SVGClipPaintable.h>
|
||||||
#include <LibWeb/Painting/SVGGraphicsPaintable.h>
|
#include <LibWeb/Painting/SVGGraphicsPaintable.h>
|
||||||
#include <LibWeb/Painting/StackingContext.h>
|
#include <LibWeb/Painting/StackingContext.h>
|
||||||
@ -88,7 +88,7 @@ RefPtr<Gfx::Bitmap> SVGMaskable::calculate_mask_of_svg(PaintContext& context, CS
|
|||||||
paint_context.set_svg_transform(graphics_element.get_transform());
|
paint_context.set_svg_transform(graphics_element.get_transform());
|
||||||
paint_context.set_draw_svg_geometry_for_clip_path(is<SVGClipPaintable>(paintable));
|
paint_context.set_draw_svg_geometry_for_clip_path(is<SVGClipPaintable>(paintable));
|
||||||
StackingContext::paint_node_as_stacking_context(paintable, paint_context);
|
StackingContext::paint_node_as_stacking_context(paintable, paint_context);
|
||||||
CommandExecutorCPU executor { *mask_bitmap };
|
DisplayListPlayerCPU executor { *mask_bitmap };
|
||||||
display_list.execute(executor);
|
display_list.execute(executor);
|
||||||
return mask_bitmap;
|
return mask_bitmap;
|
||||||
};
|
};
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||||
#include <LibWeb/Layout/Viewport.h>
|
#include <LibWeb/Layout/Viewport.h>
|
||||||
#include <LibWeb/Page/Page.h>
|
#include <LibWeb/Page/Page.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorCPU.h>
|
#include <LibWeb/Painting/DisplayListPlayerCPU.h>
|
||||||
#include <LibWeb/Painting/CommandExecutorSkia.h>
|
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
||||||
#include <LibWeb/Painting/PaintContext.h>
|
#include <LibWeb/Painting/PaintContext.h>
|
||||||
#include <LibWeb/Painting/ViewportPaintable.h>
|
#include <LibWeb/Painting/ViewportPaintable.h>
|
||||||
#include <LibWeb/SVG/SVGDecodedImageData.h>
|
#include <LibWeb/SVG/SVGDecodedImageData.h>
|
||||||
@ -98,16 +98,16 @@ RefPtr<Gfx::Bitmap> SVGDecodedImageData::render(Gfx::IntSize size) const
|
|||||||
|
|
||||||
m_document->navigable()->record_display_list(display_list_recorder, {});
|
m_document->navigable()->record_display_list(display_list_recorder, {});
|
||||||
|
|
||||||
auto painting_command_executor_type = m_page_client->painting_command_executor_type();
|
auto painting_command_executor_type = m_page_client->display_list_player_type();
|
||||||
switch (painting_command_executor_type) {
|
switch (painting_command_executor_type) {
|
||||||
case PaintingCommandExecutorType::CPU:
|
case DisplayListPlayerType::CPU:
|
||||||
case PaintingCommandExecutorType::GPU: { // GPU painter does not have any path rasterization support so we always fall back to CPU painter
|
case DisplayListPlayerType::GPU: { // GPU painter does not have any path rasterization support so we always fall back to CPU painter
|
||||||
Painting::CommandExecutorCPU executor { *bitmap };
|
Painting::DisplayListPlayerCPU executor { *bitmap };
|
||||||
display_list.execute(executor);
|
display_list.execute(executor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PaintingCommandExecutorType::Skia: {
|
case DisplayListPlayerType::Skia: {
|
||||||
Painting::CommandExecutorSkia executor { *bitmap };
|
Painting::DisplayListPlayerSkia executor { *bitmap };
|
||||||
display_list.execute(executor);
|
display_list.execute(executor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
virtual void schedule_repaint() override { }
|
virtual void schedule_repaint() override { }
|
||||||
virtual bool is_ready_to_paint() const override { return true; }
|
virtual bool is_ready_to_paint() const override { return true; }
|
||||||
|
|
||||||
virtual PaintingCommandExecutorType painting_command_executor_type() const override { return m_host_page->client().painting_command_executor_type(); }
|
virtual DisplayListPlayerType display_list_player_type() const override { return m_host_page->client().display_list_player_type(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit SVGPageClient(Page& host_page)
|
explicit SVGPageClient(Page& host_page)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <WebContent/WebDriverConnection.h>
|
#include <WebContent/WebDriverConnection.h>
|
||||||
|
|
||||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||||
# include <LibWeb/Painting/CommandExecutorGPU.h>
|
# include <LibWeb/Painting/DisplayListPlayerGPU.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace WebContent {
|
namespace WebContent {
|
||||||
@ -740,13 +740,13 @@ void PageClient::did_get_js_console_messages(i32 start_index, Vector<ByteString>
|
|||||||
client().async_did_get_js_console_messages(m_id, start_index, move(message_types), move(messages));
|
client().async_did_get_js_console_messages(m_id, start_index, move(message_types), move(messages));
|
||||||
}
|
}
|
||||||
|
|
||||||
Web::PaintingCommandExecutorType PageClient::painting_command_executor_type() const
|
Web::DisplayListPlayerType PageClient::display_list_player_type() const
|
||||||
{
|
{
|
||||||
if (s_use_gpu_painter)
|
if (s_use_gpu_painter)
|
||||||
return Web::PaintingCommandExecutorType::GPU;
|
return Web::DisplayListPlayerType::GPU;
|
||||||
if (s_use_skia_painter)
|
if (s_use_skia_painter)
|
||||||
return Web::PaintingCommandExecutorType::Skia;
|
return Web::DisplayListPlayerType::Skia;
|
||||||
return Web::PaintingCommandExecutorType::CPU;
|
return Web::DisplayListPlayerType::CPU;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageClient::queue_screenshot_task(Optional<i32> node_id)
|
void PageClient::queue_screenshot_task(Optional<i32> node_id)
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
|
|
||||||
virtual double device_pixels_per_css_pixel() const override { return m_device_pixels_per_css_pixel; }
|
virtual double device_pixels_per_css_pixel() const override { return m_device_pixels_per_css_pixel; }
|
||||||
|
|
||||||
virtual Web::PaintingCommandExecutorType painting_command_executor_type() const override;
|
virtual Web::DisplayListPlayerType display_list_player_type() const override;
|
||||||
|
|
||||||
void queue_screenshot_task(Optional<i32> node_id);
|
void queue_screenshot_task(Optional<i32> node_id);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
virtual void request_file(Web::FileRequest) override;
|
virtual void request_file(Web::FileRequest) override;
|
||||||
virtual void schedule_repaint() override {};
|
virtual void schedule_repaint() override {};
|
||||||
virtual bool is_ready_to_paint() const override { return true; }
|
virtual bool is_ready_to_paint() const override { return true; }
|
||||||
virtual Web::PaintingCommandExecutorType painting_command_executor_type() const override { VERIFY_NOT_REACHED(); }
|
virtual Web::DisplayListPlayerType display_list_player_type() const override { VERIFY_NOT_REACHED(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit PageHost(ConnectionFromClient&);
|
explicit PageHost(ConnectionFromClient&);
|
||||||
|
Loading…
Reference in New Issue
Block a user