• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "include/core/SkTypes.h"
14 
15 #include "src/gpu/GrCoordTransform.h"
16 #include "src/gpu/GrFragmentProcessor.h"
17 class GrSimpleTextureEffect : public GrFragmentProcessor {
18 public:
Make(sk_sp<GrTextureProxy> proxy,const SkMatrix & matrix)19     static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
20                                                      const SkMatrix& matrix) {
21         return std::unique_ptr<GrFragmentProcessor>(
22                 new GrSimpleTextureEffect(std::move(proxy), matrix,
23                                           GrSamplerState(GrSamplerState::WrapMode::kClamp,
24                                                          GrSamplerState::Filter::kNearest)));
25     }
26 
27     /* clamp mode */
Make(sk_sp<GrTextureProxy> proxy,const SkMatrix & matrix,GrSamplerState::Filter filter)28     static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
29                                                      const SkMatrix& matrix,
30                                                      GrSamplerState::Filter filter) {
31         return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect(
32                 std::move(proxy), matrix,
33                 GrSamplerState(GrSamplerState::WrapMode::kClamp, filter)));
34     }
35 
Make(sk_sp<GrTextureProxy> proxy,const SkMatrix & matrix,const GrSamplerState & p)36     static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
37                                                      const SkMatrix& matrix,
38                                                      const GrSamplerState& p) {
39         return std::unique_ptr<GrFragmentProcessor>(
40                 new GrSimpleTextureEffect(std::move(proxy), matrix, p));
41     }
42     GrSimpleTextureEffect(const GrSimpleTextureEffect& src);
43     std::unique_ptr<GrFragmentProcessor> clone() const override;
name()44     const char* name() const override { return "SimpleTextureEffect"; }
45     GrCoordTransform imageCoordTransform;
46     TextureSampler image;
47     SkMatrix44 matrix;
48 
49 private:
GrSimpleTextureEffect(sk_sp<GrTextureProxy> image,SkMatrix44 matrix,GrSamplerState samplerParams)50     GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, SkMatrix44 matrix,
51                           GrSamplerState samplerParams)
52             : INHERITED(kGrSimpleTextureEffect_ClassID,
53                         (OptimizationFlags)ModulateForSamplerOptFlags(
54                                 image->config(),
55                                 samplerParams.wrapModeX() ==
56                                                 GrSamplerState::WrapMode::kClampToBorder ||
57                                         samplerParams.wrapModeY() ==
58                                                 GrSamplerState::WrapMode::kClampToBorder))
59             , imageCoordTransform(matrix, image.get())
60             , image(std::move(image), samplerParams)
61             , matrix(matrix) {
62         this->setTextureSamplerCnt(1);
63         this->addCoordTransform(&imageCoordTransform);
64     }
65     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
66     void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
67     bool onIsEqual(const GrFragmentProcessor&) const override;
68     const TextureSampler& onTextureSampler(int) const override;
69     GR_DECLARE_FRAGMENT_PROCESSOR_TEST
70     typedef GrFragmentProcessor INHERITED;
71 };
72 #endif
73