Files
ladybird/Libraries/LibWeb/Painting/GradientData.h
Aliaksandr Kalenik 0f18e6e348 LibWeb: Move gradient color stops expansion to recording phase
Expand color stops during display list recording rather than playback.
Recording happens once but the display list may be executed many times,
so doing this work at record time is more efficient.
2026-01-23 19:11:14 +01:00

43 lines
866 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/Gradients.h>
#include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>
#include <LibWeb/Forward.h>
namespace Web::Painting {
using ColorStopList = Vector<Gfx::ColorStop, 4>;
struct ColorStopData {
ColorStopList list;
Optional<float> repeat_length;
bool repeating { false };
};
struct LinearGradientData {
float gradient_angle;
ColorStopData color_stops;
CSS::InterpolationMethod interpolation_method;
};
struct ConicGradientData {
float start_angle;
ColorStopData color_stops;
CSS::InterpolationMethod interpolation_method;
};
struct RadialGradientData {
ColorStopData color_stops;
CSS::InterpolationMethod interpolation_method;
};
}