1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:57:47 +00:00

LibWeb: Don't encode painting limitations in RecordingPainter API

The current set of stacking context commands do not encode the
information needed to correctly paint the stacking context, instead,
they're based on the limitations of the current CPU renderer.

Stacking contexts should be able to be transformed by an arbitrary
3D transformation matrix, not just scaled from a source to a destination
rect. The `_with_mask()` stacking context also should not be separate
from the regular stacking context.

```c++
push_stacking_context(
	bool semitransparent_or_has_non_identity_transform,
	float opacity, Gfx::FloatRect const& source_rect,
	Gfx::FloatRect const& transformed_destination_rect,
	Gfx::IntPoint const& painter_location);

pop_stacking_context(
	bool semitransparent_or_has_non_identity_transform,
	Gfx::Painter::ScalingMode scaling_mode);

push_stacking_context_with_mask(
	Gfx::IntRect const& paint_rect);

pop_stacking_context_with_mask(
	Gfx::IntRect const& paint_rect,
	RefPtr<Gfx::Bitmap> const& mask_bitmap,
	Gfx::Bitmap::MaskKind mask_kind, float opacity);
```

This patch replaces this APIs with just:

```c++
push_stacking_context(
	float opacity,
        bool is_fixed_position,
        Gfx::IntRect const& source_paintable_rect,
	Gfx::IntPoint post_transform_translation,
	CSS::ImageRendering image_rendering,
	StackingContextTransform transform,
	Optional<StackingContextMask> mask);

pop_stacking_context()
```

And moves the implementation details into the executor, this should
allow future backends to implement stacking contexts without these
limitations.
This commit is contained in:
MacDue 2023-11-18 14:23:59 +00:00 committed by Alexander Kalenik
parent 848b0d9c81
commit 4e04f81626
7 changed files with 189 additions and 253 deletions

View file

@ -20,10 +20,8 @@ public:
CommandResult set_clip_rect(Gfx::IntRect const& rect) override;
CommandResult clear_clip_rect() override;
CommandResult set_font(Gfx::Font const&) override;
CommandResult push_stacking_context(bool semitransparent_or_has_non_identity_transform, float opacity, Gfx::FloatRect const& source_rect, Gfx::FloatRect const& transformed_destination_rect, Gfx::IntPoint const& painter_location) override;
CommandResult pop_stacking_context(bool semitransparent_or_has_non_identity_transform, Gfx::Painter::ScalingMode scaling_mode) override;
CommandResult push_stacking_context_with_mask(Gfx::IntRect const&) override;
CommandResult pop_stacking_context_with_mask(Gfx::IntRect const&, RefPtr<Gfx::Bitmap> const& mask_bitmap, Gfx::Bitmap::MaskKind mask_kind, float opacity) override;
CommandResult push_stacking_context(float opacity, bool, Gfx::IntRect const& source_paintable_rect, Gfx::IntPoint post_transform_translation, CSS::ImageRendering image_rendering, StackingContextTransform transform, Optional<StackingContextMask> mask) override;
CommandResult pop_stacking_context() override;
CommandResult paint_linear_gradient(Gfx::IntRect const&, Web::Painting::LinearGradientData const&) override;
CommandResult paint_outer_box_shadow(PaintOuterBoxShadowParams const&) override;
CommandResult paint_inner_box_shadow(PaintOuterBoxShadowParams const&) override;