bsalomon@google.com | 68b58c9 | 2013-01-17 16:50:08 +0000 | [diff] [blame] | 1 | /* |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 2 | * Copyright 2017 Google Inc. |
bsalomon@google.com | 68b58c9 | 2013-01-17 16:50:08 +0000 | [diff] [blame] | 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 | |
Ethan Nicholas | 130fb3f | 2018-02-01 12:14:34 -0500 | [diff] [blame] | 8 | /************************************************************************************************** |
| 9 | *** This file was autogenerated from GrSimpleTextureEffect.fp; do not modify. |
| 10 | **************************************************************************************************/ |
bsalomon@google.com | 68b58c9 | 2013-01-17 16:50:08 +0000 | [diff] [blame] | 11 | #ifndef GrSimpleTextureEffect_DEFINED |
| 12 | #define GrSimpleTextureEffect_DEFINED |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 13 | #include "SkTypes.h" |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 14 | #include "GrFragmentProcessor.h" |
| 15 | #include "GrCoordTransform.h" |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 16 | class GrSimpleTextureEffect : public GrFragmentProcessor { |
Ethan Nicholas | baf981f | 2017-07-12 13:51:34 +0000 | [diff] [blame] | 17 | public: |
Michael Ludwig | a427559 | 2018-08-31 10:52:47 -0400 | [diff] [blame] | 18 | const SkMatrix44& matrix() const { return fMatrix; } |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 19 | |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 20 | static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 21 | const SkMatrix& matrix) { |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 22 | return std::unique_ptr<GrFragmentProcessor>( |
Brian Osman | 2240be9 | 2017-10-18 13:15:13 -0400 | [diff] [blame] | 23 | new GrSimpleTextureEffect(std::move(proxy), matrix, |
Brian Salomon | 2bbdcc4 | 2017-09-07 12:36:34 -0400 | [diff] [blame] | 24 | GrSamplerState(GrSamplerState::WrapMode::kClamp, |
| 25 | GrSamplerState::Filter::kNearest))); |
Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 26 | } |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 27 | |
Ethan Nicholas | 5b5f096 | 2017-09-11 13:50:14 -0700 | [diff] [blame] | 28 | /* clamp mode */ |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 29 | static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 30 | const SkMatrix& matrix, |
Brian Salomon | 2bbdcc4 | 2017-09-07 12:36:34 -0400 | [diff] [blame] | 31 | GrSamplerState::Filter filter) { |
| 32 | return std::unique_ptr<GrFragmentProcessor>(new GrSimpleTextureEffect( |
Brian Osman | 2240be9 | 2017-10-18 13:15:13 -0400 | [diff] [blame] | 33 | std::move(proxy), matrix, |
Brian Salomon | 2bbdcc4 | 2017-09-07 12:36:34 -0400 | [diff] [blame] | 34 | GrSamplerState(GrSamplerState::WrapMode::kClamp, filter))); |
| 35 | } |
| 36 | |
| 37 | static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, |
Brian Salomon | 2bbdcc4 | 2017-09-07 12:36:34 -0400 | [diff] [blame] | 38 | const SkMatrix& matrix, |
| 39 | const GrSamplerState& p) { |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 40 | return std::unique_ptr<GrFragmentProcessor>( |
Brian Osman | 2240be9 | 2017-10-18 13:15:13 -0400 | [diff] [blame] | 41 | new GrSimpleTextureEffect(std::move(proxy), matrix, p)); |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 42 | } |
Ethan Nicholas | f57c0d6 | 2017-07-31 11:18:22 -0400 | [diff] [blame] | 43 | GrSimpleTextureEffect(const GrSimpleTextureEffect& src); |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 44 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 45 | const char* name() const override { return "SimpleTextureEffect"; } |
Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 46 | |
bsalomon@google.com | 68b58c9 | 2013-01-17 16:50:08 +0000 | [diff] [blame] | 47 | private: |
Brian Osman | 2240be9 | 2017-10-18 13:15:13 -0400 | [diff] [blame] | 48 | GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, SkMatrix44 matrix, |
| 49 | GrSamplerState samplerParams) |
Ethan Nicholas | abff956 | 2017-10-09 10:54:08 -0400 | [diff] [blame] | 50 | : INHERITED(kGrSimpleTextureEffect_ClassID, |
Michael Ludwig | 257a03d | 2018-12-13 14:07:07 -0500 | [diff] [blame] | 51 | (OptimizationFlags)ModulateForSamplerOptFlags( |
| 52 | image->config(), |
| 53 | samplerParams.wrapModeX() == |
| 54 | GrSamplerState::WrapMode::kClampToBorder || |
| 55 | samplerParams.wrapModeY() == |
| 56 | GrSamplerState::WrapMode::kClampToBorder)) |
Robert Phillips | a98183a | 2018-03-23 11:44:25 +0000 | [diff] [blame] | 57 | , fImage(std::move(image), samplerParams) |
Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 58 | , fMatrix(matrix) |
| 59 | , fImageCoordTransform(matrix, fImage.proxy()) { |
Brian Salomon | f7dcd76 | 2018-07-30 14:48:15 -0400 | [diff] [blame] | 60 | this->setTextureSamplerCnt(1); |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 61 | this->addCoordTransform(&fImageCoordTransform); |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 62 | } |
egdaniel | 57d3b03 | 2015-11-13 11:57:27 -0800 | [diff] [blame] | 63 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 64 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 65 | bool onIsEqual(const GrFragmentProcessor&) const override; |
Brian Salomon | f7dcd76 | 2018-07-30 14:48:15 -0400 | [diff] [blame] | 66 | const TextureSampler& onTextureSampler(int) const override; |
Brian Salomon | 0c26a9d | 2017-07-06 10:09:38 -0400 | [diff] [blame] | 67 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 68 | TextureSampler fImage; |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 69 | SkMatrix44 fMatrix; |
| 70 | GrCoordTransform fImageCoordTransform; |
| 71 | typedef GrFragmentProcessor INHERITED; |
bsalomon@google.com | 68b58c9 | 2013-01-17 16:50:08 +0000 | [diff] [blame] | 72 | }; |
Ethan Nicholas | 68990be | 2017-07-13 09:36:52 -0400 | [diff] [blame] | 73 | #endif |