
This modification introduces a new layer to the painting process. The stacking context traversal no longer immediately calls the Gfx::Painter methods. Instead, it writes serialized painting commands into newly introduced RecordingPainter. Created list of commands is executed later to produce resulting bitmap. Producing painting command list will make it easier to add new optimizations: - It's simpler to check if the painting result is not visible in the viewport at the command level rather than during stacking context traversal. - Run painting in a separate thread. The painting thread can process serialized painting commands, while the main thread can work on the next paintable tree and safely invalidate the previous one. - As we consider GPU-accelerated painting support, it would be easier to back each painting command rather than constructing an alternative for the entire Gfx::Painter API.
30 lines
570 B
C++
30 lines
570 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
|
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGfx/Color.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace Web::Painting {
|
|
|
|
enum class ShadowPlacement {
|
|
Outer,
|
|
Inner,
|
|
};
|
|
|
|
struct ShadowData {
|
|
Gfx::Color color;
|
|
CSSPixels offset_x;
|
|
CSSPixels offset_y;
|
|
CSSPixels blur_radius;
|
|
CSSPixels spread_distance;
|
|
ShadowPlacement placement;
|
|
};
|
|
|
|
}
|