Files
ladybird/Libraries/LibWeb/Painting/SVGMaskable.h
Aliaksandr Kalenik cb8ecb3c11 LibGfx+LibWeb: Move SVG mask/clip composition from CPU to GPU
Previously, both mask and clip-path were rendered to separate mutable
Gfx::Bitmap objects which forced CPU rasterization. They were then
combined using a CPU pixel-by-pixel operation before being returned
as an ImmutableBitmap.

Instead of including mask in the final bitmap as already rasterized
images, we now use display lists which opens opportunity to utilize
GPU if available.

Bitmap::apply_mask() and ApplyMaskBitmap display list command are no
longer used and have been removed.
2026-01-23 16:23:06 +01:00

31 lines
839 B
C++

/*
* Copyright (c) 2024-2026, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Forward.h>
#include <LibWeb/PixelUnits.h>
#pragma once
namespace Web::Painting {
class SVGMaskable {
public:
virtual ~SVGMaskable() = default;
virtual GC::Ptr<DOM::Node const> dom_node_of_svg() const = 0;
// For <mask> element
Optional<CSSPixelRect> get_svg_mask_area() const;
Optional<Gfx::MaskKind> get_svg_mask_type() const;
RefPtr<DisplayList> calculate_svg_mask_display_list(DisplayListRecordingContext&, CSSPixelRect const& mask_area) const;
// For <clipPath> element
Optional<CSSPixelRect> get_svg_clip_area() const;
RefPtr<DisplayList> calculate_svg_clip_display_list(DisplayListRecordingContext&, CSSPixelRect const& clip_area) const;
};
}