1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 /************************************************************************************************** 9 *** This file was autogenerated from GrSimpleTextureEffect.fp; do not modify. 10 **************************************************************************************************/ 11 #ifndef GrSimpleTextureEffect_DEFINED 12 #define GrSimpleTextureEffect_DEFINED 13 #include "SkTypes.h" 14 #include "GrFragmentProcessor.h" 15 #include "GrCoordTransform.h" 16 class GrSimpleTextureEffect : public GrFragmentProcessor { 17 public: matrix()18 const SkMatrix44& matrix() const { return fMatrix; } 19 Make(sk_sp<GrTextureProxy> proxy,const SkMatrix & matrix)20 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, 21 const SkMatrix& matrix) { 22 return std::unique_ptr<GrFragmentProcessor>( 23 new GrSimpleTextureEffect(std::move(proxy), matrix, 24 GrSamplerState(GrSamplerState::WrapMode::kClamp, 25 GrSamplerState::Filter::kNearest))); 26 } 27 28 /* clamp mode */ Make(sk_sp<GrTextureProxy> proxy,const SkMatrix & matrix,GrSamplerState::Filter filter)29 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, 30 const SkMatrix& matrix, 31 GrSamplerState::Filter filter) { 32 return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect( 33 std::move(proxy), matrix, 34 GrSamplerState(GrSamplerState::WrapMode::kClamp, filter))); 35 } 36 Make(sk_sp<GrTextureProxy> proxy,const SkMatrix & matrix,const GrSamplerState & p)37 static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, 38 const SkMatrix& matrix, 39 const GrSamplerState& p) { 40 return std::unique_ptr<GrFragmentProcessor>( 41 new GrSimpleTextureEffect(std::move(proxy), matrix, p)); 42 } 43 GrSimpleTextureEffect(const GrSimpleTextureEffect& src); 44 std::unique_ptr<GrFragmentProcessor> clone() const override; name()45 const char* name() const override { return "SimpleTextureEffect"; } 46 47 private: GrSimpleTextureEffect(sk_sp<GrTextureProxy> image,SkMatrix44 matrix,GrSamplerState samplerParams)48 GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, SkMatrix44 matrix, 49 GrSamplerState samplerParams) 50 : INHERITED(kGrSimpleTextureEffect_ClassID, 51 (OptimizationFlags)ModulateForSamplerOptFlags( 52 image->config(), 53 samplerParams.wrapModeX() == 54 GrSamplerState::WrapMode::kClampToBorder || 55 samplerParams.wrapModeY() == 56 GrSamplerState::WrapMode::kClampToBorder)) 57 , fImage(std::move(image), samplerParams) 58 , fMatrix(matrix) 59 , fImageCoordTransform(matrix, fImage.proxy()) { 60 this->setTextureSamplerCnt(1); 61 this->addCoordTransform(&fImageCoordTransform); 62 } 63 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 64 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; 65 bool onIsEqual(const GrFragmentProcessor&) const override; 66 const TextureSampler& onTextureSampler(int) const override; 67 GR_DECLARE_FRAGMENT_PROCESSOR_TEST 68 TextureSampler fImage; 69 SkMatrix44 fMatrix; 70 GrCoordTransform fImageCoordTransform; 71 typedef GrFragmentProcessor INHERITED; 72 }; 73 #endif 74