mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb/CSS: Implement mix-blend-mode
This adds support for the `mix-blend-mode` CSS property.
This commit is contained in:
parent
8575bddfe6
commit
0fe30886f5
Notes:
github-actions[bot]
2025-02-05 11:28:01 +00:00
Author: https://github.com/skyz1
Commit: 0fe30886f5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3267
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/konradekk
24 changed files with 311 additions and 57 deletions
|
@ -23,6 +23,8 @@
|
|||
#include <pathops/SkPathOps.h>
|
||||
|
||||
#include <LibGfx/Font/ScaledFont.h>
|
||||
#include <LibGfx/PainterSkia.h>
|
||||
#include <LibGfx/PathSkia.h>
|
||||
#include <LibGfx/SkiaUtils.h>
|
||||
#include <LibWeb/CSS/ComputedValues.h>
|
||||
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
||||
|
@ -195,11 +197,15 @@ void DisplayListPlayerSkia::push_stacking_context(PushStackingContext const& com
|
|||
.translate(-command.transform.origin);
|
||||
auto matrix = to_skia_matrix(new_transform);
|
||||
|
||||
if (command.opacity < 1) {
|
||||
if (command.opacity < 1 || command.compositing_and_blending_operator != Gfx::CompositingAndBlendingOperator::Normal || command.isolate) {
|
||||
auto source_paintable_rect = to_skia_rect(command.source_paintable_rect);
|
||||
SkRect dest;
|
||||
matrix.mapRect(&dest, source_paintable_rect);
|
||||
canvas.saveLayerAlphaf(&dest, command.opacity);
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAlphaf(command.opacity);
|
||||
paint.setBlender(Gfx::to_skia_blender(command.compositing_and_blending_operator));
|
||||
canvas.saveLayer(&dest, &paint);
|
||||
} else {
|
||||
canvas.save();
|
||||
}
|
||||
|
@ -878,6 +884,14 @@ void DisplayListPlayerSkia::apply_opacity(ApplyOpacity const& command)
|
|||
canvas.saveLayer(nullptr, &paint);
|
||||
}
|
||||
|
||||
void DisplayListPlayerSkia::apply_composite_and_blending_operator(ApplyCompositeAndBlendingOperator const& command)
|
||||
{
|
||||
auto& canvas = surface().canvas();
|
||||
SkPaint paint;
|
||||
paint.setBlender(Gfx::to_skia_blender(command.compositing_and_blending_operator));
|
||||
canvas.saveLayer(nullptr, &paint);
|
||||
}
|
||||
|
||||
void DisplayListPlayerSkia::apply_filters(ApplyFilters const& command)
|
||||
{
|
||||
if (command.filter.is_empty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue