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 GrEllipseEffect.fp; do not modify. 10 **************************************************************************************************/ 11 #ifndef GrEllipseEffect_DEFINED 12 #define GrEllipseEffect_DEFINED 13 #include "SkTypes.h" 14 #if SK_SUPPORT_GPU 15 16 #include "GrShaderCaps.h" 17 #include "GrFragmentProcessor.h" 18 #include "GrCoordTransform.h" 19 class GrEllipseEffect : public GrFragmentProcessor { 20 public: edgeType()21 GrClipEdgeType edgeType() const { return fEdgeType; } center()22 SkPoint center() const { return fCenter; } radii()23 SkPoint radii() const { return fRadii; } 24 Make(GrClipEdgeType edgeType,SkPoint center,SkPoint radii,const GrShaderCaps & caps)25 static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType, SkPoint center, 26 SkPoint radii, const GrShaderCaps& caps) { 27 // Small radii produce bad results on devices without full float. 28 if (!caps.floatIs32Bits() && (radii.fX < 0.5f || radii.fY < 0.5f)) { 29 return nullptr; 30 } 31 return std::unique_ptr<GrFragmentProcessor>(new GrEllipseEffect(edgeType, center, radii)); 32 } 33 GrEllipseEffect(const GrEllipseEffect& src); 34 std::unique_ptr<GrFragmentProcessor> clone() const override; name()35 const char* name() const override { return "EllipseEffect"; } 36 37 private: GrEllipseEffect(GrClipEdgeType edgeType,SkPoint center,SkPoint radii)38 GrEllipseEffect(GrClipEdgeType edgeType, SkPoint center, SkPoint radii) 39 : INHERITED(kGrEllipseEffect_ClassID, 40 (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag) 41 , fEdgeType(edgeType) 42 , fCenter(center) 43 , fRadii(radii) {} 44 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 45 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; 46 bool onIsEqual(const GrFragmentProcessor&) const override; 47 GR_DECLARE_FRAGMENT_PROCESSOR_TEST 48 GrClipEdgeType fEdgeType; 49 SkPoint fCenter; 50 SkPoint fRadii; 51 typedef GrFragmentProcessor INHERITED; 52 }; 53 #endif 54 #endif 55