Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -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 | |
| 8 | /************************************************************************************************** |
| 9 | *** This file was autogenerated from GrCircleEffect.fp; do not modify. |
| 10 | **************************************************************************************************/ |
| 11 | #ifndef GrCircleEffect_DEFINED |
| 12 | #define GrCircleEffect_DEFINED |
John Stiles | 8818390 | 2020-06-10 16:40:38 -0400 | [diff] [blame] | 13 | |
Mike Reed | 46f5c5f | 2020-02-20 15:42:29 -0500 | [diff] [blame] | 14 | #include "include/core/SkM44.h" |
John Stiles | 8818390 | 2020-06-10 16:40:38 -0400 | [diff] [blame] | 15 | #include "include/core/SkTypes.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 16 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 17 | #include "src/gpu/GrFragmentProcessor.h" |
John Stiles | 8818390 | 2020-06-10 16:40:38 -0400 | [diff] [blame] | 18 | |
Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -0400 | [diff] [blame] | 19 | class GrCircleEffect : public GrFragmentProcessor { |
| 20 | public: |
John Stiles | 72e5764 | 2020-06-24 10:42:35 -0400 | [diff] [blame] | 21 | static GrFPResult Make(std::unique_ptr<GrFragmentProcessor> inputFP, |
John Stiles | de975e3 | 2020-06-17 13:49:33 -0400 | [diff] [blame] | 22 | GrClipEdgeType edgeType, |
| 23 | SkPoint center, |
| 24 | float radius) { |
Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -0400 | [diff] [blame] | 25 | // A radius below half causes the implicit insetting done by this processor to become |
| 26 | // inverted. We could handle this case by making the processor code more complicated. |
| 27 | if (radius < .5f && GrProcessorEdgeTypeIsInverseFill(edgeType)) { |
John Stiles | 72e5764 | 2020-06-24 10:42:35 -0400 | [diff] [blame] | 28 | return GrFPFailure(std::move(inputFP)); |
Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -0400 | [diff] [blame] | 29 | } |
John Stiles | 72e5764 | 2020-06-24 10:42:35 -0400 | [diff] [blame] | 30 | return GrFPSuccess(std::unique_ptr<GrFragmentProcessor>( |
John Stiles | de975e3 | 2020-06-17 13:49:33 -0400 | [diff] [blame] | 31 | new GrCircleEffect(std::move(inputFP), edgeType, center, radius))); |
Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -0400 | [diff] [blame] | 32 | } |
| 33 | GrCircleEffect(const GrCircleEffect& src); |
| 34 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
| 35 | const char* name() const override { return "CircleEffect"; } |
| 36 | GrClipEdgeType edgeType; |
| 37 | SkPoint center; |
| 38 | float radius; |
| 39 | |
| 40 | private: |
John Stiles | 2fbe617 | 2020-06-08 13:28:43 -0400 | [diff] [blame] | 41 | GrCircleEffect(std::unique_ptr<GrFragmentProcessor> inputFP, |
| 42 | GrClipEdgeType edgeType, |
| 43 | SkPoint center, |
| 44 | float radius) |
Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -0400 | [diff] [blame] | 45 | : INHERITED(kGrCircleEffect_ClassID, |
John Stiles | 2fbe617 | 2020-06-08 13:28:43 -0400 | [diff] [blame] | 46 | (OptimizationFlags)(inputFP ? ProcessorOptimizationFlags(inputFP.get()) |
| 47 | : kAll_OptimizationFlags) & |
| 48 | kCompatibleWithCoverageAsAlpha_OptimizationFlag) |
Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -0400 | [diff] [blame] | 49 | , edgeType(edgeType) |
| 50 | , center(center) |
John Stiles | 2fbe617 | 2020-06-08 13:28:43 -0400 | [diff] [blame] | 51 | , radius(radius) { |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame^] | 52 | this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough()); |
John Stiles | 2fbe617 | 2020-06-08 13:28:43 -0400 | [diff] [blame] | 53 | } |
Ethan Nicholas | 21a9b56 | 2019-04-10 12:06:19 -0400 | [diff] [blame] | 54 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 55 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
| 56 | bool onIsEqual(const GrFragmentProcessor&) const override; |
| 57 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
| 58 | typedef GrFragmentProcessor INHERITED; |
| 59 | }; |
| 60 | #endif |