LibWeb: Use new DecodedImageData::paint() API in ImageStyleValue

This commit is contained in:
Andreas Kling 2025-11-04 21:22:32 +01:00 committed by Andreas Kling
parent 4c2a02370d
commit 213e20c97b
Notes: github-actions[bot] 2025-11-05 08:12:58 +00:00

View file

@ -152,11 +152,14 @@ Optional<CSSPixelFraction> ImageStyleValue::natural_aspect_ratio() const
void ImageStyleValue::paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const
{
if (auto const* b = bitmap(m_current_frame_index, dest_rect.size().to_type<int>()); b != nullptr) {
auto scaling_mode = to_gfx_scaling_mode(image_rendering, b->rect(), dest_rect.to_type<int>());
auto dest_int_rect = dest_rect.to_type<int>();
context.display_list_recorder().draw_scaled_immutable_bitmap(dest_int_rect, dest_int_rect, *b, scaling_mode);
}
auto image_data = this->image_data();
if (!image_data)
return;
auto rect = image_data->frame_rect(m_current_frame_index).value_or(dest_rect.to_type<int>());
auto scaling_mode = to_gfx_scaling_mode(image_rendering, rect, dest_rect.to_type<int>());
auto dest_int_rect = dest_rect.to_type<int>();
image_data->paint(context, m_current_frame_index, dest_int_rect, dest_int_rect, scaling_mode);
}
Gfx::ImmutableBitmap const* ImageStyleValue::current_frame_bitmap(DevicePixelRect const& dest_rect) const