1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 14:24:57 +00:00
serenity/Userland/Libraries/LibWeb/Painting/Command.cpp
Aliaksandr Kalenik 11d746a67f 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
2024-02-18 18:45:25 +01:00

37 lines
950 B
C++

/*
* 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>());
}
}