1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:47:45 +00:00

LibWeb: Fix coordinate translation for PaintTextShadow command

Fixes regression introduced in 4318bcf447

`shadow_bounding_rect` is used on bitmap allocated for shadow and is
not supposed to be in coordinate system of stacking context. Same for
`text_rect`.

Fixes https://github.com/SerenityOS/serenity/issues/21587
This commit is contained in:
Aliaksandr Kalenik 2023-10-25 18:06:54 +02:00 committed by Andreas Kling
parent 58f8068853
commit 437442719d
2 changed files with 3 additions and 6 deletions

View file

@ -293,9 +293,6 @@ CommandResult PaintInnerBoxShadow::execute(CommandExecutionState& state) const
CommandResult PaintTextShadow::execute(CommandExecutionState& state) const
{
if (state.would_be_fully_clipped_by_painter(text_rect))
return CommandResult::Continue;
// 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());
if (maybe_shadow_bitmap.is_error()) {
@ -758,8 +755,8 @@ void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_
{
push_command(PaintTextShadow {
.blur_radius = blur_radius,
.shadow_bounding_rect = state().translation.map(bounding_rect),
.text_rect = state().translation.map(text_rect),
.shadow_bounding_rect = bounding_rect,
.text_rect = text_rect,
.text = String::from_utf8(text.as_string()).release_value_but_fixme_should_propagate_errors(),
.font = font,
.color = color,

View file

@ -163,7 +163,7 @@ struct PaintTextShadow {
int fragment_baseline;
Gfx::IntPoint draw_location;
[[nodiscard]] Gfx::IntRect bounding_rect() const { return shadow_bounding_rect; }
[[nodiscard]] Gfx::IntRect bounding_rect() const { return { draw_location, shadow_bounding_rect.size() }; }
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
};