Ethan Nicholas | 2d5f9b3 | 2017-12-13 14:36:14 -0500 | [diff] [blame] | 1 | /* |
Ethan Nicholas | 130fb3f | 2018-02-01 12:14:34 -0500 | [diff] [blame] | 2 | * Copyright 2018 Google Inc. |
Ethan Nicholas | 2d5f9b3 | 2017-12-13 14:36:14 -0500 | [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 GrMagnifierEffect.fp; do not modify. |
| 10 | **************************************************************************************************/ |
Ethan Nicholas | 2d5f9b3 | 2017-12-13 14:36:14 -0500 | [diff] [blame] | 11 | #ifndef GrMagnifierEffect_DEFINED |
| 12 | #define GrMagnifierEffect_DEFINED |
| 13 | #include "SkTypes.h" |
Ethan Nicholas | 2d5f9b3 | 2017-12-13 14:36:14 -0500 | [diff] [blame] | 14 | #include "GrFragmentProcessor.h" |
| 15 | #include "GrCoordTransform.h" |
| 16 | class GrMagnifierEffect : public GrFragmentProcessor { |
| 17 | public: |
| 18 | SkIRect bounds() const { return fBounds; } |
| 19 | SkRect srcRect() const { return fSrcRect; } |
| 20 | float xInvZoom() const { return fXInvZoom; } |
| 21 | float yInvZoom() const { return fYInvZoom; } |
| 22 | float xInvInset() const { return fXInvInset; } |
| 23 | float yInvInset() const { return fYInvInset; } |
| 24 | static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> src, SkIRect bounds, |
| 25 | SkRect srcRect, float xInvZoom, float yInvZoom, |
| 26 | float xInvInset, float yInvInset) { |
| 27 | return std::unique_ptr<GrFragmentProcessor>(new GrMagnifierEffect( |
| 28 | src, bounds, srcRect, xInvZoom, yInvZoom, xInvInset, yInvInset)); |
| 29 | } |
| 30 | GrMagnifierEffect(const GrMagnifierEffect& src); |
| 31 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
| 32 | const char* name() const override { return "MagnifierEffect"; } |
| 33 | |
| 34 | private: |
| 35 | GrMagnifierEffect(sk_sp<GrTextureProxy> src, SkIRect bounds, SkRect srcRect, float xInvZoom, |
| 36 | float yInvZoom, float xInvInset, float yInvInset) |
| 37 | : INHERITED(kGrMagnifierEffect_ClassID, kNone_OptimizationFlags) |
| 38 | , fSrc(std::move(src)) |
| 39 | , fBounds(bounds) |
| 40 | , fSrcRect(srcRect) |
| 41 | , fXInvZoom(xInvZoom) |
| 42 | , fYInvZoom(yInvZoom) |
| 43 | , fXInvInset(xInvInset) |
| 44 | , fYInvInset(yInvInset) |
| 45 | , fSrcCoordTransform(SkMatrix::I(), fSrc.proxy()) { |
Brian Salomon | f7dcd76 | 2018-07-30 14:48:15 -0400 | [diff] [blame] | 46 | this->setTextureSamplerCnt(1); |
Ethan Nicholas | 2d5f9b3 | 2017-12-13 14:36:14 -0500 | [diff] [blame] | 47 | this->addCoordTransform(&fSrcCoordTransform); |
| 48 | } |
| 49 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 50 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
| 51 | bool onIsEqual(const GrFragmentProcessor&) const override; |
Brian Salomon | f7dcd76 | 2018-07-30 14:48:15 -0400 | [diff] [blame] | 52 | const TextureSampler& onTextureSampler(int) const override; |
Ethan Nicholas | 2d5f9b3 | 2017-12-13 14:36:14 -0500 | [diff] [blame] | 53 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
| 54 | TextureSampler fSrc; |
| 55 | SkIRect fBounds; |
| 56 | SkRect fSrcRect; |
| 57 | float fXInvZoom; |
| 58 | float fYInvZoom; |
| 59 | float fXInvInset; |
| 60 | float fYInvInset; |
| 61 | GrCoordTransform fSrcCoordTransform; |
| 62 | typedef GrFragmentProcessor INHERITED; |
| 63 | }; |
| 64 | #endif |