| 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 |
| 13 | |
| 14 | #include "include/core/SkM44.h" |
| 15 | #include "include/core/SkTypes.h" |
| 16 | |
| 17 | #include "src/gpu/GrFragmentProcessor.h" |
| 18 | |
| 19 | class GrCircleEffect : public GrFragmentProcessor { |
| 20 | public: |
| 21 | static GrFPResult Make(std::unique_ptr<GrFragmentProcessor> inputFP, |
| 22 | GrClipEdgeType edgeType, |
| 23 | SkPoint center, |
| 24 | float radius) { |
| 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)) { |
| 28 | return GrFPFailure(std::move(inputFP)); |
| 29 | } |
| 30 | return GrFPSuccess(std::unique_ptr<GrFragmentProcessor>( |
| 31 | new GrCircleEffect(std::move(inputFP), edgeType, center, radius))); |
| 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: |
| 41 | GrCircleEffect(std::unique_ptr<GrFragmentProcessor> inputFP, |
| 42 | GrClipEdgeType edgeType, |
| 43 | SkPoint center, |
| 44 | float radius) |
| 45 | : INHERITED(kGrCircleEffect_ClassID, |
| 46 | (OptimizationFlags)(inputFP ? ProcessorOptimizationFlags(inputFP.get()) |
| 47 | : kAll_OptimizationFlags) & |
| 48 | kCompatibleWithCoverageAsAlpha_OptimizationFlag) |
| 49 | , edgeType(edgeType) |
| 50 | , center(center) |
| 51 | , radius(radius) { |
| 52 | this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough()); |
| 53 | } |
| 54 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 55 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
| 56 | bool onIsEqual(const GrFragmentProcessor&) const override; |
| 57 | #if GR_TEST_UTILS |
| 58 | SkString onDumpInfo() const override; |
| 59 | #endif |
| 60 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
| 61 | typedef GrFragmentProcessor INHERITED; |
| 62 | }; |
| 63 | #endif |
| 64 | |