blob: cb28f60595bf9910cb49fa76bbdde609ff2b22c7 [file] [log] [blame]
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**************************************************************************************************
*** This file was autogenerated from GrCircleEffect.fp; do not modify.
**************************************************************************************************/
#ifndef GrCircleEffect_DEFINED
#define GrCircleEffect_DEFINED
#include "SkTypes.h"
#include "GrFragmentProcessor.h"
#include "GrCoordTransform.h"
class GrCircleEffect : public GrFragmentProcessor {
public:
GrClipEdgeType edgeType() const { return fEdgeType; }
SkPoint center() const { return fCenter; }
float radius() const { return fRadius; }
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType, SkPoint center,
float radius) {
// A radius below half causes the implicit insetting done by this processor to become
// inverted. We could handle this case by making the processor code more complicated.
if (radius < .5f && GrProcessorEdgeTypeIsInverseFill(edgeType)) {
return nullptr;
}
return std::unique_ptr<GrFragmentProcessor>(new GrCircleEffect(edgeType, center, radius));
}
GrCircleEffect(const GrCircleEffect& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "CircleEffect"; }
private:
GrCircleEffect(GrClipEdgeType edgeType, SkPoint center, float radius)
: INHERITED(kGrCircleEffect_ClassID,
(OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fEdgeType(edgeType)
, fCenter(center)
, fRadius(radius) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
GrClipEdgeType fEdgeType;
SkPoint fCenter;
float fRadius;
typedef GrFragmentProcessor INHERITED;
};
#endif