blob: 4d529d9c40825883e9fe4ab0495d4da29724da9d [file] [log] [blame]
Ethan Nicholas21a9b562019-04-10 12:06:19 -04001/*
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 Stiles88183902020-06-10 16:40:38 -040013
Mike Reed46f5c5f2020-02-20 15:42:29 -050014#include "include/core/SkM44.h"
John Stiles88183902020-06-10 16:40:38 -040015#include "include/core/SkTypes.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050016
Mike Kleinc0bd9f92019-04-23 12:05:21 -050017#include "src/gpu/GrFragmentProcessor.h"
John Stiles88183902020-06-10 16:40:38 -040018
Ethan Nicholas21a9b562019-04-10 12:06:19 -040019class GrCircleEffect : public GrFragmentProcessor {
20public:
John Stiles72e57642020-06-24 10:42:35 -040021 static GrFPResult Make(std::unique_ptr<GrFragmentProcessor> inputFP,
John Stilesde975e32020-06-17 13:49:33 -040022 GrClipEdgeType edgeType,
23 SkPoint center,
24 float radius) {
Ethan Nicholas21a9b562019-04-10 12:06:19 -040025 // 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 Stiles72e57642020-06-24 10:42:35 -040028 return GrFPFailure(std::move(inputFP));
Ethan Nicholas21a9b562019-04-10 12:06:19 -040029 }
John Stiles72e57642020-06-24 10:42:35 -040030 return GrFPSuccess(std::unique_ptr<GrFragmentProcessor>(
John Stilesde975e32020-06-17 13:49:33 -040031 new GrCircleEffect(std::move(inputFP), edgeType, center, radius)));
Ethan Nicholas21a9b562019-04-10 12:06:19 -040032 }
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
40private:
John Stiles2fbe6172020-06-08 13:28:43 -040041 GrCircleEffect(std::unique_ptr<GrFragmentProcessor> inputFP,
42 GrClipEdgeType edgeType,
43 SkPoint center,
44 float radius)
Ethan Nicholas21a9b562019-04-10 12:06:19 -040045 : INHERITED(kGrCircleEffect_ClassID,
John Stiles2fbe6172020-06-08 13:28:43 -040046 (OptimizationFlags)(inputFP ? ProcessorOptimizationFlags(inputFP.get())
47 : kAll_OptimizationFlags) &
48 kCompatibleWithCoverageAsAlpha_OptimizationFlag)
Ethan Nicholas21a9b562019-04-10 12:06:19 -040049 , edgeType(edgeType)
50 , center(center)
John Stiles2fbe6172020-06-08 13:28:43 -040051 , radius(radius) {
Brian Osman12c5d292020-07-13 16:11:35 -040052 this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough());
John Stiles2fbe6172020-06-08 13:28:43 -040053 }
Ethan Nicholas21a9b562019-04-10 12:06:19 -040054 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