mirror of
https://github.com/RGBCube/serenity
synced 2025-07-19 13:17:39 +00:00
LibWeb: Enable bilinear blending for bitmaps
This is slower, but looks a lot nicer. :^)
This commit is contained in:
parent
1c807410cd
commit
a50f4d2fc9
3 changed files with 3 additions and 3 deletions
|
@ -100,7 +100,7 @@ void CanvasRenderingContext2D::draw_image(const HTMLImageElement& image_element,
|
||||||
Gfx::FloatRect dst_rect = { x, y, (float)image_element.bitmap()->width(), (float)image_element.bitmap()->height() };
|
Gfx::FloatRect dst_rect = { x, y, (float)image_element.bitmap()->width(), (float)image_element.bitmap()->height() };
|
||||||
auto rect = m_transform.map(dst_rect);
|
auto rect = m_transform.map(dst_rect);
|
||||||
|
|
||||||
painter->draw_scaled_bitmap(enclosing_int_rect(rect), *image_element.bitmap(), src_rect);
|
painter->draw_scaled_bitmap(enclosing_int_rect(rect), *image_element.bitmap(), src_rect, 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasRenderingContext2D::scale(float sx, float sy)
|
void CanvasRenderingContext2D::scale(float sx, float sy)
|
||||||
|
|
|
@ -39,7 +39,7 @@ void CanvasBox::paint(PaintContext& context, PaintPhase phase)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dom_node().bitmap())
|
if (dom_node().bitmap())
|
||||||
context.painter().draw_scaled_bitmap(enclosing_int_rect(absolute_rect()), *dom_node().bitmap(), dom_node().bitmap()->rect());
|
context.painter().draw_scaled_bitmap(enclosing_int_rect(absolute_rect()), *dom_node().bitmap(), dom_node().bitmap()->rect(), 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void ImageBox::paint(PaintContext& context, PaintPhase phase)
|
||||||
alt = image_element.src();
|
alt = image_element.src();
|
||||||
context.painter().draw_text(enclosing_int_rect(absolute_rect()), alt, Gfx::TextAlignment::Center, computed_values().color(), Gfx::TextElision::Right);
|
context.painter().draw_text(enclosing_int_rect(absolute_rect()), alt, Gfx::TextAlignment::Center, computed_values().color(), Gfx::TextElision::Right);
|
||||||
} else if (auto bitmap = m_image_loader.bitmap(m_image_loader.current_frame_index())) {
|
} else if (auto bitmap = m_image_loader.bitmap(m_image_loader.current_frame_index())) {
|
||||||
context.painter().draw_scaled_bitmap(enclosing_int_rect(absolute_rect()), *bitmap, bitmap->rect());
|
context.painter().draw_scaled_bitmap(enclosing_int_rect(absolute_rect()), *bitmap, bitmap->rect(), 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue