mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibWeb+WebContent: Separate painting command list from RecordingPainter
Separating the recorder list from the painter will allow us to save it for later execution without carrying along the painter's state. This will be useful once we have a separate thread for executing painting commands, to which we will have to transfer commands from the main thread. Preparation for https://github.com/SerenityOS/serenity/pull/23108
This commit is contained in:
parent
ce9ad3a236
commit
11d746a67f
11 changed files with 874 additions and 732 deletions
37
Userland/Libraries/LibWeb/Painting/Command.cpp
Normal file
37
Userland/Libraries/LibWeb/Painting/Command.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Painting/Command.h>
|
||||
#include <LibWeb/Painting/ShadowPainting.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
void DrawGlyphRun::translate_by(Gfx::IntPoint const& offset)
|
||||
{
|
||||
for (auto& glyph : glyph_run) {
|
||||
glyph.visit([&](auto& glyph) {
|
||||
glyph.translate_by(offset.to_type<float>());
|
||||
});
|
||||
}
|
||||
rect.translate_by(offset);
|
||||
}
|
||||
|
||||
Gfx::IntRect PaintOuterBoxShadow::bounding_rect() const
|
||||
{
|
||||
return get_outer_box_shadow_bounding_rect(outer_box_shadow_params);
|
||||
}
|
||||
|
||||
void PaintOuterBoxShadow::translate_by(Gfx::IntPoint const& offset)
|
||||
{
|
||||
outer_box_shadow_params.device_content_rect.translate_by(offset.to_type<DevicePixels>());
|
||||
}
|
||||
|
||||
void PaintInnerBoxShadow::translate_by(Gfx::IntPoint const& offset)
|
||||
{
|
||||
outer_box_shadow_params.device_content_rect.translate_by(offset.to_type<DevicePixels>());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue