Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 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 | |
Ethan Nicholas | 130fb3f | 2018-02-01 12:14:34 -0500 | [diff] [blame] | 8 | /************************************************************************************************** |
| 9 | *** This file was autogenerated from GrEllipseEffect.fp; do not modify. |
| 10 | **************************************************************************************************/ |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 11 | #ifndef GrEllipseEffect_DEFINED |
| 12 | #define GrEllipseEffect_DEFINED |
| 13 | #include "SkTypes.h" |
Brian Salomon | 1447177 | 2017-12-05 10:35:15 -0500 | [diff] [blame] | 14 | |
| 15 | #include "GrShaderCaps.h" |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 16 | #include "GrFragmentProcessor.h" |
| 17 | #include "GrCoordTransform.h" |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 18 | class GrEllipseEffect : public GrFragmentProcessor { |
| 19 | public: |
Michael Ludwig | a427559 | 2018-08-31 10:52:47 -0400 | [diff] [blame^] | 20 | const GrClipEdgeType& edgeType() const { return fEdgeType; } |
| 21 | const SkPoint& center() const { return fCenter; } |
| 22 | const SkPoint& radii() const { return fRadii; } |
Brian Salomon | 1447177 | 2017-12-05 10:35:15 -0500 | [diff] [blame] | 23 | |
Ethan Nicholas | aae47c8 | 2017-11-10 15:34:03 -0500 | [diff] [blame] | 24 | static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType, SkPoint center, |
Brian Salomon | 1447177 | 2017-12-05 10:35:15 -0500 | [diff] [blame] | 25 | SkPoint radii, const GrShaderCaps& caps) { |
| 26 | // Small radii produce bad results on devices without full float. |
| 27 | if (!caps.floatIs32Bits() && (radii.fX < 0.5f || radii.fY < 0.5f)) { |
| 28 | return nullptr; |
| 29 | } |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 30 | return std::unique_ptr<GrFragmentProcessor>(new GrEllipseEffect(edgeType, center, radii)); |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 31 | } |
Ethan Nicholas | f57c0d6 | 2017-07-31 11:18:22 -0400 | [diff] [blame] | 32 | GrEllipseEffect(const GrEllipseEffect& src); |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 33 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 34 | const char* name() const override { return "EllipseEffect"; } |
Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 35 | |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 36 | private: |
Ethan Nicholas | aae47c8 | 2017-11-10 15:34:03 -0500 | [diff] [blame] | 37 | GrEllipseEffect(GrClipEdgeType edgeType, SkPoint center, SkPoint radii) |
Ethan Nicholas | abff956 | 2017-10-09 10:54:08 -0400 | [diff] [blame] | 38 | : INHERITED(kGrEllipseEffect_ClassID, |
| 39 | (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag) |
Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 40 | , fEdgeType(edgeType) |
| 41 | , fCenter(center) |
Ethan Nicholas | abff956 | 2017-10-09 10:54:08 -0400 | [diff] [blame] | 42 | , fRadii(radii) {} |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 43 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 44 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 45 | bool onIsEqual(const GrFragmentProcessor&) const override; |
| 46 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
Ethan Nicholas | aae47c8 | 2017-11-10 15:34:03 -0500 | [diff] [blame] | 47 | GrClipEdgeType fEdgeType; |
Ethan Nicholas | 420f156 | 2017-07-14 13:11:38 -0400 | [diff] [blame] | 48 | SkPoint fCenter; |
| 49 | SkPoint fRadii; |
| 50 | typedef GrFragmentProcessor INHERITED; |
| 51 | }; |
| 52 | #endif |