Line data Source code
1 : /*
2 : * Copyright 2014 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 GrCoverageSetOpXP_DEFINED
9 : #define GrCoverageSetOpXP_DEFINED
10 :
11 : #include "GrTypes.h"
12 : #include "GrXferProcessor.h"
13 : #include "SkRegion.h"
14 :
15 : // See the comment above GrXPFactory's definition about this warning suppression.
16 : #if defined(__GNUC__) || defined(__clang)
17 : #pragma GCC diagnostic push
18 : #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
19 : #endif
20 :
21 : /**
22 : * This xfer processor directly blends the the src coverage with the dst using a set operator. It is
23 : * useful for rendering coverage masks using CSG. It can optionally invert the src coverage before
24 : * applying the set operator.
25 : */
26 : class GrCoverageSetOpXPFactory : public GrXPFactory {
27 : public:
28 : static const GrXPFactory* Get(SkRegion::Op regionOp, bool invertCoverage = false);
29 :
30 : private:
31 : constexpr GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage);
32 :
33 : sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&,
34 : GrProcessorAnalysisCoverage,
35 : bool hasMixedSamples,
36 : const GrCaps&) const override;
37 :
38 0 : AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&,
39 : const GrProcessorAnalysisCoverage&,
40 : const GrCaps&) const override {
41 0 : return AnalysisProperties::kIgnoresInputColor;
42 : }
43 :
44 :
45 : GR_DECLARE_XP_FACTORY_TEST;
46 :
47 : SkRegion::Op fRegionOp;
48 : bool fInvertCoverage;
49 :
50 : typedef GrXPFactory INHERITED;
51 : };
52 : #if defined(__GNUC__) || defined(__clang)
53 : #pragma GCC diagnostic pop
54 : #endif
55 : #endif
56 :
|