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

#include <GrBicubicEffect.h>

Inheritance diagram for GrBicubicEffect:
GrFragmentProcessor GrProcessor

Classes

class  Impl
 

Public Types

enum class  Direction { kX , kY , kXY }
 
- 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
}
 

Public Member Functions

const char * name () const override
 
std::unique_ptr< GrFragmentProcessorclone () const override
 
- 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 (GrSurfaceProxyView view, SkAlphaType, const SkMatrix &, SkCubicResampler, Direction)
 
static std::unique_ptr< GrFragmentProcessorMake (GrSurfaceProxyView view, SkAlphaType, const SkMatrix &, const GrSamplerState::WrapMode wrapX, const GrSamplerState::WrapMode wrapY, SkCubicResampler, Direction, const GrCaps &)
 
static std::unique_ptr< GrFragmentProcessorMakeSubset (GrSurfaceProxyView view, SkAlphaType, const SkMatrix &, const GrSamplerState::WrapMode wrapX, const GrSamplerState::WrapMode wrapY, const SkRect &subset, SkCubicResampler, Direction, const GrCaps &)
 
static std::unique_ptr< GrFragmentProcessorMakeSubset (GrSurfaceProxyView view, SkAlphaType, const SkMatrix &, const GrSamplerState::WrapMode wrapX, const GrSamplerState::WrapMode wrapY, const SkRect &subset, const SkRect &domain, SkCubicResampler, Direction, const GrCaps &)
 
static std::unique_ptr< GrFragmentProcessorMake (std::unique_ptr< GrFragmentProcessor >, SkAlphaType, const SkMatrix &, SkCubicResampler, Direction)
 
- 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 >)
 

Static Public Attributes

static constexpr SkCubicResampler gMitchell = { 1.0f/3, 1.0f/3 }
 
static constexpr SkCubicResampler gCatmullRom = { 0, 1.0f/2 }
 

Private Member Functions

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

Additional Inherited Members

- 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 28 of file GrBicubicEffect.h.

Member Enumeration Documentation

◆ Direction

enum class GrBicubicEffect::Direction
strong
Enumerator
kX 

Apply bicubic kernel in local coord x, nearest neighbor in y.

kY 

Apply bicubic kernel in local coord y, nearest neighbor in x.

kXY 

Apply bicubic in both x and y.

Definition at line 33 of file GrBicubicEffect.h.

33 {
34 /** Apply bicubic kernel in local coord x, nearest neighbor in y. */
35 kX,
36 /** Apply bicubic kernel in local coord y, nearest neighbor in x. */
37 kY,
38 /** Apply bicubic in both x and y. */
39 kXY
40 };

Member Function Documentation

◆ clone()

std::unique_ptr< GrFragmentProcessor > GrBicubicEffect::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 44 of file GrBicubicEffect.h.

44 {
45 return std::unique_ptr<GrFragmentProcessor>(new GrBicubicEffect(*this));
46 }

◆ constantOutputForConstantInput()

SkPMColor4f GrBicubicEffect::constantOutputForConstantInput ( const SkPMColor4f input) const
overrideprivatevirtual

Reimplemented from GrFragmentProcessor.

Definition at line 245 of file GrBicubicEffect.cpp.

245 {
247}
GrFragmentProcessor * childProcessor(int index)
static SkPMColor4f ConstantOutputForConstantInput(const GrFragmentProcessor *fp, const SkPMColor4f &input)

◆ Make() [1/3]

std::unique_ptr< GrFragmentProcessor > GrBicubicEffect::Make ( GrSurfaceProxyView  view,
SkAlphaType  alphaType,
const SkMatrix matrix,
const GrSamplerState::WrapMode  wrapX,
const GrSamplerState::WrapMode  wrapY,
SkCubicResampler  kernel,
Direction  direction,
const GrCaps caps 
)
static

Create a bicubic filter effect for a texture with arbitrary wrap modes.

Definition at line 137 of file GrBicubicEffect.cpp.

144 {
145 GrSamplerState sampler(wrapX, wrapY, GrSamplerState::Filter::kNearest);
146 std::unique_ptr<GrFragmentProcessor> fp;
147 fp = GrTextureEffect::Make(std::move(view), alphaType, SkMatrix::I(), sampler, caps);
148 auto clamp = kPremul_SkAlphaType == alphaType ? Clamp::kPremul : Clamp::kUnpremul;
149 return GrMatrixEffect::Make(matrix, std::unique_ptr<GrFragmentProcessor>(
150 new GrBicubicEffect(std::move(fp), kernel, direction, clamp)));
151}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
static unsigned clamp(SkFixed fx, int max)
static std::unique_ptr< GrFragmentProcessor > Make(const SkMatrix &matrix, std::unique_ptr< GrFragmentProcessor > child)
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()
const uint32_t fp

◆ Make() [2/3]

std::unique_ptr< GrFragmentProcessor > GrBicubicEffect::Make ( GrSurfaceProxyView  view,
SkAlphaType  alphaType,
const SkMatrix matrix,
SkCubicResampler  kernel,
Direction  direction 
)
static

Create a bicubic filter effect with specified texture matrix with clamp wrap mode.

Definition at line 126 of file GrBicubicEffect.cpp.

130 {
131 auto fp = GrTextureEffect::Make(std::move(view), alphaType, SkMatrix::I());
132 auto clamp = kPremul_SkAlphaType == alphaType ? Clamp::kPremul : Clamp::kUnpremul;
133 return GrMatrixEffect::Make(matrix, std::unique_ptr<GrFragmentProcessor>(
134 new GrBicubicEffect(std::move(fp), kernel, direction, clamp)));
135}

◆ Make() [3/3]

std::unique_ptr< GrFragmentProcessor > GrBicubicEffect::Make ( std::unique_ptr< GrFragmentProcessor fp,
SkAlphaType  alphaType,
const SkMatrix matrix,
SkCubicResampler  kernel,
Direction  direction 
)
static

Make a bicubic filter of a another fragment processor. The bicubic filter assumes that the discrete samples of the provided processor are at half-integer coords.

Definition at line 200 of file GrBicubicEffect.cpp.

204 {
205 auto clamp = kPremul_SkAlphaType == alphaType ? Clamp::kPremul : Clamp::kUnpremul;
206 return GrMatrixEffect::Make(matrix, std::unique_ptr<GrFragmentProcessor>(
207 new GrBicubicEffect(std::move(fp), kernel, direction, clamp)));
208}

◆ MakeSubset() [1/2]

std::unique_ptr< GrFragmentProcessor > GrBicubicEffect::MakeSubset ( GrSurfaceProxyView  view,
SkAlphaType  alphaType,
const SkMatrix matrix,
const GrSamplerState::WrapMode  wrapX,
const GrSamplerState::WrapMode  wrapY,
const SkRect subset,
const SkRect domain,
SkCubicResampler  kernel,
Direction  direction,
const GrCaps caps 
)
static

Same as above but provides a known 'domain' that bounds the coords at which bicubic sampling occurs. Note that this is a bound on the coords after transformed by the matrix parameter.

Definition at line 172 of file GrBicubicEffect.cpp.

182 {
183 auto lowerBound = [](float x) { return std::floor(x - 1.5f) + 0.5f; };
184 auto upperBound = [](float x) { return std::floor(x + 1.5f) - 0.5f; };
185 SkRect expandedDomain {
186 lowerBound(domain.fLeft) ,
187 upperBound(domain.fRight) ,
188 lowerBound(domain.fTop) ,
189 upperBound(domain.fBottom)
190 };
191 GrSamplerState sampler(wrapX, wrapY, GrSamplerState::Filter::kNearest);
192 std::unique_ptr<GrFragmentProcessor> fp;
194 std::move(view), alphaType, SkMatrix::I(), sampler, subset, expandedDomain, caps);
195 auto clamp = kPremul_SkAlphaType == alphaType ? Clamp::kPremul : Clamp::kUnpremul;
196 return GrMatrixEffect::Make(matrix, std::unique_ptr<GrFragmentProcessor>(
197 new GrBicubicEffect(std::move(fp), kernel, direction, clamp)));
198}
static std::unique_ptr< GrFragmentProcessor > MakeSubset(GrSurfaceProxyView, SkAlphaType, const SkMatrix &, GrSamplerState, const SkRect &subset, const GrCaps &caps, const float border[4]=kDefaultBorder, bool alwaysUseShaderTileMode=false)
double x
SkScalar fBottom
larger y-axis bounds
Definition extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition extension.cpp:15

◆ MakeSubset() [2/2]

std::unique_ptr< GrFragmentProcessor > GrBicubicEffect::MakeSubset ( GrSurfaceProxyView  view,
SkAlphaType  alphaType,
const SkMatrix matrix,
const GrSamplerState::WrapMode  wrapX,
const GrSamplerState::WrapMode  wrapY,
const SkRect subset,
SkCubicResampler  kernel,
Direction  direction,
const GrCaps caps 
)
static

Create a bicubic filter effect for a subset of a texture, specified by a texture coordinate rectangle subset. The WrapModes apply to the subset.

Definition at line 153 of file GrBicubicEffect.cpp.

162 {
163 GrSamplerState sampler(wrapX, wrapY, GrSamplerState::Filter::kNearest);
164 std::unique_ptr<GrFragmentProcessor> fp;
166 std::move(view), alphaType, SkMatrix::I(), sampler, subset, caps);
167 auto clamp = kPremul_SkAlphaType == alphaType ? Clamp::kPremul : Clamp::kUnpremul;
168 return GrMatrixEffect::Make(matrix, std::unique_ptr<GrFragmentProcessor>(
169 new GrBicubicEffect(std::move(fp), kernel, direction, clamp)));
170}

◆ name()

const char * GrBicubicEffect::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 42 of file GrBicubicEffect.h.

42{ return "Bicubic"; }

◆ onAddToKey()

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

Implements GrFragmentProcessor.

Definition at line 228 of file GrBicubicEffect.cpp.

228 {
229 uint32_t key = (static_cast<uint32_t>(fDirection) << 0) | (static_cast<uint32_t>(fClamp) << 2);
230 b->add32(key);
231}
static bool b

◆ onIsEqual()

bool GrBicubicEffect::onIsEqual ( const GrFragmentProcessor ) const
overrideprivatevirtual

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 237 of file GrBicubicEffect.cpp.

237 {
238 const auto& that = other.cast<GrBicubicEffect>();
239 return fDirection == that.fDirection &&
240 fClamp == that.fClamp &&
241 fKernel.B == that.fKernel.B &&
242 fKernel.C == that.fKernel.C;
243}

◆ onMakeProgramImpl()

std::unique_ptr< GrFragmentProcessor::ProgramImpl > GrBicubicEffect::onMakeProgramImpl ( ) const
overrideprivatevirtual

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 233 of file GrBicubicEffect.cpp.

233 {
234 return std::make_unique<Impl>();
235}

Member Data Documentation

◆ gCatmullRom

constexpr SkCubicResampler GrBicubicEffect::gCatmullRom = { 0, 1.0f/2 }
inlinestaticconstexpr

Definition at line 31 of file GrBicubicEffect.h.

31{ 0, 1.0f/2 };

◆ gMitchell

constexpr SkCubicResampler GrBicubicEffect::gMitchell = { 1.0f/3, 1.0f/3 }
inlinestaticconstexpr

Definition at line 30 of file GrBicubicEffect.h.

30{ 1.0f/3, 1.0f/3 };

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