| 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(GrSurfaceProxyView, const GrCCClipPath*, IsCoverageCount, MustCheckBounds); |
| 28 | GrCCClipProcessor(const GrCaps&, const GrCCClipPath*, IsCoverageCount, MustCheckBounds); |
| 29 | |
| 30 | const char* name() const override { return "GrCCClipProcessor"; } |
| 31 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
| 32 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
| 33 | bool onIsEqual(const GrFragmentProcessor&) const override; |
| 34 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 35 | const TextureSampler& onTextureSampler(int) const override { return fAtlasAccess; } |
| 36 | |
| 37 | private: |
| 38 | const GrCCClipPath* const fClipPath; |
| 39 | const bool fIsCoverageCount; |
| 40 | const bool fMustCheckBounds; |
| 41 | const TextureSampler fAtlasAccess; |
| 42 | |
| 43 | class Impl; |
| 44 | |
| 45 | typedef GrFragmentProcessor INHERITED; |
| 46 | }; |
| 47 | |
| 48 | #endif |
| 49 |