mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/CSS: Improved implementation of background-blend-mode
This is a improved version ofa73cd88f0cThe old commit was reverted in552dd18696The new version only paints an element into a new layer if background blend modes other than normal are used. The rasterization performance of most websites should therefore not suffer. Co-Authored-By: Alexander Kalenik <kalenik.aliaksandr@gmail.com>
This commit is contained in:
parent
6906f1722a
commit
9973b01848
Notes:
github-actions[bot]
2025-04-01 11:39:02 +00:00
Author: https://github.com/skyz1
Commit: 9973b01848
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4150
16 changed files with 311 additions and 198 deletions
48
Libraries/LibWeb/Painting/Blending.h
Normal file
48
Libraries/LibWeb/Painting/Blending.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Glenn Skrzypczak <glenn.skrzypczak@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/CompositingAndBlendingOperator.h>
|
||||
#include <LibWeb/CSS/Enums.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
#define ENUMERATE_MIX_BLEND_MODES(E) \
|
||||
E(Normal) \
|
||||
E(Multiply) \
|
||||
E(Screen) \
|
||||
E(Overlay) \
|
||||
E(Darken) \
|
||||
E(Lighten) \
|
||||
E(ColorDodge) \
|
||||
E(ColorBurn) \
|
||||
E(HardLight) \
|
||||
E(SoftLight) \
|
||||
E(Difference) \
|
||||
E(Exclusion) \
|
||||
E(Hue) \
|
||||
E(Saturation) \
|
||||
E(Color) \
|
||||
E(Luminosity) \
|
||||
E(PlusDarker) \
|
||||
E(PlusLighter)
|
||||
|
||||
static Gfx::CompositingAndBlendingOperator mix_blend_mode_to_compositing_and_blending_operator(CSS::MixBlendMode blend_mode)
|
||||
{
|
||||
switch (blend_mode) {
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(blend_mode) \
|
||||
case CSS::MixBlendMode::blend_mode: \
|
||||
return Gfx::CompositingAndBlendingOperator::blend_mode;
|
||||
ENUMERATE_MIX_BLEND_MODES(__ENUMERATE)
|
||||
#undef __ENUMERATE
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue