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 #ifndef GrCCClipProcessor_DEFINED 9 #define GrCCClipProcessor_DEFINED 10 11 #include "src/gpu/GrFragmentProcessor.h" 12 13 class GrCCClipPath; 14 15 class GrCCClipProcessor : public GrFragmentProcessor { 16 public: 17 enum class IsCoverageCount : bool { 18 kNo = false, 19 kYes = true 20 }; 21 22 enum class MustCheckBounds : bool { 23 kNo = false, 24 kYes = true 25 }; 26 27 GrCCClipProcessor(const GrCCClipPath*, IsCoverageCount, MustCheckBounds); 28 name()29 const char* name() const override { return "GrCCClipProcessor"; } 30 std::unique_ptr<GrFragmentProcessor> clone() const override; 31 void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; 32 bool onIsEqual(const GrFragmentProcessor&) const override; 33 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; onTextureSampler(int)34 const TextureSampler& onTextureSampler(int) const override { return fAtlasAccess; } 35 36 private: 37 const GrCCClipPath* const fClipPath; 38 const bool fIsCoverageCount; 39 const bool fMustCheckBounds; 40 const TextureSampler fAtlasAccess; 41 42 class Impl; 43 44 typedef GrFragmentProcessor INHERITED; 45 }; 46 47 #endif 48