mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
063e66cae9
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.
39 lines
649 B
C++
39 lines
649 B
C++
/*
|
|
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Span.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibGfx/Color.h>
|
|
#include <LibGfx/Gradients.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace Web::Painting {
|
|
|
|
using ColorStopList = Vector<Gfx::ColorStop, 4>;
|
|
|
|
struct ColorStopData {
|
|
ColorStopList list;
|
|
Optional<float> repeat_length;
|
|
};
|
|
|
|
struct LinearGradientData {
|
|
float gradient_angle;
|
|
ColorStopData color_stops;
|
|
};
|
|
|
|
struct ConicGradientData {
|
|
float start_angle;
|
|
ColorStopData color_stops;
|
|
};
|
|
|
|
struct RadialGradientData {
|
|
ColorStopData color_stops;
|
|
};
|
|
|
|
}
|