#include "src/pdf/SkPDFGradientShader.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPathTypes.h"
#include "include/core/SkSpan.h"
#include "include/core/SkStream.h"
#include "include/core/SkTileMode.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "src/core/SkChecksum.h"
#include "src/core/SkTHash.h"
#include "src/pdf/SkPDFDocumentPriv.h"
#include "src/pdf/SkPDFFormXObject.h"
#include "src/pdf/SkPDFGraphicState.h"
#include "src/pdf/SkPDFResourceDict.h"
#include "src/pdf/SkPDFTypes.h"
#include "src/pdf/SkPDFUtils.h"
#include <cmath>
#include <cstddef>
#include <utility>
#include <vector>
usingnamespaceskia_private;
static uint32_t hash(const SkShaderBase::GradientInfo& v) { … }
static uint32_t hash(const SkPDFGradientShader::Key& k) { … }
static void unit_to_points_matrix(const SkPoint pts[2], SkMatrix* matrix) { … }
static const int kColorComponents = …;
ColorTuple;
static void interpolate_color_code(SkScalar range, SkColor beginColor, SkColor endColor,
SkDynamicMemoryWStream* result) { … }
static void write_gradient_ranges(const SkShaderBase::GradientInfo& info, SkSpan<size_t> rangeEnds,
bool top, bool first, SkDynamicMemoryWStream* result) { … }
static void gradient_function_code(const SkShaderBase::GradientInfo& info,
SkDynamicMemoryWStream* result) { … }
static std::unique_ptr<SkPDFDict> createInterpolationFunction(const ColorTuple& color1,
const ColorTuple& color2) { … }
static std::unique_ptr<SkPDFDict> gradientStitchCode(const SkShaderBase::GradientInfo& info) { … }
static void tileModeCode(SkTileMode mode, SkDynamicMemoryWStream* result) { … }
static void apply_perspective_to_coordinates(const SkMatrix& inversePerspectiveMatrix,
SkDynamicMemoryWStream* code) { … }
static void linearCode(const SkShaderBase::GradientInfo& info,
const SkMatrix& perspectiveRemover,
SkDynamicMemoryWStream* function) { … }
static void radialCode(const SkShaderBase::GradientInfo& info,
const SkMatrix& perspectiveRemover,
SkDynamicMemoryWStream* function) { … }
static void twoPointConicalCode(const SkShaderBase::GradientInfo& info,
const SkMatrix& perspectiveRemover,
SkDynamicMemoryWStream* function) { … }
static void sweepCode(const SkShaderBase::GradientInfo& info,
const SkMatrix& perspectiveRemover,
SkDynamicMemoryWStream* function) { … }
static void FixUpRadius(const SkPoint& p1, SkScalar& r1, const SkPoint& p2, SkScalar& r2) { … }
static bool split_perspective(const SkMatrix in, SkMatrix* affine,
SkMatrix* perspectiveInverse) { … }
static SkPDFIndirectReference make_ps_function(std::unique_ptr<SkStreamAsset> psCode,
std::unique_ptr<SkPDFArray> domain,
std::unique_ptr<SkPDFObject> range,
SkPDFDocument* doc) { … }
static SkPDFIndirectReference make_function_shader(SkPDFDocument* doc,
const SkPDFGradientShader::Key& state) { … }
static SkPDFIndirectReference find_pdf_shader(SkPDFDocument* doc,
SkPDFGradientShader::Key key,
bool keyHasAlpha);
static std::unique_ptr<SkPDFDict> get_gradient_resource_dict(SkPDFIndirectReference functionShader,
SkPDFIndirectReference gState) { … }
static std::unique_ptr<SkStreamAsset> create_pattern_fill_content(int gsIndex,
int patternIndex,
SkRect& bounds) { … }
static bool gradient_has_alpha(const SkPDFGradientShader::Key& key) { … }
static SkPDFGradientShader::Key clone_key(const SkPDFGradientShader::Key& k) { … }
static SkPDFIndirectReference create_smask_graphic_state(SkPDFDocument* doc,
const SkPDFGradientShader::Key& state) { … }
static SkPDFIndirectReference make_alpha_function_shader(SkPDFDocument* doc,
const SkPDFGradientShader::Key& state) { … }
static SkPDFGradientShader::Key make_key(const SkShader* shader,
const SkMatrix& canvasTransform,
const SkIRect& bbox) { … }
static SkPDFIndirectReference find_pdf_shader(SkPDFDocument* doc,
SkPDFGradientShader::Key key,
bool keyHasAlpha) { … }
SkPDFIndirectReference SkPDFGradientShader::Make(SkPDFDocument* doc,
SkShader* shader,
const SkMatrix& canvasTransform,
const SkIRect& bbox) { … }