Skip to content

Commit 213e20c

Browse files
committed
LibWeb: Use new DecodedImageData::paint() API in ImageStyleValue
1 parent 4c2a023 commit 213e20c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,14 @@ Optional<CSSPixelFraction> ImageStyleValue::natural_aspect_ratio() const
152152

153153
void ImageStyleValue::paint(DisplayListRecordingContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const
154154
{
155-
if (auto const* b = bitmap(m_current_frame_index, dest_rect.size().to_type<int>()); b != nullptr) {
156-
auto scaling_mode = to_gfx_scaling_mode(image_rendering, b->rect(), dest_rect.to_type<int>());
157-
auto dest_int_rect = dest_rect.to_type<int>();
158-
context.display_list_recorder().draw_scaled_immutable_bitmap(dest_int_rect, dest_int_rect, *b, scaling_mode);
159-
}
155+
auto image_data = this->image_data();
156+
if (!image_data)
157+
return;
158+
159+
auto rect = image_data->frame_rect(m_current_frame_index).value_or(dest_rect.to_type<int>());
160+
auto scaling_mode = to_gfx_scaling_mode(image_rendering, rect, dest_rect.to_type<int>());
161+
auto dest_int_rect = dest_rect.to_type<int>();
162+
image_data->paint(context, m_current_frame_index, dest_int_rect, dest_int_rect, scaling_mode);
160163
}
161164

162165
Gfx::ImmutableBitmap const* ImageStyleValue::current_frame_bitmap(DevicePixelRect const& dest_rect) const

0 commit comments

Comments
 (0)