33 , fBaseFrequencyX(baseFrequencyX)
34 , fBaseFrequencyY(baseFrequencyY)
35 , fNumOctaves(numOctaves > kMaxOctaves ? kMaxOctaves
38 , fTileSize(nullptr == tileSize ?
SkISize::
Make(0, 0) : *tileSize)
39 , fStitchTiles(!fTileSize.isEmpty()) {
46 static_assert(SkPerlinNoiseShader::kBlockSize == 256);
74 buffer.writeInt((
int)fType);
75 buffer.writeScalar(fBaseFrequencyX);
76 buffer.writeScalar(fBaseFrequencyY);
77 buffer.writeInt(fNumOctaves);
85 std::optional<SkShaders::MatrixRec> newMRec = mRec.
apply(rec);
86 if (!newMRec.has_value()) {
90 fInitPaintingDataOnce([&] {
96 ctx->baseFrequencyX = fPaintingData->fBaseFrequency.fX;
97 ctx->baseFrequencyY = fPaintingData->fBaseFrequency.fY;
98 ctx->stitchDataInX = fPaintingData->fStitchDataInit.fWidth;
99 ctx->stitchDataInY = fPaintingData->fStitchDataInit.fHeight;
100 ctx->stitching = fStitchTiles;
101 ctx->numOctaves = fNumOctaves;
102 ctx->latticeSelector = fPaintingData->fLatticeSelector;
103 ctx->noiseData = &fPaintingData->fNoise[0][0][0];
113 if (!(baseX >= 0 && baseY >= 0)) {
119 if (tileSize && !(tileSize->
width() >= 0 && tileSize->
height() >= 0)) {
140 if (!
valid_input(baseFrequencyX, baseFrequencyY, numOctaves, tileSize, seed)) {
144 if (0 == numOctaves) {
147 constexpr SkColor4f kTransparentGray = {0.5f, 0.5f, 0.5f, 0.5f};
165 if (!
valid_input(baseFrequencyX, baseFrequencyY, numOctaves, tileSize, seed)) {
169 if (0 == numOctaves) {
#define SK_REGISTER_FLATTENABLE(type)
static bool SkIsFinite(T x, Pack... values)
static bool valid_input(SkScalar baseX, SkScalar baseY, int numOctaves, const SkISize *tileSize, SkScalar seed)
void SkRegisterPerlinNoiseShaderFlattenable()
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
static void Register(const char name[], Factory)
ShaderType type() const override
SkPerlinNoiseShader(SkPerlinNoiseShaderType type, SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize)
bool appendStages(const SkStageRec &rec, const SkShaders::MatrixRec &mRec) const override
static const int kMaxOctaves
std::unique_ptr< PaintingData > getPaintingData() const
void flatten(SkWriteBuffer &) const override
void append(SkRasterPipelineOp, void *=nullptr)
std::optional< MatrixRec > apply(const SkStageRec &rec, const SkMatrix &postInv={}) const
constexpr SkColor4f kTransparent
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
SK_API sk_sp< SkShader > Color(SkColor)
SK_API sk_sp< SkShader > MakeTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
SK_API sk_sp< SkShader > MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
constexpr int32_t width() const
constexpr int32_t height() const
SkPerlinNoiseShaderType noiseType
SkRasterPipeline * fPipeline