8#ifndef GrTextureEffect_DEFINED
9#define GrTextureEffect_DEFINED
29namespace skgpu {
class KeyBuilder; }
39#if defined(SK_USE_SAFE_INSET_FOR_TEXTURE_SAMPLING)
55 static std::unique_ptr<GrFragmentProcessor>
Make(
90 bool alwaysUseShaderTileMode =
false);
129 std::unique_ptr<GrFragmentProcessor>
clone()
const override;
131 const char*
name()
const override {
return "TextureEffect"; }
150 fSamplerHandle = handle;
170 enum class ShaderMode : uint16_t {
173 kRepeat_Nearest_None,
175 kRepeat_Linear_Mipmap,
176 kRepeat_Nearest_Mipmap,
178 kClampToBorder_Nearest,
179 kClampToBorder_Filter,
184 static bool ShaderModeIsClampToBorder(ShaderMode);
189 static bool ShaderModeRequiresUnormCoord(ShaderMode);
196 ShaderMode fShaderModes[2];
202 std::unique_ptr<ProgramImpl> onMakeProgramImpl()
const override;
208 bool matrixEffectShouldNormalize()
const;
210 bool hasClampToBorderShaderMode()
const {
211 return ShaderModeIsClampToBorder(fShaderModes[0]) ||
212 ShaderModeIsClampToBorder(fShaderModes[1]);
#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST
#define INHERITED(method,...)
GrGLSLUniformHandler::UniformHandle UniformHandle
GrFragmentProcessor(ClassID classID, OptimizationFlags optimizationFlags)
GrGLSLUniformHandler::SamplerHandle SamplerHandle
GrTextureProxy * asTextureProxy() const
GrTexture * peekTexture() const
void emitCode(EmitArgs &) override
void setSamplerHandle(GrGLSLShaderBuilder::SamplerHandle handle)
static constexpr float kInsetEpsilon
static std::unique_ptr< GrFragmentProcessor > MakeCustomLinearFilterInset(GrSurfaceProxyView, SkAlphaType, const SkMatrix &, GrSamplerState::WrapMode wx, GrSamplerState::WrapMode wy, const SkRect &subset, const SkRect *domain, SkVector inset, const GrCaps &caps, const float border[4]=kDefaultBorder)
const char * name() const override
const GrSurfaceProxyView & view() const
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)
SkMatrix coordAdjustmentMatrix() const
static constexpr float kLinearInset
static constexpr float kDefaultBorder[4]
GrTexture * texture() const
std::unique_ptr< GrFragmentProcessor > clone() const override
GrSamplerState samplerState() 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()
static SkRect inset(const SkRect &r)