mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 14:24:57 +00:00

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
37 lines
950 B
C++
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>());
|
|
}
|
|
|
|
}
|