Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
GrPerlinNoise2Effect Class Reference

#include <GrPerlinNoise2Effect.h>

Inheritance diagram for GrPerlinNoise2Effect:
GrFragmentProcessor GrProcessor

Public Member Functions

const char * name () const override
 
std::unique_ptr< GrFragmentProcessorclone () const override
 
const SkPerlinNoiseShader::StitchDatastitchData () const
 
SkPerlinNoiseShaderType type () const
 
bool stitchTiles () const
 
const SkVectorbaseFrequency () const
 
int numOctaves () const
 
- Public Member Functions inherited from GrFragmentProcessor
const GrFragmentProcessorparent () const
 
std::unique_ptr< ProgramImplmakeProgramImpl () const
 
void addToKey (const GrShaderCaps &caps, skgpu::KeyBuilder *b) const
 
int numChildProcessors () const
 
int numNonNullChildProcessors () const
 
GrFragmentProcessorchildProcessor (int index)
 
const GrFragmentProcessorchildProcessor (int index) const
 
 SkDEBUGCODE (bool isInstantiated() const ;) bool willReadDstColor() const
 
bool isBlendFunction () const
 
bool usesSampleCoordsDirectly () const
 
bool usesSampleCoords () const
 
const SkSL::SampleUsagesampleUsage () const
 
bool compatibleWithCoverageAsAlpha () const
 
bool preservesOpaqueInput () const
 
bool hasConstantOutputForConstantInput (SkPMColor4f inputColor, SkPMColor4f *outputColor) const
 
bool hasConstantOutputForConstantInput () const
 
void clearConstantOutputForConstantInputFlag ()
 
bool isEqual (const GrFragmentProcessor &that) const
 
void visitProxies (const GrVisitProxyFunc &) const
 
void visitTextureEffects (const std::function< void(const GrTextureEffect &)> &) const
 
void visitWithImpls (const std::function< void(const GrFragmentProcessor &, ProgramImpl &)> &, ProgramImpl &) const
 
GrTextureEffectasTextureEffect ()
 
const GrTextureEffectasTextureEffect () const
 
- Public Member Functions inherited from GrProcessor
virtual ~GrProcessor ()=default
 
void * operator new (size_t size)
 
void * operator new (size_t object_size, size_t footer_size)
 
void operator delete (void *target)
 
void * operator new (size_t size, void *placement)
 
void operator delete (void *target, void *placement)
 
template<typename T >
const Tcast () const
 
ClassID classID () const
 

Static Public Member Functions

static std::unique_ptr< GrFragmentProcessorMake (SkPerlinNoiseShaderType type, int numOctaves, bool stitchTiles, std::unique_ptr< SkPerlinNoiseShader::PaintingData > paintingData, GrSurfaceProxyView permutationsView, GrSurfaceProxyView noiseView, const GrCaps &caps)
 
- Static Public Member Functions inherited from GrFragmentProcessor
static std::unique_ptr< GrFragmentProcessorMakeColor (SkPMColor4f color)
 
static std::unique_ptr< GrFragmentProcessorMulInputByChildAlpha (std::unique_ptr< GrFragmentProcessor > child)
 
static std::unique_ptr< GrFragmentProcessorApplyPaintAlpha (std::unique_ptr< GrFragmentProcessor > child)
 
static std::unique_ptr< GrFragmentProcessorModulateRGBA (std::unique_ptr< GrFragmentProcessor > child, const SkPMColor4f &color)
 
static std::unique_ptr< GrFragmentProcessorOverrideInput (std::unique_ptr< GrFragmentProcessor >, const SkPMColor4f &)
 
static std::unique_ptr< GrFragmentProcessorDisableCoverageAsAlpha (std::unique_ptr< GrFragmentProcessor >)
 
static std::unique_ptr< GrFragmentProcessorDestColor ()
 
static std::unique_ptr< GrFragmentProcessorSwizzleOutput (std::unique_ptr< GrFragmentProcessor >, const skgpu::Swizzle &)
 
static std::unique_ptr< GrFragmentProcessorClampOutput (std::unique_ptr< GrFragmentProcessor >)
 
static std::unique_ptr< GrFragmentProcessorCompose (std::unique_ptr< GrFragmentProcessor > f, std::unique_ptr< GrFragmentProcessor > g)
 
static std::unique_ptr< GrFragmentProcessorColorMatrix (std::unique_ptr< GrFragmentProcessor > child, const float matrix[20], bool unpremulInput, bool clampRGBOutput, bool premulOutput)
 
static std::unique_ptr< GrFragmentProcessorSurfaceColor ()
 
static std::unique_ptr< GrFragmentProcessorDeviceSpace (std::unique_ptr< GrFragmentProcessor >)
 
static std::unique_ptr< GrFragmentProcessorRect (std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkRect)
 
static GrFPResult Circle (std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkPoint center, float radius)
 
static GrFPResult Ellipse (std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkPoint center, SkPoint radii, const GrShaderCaps &)
 
static std::unique_ptr< GrFragmentProcessorHighPrecision (std::unique_ptr< GrFragmentProcessor >)
 

Private Member Functions

std::unique_ptr< ProgramImplonMakeProgramImpl () const override
 
void onAddToKey (const GrShaderCaps &caps, skgpu::KeyBuilder *b) const override
 
bool onIsEqual (const GrFragmentProcessor &sBase) const override
 

Additional Inherited Members

- Public Types inherited from GrProcessor
enum  ClassID {
  kNull_ClassID , kAttributeTestProcessor_ClassID , kBigKeyProcessor_ClassID , kBlendFragmentProcessor_ClassID ,
  kBlockInputFragmentProcessor_ClassID , kButtCapStrokedCircleGeometryProcessor_ClassID , kCircleGeometryProcessor_ClassID , kCircularRRectEffect_ClassID ,
  kClockwiseTestProcessor_ClassID , kColorTableEffect_ClassID , kCoverageSetOpXP_ClassID , kCustomXP_ClassID ,
  kDashingCircleEffect_ClassID , kDashingLineEffect_ClassID , kDefaultGeoProc_ClassID , kDeviceSpace_ClassID ,
  kDIEllipseGeometryProcessor_ClassID , kDisableColorXP_ClassID , kDrawAtlasPathShader_ClassID , kEllipseGeometryProcessor_ClassID ,
  kEllipticalRRectEffect_ClassID , kFwidthSquircleTestProcessor_ClassID , kGP_ClassID , kGrBicubicEffect_ClassID ,
  kGrBitmapTextGeoProc_ClassID , kGrColorSpaceXformEffect_ClassID , kGrConicEffect_ClassID , kGrConvexPolyEffect_ClassID ,
  kGrDiffuseLightingEffect_ClassID , kGrDisplacementMapEffect_ClassID , kGrDistanceFieldA8TextGeoProc_ClassID , kGrDistanceFieldLCDTextGeoProc_ClassID ,
  kGrDistanceFieldPathGeoProc_ClassID , kGrFillRRectOp_Processor_ClassID , kGrGaussianConvolutionFragmentProcessor_ClassID , kGrMatrixConvolutionEffect_ClassID ,
  kGrMatrixEffect_ClassID , kGrMeshTestProcessor_ClassID , kGrMorphologyEffect_ClassID , kGrPerlinNoise2Effect_ClassID ,
  kGrPipelineDynamicStateTestProcessor_ClassID , kGrQuadEffect_ClassID , kGrRRectShadowGeoProc_ClassID , kGrSkSLFP_ClassID ,
  kGrSpecularLightingEffect_ClassID , kGrTextureEffect_ClassID , kGrUnrolledBinaryGradientColorizer_ClassID , kGrYUVtoRGBEffect_ClassID ,
  kHighPrecisionFragmentProcessor_ClassID , kLatticeGP_ClassID , kPDLCDXferProcessor_ClassID , kPorterDuffXferProcessor_ClassID ,
  kPremulFragmentProcessor_ClassID , kQuadEdgeEffect_ClassID , kQuadPerEdgeAAGeometryProcessor_ClassID , kSeriesFragmentProcessor_ClassID ,
  kShaderPDXferProcessor_ClassID , kSurfaceColorProcessor_ClassID , kSwizzleFragmentProcessor_ClassID , kTessellate_BoundingBoxShader_ClassID ,
  kTessellate_GrModulateAtlasCoverageEffect_ClassID , kTessellate_GrStrokeTessellationShader_ClassID , kTessellate_HullShader_ClassID , kTessellate_MiddleOutShader_ClassID ,
  kTessellate_SimpleTriangleShader_ClassID , kTessellationTestTriShader_ClassID , kTestFP_ClassID , kTestRectOp_ClassID ,
  kVertexColorSpaceBenchGP_ClassID , kVerticesGP_ClassID
}
 
- Protected Types inherited from GrFragmentProcessor
enum  OptimizationFlags : uint32_t {
  kNone_OptimizationFlags , kCompatibleWithCoverageAsAlpha_OptimizationFlag = 0x1 , kPreservesOpaqueInput_OptimizationFlag = 0x2 , kConstantOutputForConstantInput_OptimizationFlag = 0x4 ,
  kAll_OptimizationFlags
}
 
- Protected Member Functions inherited from GrFragmentProcessor
 GrFragmentProcessor (ClassID classID, OptimizationFlags optimizationFlags)
 
 GrFragmentProcessor (const GrFragmentProcessor &src)
 
OptimizationFlags optimizationFlags () const
 
void registerChild (std::unique_ptr< GrFragmentProcessor > child, SkSL::SampleUsage sampleUsage=SkSL::SampleUsage::PassThrough())
 
void cloneAndRegisterAllChildProcessors (const GrFragmentProcessor &src)
 
void setUsesSampleCoordsDirectly ()
 
void setWillReadDstColor ()
 
void setIsBlendFunction ()
 
void mergeOptimizationFlags (OptimizationFlags flags)
 
- Protected Member Functions inherited from GrProcessor
 GrProcessor (ClassID classID)
 
 GrProcessor (const GrProcessor &)=delete
 
GrProcessoroperator= (const GrProcessor &)=delete
 
- Static Protected Member Functions inherited from GrFragmentProcessor
static OptimizationFlags ModulateForSamplerOptFlags (SkAlphaType alphaType, bool samplingDecal)
 
static OptimizationFlags ModulateForClampedSamplerOptFlags (SkAlphaType alphaType)
 
static OptimizationFlags ProcessorOptimizationFlags (const GrFragmentProcessor *fp)
 
static SkPMColor4f ConstantOutputForConstantInput (const GrFragmentProcessor *fp, const SkPMColor4f &input)
 
- Protected Attributes inherited from GrProcessor
const ClassID fClassID
 

Detailed Description

Definition at line 35 of file GrPerlinNoise2Effect.h.

Member Function Documentation

◆ baseFrequency()

const SkVector & GrPerlinNoise2Effect::baseFrequency ( ) const
inline

Definition at line 77 of file GrPerlinNoise2Effect.h.

77{ return fPaintingData->fBaseFrequency; }

◆ clone()

std::unique_ptr< GrFragmentProcessor > GrPerlinNoise2Effect::clone ( ) const
inlineoverridevirtual

Makes a copy of this fragment processor that draws equivalently to the original. If the processor has child processors they are cloned as well.

Implements GrFragmentProcessor.

Definition at line 67 of file GrPerlinNoise2Effect.h.

67 {
68 return std::unique_ptr<GrFragmentProcessor>(new GrPerlinNoise2Effect(*this));
69 }

◆ Make()

static std::unique_ptr< GrFragmentProcessor > GrPerlinNoise2Effect::Make ( SkPerlinNoiseShaderType  type,
int  numOctaves,
bool  stitchTiles,
std::unique_ptr< SkPerlinNoiseShader::PaintingData paintingData,
GrSurfaceProxyView  permutationsView,
GrSurfaceProxyView  noiseView,
const GrCaps caps 
)
inlinestatic

Definition at line 37 of file GrPerlinNoise2Effect.h.

44 {
45 static constexpr GrSamplerState kRepeatXSampler = {GrSamplerState::WrapMode::kRepeat,
47 GrSamplerState::Filter::kNearest};
48 auto permutationsFP = GrTextureEffect::Make(std::move(permutationsView),
51 kRepeatXSampler,
52 caps);
53 auto noiseFP = GrTextureEffect::Make(
54 std::move(noiseView), kPremul_SkAlphaType, SkMatrix::I(), kRepeatXSampler, caps);
55
56 return std::unique_ptr<GrFragmentProcessor>(
60 std::move(paintingData),
61 std::move(permutationsFP),
62 std::move(noiseFP)));
63 }
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
SkPerlinNoiseShaderType type() const
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
static const SkMatrix & I()

◆ name()

const char * GrPerlinNoise2Effect::name ( ) const
inlineoverridevirtual

Human-meaningful string to identify this processor; may be embedded in generated shader code and must be a legal SkSL identifier prefix.

Implements GrProcessor.

Definition at line 65 of file GrPerlinNoise2Effect.h.

65{ return "PerlinNoise"; }

◆ numOctaves()

int GrPerlinNoise2Effect::numOctaves ( ) const
inline

Definition at line 78 of file GrPerlinNoise2Effect.h.

78{ return fNumOctaves; }

◆ onAddToKey()

void GrPerlinNoise2Effect::onAddToKey ( const GrShaderCaps caps,
skgpu::KeyBuilder b 
) const
overrideprivatevirtual

Implements GrFragmentProcessor.

Definition at line 290 of file GrPerlinNoise2Effect.cpp.

290 {
291 uint32_t key = fNumOctaves;
292 key = key << 3; // Make room for next 3 bits
293 switch (fType) {
295 key |= 0x1;
296 break;
298 key |= 0x2;
299 break;
300 default:
301 // leave key at 0
302 break;
303 }
304 if (fStitchTiles) {
305 key |= 0x4; // Flip the 3rd bit if tile stitching is on
306 }
307 b->add32(key);
308}
static bool b

◆ onIsEqual()

bool GrPerlinNoise2Effect::onIsEqual ( const GrFragmentProcessor ) const
inlineoverrideprivatevirtual

Subclass implements this to support isEqual(). It will only be called if it is known that the two processors are of the same subclass (i.e. have the same ClassID).

Implements GrFragmentProcessor.

Definition at line 99 of file GrPerlinNoise2Effect.h.

99 {
100 const GrPerlinNoise2Effect& s = sBase.cast<GrPerlinNoise2Effect>();
101 return fType == s.fType &&
102 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency &&
103 fNumOctaves == s.fNumOctaves && fStitchTiles == s.fStitchTiles &&
104 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataInit;
105 }
struct MyStruct s

◆ onMakeProgramImpl()

std::unique_ptr< ProgramImpl > GrPerlinNoise2Effect::onMakeProgramImpl ( ) const
inlineoverrideprivatevirtual

Returns a new instance of the appropriate ProgramImpl subclass for the given GrFragmentProcessor. It will emit the appropriate code and live with the cached program to setup uniform data for each draw that uses the program.

Implements GrFragmentProcessor.

Definition at line 93 of file GrPerlinNoise2Effect.h.

93 {
94 return std::make_unique<Impl>();
95 }

◆ stitchData()

const SkPerlinNoiseShader::StitchData & GrPerlinNoise2Effect::stitchData ( ) const
inline

Definition at line 71 of file GrPerlinNoise2Effect.h.

71 {
72 return fPaintingData->fStitchDataInit;
73 }

◆ stitchTiles()

bool GrPerlinNoise2Effect::stitchTiles ( ) const
inline

Definition at line 76 of file GrPerlinNoise2Effect.h.

76{ return fStitchTiles; }

◆ type()

SkPerlinNoiseShaderType GrPerlinNoise2Effect::type ( ) const
inline

Definition at line 75 of file GrPerlinNoise2Effect.h.

75{ return fType; }

The documentation for this class was generated from the following files: