#include "src/shaders/gradients/SkGradientBaseShader.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkColorType.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkShader.h"
#include "include/core/SkTileMode.h"
#include "include/private/SkColorData.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTPin.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkFloatBits.h"
#include "src/base/SkVx.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkColorSpaceXformSteps.h"
#include "src/core/SkConvertPixels.h"
#include "src/core/SkEffectPriv.h"
#include "src/core/SkPicturePriv.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkRasterPipelineOpContexts.h"
#include "src/core/SkRasterPipelineOpList.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
#include <algorithm>
#include <cmath>
#include <optional>
#include <utility>
usingnamespaceskia_private;
enum GradientSerializationFlags { … };
SkGradientBaseShader::Descriptor::Descriptor() { … }
SkGradientBaseShader::Descriptor::~Descriptor() = default;
void SkGradientBaseShader::flatten(SkWriteBuffer& buffer) const { … }
template <int N, typename T, bool MEM_MOVE>
static bool validate_array(SkReadBuffer& buffer, size_t count, STArray<N, T, MEM_MOVE>* array) { … }
bool SkGradientBaseShader::DescriptorScope::unflatten(SkReadBuffer& buffer,
SkMatrix* legacyLocalMatrix) { … }
SkGradientBaseShader::SkGradientBaseShader(const Descriptor& desc, const SkMatrix& ptsToUnit)
: … { … }
SkGradientBaseShader::~SkGradientBaseShader() { … }
static void add_stop_color(SkRasterPipeline_GradientCtx* ctx,
size_t stop,
SkPMColor4f Fs,
SkPMColor4f Bs) { … }
static void add_const_color(SkRasterPipeline_GradientCtx* ctx, size_t stop, SkPMColor4f color) { … }
static void init_stop_evenly(SkRasterPipeline_GradientCtx* ctx,
float gapCount,
size_t stop,
SkPMColor4f c_l,
SkPMColor4f c_r) { … }
static void init_stop_pos(SkRasterPipeline_GradientCtx* ctx,
size_t stop,
float t_l,
float c_scale,
SkPMColor4f c_l,
SkPMColor4f c_r) { … }
void SkGradientBaseShader::AppendGradientFillStages(SkRasterPipeline* p,
SkArenaAlloc* alloc,
const SkPMColor4f* pmColors,
const SkScalar* positions,
int count) { … }
void SkGradientBaseShader::AppendInterpolatedToDstStages(SkRasterPipeline* p,
SkArenaAlloc* alloc,
bool colorsAreOpaque,
const Interpolation& interpolation,
const SkColorSpace* intermediateColorSpace,
const SkColorSpace* dstColorSpace) { … }
bool SkGradientBaseShader::appendStages(const SkStageRec& rec,
const SkShaders::MatrixRec& mRec) const { … }
bool SkGradientBaseShader::isOpaque() const { … }
bool SkGradientBaseShader::onAsLuminanceColor(SkColor4f* lum) const { … }
static sk_sp<SkColorSpace> intermediate_color_space(SkGradientShader::Interpolation::ColorSpace cs,
SkColorSpace* dst) { … }
ConvertColorProc;
PremulColorProc;
static SkPMColor4f srgb_to_hsl(SkPMColor4f rgb, bool* hueIsPowerless) { … }
static SkPMColor4f srgb_to_hwb(SkPMColor4f rgb, bool* hueIsPowerless) { … }
static SkPMColor4f xyzd50_to_lab(SkPMColor4f xyz, bool* ) { … }
static SkPMColor4f xyzd50_to_hcl(SkPMColor4f xyz, bool* hueIsPowerless) { … }
static SkPMColor4f lin_srgb_to_oklab(SkPMColor4f rgb, bool* ) { … }
static SkPMColor4f lin_srgb_to_okhcl(SkPMColor4f rgb, bool* hueIsPowerless) { … }
static SkPMColor4f premul_polar(SkPMColor4f hsl) { … }
static SkPMColor4f premul_rgb(SkPMColor4f rgb) { … }
static bool color_space_is_polar(SkGradientShader::Interpolation::ColorSpace cs) { … }
SkColor4fXformer::SkColor4fXformer(const SkGradientBaseShader* shader,
SkColorSpace* dst,
bool forceExplicitPositions) { … }
SkColorConverter::SkColorConverter(const SkColor* colors, int count) { … }
void SkGradientBaseShader::commonAsAGradient(GradientInfo* info) const { … }
bool SkGradientBaseShader::ValidGradient(const SkColor4f colors[],
int count,
SkTileMode tileMode,
const Interpolation& interpolation) { … }
SkGradientBaseShader::Descriptor::Descriptor(const SkColor4f colors[],
sk_sp<SkColorSpace> colorSpace,
const SkScalar positions[],
int colorCount,
SkTileMode mode,
const Interpolation& interpolation)
: … { … }
static SkColor4f average_gradient_color(const SkColor4f colors[],
const SkScalar pos[],
int colorCount) { … }
sk_sp<SkShader> SkGradientBaseShader::MakeDegenerateGradient(const SkColor4f colors[],
const SkScalar pos[],
int colorCount,
sk_sp<SkColorSpace> colorSpace,
SkTileMode mode) { … }