summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-29 01:20:13 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-29 20:10:02 +0200
commitb7f9387f69a17eb209d97a2783ca32e3bee16d7d (patch)
tree5873f8f6505c75b4b0530f2339ba9eb35b7d01ad /Userland/Libraries/LibWeb
parente8a5233b946ad66ad4a8091087cda16ee8651094 (diff)
downloadserenity-b7f9387f69a17eb209d97a2783ca32e3bee16d7d.zip
LibWeb: Don't draw only-translated stacking contexts via bitmap
If the 2D transform in effect is just a simple translation, we don't need to draw into a temporary bitmap and then transform it. We can just translate the painter. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Painting/StackingContext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
index 8d525f2fe1..d08d3e6f47 100644
--- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
+++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
@@ -292,7 +292,7 @@ void StackingContext::paint(PaintContext& context) const
auto affine_transform = affine_transform_matrix();
- if (opacity < 1.0f || !affine_transform.is_identity()) {
+ if (opacity < 1.0f || !affine_transform.is_identity_or_translation()) {
auto transform_origin = this->transform_origin();
auto source_rect = paintable().absolute_paint_rect().translated(-transform_origin);
auto transformed_destination_rect = affine_transform.map(source_rect).translated(transform_origin);
@@ -333,6 +333,8 @@ void StackingContext::paint(PaintContext& context) const
else
context.painter().draw_scaled_bitmap(destination_rect, *bitmap, bitmap->rect(), opacity, Gfx::Painter::ScalingMode::BilinearBlend);
} else {
+ Gfx::PainterStateSaver saver(context.painter());
+ context.painter().translate(affine_transform.translation().to_rounded<int>());
paint_internal(context);
}
}