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