mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibWeb: Add fast path for CRC2D.drawImage() with simple transform
If the transform is a simple translation, we don't need to run the big and slow transform rasterizer.
This commit is contained in:
parent
57feb0f3ec
commit
88ef1bff38
1 changed files with 3 additions and 2 deletions
|
@ -182,9 +182,10 @@ DOM::ExceptionOr<void> CanvasRenderingContext2D::draw_image(CanvasImageSource co
|
|||
if (!painter)
|
||||
return {};
|
||||
|
||||
if (m_drawing_state.transform.is_identity()) {
|
||||
// There's no affine transformation to worry about, we can just call Gfx::Painter.
|
||||
if (m_drawing_state.transform.is_identity_or_translation()) {
|
||||
painter->translate(m_drawing_state.transform.e(), m_drawing_state.transform.f());
|
||||
painter->draw_scaled_bitmap(destination_rect.to_rounded<int>(), *bitmap, source_rect, 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
|
||||
painter->translate(-m_drawing_state.transform.e(), -m_drawing_state.transform.f());
|
||||
} else {
|
||||
// The context has an affine transform, we have to draw through it!
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue